Git init
[framework/uifw/isf.git] / ism / src / SLP_ISF_PG.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) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6  *
7  * Contact: Jihoon Kim <jihoon48.kim@samsung.com>, Haifeng Deng <haifeng.deng@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  *  @ingroup SLP_PG
26  *  @defgroup InputServiceFramework_PG InputServiceFW
27  *  @{
28
29  <h1 class="pg">Introduction</h1>
30 The Input Service Framework (ISF) is based on the open source project SCIM-1.4.7. The Input Service Framework is capable of supporting advanced input methods like full touch input, voice input, handwriting etc.
31
32  <h2 class="pg">Purpose</h2>
33 This document is aimed to describe how to develop application using TIZEN ISE (Input Service Engine) based on the ISF (Input Service Framework). The contents include: the introduction which is whole of the TIZEN ISE sample screen followed in GUI, the introduction of type and interface function of TIZEN ISE developing, and use from some sample application programs.
34
35  <h2 class="pg">Scope</h2>
36 The intention is that this document will provide a guide to enable the application programmer to be familiar with using TIZEN ISE as soon as possible. In this document it will only cover part of TIZEN ISE APIs, which are close to the development of ISF and other ISE.
37
38 <h2 class="pg">Intended Readers</h2>
39 This document is intended for the TIZEN ISE application programmer and the related project managers. (Actually, this document is focused on application developer who uses TIZEN ISE).
40
41 <h2 class="pg">Abbreviations</h2>
42 - ISF - Input Service Framework
43 - ISE - Input Service Engine
44
45 <h2 class="pg">Abstract</h2>
46 ISF is to monitor and handle all the input events and provide the input service to meet the requirement of applications. Then how does the application to get the input service of ISEs. For KeyboardISE and TouchISE, the interface is the ISF implementation of STKImControl. So the application programmer can easily program to the interface of STKImControl to get the service.
47 The application programmer who wants to use the traditional input service (like keyboard, soft-keyboard) does not need to change any code.
48 @}
49
50 @defgroup ISF_Architecture Architecture
51 @ingroup InputServiceFramework_PG
52 @{
53  <h1 class="pg">Architecture</h1>
54 @image html TIZEN_ISF_PG_architecture.png
55 <center><b>Figure.</b> UI Framework Architecture Diagram</center>
56
57 <h2 class="pg">UI Framework</h2>
58 The UI framework is a middleware that consists of several modules like UI toolkit and Document-View framework (for building work-based application user interface), UI Contention manager (which implements various UI policies regarding screen state management), resource manager (which manages application and system resources), , font system, Flash engine (which takes care of 3D screens in applications), Input service framework, and windowing and graphics (including Vector, and raster graphics) system.
59
60 @image html TIZEN_ISF_PG_isf_diagram.png
61 <center><b>Figure.</b> UI Framework Architecture Diagram</center>
62
63 <h2 class="pg">ISF</h2>
64 The Input Service Framework (ISF) is an abstraction layer with a well defined interface to allow text editor widgets to utilize the input methods. It is the responsibility of the widgets to request the assistance of the ISF, through the exported interface layer (Ecore IMF/GtkIM).
65
66 The Input Service Framework (ISF) monitors and handles all the input events from kernel which means ISF should manage all kinds of input events and dispatch them. On the other hand, as a service provider, ISF provides the input service to fulfill the requirement of applications and users in platform, which means ISF is a container for loading Input Service Engine (ISE) to provide services.
67
68 ISF consists of following components
69 -#      ISF-IMF API Layer
70 -#      ISM
71 -#      Panel (UI)
72
73 <h3 class="pg">ISM</h3>
74 - Registration/Load/Unload/Running/Pause/Resume/Mutually exclusive for ISEs
75 - Interfaces among applications/ISE
76 - The program of ISM is highly modular. All ISEs are required to program according to specific interface and each ISE will be compiled into individual dynamic library and be placed into the predefine directory. So when ISE module run, ISF will search the predefine directory and dynamically load the ISE module.
77
78 @image html TIZEN_ISF_PG_ism_ise_interaction_diagram.png
79 <center><b>Figure.</b> ISM-ISE interaction Diagram</center>
80
81 <h3 class="pg">Panel (UI)</h3>
82 - Provide the ISF control panel, enable the user configure ISF and ISE, providing the help information, providing the switch of active ISEs.
83 - Provide the visual feedback from the user, such as candidates, associated phrases.
84
85 <h3 class="pg">ISE</h3>
86 - Helper ISE is based on HelperAgent. HelperAgent is responsible for the communication between Helper ISE and ISF.
87 - Keyboard ISE is the traditional ISE, and it is running in ISM process.
88 @}
89
90 @defgroup ISF_Use_Cases1  App Dev Guide for EFL
91 @brief Application Guide for EFL
92
93 @defgroup ISF_Use_Cases1_1 How to show soft keyboard as soon as application is launched.
94 @ingroup ISF_Use_Cases1
95 @{
96 <h3 class="pg">How to show soft keyboard as soon as application is launched.</h3>
97 Call elm_object_focus() API to let entry have a focus.
98 @code
99 void create_entry(struct appdata *ad)
100 {
101         ad->eb = elm_entry_add(ad->eb_layout);
102         elm_layout_content_set (ad->eb_layout, "btn_text", ad->eb);
103
104         // Set the layout of soft keyboard when entry has a focus or is clicked.
105         elm_entry_input_panel_layout_set(ad->eb, ELM_INPUT_PANEL_LAYOUT_URL);
106         elm_object_focus(ad->eb); //give focus to the entry and then soft keyboard will be shown automatically
107 }
108 @endcode
109 @}
110 @defgroup ISF_Use_Cases1_2 Example of Applications to be hidden soft keyboard
111 @ingroup ISF_Use_Cases1
112 @{
113
114 <h3 class="pg">Example of Applications that must avoid showing soft keyboard even though entry has a focus or is clicked</h3>
115 To avoid showing soft keyboard automatically, use elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled) API.
116 @code
117 Evas_Object *eo;
118
119 eo = elm_entry_add(ad->win_main);
120
121 //avoid showing soft keyboard automatically
122 elm_entry_input_panel_enabled_set(eo, EINA_FALSE);
123 @endcode
124 @}
125 @defgroup ISF_Use_Cases1_3 How to show soft keyboard manually
126 @ingroup ISF_Use_Cases1
127 @{
128
129 <h3 class="pg">How to show the current active soft keyboard manually</h3>
130 <table>
131 <tr>
132     <td>
133         <b>Note:</b> If you use elm_entry widget, you don't need to call this API.<br>
134         Please give a focus to entry widget using elm_object_focus() if you want to show a soft keyboard.
135     </td>
136 </tr>
137 </table>
138 @code
139 static void entry_application(appdata * ad)
140 {
141         Evas_Object *en;
142         Ecore_IMF_Context *imf_context = NULL;
143
144         en = elm_entry_add(ad->win_main);
145         imf_context = elm_entry_imf_context_get(en);
146         ecore_imf_context_input_panel_show(imf_context);
147 }
148 @endcode
149 @}
150 @defgroup ISF_Use_Cases1_4 How to hide soft keyboard manually
151 @ingroup ISF_Use_Cases1
152 @{
153
154 <h3 class="pg">How to hide the current active soft keyboard manually</h3>
155 <table>
156 <tr>
157     <td>
158         <b>Note:</b> If you use elm_entry widget, you don't need to call this API.<br>
159         Soft keyboard will be hidden when entry widget loses a focus.
160     </td>
161 </tr>
162 </table>
163 @code
164 static void entry_application(appdata * ad)
165 {
166         Evas_Object *bt;
167         bt = elm_button_add(ad->win_main);
168         evas_object_smart_callback_add(bt, "clicked", button_cb, ad);
169 }
170
171 static void button_cb(void *data, Evas_Object *obj, void *event_info)
172 {
173         struct appdata *ad = (struct appdata *)data;
174         Ecore_IMF_Context *imf_context = NULL;
175         imf_context = elm_entry_imf_context_get(ad->entry);
176
177         if (imf_context)
178                 ecore_imf_context_input_panel_hide(imf_context);
179 }
180 @endcode
181 @}
182 @defgroup ISF_Use_Cases1_5 How to set ISE Specific data
183 @ingroup ISF_Use_Cases1
184 @{
185
186 <h3 class="pg">How to set ISE Specific data before show ISE</h3>
187 Use ecore_imf_context_input_panel_imdata_set() API when application wants to deliver specific data to ISE.<br>
188 In this case, application and ISE negotiate the data format.
189 @code
190 #include <Ecore_IMF.h>
191
192 void create_entry(struct appdata *ad)
193 {
194         char *im_data = "application sample imdata";
195         Ecore_IMF_Context *imf_context = NULL;
196         ad->entry = elm_entry_add(ad->layout_main);
197         imf_context = elm_entry_imf_context_get(ad->entry);
198
199         if (imf_context)
200         {
201                 ecore_imf_context_input_panel_imdata_set(imf_context, im_data, strlen(im_data)+1);
202         }
203 }
204 @endcode
205 @}
206 @defgroup ISF_Use_Cases1_6 How to get ISE specific data
207 @ingroup ISF_Use_Cases1
208 @{
209
210 <h3 class="pg">How to get ISE specific data of current active ISE.</h3>
211 @code
212 #include <Ecore_IMF.h>
213
214 void get_imdata(struct appdata *ad)
215 {
216         int len = 256;
217         char *im_data = (char*) malloc(len);
218         Ecore_IMF_Context *imf_context = NULL;
219         imf_context = elm_entry_imf_context_get(ad->entry);
220         if (imf_context)
221                 ecore_imf_context_input_panel_imdata_get(imf_context, im_data, &len);
222
223         free(im_data);
224 }
225 @endcode
226 @}
227 @defgroup ISF_Use_Cases1_7 How to detect whether soft keyboard is shown or hidden
228 @ingroup ISF_Use_Cases1
229 @{
230
231 <h3 class="pg">Example code to detect whether soft keyboard is shown or hidden </h3>
232 @code
233 void _input_panel_event_callback(void *data, Ecore_IMF_Context *imf_context, int value)
234 {
235         int x, y, w, h;
236         if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
237                 // ISE state has changed to INPUT_PANEL_STATE_SHOW status
238                 // Get ISE position of current active ISE
239                 ecore_imf_context_input_panel_geometry_get(imf_context, &x, &y, &w, &h);
240                 printf("keypad is shown\n");
241                 printf("The coordination of input panel. x : %d, y : %d, w : %d, h : %d\n", x, y, w, h);
242         } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
243                 // ISE state has changed to INPUT_PANEL_STATE_HIDE status
244                 printf("keypad is hidden\n");
245         }
246 }
247
248 static void create_entry(struct appdata *ad)
249 {
250         Evas_Object *en;
251         Ecore_IMF_Context *imf_context = NULL;
252         en = elm_entry_add(ad->layout_main);
253         elm_layout_content_set(ad->layout_main, "entry", en);
254
255         imf_context = elm_entry_imf_context_get(en);
256
257         if (imf_context)
258         {
259                 ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_callback, data);
260         }
261 }
262 @endcode
263 @}
264 @defgroup ISF_Use_Cases1_8 Sets up a private key of active ISE keyboard layout
265 @ingroup ISF_Use_Cases1
266 @{
267
268 <h3 class="pg">Sets up a private key of active ISE keyboard layout</h3>
269 @code
270 int create_entry(struct appdata *ad)
271 {
272         Ecore_IMF_Context *imf_context = NULL;
273         ad->entry = elm_entry_add(ad->layout_main);
274         elm_entry_input_panel_layout_set(ad->entry, ELM_ INPUT_PANEL_LAYOUT_NUMBER);
275         imf_context = elm_entry_imf_context_get(ad->entry);
276
277         if (imf_context)
278         {
279                 ecore_imf_context_input_panel_private_key_set(imf_context, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL,
280                 ECORE_IMF_INPUT_PANEL_KEY_ENTER, NULL, "Go", ECORE_IMF_INPUT_PANEL_KEY_ENTER, NULL);
281         }
282 }
283 @endcode
284
285 @image html TIZEN_ISF_PG_private_key.png<br>
286 <center><b>Figure.</b> Example of private key "Go" instead of "Enter"</center>
287 @}
288 @defgroup ISF_Use_Cases1_91 How to set the layout of soft keyboard ISE Layout
289 @ingroup ISF_Use_Cases1
290 @{
291
292 <h3 class="pg">How to set the layout of soft keyboard</h3>
293 The layouts that are currently supported by ISEs are<br>
294 ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL<br>
295 ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER (in qwerty mode)<br>
296 ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL (in qwerty mode)<br>
297 ECORE_IMF_INPUT_PANEL_LAYOUT_URL (in qwerty mode)<br>
298 ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER (in 4x4 modes)<br>
299 ECORE_IMF_INPUT_PANEL_LAYOUT_IP (including IPv4, IPv6)<br>
300 ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH (in 3x4 mode)<br>
301 ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY (in 3x4 mode)<p>
302 <b>Sample code</b>: Refer to the example of ecore_imf_context_input_panel_layout_set () API<br>
303 The snapshots of common layouts supported in Korean ISE are shown below
304
305 <table>
306 <tr>
307     <th>NORMAL layout</th>
308     <th>NUMBER layout</th>
309     <th>EMAIL layout</th>
310     <th>URL layout</th>
311 </tr>
312 <tr>
313     <td>@image html TIZEN_ISF_PG_normal_layout.png</td>
314     <td>@image html TIZEN_ISF_PG_number_layout.png</td>
315     <td>@image html TIZEN_ISF_PG_email_layout.png</td>
316     <td>@image html TIZEN_ISF_PG_url_layout.png</td>
317 </tr>
318 </table>
319
320 <table>
321 <tr>
322     <th>PHONENUMBER layout</th>
323     <th>IP layout</th>
324     <th>MONTH layout</th>
325     <th>NUMBERONLY layout</th>
326 </tr>
327 <tr>
328     <td>@image html TIZEN_ISF_PG_phonenumber_layout.png</td>
329     <td>@image html TIZEN_ISF_PG_ip_layout.png</td>
330     <td>@image html TIZEN_ISF_PG_month_layout.png</td>
331     <td>@image html TIZEN_ISF_PG_numberonly_layout.png</td>
332 </tr>
333 </table>
334 @code
335 static void entry_application(appdata * ad)
336 {
337         Evas_Object *en;
338         Ecore_IMF_Context *imf_context;
339         en = elm_entry_add(ad->win_main);
340
341         elm_entry_input_panel_layout_set(en, ELM_INPUT_PANEL_LAYOUT_URL);
342 }
343 @endcode
344 @}
345 @defgroup ISF_Use_Cases1_92 Get ISE Layout of current active ISE
346 @ingroup ISF_Use_Cases1
347 @{
348
349 <h3 class="pg">Get ISE Layout of current active ISE</h3>
350 @code
351 void get_layout(struct appdata)
352 {
353         Elm_Input_Panel_Layout layout ;
354         Ecore_IMF_Context *imf_context = NULL;
355
356         layout = elm_entry_input_panel_layout_get(en);
357         //here you can see what the current layout is
358         printf("the current layout is %d", layout);
359 }
360 @endcode
361 @}
362 @defgroup ISF_Use_Cases1_93 How to register a callback for any change in ISE values
363 @ingroup ISF_Use_Cases1
364 @{
365
366 <h3 class="pg">How to register a callback for any change in ISE values</h3>
367 @code
368 void _input_panel_event_callback(void *data, Ecore_IMF_Context *ctx, int value)
369 {
370         if(value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
371                 // ISE state has changed to ECORE_IMF_INPUT_PANEL_STATE_SHOW status
372         } else if(value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
373                 // ISE state has changed to ECORE_IMF_INPUT_PANEL_STATE_HIDE status
374         }
375         printf("value: %d\n", value);
376 }
377
378 static void create_entry(struct appdata *ad)
379 {
380         Evas_Object *en;
381         en = elm_entry_add(ad->layout_main);
382         elm_layout_content_set(ad->layout_main, "entry", en);
383
384         Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(en); // Get the input context in the entry
385
386         if (imf_context)
387         {
388                 ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_callback, data);
389         }
390 }
391 @endcode
392 @}
393 @defgroup ISF_Use_Cases1_94 Unregister a callback for any change in ISE values
394 @ingroup ISF_Use_Cases1
395 @{
396
397 <h3 class="pg">Unregister a callback for any change in ISE values.</h3>
398 @code
399 static void deregister_callback(struct appdata *ad)
400 {
401         Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(ad->entry); // Get the input context in the entry
402
403         if (imf_context)
404         {
405                 ecore_imf_context_input_panel_event_callback_del(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_callback);
406         }
407 }
408 @endcode
409 @}
410
411 <h2 class="pg">Sample codes</h2>
412 <h3 class="pg">Sample 1 - How application uses IMControl APIs (European ISE Launch)</h3>
413 @code
414 static int init(struct appdata *ad)
415 {
416         Evas_Object *en;
417
418         en = elm_entry_add(ad->win_main);
419         elm_layout_content_set(ad->layout_main, "entry", en);
420         elm_entry_input_panel_layout_set(en, ELM_INPUT_PANEL_LAYOUT_NUMBER);
421 }
422 @endcode
423 @}
424 @defgroup ISF_Use_Cases1_95 How Application gets ISE Input String
425 @ingroup ISF_Use_Cases1
426 @{
427
428 <h3 class="pg">Sample 2 - How Application gets ISE Input String</h3>
429 @code
430 static Eina_Bool _imf_event_commit_cb(void *data, int type, void *event)
431 {
432         Ecore_IMF_Event_Commit *ev = event;
433         printf("input string from ISE is %s \n", ev->str); //here you get the Input String from ISE
434
435     return ECORE_CALLBACK_PASS_ON;
436 }
437
438 Ecore_IMF_Context *imf_context_create(Evas_Object *obj)
439 {
440         Ecore_IMF_Context *imf_context = NULL;
441         const char *ctx_id = ecore_imf_context_default_id_get();
442         Evas *evas = evas_object_evas_get(obj);
443         if (ctx_id)
444         {
445                 imf_context = ecore_imf_context_add(ctx_id);
446                 if (obj)
447                 {
448                         ecore_imf_context_client_window_set(imf_context, (void *)ecore_evas_window_get(ecore_evas_ecore_evas_get(evas)));
449                         // the canvas information is used for supporting the auto rotation of input panel
450                         ecore_imf_context_client_canvas_set(imf_context, evas);
451                 }
452         }
453
454         return imf_context;
455 }
456
457 void test_ise_show(void *data, Evas_Object *obj, void *event_info)
458 {
459         Ecore_IMF_Context *imf_context = NULL;
460         imf_context = imf_context_create(NULL);
461
462         ecore_imf_context_reset(imf_context);
463         ecore_imf_context_focus_in(imf_context);
464
465         if (imf_context)
466                 ecore_imf_context_input_panel_show(imf_context);
467
468         ecore_event_handler_add(ECORE_IMF_EVENT_COMMIT, _imf_event_commit_cb, NULL);
469         //please use ECORE_IMF_EVENT_PREEDIT_CHANGED if want preedit string
470         //ecore_event_handler_add(ECORE_IMF_EVENT_PREEDIT_CHANGED, _imf_event_changed_cb, NULL);
471 }
472
473 static void my_win_main(void)
474 {
475         ...
476         elm_list_item_append(li, "ISE SHOW", NULL, NULL, test_ise_show, NULL);
477         ...
478 }
479 @endcode
480 @}
481 @defgroup ISF_Use_Cases1_96 How Application gets ISE-Specific Key Event
482 @ingroup ISF_Use_Cases1
483 @{
484
485 <h3 class="pg">Sample 3 - How Application gets ISE-Specific Key Event</h3>
486 @code
487 static Eina_Bool _imf_event_commit_cb(void *data, int type, void *event)
488 {
489         Ecore_IMF_Event_Commit *ev = event;
490         printf("input string from ISE is %s \n", ev->str); //here you get the Input String from ISE
491
492         return ECORE_CALLBACK_PASS_ON;
493 };
494
495 Ecore_IMF_Context *imf_context_create(Evas_Object *obj)
496 {
497         Ecore_IMF_Context *imf_context = NULL;
498         const char *ctx_id = ecore_imf_context_default_id_get();
499         Evas_Object *evas = evas_object_evas_get(obj);
500
501         if (ctx_id)
502         {
503                 imf_context = ecore_imf_context_add(ctx_id);
504                 if (obj)
505                 {
506                         ecore_imf_context_client_window_set(imf_context, (void *)ecore_evas_window_get(ecore_evas_ecore_evas_get(evas)));
507                         // the canvas information is used for supporting the auto rotation of input panel
508                         ecore_imf_context_client_canvas_set(imf_context, evas_object_evas_get(obj));
509                 }
510         }
511
512         return imf_context;
513 }
514
515 void test_ise_show(void *data, Evas_Object *obj, void *event_info)
516 {
517         Ecore_IMF_Context *imf_context = NULL;
518         imf_context = imf_context_create(NULL);
519
520         if (imf_context)
521                 ecore_imf_context_input_panel_show(imf_context);
522
523         ecore_imf_context_reset(imf_context);
524         ecore_imf_context_focus_in(imf_context);
525
526         ecore_event_handler_add(ECORE_IMF_EVENT_COMMIT, _imf_event_commit_cb, NULL);
527         //please use ECORE_IMF_EVENT_PREEDIT_CHANGED if want preedit string
528         //ecore_event_handler_add(ECORE_IMF_EVENT_PREEDIT_CHANGED,      _imf_event_changed_cb, NULL);
529 }
530
531 static void my_win_main(void)
532 {
533         ...
534         elm_list_item_append(li, "ISE SHOW", NULL, NULL, test_ise_show, NULL);
535         ...
536 }
537 @endcode
538 @code
539 static void
540 _edje_key_down_cb(void *data, Evas *e , Evas_Object *obj, void *event_info)
541 {
542         Evas_Event_Key_Down *ev = event_info;
543         //if (!strcmp(ev->key, "BackSpace"))
544         printf("Key Event from ISE is %s \n", ev->key); //here you can get the Key Event from ISE
545 }
546
547 Ecore_IMF_Context *imf_context_create(Evas_Object *obj)
548 {
549         Ecore_IMF_Context *imf_context = NULL;
550         const char *ctx_id = ecore_imf_context_default_id_get();
551         Evas *evas = evas_object_evas_get(obj);
552
553         if (ctx_id)
554         {
555                 imf_context = ecore_imf_context_add(ctx_id);
556                 if (obj)
557                 {
558                         ecore_imf_context_client_window_set(imf_context, (void *)ecore_evas_window_get(ecore_evas_ecore_evas_get(evas)));
559                         // the canvas information is used for supporting the auto rotation of input panel
560                         ecore_imf_context_client_canvas_set(imf_context, evas);
561                 }
562         }
563
564         return imf_context;
565 }
566
567 void test_ise_show(void *data, Evas_Object *obj, void *event_info)
568 {
569         Ecore_IMF_Context *imf_context = NULL;
570
571         imf_context = imf_context_create(obj);
572         //printf("imf_context = %d\n", imf_context);
573
574         if (imf_context)
575                 ecore_imf_context_input_panel_show(imf_context);
576
577         evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _edje_key_down_cb, NULL);
578         evas_object_focus_set(obj, EINA_TRUE);
579 }
580
581 static void my_win_main(void)
582 {
583         ...
584         elm_list_item_append(li, "ISE SHOW", NULL, NULL, test_ise_show, NULL);
585         ...
586 }
587 @endcode
588 @}
589 @defgroup ISF_Use_Cases1_97 How Application can set layout
590 @ingroup ISF_Use_Cases1
591 @{
592
593 <h3 class="pg">Sample 4 - How to get key event</h3>
594 - How to get key event and identify entry
595         -# Register the event EVAS_CALLBACK_KEY_UP callback function for each entry which needs to process key up event.
596         @code
597 evas_object_event_callback_add(_entry1, EVAS_CALLBACK_KEY_UP, _evas_key_up_cb, (void *)NULL);
598         @endcode
599         -# Make callback function like below to identify which entry received key event
600         @code
601 static void
602 _evas_key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
603 {
604         static char str [100];
605         Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *) event_info;
606
607         if (obj == _entry1)
608                 sprintf (str, "entry 1  get keyEvent: %s", ev->keyname);
609         else if (obj == _entry2)
610                 sprintf (str, "entry 2  get keyEvent: %s", ev->keyname);
611         else
612                 sprintf (str, "");
613
614         elm_object_label_set(_key_event_label, str);
615 }
616         @endcode
617
618 - How to use Ecore event handlers
619         -# The ECORE_IMF_EVENT_PREEDIT_CHANGED and ECORE_IMF_EVENT_COMMIT are not bound to object. However ISF always sends the preedit string and commit string to the focused entry. So in the callback functions for the two events, we can determine which entry receives the preedit string and commit string by checking which entry gets the focus. The function to determine which widget gets the focus is elm_object_focus_get().
620         -# For preedit string, we need call ecore_imf_context_preedit_string_get()  to get the preedit string in its callback function.
621         -# For commit string, the third parameter ev of _ecore_imf_event_commit_cb contain the commit string.
622
623 - How to get pre-edit string and identify entry
624         -# Register the event ECORE_IMF_EVENT_PREEDIT_CHANGED callback function for each entry which needs to process pre-edit.
625         @code
626 ecore_event_handler_add(ECORE_IMF_EVENT_PREEDIT_CHANGED, _ecore_imf_event_changed_cb, NULL);
627         @endcode
628         -# Make callback function like below
629         @code
630 static Eina_Bool _ecore_imf_event_changed_cb(void *data, int type, void *event)
631 {
632         static char str [100];
633         char *preedit_string;
634         int len;
635         Ecore_IMF_Context *imf_context = NULL;
636
637         if (elm_object_focus_get(_entry1))
638         {
639                 imf_context = elm_entry_imf_context_get(_entry1);
640                 ecore_imf_context_preedit_string_get(imf_context, &preedit_string, &len);
641
642                 sprintf(str, "entry 1 get preedit string: %s", preedit_string);
643         }
644         else if (elm_object_focus_get(_entry2))
645         {
646                 imf_context = elm_entry_imf_context_get(_entry2);
647                 ecore_imf_context_preedit_string_get(imf_context, &preedit_string, &len);
648
649                 sprintf(str, "entry 1 get preedit string: %s", preedit_string);
650         }
651         else
652                 sprintf(str, "");
653
654         free(preedit_string);
655
656         elm_object_label_set(_preedit_event_label,str);
657
658         return ECORE_CALLBACK_PASS_ON;
659 }
660         @endcode
661
662 - How to get commit string and identify entry
663         -# Register the event ECORE_IMF_EVENT_COMMIT callback function for each entry which needs to process pre-edit.
664         @code
665 ecore_event_handler_add(ECORE_IMF_EVENT_COMMIT, _ecore_imf_event_commit_cb, NULL);
666         @endcode
667         -# Make callback function like below
668         @code
669 static Eina_Bool _ecore_imf_event_commit_cb(void *data, int type, void *event)
670 {
671         static char str [100];
672         Ecore_IMF_Event_Commit *ev = (Ecore_IMF_Event_Commit *) event;
673
674         if (elm_object_focus_get(_entry1))
675                 sprintf(str, "entry 1 get commit string: %s", ev->str);
676         else if (elm_object_focus_get(_entry2))
677                 sprintf (str, "entry 2 get commit string: %s", ev->str);
678         else
679                 sprintf (str, "");
680
681         elm_object_label_set(_commit_event_label,str);
682
683         return ECORE_CALLBACK_PASS_ON;
684 }
685         @endcode
686 - How to use Ecore event handlers
687         -# The ECORE_IMF_EVENT_PREEDIT_CHANGED and ECORE_IMF_EVENT_COMMIT are not bound to object. But ISF always send the preedit string and commit string to the focused entry. So in the callback functions for the two events, we can determine which entry receive the preedit string and commit string by checking which entry get the focus. The function to determine which widget gets the focus is elm_object_focus_get().
688         -# For preedit string, we need call ecore_imf_context_preedit_string_get()  to get the preedit string in its callback function. After getting preedit_string, you should deallocate memory by using free().
689         -# For commit string, the third parameter ev of _ecore_imf_event_commit_cb contain the commit string.
690
691 - Example - In case the application does not use an Entry
692         -# We use elm_label as the sample for showing how to get the key event, commit string and preedit string in case the application does not use an entry. Most part is similar to the application using entry except the following b) and c).
693         -# Creating an imcontext instance.
694 @code
695 Evas_Object *label;
696
697 ......
698 static Eina_Bool _ecore_imf_event_changed_cb(void *data, int type, void *event)
699 {
700         //example how to get preedit string
701         static char str [100];
702         char *preedit_string;
703         int len;
704         Ecore_IMF_Context * imf_context = (Ecore_IMF_Context *)data;
705
706         ecore_imf_context_preedit_string_get(imf_context, &preedit_string, &len);
707         sprint(str, "preedit string : %s\n", preedit_string);
708
709         elm_object_label_set(label, str);
710         free(preedit_string);
711
712         return ECORE_CALLBACK_PASS_ON;
713 }
714
715 static Eina_Bool _ecore_imf_event_commit_cb(void *data, int type, void *event)
716 {
717         //example how to get commit string
718         Ecore_IMF_Event_Commit *ev = (Ecore_IMF_Event_Commit *) event;
719
720         sprint(str, "commit string : %s\n", ev->str);
721         elm_object_label_set(label, ev->str);
722
723         return ECORE_CALLBACK_PASS_ON;
724 }
725
726 void
727 isf_label_event_demo_bt(void *data, Evas_Object *obj, void *event_info)
728 {
729         struct appdata *ad = (struct appdata *)data;
730         Ecore_IMF_Context * _imf_context;
731         Evas *evas = evas_object_evas_get(obj);
732
733         if (ad == NULL) return;
734
735         label = elm_label_add(ad->win_main);
736
737         const char *ctx_id = ecore_imf_context_default_id_get();
738         _imf_context =  ecore_imf_context_add(ctx_id);
739
740         ecore_imf_context_client_window_set(imf_context, (void *)ecore_evas_window_get(ecore_evas_ecore_evas_get(evas)));
741         // the canvas information is used for supporting the auto rotation of input panel
742         ecore_imf_context_client_canvas_set(imf_context, evas);
743
744         ecore_event_handler_add(ECORE_IMF_EVENT_COMMIT, _ecore_imf_event_commit_cb, _imf_context);
745         ecore_event_handler_add(ECORE_IMF_EVENT_PREEDIT_CHANGED, _ecore_imf_event_changed_cb, _imf_context);
746 }
747 @endcode
748 @}
749
750 @defgroup ISF_Use_Cases3  ISE Dev Guide
751 @ingroup ISF_Use_Cases
752 @{
753 <h1 class="pg">ISE Development Guide</h1>
754 <h2 class="pg">Purpose</h2>
755 This document aimed at ISE (Input Service Engine) developers to make their own keyboard (i.e. ISE) quickly, with using of ISF (Input Service Framework) in TIZEN.
756 The contents include:
757 - Making ISE step by step
758 - How to install ISE on target
759 - An example
760 - Other you may be interested
761
762 <h2 class="pg">Let's get started</h2>
763 ISF in TIZEN is designed to support a variety of ISEs, including soft keyboard, hand-writing recognizers, and hard keyboard. In this document our focus will be on soft keyboards, since this is most often developing ISE in support TIZEN text input. For more detail about other ISE types, you can refer to "ISF User Manual" for getting more information.
764 With ISE of soft keyboard, the life-cycle of input flow looks like below:
765
766 @image html TIZEN_ISF_PG_lifecycle_of_input_flow.png
767 <center><b>Figure.</b> Life Cycle of Input Flow</center>
768 @}
769
770 @defgroup ISF_Use_Cases3_1 Step1 : Define and Include
771 @ingroup ISF_Use_Cases3
772 @{
773
774 <h2 class="pg">For generating a new ISE with soft keyboard, let's follow 6 steps to make it. </h2>
775 <h3 class="pg">Step 1 : Define and Include</h3>
776 @code
777 #define Uses_SCIM_HELPER
778 #define Uses_SCIM_CONFIG_BASE
779 #include <scim.h>
780 using namespace scim;
781
782 #define YOUR_ISE_UUID               "ff119040-4062-b8f0-9ff6-3575c0a84f4f"
783 #define YOUR_ISE_NAME               "Your ISE Name"
784 #define YOUR_ISE_ICON               (SCIM_ICONDIR "/your_ise_icon.png")
785 #define YOUR_ISE_DESCRIPTION        "Your ISE Description"
786 @endcode
787 Here, HELPER   mainly means ISEs with using touch screen device.
788 @}
789
790 @defgroup ISF_Use_Cases3_2 Step2 : Implement 2 objects
791 @ingroup ISF_Use_Cases3
792 @{
793
794 <h3 class="pg">Step 2 : Implement 2 objects</h3>
795 @code
796 static HelperInfo  helper_info (YOUR_ISE_UUID,
797                                 YOUR_ISE_NAME,
798                                 String (YOUR_ISE_ICON),
799                                 YOUR_ISE_DESCRIPTION,
800                                 SCIM_HELPER_STAND_ALONE|SCIM_HELPER_AUTO_RESTART);
801 @endcode
802
803 Structure helper_info collects basic information of your ISE. UUID is the unique ID for your ISE, also the NAME and ICON.
804
805 The most often using helper_info options:
806 <table>
807 <tr><th>Option</th><th>Description</th></tr>
808 <tr><td>SCIM_HELPER_STAND_ALONE</td><td>compulsory option</td></tr>
809 <tr><td>SCIM_HELPER_AUTO_RESTART</td><td>Option indicates ISE will be restarted when it exits abnormally. We strongly recommend you use this option only in your release version, for not hiding abnormal cases.</td></tr>
810 </table>
811
812 @code
813 HelperAgent           _helper_agent;
814 @endcode
815
816 Class HelperAgent is an accessory class to write a Helper object. This class implements all Socket transaction protocol between Helper object and Panel. Helper objects and Panel communicate with each other via the Socket created by Panel. Helper object could use command and signal through Panel Socket to do some operations with Application, Hard Keyboard ISE and Configure Module.
817
818 About detailed description of HelperAgent, please refer to "ISF User Manual", and the most often using methods of HelperAgent object are listed here.
819 @}
820
821 @defgroup ISF_Use_Cases3_3 Step3 : Implement 6 interfaces
822 @ingroup ISF_Use_Cases3
823 @{
824
825 <h3 class="pg">Step 3 : Implement 6 interfaces</h3>
826 First of all, you need implement scim_module_init and scim_module_exit, for your ISE will be a module loaded by ISF.
827 scim_module_init will be called by ISF when the ISE module is loaded.  You can do your general module initialization work in it.
828
829 scim_module_exit will be called by ISF when the ISE module is unloaded. You can do the general module cleaning work in it.
830 @code
831 void scim_module_init(void)
832 {
833         bindtextdomain(GETTEXT_PACKAGE, SCIM_INPUT_PAD_LOCALEDIR);
834         bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
835         ...
836         Do your initializing work here
837         ...
838 }
839
840 void scim_module_exit(void)
841 {
842         ...
843         Do your finalizing work here
844         ...
845 }
846 @endcode
847
848 Then you will implement the information collection interfaces for your Helper.
849 scim_helper_module_number_of_helpers gets the number of Helpers in this module. Because a Helper module can have multiple Helpers in it, and each Helper should run in its own process space.
850 scim_helper_module_get_helper_info gets the basic information of a Helper.
851 scim_helper_module_get_helper_language gets supported language for the specific Helper ISE.
852
853 @code
854 unsigned int scim_helper_module_number_of_helpers(void)
855 {
856         return 1; //1 for common use
857 }
858
859 bool scim_helper_module_get_helper_info(unsigned int idx, HelperInfo &info)
860 {
861         if (idx == 0)
862         {
863                 info = _helper_info;
864                 return true;
865         }
866         return false;
867 }
868
869 String scim_helper_module_get_helper_language(unsigned int idx)
870 {
871         if (idx == 0)
872         {
873                 String strLanguage("en,de_DE,fr_FR,es,pt,it_IT,nl_NL,ar,ru_RU");
874                 return strLanguage;
875         }
876         return "other";
877 }
878 @endcode
879
880 Then, you need implement scim_helper_module_run_helper.
881
882 This interface is the last but the most important one, because most of your real implementation of your ISE will be here.
883
884 @code
885 void scim_helper_module_run_helper(const String &uuid, const ConfigPointer &config, const String &display)
886 {
887         _config = config;
888         if (uuid == YOUR_ISE_UUID)
889         {
890                 ...
891                 Read your configure here
892                 ...
893                 run(display);
894         }
895 }
896 @endcode
897
898 @code
899 void run(const String &display)
900 {
901         char **argv = new char * [4];
902         int    argc = 3;
903         argv [0] = const_cast<char *> ("input-pad");
904         argv [1] = const_cast<char *> ("--display");
905         argv [2] = const_cast<char *> (display.c_str ());
906         argv [3] = 0;
907         setenv("DISPLAY", display.c_str(), 1);
908
909         elm_init(argc, argv);
910
911         _helper_agent.signal_connect_exit(slot(slot_exit));
912         ...
913         Do your signal connection work here
914         ...
915
916         int id, fd;
917         id = _helper_agent.open_connection(_helper_info, display);
918         if (id == -1)
919         {
920                 std::cerr << "    open_connection failed!!!!!!\n";
921                 goto ise_exit;
922         }
923
924         fd = _helper_agent.get_connection_number();
925         if (fd >= 0)
926         {
927                 _read_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, helper_agent_input_handler, NULL, NULL, NULL);
928         }
929
930         elm_run();
931         elm_shutdown();
932
933 ise_exit:
934         if (argv)
935                 delete []argv;
936
937 }
938 @endcode
939
940 In scim_helper_module_run_helper, you should implement a set of signal connection for combination the signal with your real implemented functions (slots), which we'll describe in step 4.
941 @}
942
943 @defgroup ISF_Use_Cases3_4 Step4 : Implement main signal/slots
944 @ingroup ISF_Use_Cases3
945 @{
946
947 <h3 class="pg">Step 4 : Implement main signal/slots</h3>
948
949 - Introduction of signal/slot
950 ISF adopts Signal/Slot to implement some callback function mechanism. It defines one-to-many relationship between a signal object and any number of slot objects, so that when the signal is emitted, all its slots will be called automatically.
951 The class diagram of Signal/Slot shown like this:
952
953 @image html TIZEN_ISF_PG_slot_and_signal.png
954
955 SignalN
956 - Knows the prototype of its slots
957 - Can hold any number of slots
958 - Provide a interface to attach slot object at run time
959 SlotN
960 - Provides a call interface to let signal object call.
961 FunctionSlotN
962 - Derived from SlotN
963 - Implement the call operation.
964
965 - Implementation of signal/slot
966 ISE can receive many signals from ISF by HelperAgent, and you should implement those slot functions for concerned signals, then call signal connection function to connect those slots functions.  About all slot functions interface and parameters, please reference to scim_helper.h and Input-pad ISE demo. Normally below slot functions should be implemented.<br><br>
967 _helper_agent.signal_connect_exit(slot(slot_exit));<br>
968 _helper_agent.signal_connect_focus_out(slot(slot_focus_out));<br>
969 _helper_agent.signal_connect_focus_in(slot(slot_focus_in));<br>
970 _helper_agent.signal_connect_reload_config(slot(slot_reload_config));<br>
971
972 The mapping of EFLIMFControl APIs and HelperAgent signals:
973 <table>
974 <tr>
975         <th>EFLIMFControl API</th>
976         <th>Signal</th>
977 </tr>
978 <tr>
979         <td>ecore_imf_context_input_panel_show</td><td>signal_ise_show</td>
980 </tr>
981 <tr>
982         <td>ecore_imf_context_input_panel_hide</td><td>signal_ise_hide</td>
983 </tr>
984 <tr>
985         <td>ecore_imf_context_input_panel_imdata_set</td><td>signal_set_imdata</td>
986 </tr>
987 <tr>
988         <td>ecore_imf_context_input_panel_imdata_get</td><td>signal_get_imdata</td>
989 </tr>
990 <tr>
991         <td>ecore_imf_context_input_panel_private_key_set</td><td>signal_set_private_key_by_label</td>
992 </tr>
993 <tr>
994         <td>ecore_imf_context_input_panel_layout_set</td><td>signal_set_layout</td>
995 </tr>
996 <tr>
997         <td>ecore_imf_context_input_panel_layout_get</td><td>signal_get_layout</td>
998 </tr>
999 <tr>
1000         <td>ecore_imf_context_input_panel_geometry_get</td><td>signal_get_size</td>
1001 </tr>
1002 </table>
1003 @}
1004
1005 @defgroup ISF_Use_Cases3_5 Step5 : Interacting with window manager
1006 @ingroup ISF_Use_Cases3
1007 @{
1008
1009 <h3 class="pg">Step 5 : Interacting with window manager</h3>
1010 In TIZEN, window manager should treat soft keyboard window differently from other normal application windows. When an ISE creates its soft keyboard window, it should notify the window manager that the created window's type is a soft keyboard type, by calling following function.
1011
1012 @code
1013 elm_win_keyboard_win_set(main_window, EINA_TRUE);
1014 @endcode
1015
1016 And when an application rotates its window, the window manager sends a X Client Message to a soft keyboard to let it know the state change of target application window. To handle the X client message, the following handler function should be implemented inside ISE.
1017 @code
1018 static int _client_message_cb(void *data, int type, void *event)
1019 {
1020         Ecore_X_Event_Client_Message *ev = (Ecore_X_Event_Client_Message *)event;
1021         int angle;
1022
1023         if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE) {
1024                 angle = ev->data.l[0];
1025                 ...
1026                 Do your keyboard rotation work here
1027                 ...
1028         }
1029
1030         return ECORE_CALLBACK_RENEW;
1031 }
1032 @endcode
1033
1034 And the handler function should be registered as a handler function to ECORE_X_EVENT_CLIENT_MESSAGE when initializing, as shown below.
1035
1036 @code
1037 Ecore_Event_Handler *handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _client_message_cb, NULL);
1038 @endcode
1039 @}
1040
1041 @defgroup ISF_Use_Cases3_6 Step6 : How to install ISE on target
1042 @ingroup ISF_Use_Cases3
1043 @{
1044
1045 <h3 class="pg">Step 6 : How to install ISE on target</h3>
1046 To integrate an ISE into ISF, you should build ISE module as a dynamic library and install it into the predefined directory \$(TOP_INSTALL_DIR)/lib/scim-1.0/1.4.0/\$(ISE_TYPE)/. Then ISF will search the predefined directory to find the ISE module.<br>
1047 The TOP_INSTALL_DIR is the top-level ISF installation directory. By default its value is "/usr".<br>
1048 The ISE_TYPE is "IMEngine" (KeyboardISE) or "Helper" (HelperISE). The ISE developer should select one value according to the ISE type.<br>
1049 If the ISE has one setup UI module, this setup UI module should be installed into "\$(TOP_INSTALL_DIR)/lib/scim-1.0/1.4.0/SetupUI" directory.<br>
1050 The setup UI module's name should be defined as ISE file name + "-imengine-setup.so".<br>
1051 For example, Input-pad ISE file name is "input-pad.so", its setup UI module's name is "input-pad-imengine-setup.so".
1052
1053 Below are the repository directories for three modules:<br>
1054 - KeyboardISE<br>
1055 \$(TOP_INSTALL_DIR)/lib/scim-1.0/1.4.0/IMEngine.
1056 - HelperISE<br>
1057 \$(TOP_INSTALL_DIR)/lib/scim-1.0/1.4.0/Helper
1058 - ISE Setup Module<br>
1059 \$(TOP_INSTALL_DIR)/lib/scim-1.0/1.4.0/SetupUI
1060 @}
1061
1062 @defgroup ISF_Ref References
1063 @ingroup InputServiceFramework_PG
1064 @{
1065
1066 <h3 class="pg"> Demo for Softkeyboard ISE</h3>
1067 The HelperISE uses an object of accessory class HelperAgent to deal with all Socket Transaction between HelperISE objects and PanelAgent.<br>
1068 It needs to implement the necessary slot functions and connect the slots to the corresponding signals if they want to accept the specific events.
1069 @code
1070 static HelperAgent  helper_agent;
1071 static HelperInfo helper_info(
1072                               String ("ff110940-b8f0-4062-9ff6-a84f4f3575c0"),
1073                               "Input Pad",
1074                                           String (SCIM_INPUT_PAD_ICON),
1075                               "",
1076                               SCIM_HELPER_STAND_ALONE|SCIM_HELPER_NEED_SCREEN_INFO);
1077
1078 void scim_module_init(void)
1079 {
1080         bindtextdomain(GETTEXT_PACKAGE, SCIM_INPUT_PAD_LOCALEDIR);
1081         bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
1082
1083         _helper_info.name        = String (_("Input Pad"));
1084         _helper_info.description = String (_("An On Screen Input Pad to input   characters easily."));
1085 }
1086
1087 void scim_module_exit(void)
1088 {
1089 }
1090
1091 unsigned int scim_helper_module_number_of_helpers(void)
1092 {
1093         return 1;
1094 }
1095
1096 bool scim_helper_module_get_helper_info(unsigned int idx, HelperInfo &info)
1097 {
1098         if (idx == 0) {
1099                 info = helper_info;
1100                 return true;
1101         }
1102         return false;
1103 }
1104
1105 String scim_helper_module_get_helper_language(unsigned int idx)
1106 {
1107         if (idx == 0)
1108         {
1109                 String
1110                 strLanguage ("en,de_DE,fr_FR,es,pt,tr_TR,el_GR,it_IT,nl_NL,ar,ru_RU,"
1111                         "az_AZ,bn,bg_BG,ca_ES,cs_CZ,cy_GB,da_DK,et_EE,"
1112                         "eu_ES,fi_FI,ga_IE,gl_ES,gu_IN,he_IL,hi_IN,hu_HU,"
1113                         "is_IS,ka_GE,kk_KZ,km,kn_IN,lt_LT,lv_LV,mk_MK,"
1114                         "ml_IN,mn_MN,Marathi,ms_MY,no_NO,pa_IN,pl_PL,"
1115                         "ro_RO,si_LK,sk_SK,sl_SI,sq_AL,sr_CS,sv,ta_IN,"
1116                         "te_IN,th_TH,uk_UA,ur_PK,z_UZ,vi_VN,"
1117                         "zh_CN,zh_TW,zh_HK,zh_SG");
1118
1119                 return strLanguage;
1120         }
1121         return "other";
1122 }
1123
1124 void scim_helper_module_run_helper(const String &uuid, const ConfigPointer &config, const String &display)
1125 {
1126         char **argv = new char * [4];
1127         int    argc = 3;
1128
1129         argv [0] = const_cast<char *> ("input-pad");
1130         argv [1] = const_cast<char *> ("--display");
1131         argv [2] = const_cast<char *> (display.c_str ());
1132         argv [3] = 0;
1133
1134         setenv("DISPLAY", display.c_str(), 1);
1135
1136         elm_init(argc, argv);
1137         ......
1138         helper_agent.signal_connect_exit(slot(slot_exit));
1139         helper_agent.signal_connect_focus_out(slot(slot_focus_out));
1140         helper_agent.signal_connect_focus_in(slot(slot_focus_in));
1141         ......
1142         int id, fd;
1143         id = _helper_agent.open_connection(_helper_info, display);
1144         if (id == -1)
1145         {
1146                 std::cerr << "    open_connection failed!!!!!!\n";
1147                 goto ise_exit;
1148         }
1149
1150         fd = _helper_agent.get_connection_number();
1151         if (fd >= 0)
1152         {
1153                 _read_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ,
1154                 helper_agent_input_handler, NULL, NULL, NULL);
1155                 //ecore_main_fd_handler_active_set(_read_handler, ECORE_FD_READ);
1156         }
1157
1158         create_ise_window();
1159         init_candidate_table_labels();
1160         ......
1161         _helper_agent.get_keyboard_ise_list(_helper_info.uuid);
1162         _helper_agent.get_candidate_ui(_helper_info.uuid);
1163         _helper_agent.get_candidate_window_rect(_helper_info.uuid);
1164         _helper_agent.get_keyboard_ise(_helper_info.uuid);
1165
1166         _helper_agent.set_candidate_position(-1, -1);
1167         elm_run();
1168         elm_shutdown();
1169
1170 ise_exit:
1171         if (argv)
1172                 delete []argv;
1173         ......
1174 }
1175 @endcode
1176
1177 Here, we will use the skeleton of InputPad ISE as an example. InputPad is a software keyboard ISE. By studying the code segment example, you can see:
1178 -# As mentioned in step 3, the HelperISE should at least implement the six interfaces "scim_module_init()", "scim_module_exit()", "scim_helper_module_number_of_helpers()", "scim_helper_module_get_helper_info()", "scim_helper_module_get_helper_language()" and "scim_helper_module_run_helper()"
1179 -# How to send the result to the target input widget
1180 HelperAgent class provides two member functions to do this job, helper_agent.commit_string() and helper_agent.send_key_event(). As indicated by the function name, commit_string() is to send a string to the target input widget while send_key_event() is to send a key event to the target input widget.
1181         -# helper_agent.commit_string(-1, "", scim::utf8_mbstowcs(str));
1182         -# helper_agent.send_key_event(-1, "", key);
1183 In InputPad, the first parameters of commit_string and send_key_event are assigned with -1 and "", then the result will be sent to the last focused widget.
1184 -# How to receive the ISF events
1185 Here, we adopt Signal/Slot to connect the callback functions (Slot) to the corresponding events (Signal). In InputPad, helper_agent.signal_connect_exit(), helper_agent.signal_connect_update_screen() etc will do the connection. Currently, the InputPad will emit the following signals:
1186         -# signal_exit
1187         -# signal_ise_show
1188         -# signal_ise_hide
1189         -# signal_get_size
1190         -# signal_set_layout
1191         -# signal_update_candidate_ui
1192         -# signal_update_keyboard_ise
1193
1194 Most often HelperAgent Methods
1195 <table>
1196 <tr>
1197         <th>Method</th>
1198         <th>Description</th>
1199 <tr>
1200         <td>int open_connection(const HelperInfo &info, const String &display);</td>
1201         <td>Open socket connection to the Panel.
1202 - Param info: The information of this Helper object.
1203 - Param display: The display which this Helper object should run on.
1204 Return the connection socket id. -1 means failed to create the connection
1205         </td>
1206 </tr>
1207 <tr>
1208         <td>void close_connection();</td><td>Close the socket connection to Panel.</td>
1209 </tr>
1210 <tr>
1211         <td>int get_connection_number() const;</td><td>Get the connection id previously returned by open_connection().</td>
1212 </tr>
1213 <tr>
1214         <td>bool is_connected() const;</td>
1215         <td>Return whether this HelperAgent has been connected to a Panel.
1216 Return true if there are any events available.
1217 </td>
1218 </tr>
1219 <tr>
1220         <td>bool has_pending_event() const;</td>
1221         <td>Check if there are any events available to be processed. If it returns true then Helper object should call HelperAgent::filter_event() to process them.</td>
1222 </tr>
1223 <tr>
1224         <td>bool filter_event();</td>
1225         <td>Process the pending events. This function will emit the corresponding signals according to the events.
1226 Return false if the connection is broken, otherwise return true.
1227 </td>
1228 </tr>
1229 <tr>
1230         <td>void reload_config() const;</td><td>Request ISF to reload all configurations. This function should only be used by Setup Helper to request ISF's reloading the configuration.</td>
1231 </tr>
1232 <tr>
1233         <td>void send_imengine_event(int ic, const String  &ic_uuid, const Transaction  &trans) const;</td>
1234         <td>Send a set of events to a Hard Keyboard ISE Instance. All events should be put into a Transaction. And the events can only be received by one IMEngineInstance (Hard keyboard ISE) object.
1235 - Param ic: The handle of the Input Context to receive the events.
1236 - Param ic_uuid: The UUID of the Input Context.
1237 - Param trans: The Transaction object holds the events.
1238 </td>
1239 </tr>
1240 <tr>
1241         <td>void send_key_event(int ic, const String &ic_uuid, const KeyEvent &key) const;</td>
1242         <td>Send a KeyEvent to an IMEngineInstance.
1243 - Param ic: The handle of the IMEngineInstance to receive the event. -1 means the currently focused IMEngineInstance.
1244 - Param ic_uuid: The UUID of the IMEngineInstance. Empty means don't match.
1245 - Param key: The KeyEvent to be sent.
1246 </td>
1247 </tr>
1248 <tr>
1249         <td>void forward_key_event(int ic, const String &ic_uuid, const KeyEvent &key) const;</td>
1250         <td>Forward a KeyEvent to client application directly.
1251 - Param ic: The handle of the IMEngineInstance to receive the event. -1 means the currently focused IMEngineInstance.
1252 - Param ic_uuid: The UUID of the IMEngineInstance. Empty means don't match.
1253         </td>
1254 </tr>
1255 <tr>
1256         <td>void commit_string(int ic, const String &ic_uuid, const WideString &wstr) const;</td>
1257         <td>Commit a WideString to client application directly.
1258 - Param ic: The handle of the client Input Context to receive the WideString. -1 means the currently focused Input Context.
1259 - Param ic_uuid: The UUID of the IMEngine used by the Input Context. Empty means don't match.
1260 - Param wstr: The WideString to be committed.
1261         </td>
1262 </tr>
1263 <tr>
1264         <td>void update_input_context(uint32 type,       uint32 value) const;</td>
1265         <td>When the input context of ISE is changed, ISE can call this function to notify application.
1266 - Param type: type of event. The type of event may differ in different project. It is an engagement between ISE and the applications. One example definition is ECORE_IMF_INPUT_PANEL_EVENT in Ecore_IMF.h in TIZEN project.
1267 - Param value: value of event.
1268         </td>
1269 </tr>
1270 <tr>
1271         <td>void set_candidate_ui(const ISF_CANDIDATE_STYLE_T style, const ISF_CANDIDATE_MODE_T mode) const;</td>
1272         <td>Set the style and mode for candidate window.
1273 - Param style: The candidate window style.
1274 ISF_CANDIDATE_STYLE_T may differ in different project. Please refer the latest definition  in scim_utility.h.
1275 - Param mode: The candidate window mode.
1276 ISF_CANDIDATE_MODE_T may differ in different project. Please refer the latest definition in scim_utility.h.
1277         </td>
1278 </tr>
1279 <tr>
1280         <td>void get_candidate_ui(const String &uuid) const;</td><td>Send request to get the candidate window's style and mode.</td>
1281 </tr>
1282 <tr>
1283         <td>void set_candidate_position(int left, int top) const;</td>
1284         <td>Set the position for candidate window.
1285 - Param left: The candidate window's left position.
1286 - Param top: The candidate window's top position.
1287 - If both Params set <0, the candidate will be default set to cursor following mode.
1288         </td>
1289 </tr>
1290 <tr>
1291         <td>void candidate_hide(void) const;</td>
1292         <td>Send request to hide the candidate window, including Aux, Candidate and Associate area</td>
1293 </tr>
1294 <tr>
1295         <td>void get_candidate_window_rect(const String &uuid) const;</td>
1296         <td>Send request to get the candidate window's size and position.
1297 - Param uuid: The Helper ISE's uuid.
1298         </td>
1299 </tr>
1300 <tr>
1301         <td>void set_keyboard_ise_by_uuid(const String &uuid) const;</td>
1302         <td>Set the keyboard ISE by ISE's uuid.
1303 - Param uuid: The keyboard ISE's uuid.
1304 </td>
1305 </tr>
1306 <tr>
1307         <td>void get_keyboard_ise(const String  &uuid) const;</td>
1308         <td>Send request to get the current keyboard ISE.
1309 - Param uuid: The Helper ISE's uuid.
1310 </td>
1311 </tr>
1312 </table>
1313 @}
1314 */
1315
1316 /**
1317 * @addtogroup  InputServiceFramework_PG Input Service FW
1318  @{
1319 *       @defgroup ISF_Use_Cases Use Cases
1320         @{
1321 *               @defgroup ISF_Use_Cases1
1322 *               @defgroup ISF_Use_Cases2
1323 *               @defgroup ISF_Use_Cases3
1324                 @brief For generating a new ISE with soft keyboard, let's follow 6 steps to make it.
1325         @}
1326  @}
1327 */