2 * ISF(Input Service Framework)
4 * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable.
5 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
7 * Contact: Shuo Liu <shuo0805.liu@samsung.com>, Jihoon Kim <jihoon48.kim@samsung.com>
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)
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.
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
25 #include "isf_demo_efl.h"
27 static Ecore_IMF_Context *imf_context = NULL;
28 static Elm_Genlist_Item_Class itci;
31 INPUT_PANEL_GEOMETRY_GET,
34 INPUT_PANEL_IMDATA_SET,
35 INPUT_PANEL_IMDATA_GET,
36 INPUT_PANEL_LAYOUT_SET,
37 INPUT_PANEL_LAYOUT_GET,
38 INPUT_PANEL_PRIVATE_KEY_SET,
39 INPUT_PANEL_KEY_DISABLED_SET,
40 INPUT_PANEL_STATE_GET,
46 const char *api_list[]={
50 "INPUT PANEL IMDATA SET",
51 "INPUT PANEL IMDATA GET",
52 "INPUT PANEL LAYOUT SET",
53 "INPUT PANEL LAYOUT GET",
54 "PANEL PRIVATE KEY SET",
55 "PANEL KEY DISABLED SET",
56 "INPUT PANEL STATE GET",
62 static void test_input_panel_geometry_get (void *data, Evas_Object *obj, void *event_info)
65 if (imf_context != NULL) {
66 ecore_imf_context_input_panel_geometry_get (imf_context, &x, &y, &w, &h);
67 printf ("x=%d \n", x);
68 printf ("y=%d \n", y);
69 printf ("width=%d \n", w);
70 printf ("height=%d \n", h);
74 void test_input_panel_show (void *data, Evas_Object *obj, void *event_info)
76 if (imf_context != NULL) {
77 ecore_imf_context_input_panel_show (imf_context);
81 void test_input_panel_hide (void *data, Evas_Object *obj, void *event_info)
83 if (imf_context != NULL) {
84 ecore_imf_context_input_panel_hide (imf_context);
88 void test_input_panel_imdata_set (void *data, Evas_Object *obj, void *event_info)
90 // need ISE to deal with the data
91 char buf[256] = "ur imdata";
92 if (imf_context != NULL)
93 ecore_imf_context_input_panel_imdata_set (imf_context, buf, sizeof (buf));
96 void test_input_panel_imdata_get (void *data, Evas_Object *obj, void *event_info)
99 char* buf = (char*) malloc (len);
101 memset (buf, '\0', len);
102 if (imf_context != NULL) {
103 ecore_imf_context_input_panel_imdata_get (imf_context, buf, &len);
104 printf ("get imdata %s, and len is %d ...\n", (char *)buf, len);
110 void test_input_panel_layout_set (void *data, Evas_Object *obj, void *event_info)
112 Ecore_IMF_Input_Panel_Layout layout = ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL;
113 if (imf_context != NULL)
114 ecore_imf_context_input_panel_layout_set (imf_context, layout);
117 void test_input_panel_layout_get (void *data, Evas_Object *obj, void *event_info)
119 Ecore_IMF_Input_Panel_Layout layout;
120 if (imf_context != NULL) {
121 layout = ecore_imf_context_input_panel_layout_get (imf_context);
122 printf ("get layout : %d ...\n", (int)layout);
126 void test_input_panel_private_key_set (void *data, Evas_Object *obj, void *event_info)
128 int layout_index = 1;
130 if (imf_context != NULL)
131 ecore_imf_context_input_panel_private_key_set (imf_context, layout_index, ECORE_IMF_INPUT_PANEL_KEY_ENTER, NULL, "Go", ECORE_IMF_INPUT_PANEL_KEY_ENTER, NULL);
134 void test_input_panel_key_disabled_set (void *data, Evas_Object *obj, void *event_info)
136 int layout_index = 1;
139 if (imf_context != NULL)
140 ecore_imf_context_input_panel_key_disabled_set (imf_context, layout_index, key_index, EINA_TRUE);
143 void test_input_panel_state_get (void *data, Evas_Object *obj, void *event_info)
145 Ecore_IMF_Input_Panel_State state;
147 if (imf_context != NULL) {
148 state = ecore_imf_context_input_panel_state_get (imf_context);
149 printf ("ise state : %d \n", (int)state);
153 void test_control_panel_show (void *data, Evas_Object *obj, void *event_info)
155 if (imf_context != NULL) {
156 ecore_imf_context_control_panel_show (imf_context);
160 void test_control_panel_hide (void *data, Evas_Object *obj, void *event_info)
162 if (imf_context != NULL) {
163 ecore_imf_context_control_panel_hide (imf_context);
167 void test_input_panel_move (void *data, Evas_Object *obj, void *event_info)
169 if (imf_context != NULL) {
170 ecore_imf_context_input_panel_move (imf_context, 100, 100);
174 char *gli_label_get (void *data, Evas_Object *obj, const char *part)
177 return strdup (api_list[j]);
180 static void test_api (void *data, Evas_Object *obj, void *event_info)
184 case INPUT_PANEL_GEOMETRY_GET:
185 test_input_panel_geometry_get (NULL, obj, event_info);
187 case INPUT_PANEL_SHOW:
188 test_input_panel_show (NULL, obj, event_info);
190 case INPUT_PANEL_HIDE:
191 test_input_panel_hide (NULL, obj, event_info);
193 case INPUT_PANEL_IMDATA_SET:
194 test_input_panel_imdata_set (NULL,obj, event_info);
196 case INPUT_PANEL_IMDATA_GET:
197 test_input_panel_imdata_get (NULL,obj, event_info);
199 case INPUT_PANEL_LAYOUT_SET:
200 test_input_panel_layout_set (NULL,obj, event_info);
202 case INPUT_PANEL_LAYOUT_GET:
203 test_input_panel_layout_get (NULL,obj, event_info);
205 case INPUT_PANEL_PRIVATE_KEY_SET:
206 test_input_panel_private_key_set (NULL, obj, event_info);
208 case INPUT_PANEL_KEY_DISABLED_SET:
209 test_input_panel_key_disabled_set (NULL, obj, event_info);
211 case INPUT_PANEL_STATE_GET:
212 test_input_panel_state_get (NULL, obj, event_info);
214 case INPUT_PANEL_MOVE:
215 test_input_panel_move (NULL, obj, event_info);
217 case CONTROL_PANEL_SHOW:
218 test_control_panel_show (NULL, obj, event_info);
220 case CONTROL_PANEL_HIDE:
221 test_control_panel_hide (NULL, obj, event_info);
228 static void _nf_back_event (void *data, Evas_Object *obj, void *event_info)
231 ecore_imf_context_del(imf_context);
236 static Evas_Object *_create_imcontrolapi_list (Evas_Object *parent)
240 Evas_Object *gl = elm_genlist_add (parent);
242 itci.item_style = "default";
243 itci.func.label_get = gli_label_get;
244 itci.func.icon_get = NULL;
245 itci.func.state_get = NULL;
246 itci.func.del = NULL;
248 num = sizeof (api_list) / sizeof (char *);
249 for (i = 0; i < num; i++) {
250 elm_genlist_item_append (gl, &itci,
251 (void *)i/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, test_api/* func */,
252 (void *)i/* func data */);
258 void imcontrolapi_bt (void *data, Evas_Object *obj, void *event_info)
260 const char *ctx_id = ecore_imf_context_default_id_get ();
261 if (ctx_id != NULL) {
262 imf_context = ecore_imf_context_add (ctx_id);
264 printf ("Cannot create imf context\n");
268 struct appdata *ad = (struct appdata *)data;
269 Evas_Object *gl = NULL;
271 gl = _create_imcontrolapi_list (ad->naviframe);
273 Elm_Object_Item *navi_it = elm_naviframe_item_push (ad->naviframe, _("isfimcontrol api"), NULL, NULL, gl, NULL);
275 Evas_Object *back_btn = elm_object_item_content_part_get (navi_it, ELM_NAVIFRAME_ITEM_PREV_BTN);
276 evas_object_smart_callback_add (back_btn, "clicked", _nf_back_event, ad);
280 vi:ts=4:ai:nowrap:expandtab