/src/scim-python-helper.h

http://scim-python.googlecode.com/ · C Header · 115 lines · 74 code · 13 blank · 28 comment · 0 complexity · bb3c18e01d0f7c6fde89ec2aedc3ff9b 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_HELPER_H_
  26. #define __SCIM_PYTHON_HELPER_H_
  27. #define Uses_SCIM_HELPER
  28. #define Uses_SCIM_CONFIG_BASE
  29. #include <Python.h>
  30. #include <scim.h>
  31. using namespace scim;
  32. struct PyHelperAgentObject;
  33. class PyHelperAgent : public HelperAgent {
  34. private:
  35. PyHelperAgentObject *self;
  36. private:
  37. PyHelperAgent (PyObject *self);
  38. virtual ~PyHelperAgent ();
  39. public:
  40. //Wrapper functions for HelperAgent class
  41. static PyObject *py_open_connection (PyHelperAgentObject *self,
  42. PyObject *args);
  43. static PyObject *py_close_connection (PyHelperAgentObject *self,
  44. PyObject *args);
  45. static PyObject *py_get_connection_number
  46. (PyHelperAgentObject *self,
  47. PyObject *args);
  48. static PyObject *py_is_connected (PyHelperAgentObject *self,
  49. PyObject *args);
  50. static PyObject *py_has_pending_event (PyHelperAgentObject *self,
  51. PyObject *args);
  52. static PyObject *py_filter_event (PyHelperAgentObject *self,
  53. PyObject *args);
  54. static PyObject *py_reload_config (PyHelperAgentObject *self,
  55. PyObject *args);
  56. static PyObject *py_register_properties (PyHelperAgentObject *self,
  57. PyObject *args);
  58. static PyObject *py_update_property (PyHelperAgentObject *self,
  59. PyObject *args);
  60. static PyObject *py_send_imengine_event (PyHelperAgentObject *self,
  61. PyObject *args);
  62. static PyObject *py_send_key_event (PyHelperAgentObject *self,
  63. PyObject *args);
  64. static PyObject *py_forward_key_event (PyHelperAgentObject *self,
  65. PyObject *args);
  66. static PyObject *py_commit_string (PyHelperAgentObject *self,
  67. PyObject *args);
  68. private:
  69. // Slots for HelperAgent
  70. void slot_exit (const HelperAgent *helper, int ic, const String &ic_uuid);
  71. void slot_attach_input_context (const HelperAgent *helper, int ic, const String &ic_uuid);
  72. void slot_detach_input_context (const HelperAgent *helper, int ic, const String &ic_uuid);
  73. void slot_reload_config (const HelperAgent *helper, int ic, const String &ic_uuid);
  74. void slot_update_screen (const HelperAgent *helper, int ic, const String &ic_uuid, int screen_number);
  75. void slot_update_spot_location (const HelperAgent *helper, int ic, const String &ic_uuid, int x, int y);
  76. void slot_trigger_property (const HelperAgent *helper, int ic, const String &ic_uuid, const String &property);
  77. void slot_process_imengine_event (const HelperAgent *helper, int ic, const String &ic_uuid, const Transaction &transaction);
  78. // Connections for slots
  79. Connection exit_signal_connection;
  80. Connection attach_input_context_signal_connection;
  81. Connection detach_input_context_signal_connection;
  82. Connection reload_config_signal_connection;
  83. Connection update_screen_signal_connection;
  84. Connection update_spot_location_signal_connection;
  85. Connection trigger_property_connection;
  86. Connection process_imengine_event_connection;
  87. public:
  88. // Functions for PyObject
  89. static PyObject *py_new (PyTypeObject *type,
  90. PyObject *args,
  91. PyObject *kwds);
  92. static int py_init (PyHelperAgentObject *self,
  93. PyObject *args,
  94. PyObject *kwds);
  95. static void py_dealloc (PyHelperAgentObject *self);
  96. static HelperAgent *from_pyobject
  97. (PyObject *object);
  98. static PyMethodDef py_methods[];
  99. static void operator delete (void *p);
  100. };
  101. void init_helper (PyObject *module);
  102. #endif /*__SCIM_PYTHON_HELPER_H_*/