PageRenderTime 114ms CodeModel.GetById 40ms app.highlight 26ms RepoModel.GetById 41ms app.codeStats 1ms

/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
32using namespace scim;
33
34struct PyIMEngineFactoryObject;
35
36class PyIMEngineFactory : public IMEngineFactoryBase {
37private:
38	PyObject *self;
39	PyObject *config;
40	Connection reload_signal_connection;
41
42private:
43	PyIMEngineFactory (PyObject *self, PyObject *config);
44	virtual ~PyIMEngineFactory ();
45
46public:
47	String get_attr_string (char *name) const;
48	WideString get_attr_unicode (char *name) const;	
49	virtual WideString  get_name () const;
50	virtual String get_uuid () const;
51	virtual String get_icon_file () const;
52	virtual WideString get_authors () const;
53	virtual WideString get_credits () const;
54	virtual WideString get_help () const;
55	virtual bool validate_encoding (const String& encoding);
56	virtual bool validate_locale (const String& locale);
57	virtual IMEngineInstancePointer create_instance (const String& encoding, int id = -1);
58
59private:
60	void reload_config (const ConfigPointer &config);
61
62public:
63	static PyObject *py_set_languages		(PyIMEngineFactoryObject	*self, 
64											 PyObject					*args);
65	static PyObject *py_validate_encoding	(PyIMEngineFactoryObject 	*self,
66											 PyObject					*args);
67	static PyObject *py_validate_locale		(PyIMEngineFactoryObject	*self,
68											 PyObject					*args);
69	static PyObject *py_new					(PyTypeObject				*type,
70											 PyObject					*args,
71											 PyObject					*kwds);
72	static int py_init						(PyIMEngineFactoryObject	*self,
73											 PyObject					*args,
74											 PyObject					*kwds);
75	static void py_dealloc					(PyIMEngineFactoryObject 	*self);
76	static IMEngineFactoryBase *from_pyobject
77											(PyObject					*object);
78
79	static PyMethodDef py_methods[];
80
81	static void operator delete 			(void						*p);
82
83};
84
85void init_factory (PyObject *module);
86
87#endif /*__SCIM_PYTHON_FACTORY_H_*/