PageRenderTime 42ms CodeModel.GetById 23ms app.highlight 17ms RepoModel.GetById 1ms app.codeStats 0ms

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