PageRenderTime 89ms CodeModel.GetById 7ms RepoModel.GetById 8ms app.codeStats 0ms

/src/scim-python-factory.h

http://scim-python.googlecode.com/
C Header | 87 lines | 51 code | 12 blank | 24 comment | 0 complexity | 9907297781c38bf3540ab11f7a1658ba MD5 | raw file
  1. /* vim:set noet ts=4: */
  2. /**
  3. * scim-python
  4. *
  5. * Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
  6. *
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this program; if not, write to the
  20. * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  21. * Boston, MA 02111-1307 USA
  22. *
  23. * $Id: $
  24. */
  25. #ifndef __SCIM_PYTHON_FACTORY_H_
  26. #define __SCIM_PYTHON_FACTORY_H_
  27. #define Uses_SCIM_IMENGINE
  28. #define Uses_SCIM_CONFIG_BASE
  29. #include <Python.h>
  30. #include <scim.h>
  31. using namespace scim;
  32. struct PyIMEngineFactoryObject;
  33. class PyIMEngineFactory : public IMEngineFactoryBase {
  34. private:
  35. PyObject *self;
  36. PyObject *config;
  37. Connection reload_signal_connection;
  38. private:
  39. PyIMEngineFactory (PyObject *self, PyObject *config);
  40. virtual ~PyIMEngineFactory ();
  41. public:
  42. String get_attr_string (char *name) const;
  43. WideString get_attr_unicode (char *name) const;
  44. virtual WideString get_name () const;
  45. virtual String get_uuid () const;
  46. virtual String get_icon_file () const;
  47. virtual WideString get_authors () const;
  48. virtual WideString get_credits () const;
  49. virtual WideString get_help () const;
  50. virtual bool validate_encoding (const String& encoding);
  51. virtual bool validate_locale (const String& locale);
  52. virtual IMEngineInstancePointer create_instance (const String& encoding, int id = -1);
  53. private:
  54. void reload_config (const ConfigPointer &config);
  55. public:
  56. static PyObject *py_set_languages (PyIMEngineFactoryObject *self,
  57. PyObject *args);
  58. static PyObject *py_validate_encoding (PyIMEngineFactoryObject *self,
  59. PyObject *args);
  60. static PyObject *py_validate_locale (PyIMEngineFactoryObject *self,
  61. PyObject *args);
  62. static PyObject *py_new (PyTypeObject *type,
  63. PyObject *args,
  64. PyObject *kwds);
  65. static int py_init (PyIMEngineFactoryObject *self,
  66. PyObject *args,
  67. PyObject *kwds);
  68. static void py_dealloc (PyIMEngineFactoryObject *self);
  69. static IMEngineFactoryBase *from_pyobject
  70. (PyObject *object);
  71. static PyMethodDef py_methods[];
  72. static void operator delete (void *p);
  73. };
  74. void init_factory (PyObject *module);
  75. #endif /*__SCIM_PYTHON_FACTORY_H_*/