PageRenderTime 35ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/src/scim-python-engine.h

http://scim-python.googlecode.com/
C Header | 121 lines | 79 code | 15 blank | 27 comment | 0 complexity | c97b08ae06f59150a9207f77bd63b3b9 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_ENGINE_H_
  26. #define __SCIM_PYTHON_ENGINE_H_
  27. #define Uses_SCIM_IMENGINE
  28. #include <Python.h>
  29. #include <scim.h>
  30. using namespace scim;
  31. struct PyIMEngineObject;
  32. class PyIMEngine : public IMEngineInstanceBase
  33. {
  34. private:
  35. PyObject *self;
  36. PyObject *factory;
  37. PyObject *config;
  38. Connection reload_signal_connection;
  39. private:
  40. PyIMEngine (PyObject *self,
  41. PyObject *factory,
  42. PyObject *config,
  43. const String &encoding,
  44. int id = -1);
  45. virtual ~PyIMEngine ();
  46. public:
  47. virtual bool process_key_event (const KeyEvent &key);
  48. virtual void move_preedit_caret (unsigned int pos);
  49. virtual void select_candidate (unsigned int index);
  50. virtual void update_lookup_table_page_size (unsigned int page_size);
  51. virtual void lookup_table_page_up ();
  52. virtual void lookup_table_page_down ();
  53. virtual void reset ();
  54. virtual void focus_in ();
  55. virtual void focus_out ();
  56. virtual void trigger_property (const String &property);
  57. virtual void process_helper_event (const String &helper_uuid, const Transaction &trans);
  58. virtual void update_client_capabilities (unsigned int cap);
  59. private:
  60. void reload_config (const ConfigPointer &config);
  61. public:
  62. /*
  63. * Wrapper functions
  64. */
  65. static PyObject *py_process_key_event (PyIMEngineObject *self, PyObject *args);
  66. static PyObject *py_move_preedit_caret (PyIMEngineObject *self, PyObject *args);
  67. static PyObject *py_select_candidate (PyIMEngineObject *self, PyObject *args);
  68. static PyObject *py_update_lookup_table_page_size (PyIMEngineObject *self, PyObject *args);
  69. static PyObject *py_lookup_table_page_up (PyIMEngineObject *self);
  70. static PyObject *py_lookup_table_page_down (PyIMEngineObject *self);
  71. static PyObject *py_reset (PyIMEngineObject *self);
  72. static PyObject *py_focus_in (PyIMEngineObject *self);
  73. static PyObject *py_focus_out (PyIMEngineObject *self);
  74. static PyObject *py_trigger_property (PyIMEngineObject *self, PyObject *arg);
  75. static PyObject *py_process_helper_event (PyIMEngineObject *self, PyObject *args);
  76. static PyObject *py_update_client_capabilities (PyIMEngineObject *self, PyObject *arg);
  77. static PyObject *py_show_preedit_string (PyIMEngineObject *self);
  78. static PyObject *py_show_aux_string (PyIMEngineObject *self);
  79. static PyObject *py_show_lookup_table (PyIMEngineObject *self);
  80. static PyObject *py_hide_preedit_string (PyIMEngineObject *self);
  81. static PyObject *py_hide_aux_string (PyIMEngineObject *self);
  82. static PyObject *py_hide_lookup_table (PyIMEngineObject *self);
  83. static PyObject *py_update_preedit_caret (PyIMEngineObject *self, PyObject *args);
  84. static PyObject *py_update_preedit_string (PyIMEngineObject *self, PyObject *args);
  85. static PyObject *py_update_aux_string (PyIMEngineObject *self, PyObject *args);
  86. static PyObject *py_update_lookup_table (PyIMEngineObject *self, PyObject *args);
  87. static PyObject *py_commit_string (PyIMEngineObject *self, PyObject *args);
  88. static PyObject *py_forward_key_event (PyIMEngineObject *self, PyObject *args);
  89. static PyObject *py_register_properties (PyIMEngineObject *self, PyObject *args);
  90. static PyObject *py_update_property (PyIMEngineObject *self, PyObject *args);
  91. static PyObject *py_beep (PyIMEngineObject *self);
  92. static PyObject *py_start_helper (PyIMEngineObject *self, PyObject *args);
  93. static PyObject *py_stop_helper (PyIMEngineObject *self, PyObject *args);
  94. static PyObject *py_send_helper_event (PyIMEngineObject *self, PyObject *args);
  95. static PyObject *py_get_surrounding_text (PyIMEngineObject *self, PyObject *args);
  96. static PyObject *py_delete_surrounding_text (PyIMEngineObject *self, PyObject *args);
  97. static PyObject *py_new (PyTypeObject *type, PyObject *args, PyObject *kwds);
  98. static int py_init (PyIMEngineObject *self, PyObject *args, PyObject *kwds);
  99. static void py_dealloc (PyIMEngineObject *self);
  100. static IMEngineInstanceBase *from_pyobject (PyObject *object);
  101. static PyMethodDef py_methods[];
  102. public:
  103. static void operator delete (void *p);
  104. };
  105. void init_engine (PyObject *module);
  106. #endif /*__SCIM_PYTHON_ENGINE_H_*/