Add new isf_control APIs for "Keyboard & input method" setting
[platform/core/uifw/isf.git] / ism / src / isf_control.h
1 /*
2  * ISF(Input Service Framework)
3  *
4  * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable.
5  * Copyright (c) 2012-2014 Samsung Electronics Co., Ltd.
6  *
7  * Contact: Haifeng Deng <haifeng.deng@samsung.com>, Hengliang Luo <hl.luo@samsung.com>
8  *
9  * This library is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU Lesser General Public License as published by the
11  * Free Software Foundation; either version 2.1 of the License, or (at your option)
12  * any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
15  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this library; if not, write to the Free Software Foundation, Inc., 51
21  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24
25 #ifndef __ISF_CONTROL_H
26 #define __ISF_CONTROL_H
27
28 #include <scim_visibility.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33
34 /////////////////////////////////////////////////////////////////////////////
35 // Declaration of global data types.
36 /////////////////////////////////////////////////////////////////////////////
37 typedef enum
38 {
39     HARDWARE_KEYBOARD_ISE = 0,  /* Hardware keyboard ISE */
40     SOFTWARE_KEYBOARD_ISE       /* Software keyboard ISE */
41 } ISE_TYPE_T;
42
43 /**
44  * @brief The structure type to contain IME's information.
45  *
46  * @since_tizen 2.4
47  *
48  * @see isf_control_get_all_ime_info
49  */
50 typedef struct {
51     char label[256];
52     bool is_enabled;
53     bool is_preinstalled;
54     bool has_option;
55 } ime_info_s;
56
57 /////////////////////////////////////////////////////////////////////////////
58 // Declaration of global functions.
59 /////////////////////////////////////////////////////////////////////////////
60 /**
61  * @brief Set active ISE by UUID.
62  *
63  * @param uuid The active ISE's UUID.
64  *
65  * @return 0 if successfully, otherwise return -1;
66  */
67 EAPI int isf_control_set_active_ise_by_uuid (const char *uuid);
68
69 /**
70  * @brief Get active ISE's UUID.
71  *
72  * @param uuid The parameter is used to store active ISE's UUID.
73  *             Application needs free *uuid if it is not used.
74  *
75  * @return the length of UUID if successfully, otherwise return -1;
76  */
77 EAPI int isf_control_get_active_ise (char **uuid);
78
79 /**
80  * @brief Get the list of all ISEs' UUID.
81  *
82  * @param uuid_list The list is used to store all ISEs' UUID.
83  *                  Application needs free **uuid_list if it is not used.
84  *
85  * @return the count of UUID list if successfully, otherwise return -1;
86  */
87 EAPI int isf_control_get_ise_list (char ***uuid_list);
88
89 /**
90  * @brief Get ISE's information according to ISE's UUID.
91  *
92  * @param uuid The ISE's UUID.
93  * @param name     The parameter is used to store ISE's name. Application needs free *name if it is not used.
94  * @param language The parameter is used to store ISE's language. Application needs free *language if it is not used.
95  * @param type     The parameter is used to store ISE's type.
96  * @param option   The parameter is used to store ISE's option.
97  *
98  * @return 0 if successfully, otherwise return -1;
99  */
100 EAPI int isf_control_get_ise_info (const char *uuid, char **name, char **language, ISE_TYPE_T *type, int *option);
101
102 /**
103  * @brief Get ISE's information according to ISE's UUID.
104  *
105  * @param uuid The ISE's UUID.
106  * @param name     The parameter is used to store ISE's name. Application needs free *name if it is not used.
107  * @param language The parameter is used to store ISE's language. Application needs free *language if it is not used.
108  * @param type     The parameter is used to store ISE's type.
109  * @param option   The parameter is used to store ISE's option.
110  * @param module_name The parameter is used to store ISE's module file name.
111  *
112  * @return 0 if successfully, otherwise return -1;
113  */
114 EAPI int isf_control_get_ise_info_and_module_name (const char *uuid, char **name, char **language, ISE_TYPE_T *type, int *option, char **module_name);
115
116 /**
117  * @brief Set active ISE to default ISE.
118  *
119  * @return 0 if successfully, otherwise return -1;
120  */
121 EAPI int isf_control_set_active_ise_to_default (void);
122
123 /**
124  * @brief Reset all ISEs' options.
125  *
126  * @return 0 if successfully, otherwise return -1;
127  */
128 EAPI int isf_control_reset_ise_option (void);
129
130 /**
131  * @brief Set initial ISE by UUID.
132  *
133  * @param uuid The initial ISE's UUID.
134  *
135  * @return 0 if successfully, otherwise return -1;
136  */
137 EAPI int isf_control_set_initial_ise_by_uuid (const char *uuid);
138
139 /**
140  * @brief Get initial ISE UUID.
141  *
142  * @param uuid The parameter is used to store initial ISE's UUID.
143  *             Application needs free *uuid if it is not used.
144  *
145  * @return the length of UUID if successfully, otherwise return -1;
146  */
147 EAPI int isf_control_get_initial_ise (char **uuid);
148
149 /**
150  * @brief Show ISE selector.
151  *
152  * @return 0 if successfully, otherwise return -1;
153  */
154 EAPI int isf_control_show_ise_selector ();
155
156 /**
157  * @brief Get the number of S/W or H/W keyboard ISEs
158  *
159  * @param type     ISE's type.
160  *
161  * @return the count of ISEs if successfully, otherwise return -1;
162  */
163 EAPI int isf_control_get_ise_count (ISE_TYPE_T type);
164
165 /**
166  * @brief Show ISE's option window.
167  *
168  * @return 0 if successfully, otherwise return -1;
169  */
170 EAPI int isf_control_show_ise_option_window ();
171
172 /**
173  * @brief Gets the information of all Software (on-screen) IME.
174  *
175  * @since_tizen 2.4
176  *
177  * @param[out] info The parameter is used to store all IME information. Application needs to free @a *info variable
178  *
179  * @return The count of IME if successfully, otherwise return -1;
180  *
181  * @code
182      int i;
183      ime_info_s *ime_info = NULL;
184      cnt = isf_control_get_all_ime_info(&ime_info);
185      if (ime_info) {
186          for (i = 0; i < cnt; i++) {
187              LOGD("%s %d %d %d", ime_info[i].label, ime_info[i].is_enabled, ime_info[i].is_preinstalled, ime_info[i].has_option);
188          }
189          free(ime_info);
190      }
191  * @endcode
192  */
193 EAPI int isf_control_get_all_ime_info (ime_info_s **info);
194
195 /**
196  * @brief Sets active IME by Application ID.
197  *
198  * @since_tizen 2.4
199  *
200  * @param[in] appid Application ID of IME to set as active one
201  *
202  * @return 0 if successfully, otherwise return -1;
203  */
204 EAPI int isf_control_set_active_ime (const char *appid);
205
206 /**
207  * @brief Sets On/Off of installed IME by Application ID.
208  *
209  * @since_tizen 2.4
210  *
211  * @param[in] appid Application ID of IME to enable or disable
212  * @param[in] is_enabled @c true to enable the IME, otherwise @c false
213  *
214  * @return 0 if successfully, otherwise return -1;
215  */
216 EAPI int isf_control_enable_ime (const char *appid, bool is_enabled);
217
218 #ifdef __cplusplus
219 }
220 #endif /* __cplusplus */
221
222 #endif /* __ISF_CONTROL_H */
223
224 /*
225 vi:ts=4:nowrap:ai:expandtab
226 */