1 /** @file scim_frontend_module.h
2 * @brief definition of FrontEndModule related classes.
5 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
8 * Smart Common Input Method
10 * Copyright (c) 2002-2005 James Su <suzhe@tsinghua.org.cn>
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this program; if not, write to the
25 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
26 * Boston, MA 02111-1307 USA
28 * $Id: scim_frontend_module.h,v 1.16 2005/01/10 08:30:54 suzhe Exp $
31 #ifndef __SCIM_FRONTEND_MODULE_H
32 #define __SCIM_FRONTEND_MODULE_H
37 * @addtogroup FrontEnd
38 * @ingroup InputServiceFramework
43 * @brief Initialize a FrontEnd Module.
45 * There must be a function called "scim_frontend_module_init"
46 * in each frontend module which complies with this prototype.
47 * This function name can have a prefix like x11_LTX_,
48 * in which "x11" is the module's name.
50 * @param backend - a BackEnd instance which hold all IMEngineFactory instances.
51 * @param config - a ConfigBase instance to maintain the configuration.
53 typedef void (*FrontEndModuleInitFunc) (const BackEndPointer &backend,
54 const ConfigPointer &config,
59 * @brief Run a FrontEnd Module.
61 * There must be a function called "scim_frontend_module_run"
62 * in each frontend module which complies with this prototype.
63 * This function name can have a prefix like x11_LTX_,
64 * in which "x11" is the module's name.
66 typedef void (*FrontEndModuleRunFunc) (void);
69 * @brief The class to manipulate the frontend modules.
71 * This is a wrapper of scim::Module class, which is specially
72 * for manipulating the frontend modules.
78 FrontEndModuleInitFunc m_frontend_init;
79 FrontEndModuleRunFunc m_frontend_run;
81 FrontEndModule (const FrontEndModule &);
82 FrontEndModule & operator= (const FrontEndModule &);
86 * @brief Default constructor.
92 * @param name - the module's name, eg. "rawcode".
93 * @param backend - a BackEnd instance which holds all IMEngineFactory instances.
94 * @param config - a smart pointer points to a ConfigBase instance.
95 * @param argc - the number of (fake) command line arguments
96 * @param argv - the (fake) command line argument vector
98 FrontEndModule (const String &name,
99 const BackEndPointer &backend,
100 const ConfigPointer &config,
105 * @brief Load a FrontEnd module by its name.
107 * Load a module into memory.
108 * If another module has been loaded into this object,
109 * then the old module will be unloaded first.
110 * If the old module is resident, false will be returned,
111 * and the old module will be untouched.
113 * @param name - the module's name, eg. "rawcode".
114 * @param backend - a BackEnd instance which holds all IMEngineFactory instances.
115 * @param config - a smart pointer points to a ConfigBase instance.
116 * @param argc - the number of (fake) command line arguments
117 * @param argv - the (fake) command line argument vector
119 bool load (const String &name,
120 const BackEndPointer &backend,
121 const ConfigPointer &config,
126 * @brief Check if a module is loaded and initialized successfully.
127 * @return true if a module is already loaded and initialized successfully.
132 * @brief run this FrontEnd module.
138 * @brief Get a name list of currently available frontend modules.
139 * @param mod_list - the result list will be stored here.
140 * @return the number of the modules, equal to mod_list.size ().
142 int scim_get_frontend_module_list (std::vector <String>& mod_list);
148 #endif //__SCIM_FRONTEND_MODULE_H
151 vi:ts=4:ai:nowrap:expandtab