Added interface for restoring ISE option window
[platform/core/uifw/isf.git] / ism / src / scim_helper.h
1 /**
2  * @file scim_helper.h
3  * @brief Defines scim::HelperAgent and it's related types.
4  *
5  * scim::HelperAgent is a class used to write Client Helper modules.
6  *
7  */
8
9 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
10
11 /*
12  * Smart Common Input Method
13  *
14  * Copyright (c) 2004-2005 James Su <suzhe@tsinghua.org.cn>
15  * Copyright (c) 2012-2015 Samsung Electronics Co., Ltd.
16  *
17  *
18  * This library is free software; you can redistribute it and/or
19  * modify it under the terms of the GNU Lesser General Public
20  * License as published by the Free Software Foundation; either
21  * version 2 of the License, or (at your option) any later version.
22  *
23  * This library is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU Lesser General Public License for more details.
27  *
28  * You should have received a copy of the GNU Lesser General Public
29  * License along with this program; if not, write to the
30  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
31  * Boston, MA  02111-1307  USA
32  *
33  * Modifications by Samsung Electronics Co., Ltd.
34  * 1. Add new interface APIs for keyboard ISE
35  *    a. expand_candidate (), contract_candidate () and set_candidate_style ()
36  *    b. set_keyboard_ise_by_uuid () and reset_keyboard_ise ()
37  *    c. get_surrounding_text () and delete_surrounding_text ()
38  *    d. show_preedit_string (), hide_preedit_string (), update_preedit_string () and update_preedit_caret ()
39  *    e. show_candidate_string (), hide_candidate_string () and update_candidate_string ()
40  *
41  * $Id: scim_helper.h,v 1.16 2005/05/24 12:22:51 suzhe Exp $
42  */
43
44 #ifndef __SCIM_HELPER_H
45 #define __SCIM_HELPER_H
46
47 #include "scim_utility.h"
48
49 #ifndef SCIM_HELPER_LAUNCHER_PROGRAM
50 #define SCIM_HELPER_LAUNCHER_PROGRAM  (SCIM_LIBEXECDIR "/scim-helper-launcher")
51 #endif
52
53 namespace scim {
54
55 /**
56  * @addtogroup Helper
57  * @ingroup InputServiceFramework
58  * The accessory classes to help develop and manage Client Helper objects.
59  * @{
60  */
61 class EXAPI HelperError: public Exception
62 {
63 public:
64     HelperError (const String& what_arg)
65         : Exception (String("scim::Helper: ") + what_arg) { }
66 };
67
68 /**
69  * @brief Helper option indicates that it's a stand alone Helper.
70  *
71  * Stand alone Helper has no corresponding IMEngine Factory,
72  * Such Helper can not be started by IMEngine Factory.
73  * So Panel must provide a menu, or something else, which contains
74  * all stand alone Helper items, so that user can start them by
75  * clicking the items.
76  */
77 const uint32 SCIM_HELPER_STAND_ALONE             = 1;
78
79 /**
80  * @brief Helper option indicates that it must be started
81  * automatically when Panel starts.
82  *
83  * If Helper objects want to start itself as soon as
84  * the Panel starts, set this option.
85  */
86 const uint32 SCIM_HELPER_AUTO_START              = (1<<1);
87
88 /**
89  * @brief Helper option indicates that it should be restarted
90  * when it exits abnormally.
91  *
92  * This option should not be used with #SCIM_HELPER_STAND_ALONE.
93  */
94 const uint32 SCIM_HELPER_AUTO_RESTART            = (1<<2);
95
96 /**
97  * @brief Helper option indicates that it needs the screen update
98  * information.
99  *
100  * Helper object with this option will receive the UPDATE_SCREEN event
101  * when the screen of focused ic is changed.
102  */
103 const uint32 SCIM_HELPER_NEED_SCREEN_INFO        = (1<<3);
104
105 /**
106  * @brief Helper option indicates that it needs the spot location
107  * information.
108  *
109  * Helper object with this option will receive the SPOT_LOCATION_INFO event
110  * when the spot location of focused ic is changed.
111  */
112 const uint32 SCIM_HELPER_NEED_SPOT_LOCATION_INFO = (1<<4);
113
114 /**
115  * @brief ISE option indicates whether helper ISE handles the keyboard keyevent
116  */
117 const uint32 ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT = (1<<16);
118
119 /**
120  * @brief ISE option indicates whether it should be hidden in control panel.
121  */
122 const uint32 ISM_ISE_HIDE_IN_CONTROL_PANEL       = (1<<17);
123
124 /**
125  * @brief ISE option for 3rd party; IMEngine is not available.
126  */
127 const uint32 ISM_HELPER_WITHOUT_IMENGINE         = (1<<18);
128
129 /**
130  * @brief Structure to hold the information of a Helper object.
131  */
132 struct HelperInfo
133 {
134     String uuid;            /**< The UUID of this Helper object, replaced with Application ID since tizen 2.4 */
135     String name;            /**< The Name of this Helper object, UTF-8 encoding. Deprecated since tizen 2.4 */
136     String icon;            /**< The Icon file path of this Helper object. Deprecated since tizen 2.4 */
137     String description;     /**< The short description of this Helper object. Deprecated since tizen 2.4 */
138     uint32 option;          /**< The options of this Helper object. @sa #SCIM_HELPER_STAND_ALONE etc. Deprecated since tizen 2.4 */
139
140     HelperInfo (const String &puuid = String (),
141                 const String &pname = String (),
142                 const String &picon = String (),
143                 const String &pdesc = String (),
144                 uint32 opt = 0)
145         : uuid (puuid),
146           name (pname),
147           icon (picon),
148           description (pdesc),
149           option (opt) {
150     }
151 };
152
153 enum HelperState
154 {
155     HELPER_SHOWED,
156     HELPER_HIDED,
157     HELPER_INVALID_STATE
158 };
159
160 class MessageItem;
161 class HelperAgent;
162
163 typedef Slot3<void, const HelperAgent *, int, const String &>
164         HelperAgentSlotVoid;
165
166 typedef Slot4<void, const HelperAgent *, int, const String &, const String &>
167         HelperAgentSlotString;
168
169 typedef Slot4<void, const HelperAgent *, int, const String &, const std::vector<String> &>
170         HelperAgentSlotStringVector;
171
172 typedef Slot5<void, const HelperAgent *, int, const String &, const String &, const String &>
173         HelperAgentSlotString2;
174
175 typedef Slot4<void, const HelperAgent *, int, const String &, int>
176         HelperAgentSlotInt;
177
178 typedef Slot5<void, const HelperAgent *, int, const String &, int, int>
179         HelperAgentSlotIntInt;
180
181 typedef Slot4<void, const HelperAgent *, int, const String &, const Transaction &>
182         HelperAgentSlotTransaction;
183
184 typedef Slot4<void, const HelperAgent *, int, const String &, const rectinfo &>
185         HelperAgentSlotRect;
186
187 typedef Slot2<void, const HelperAgent *, struct rectinfo &>
188         HelperAgentSlotSize;
189
190 typedef Slot2<void, const HelperAgent *, uint32 &>
191         HelperAgentSlotUintVoid;
192
193 typedef Slot3<void, const HelperAgent *, int, uint32 &>
194         HelperAgentSlotIntUint;
195
196 typedef Slot3<void, const HelperAgent *, char *, size_t &>
197         HelperAgentSlotRawVoid;
198
199 typedef Slot3<void, const HelperAgent *, char **, size_t &>
200         HelperAgentSlotGetRawVoid;
201
202 typedef Slot4<void, const HelperAgent *, int, char *, size_t &>
203         HelperAgentSlotIntRawVoid;
204
205 typedef Slot3<void, const HelperAgent *, int, char **>
206         HelperAgentSlotIntGetStringVoid;
207
208 typedef Slot2<void, const HelperAgent *, const std::vector<uint32> &>
209         HelperAgentSlotUintVector;
210
211 typedef Slot2<void, const HelperAgent *, LookupTable &>
212         HelperAgentSlotLookupTable;
213 typedef Slot3<void, const HelperAgent *, KeyEvent &, uint32 &>
214         HelperAgentSlotKeyEventUint;
215
216 typedef Slot5<void, const HelperAgent *, uint32 &, char *, size_t &, uint32 &>
217         HelperAgentSlotUintCharSizeUint;
218
219 /**
220  * @brief The accessory class to write a Helper object.
221  *
222  * This class implements all Socket Transaction protocol between
223  * Helper object and Panel.
224  */
225 class EXAPI HelperAgent
226 {
227     class HelperAgentImpl;
228     HelperAgentImpl *m_impl;
229
230     HelperAgent (const HelperAgent &);
231     const HelperAgent & operator = (const HelperAgent &);
232
233 public:
234     HelperAgent  ();
235     ~HelperAgent ();
236
237     /**
238      * @brief Open socket connection to the Panel.
239      *
240      * Helper objects and Panel communicate with each other via the Socket
241      * created by Panel, just same as the Socket between FrontEnds and Panel.
242      *
243      * Helper object can select/poll on the connection id returned by this function
244      * to see if there are any data available to be read. If any data are available,
245      * Helper object should call HelperAgent::filter_event() to process the data.
246      *
247      * This method should be called after the necessary signal-slots are connected.
248      * If this Helper is started by an IMEngine Instance, then signal attach_input_context
249      * will be emitted during this call.
250      *
251      * Signal update_screen will be emitted during this call as well to set the startup
252      * screen of this Helper. The ic and ic_uuid parameters are invalid here.
253      *
254      * @param info The information of this Helper object.
255      * @param display The display which this Helper object should run on.
256      *
257      * @return The connection socket id. -1 means failed to create
258      *         the connection.
259      */
260     int  open_connection        (const HelperInfo   &info,
261                                  const String       &display);
262
263     /**
264      * @brief Close the socket connection to Panel.
265      */
266     void close_connection       ();
267
268     /**
269      * @brief Get the connection id previously returned by open_connection().
270      *
271      * @return the connection id
272      */
273     int  get_connection_number  () const;
274
275     /**
276      * @brief Check whether this HelperAgent has been connected to a Panel.
277      *
278      * Return true when it is connected to panel, otherwise return false.
279      */
280     bool is_connected           () const;
281
282     /**
283      * @brief Check if there are any events available to be processed.
284      *
285      * If it returns true then Helper object should call
286      * HelperAgent::filter_event() to process them.
287      *
288      * @return true if there are any events available.
289      */
290     bool has_pending_event      () const;
291
292     /**
293      * @brief Process the pending events.
294      *
295      * This function will emit the corresponding signals according
296      * to the events.
297      *
298      * @return false if the connection is broken, otherwise return true.
299      */
300     bool filter_event           ();
301
302     /**
303     * @brief Read messages from socket buffer, and see if there is a message with the given cmd.
304     *
305     * @return false if the connection is broken, or no message available with given cmd. Otherwise return true.
306     */
307     bool wait_for_message       (int cmd, int timeout);
308
309     /**
310     * @brief Process one message that is in our message queue.
311     *
312     * This function will emit the corresponding signals according
313     * to the events.
314     *
315     * @param message The message that needs to be handled.
316     *
317     * @return false if the connection is broken, otherwise return true.
318     */
319     bool handle_message         (MessageItem *message);
320
321     /**
322      * @brief Request SCIM to reload all configuration.
323      *
324      * This function should only by used by Setup Helper to request
325      * scim's reloading the configuration.
326      */
327     void reload_config          () const;
328
329     /**
330      * @brief Register some properties into Panel.
331      *
332      * This function send the request to Panel to register a list
333      * of Properties.
334      *
335      * @param properties The list of Properties to be registered into Panel.
336      *
337      * @sa scim::Property.
338      */
339     void register_properties    (const PropertyList &properties) const;
340
341     /**
342      * @brief Update a registered property.
343      *
344      * @param property The property to be updated.
345      */
346     void update_property        (const Property     &property) const;
347
348     /**
349      * @brief Send a set of events to an IMEngineInstance.
350      *
351      * All events should be put into a Transaction.
352      * And the events can only be received by one IMEngineInstance object.
353      *
354      * @param ic The handle of the Input Context to receive the events.
355      * @param ic_uuid The UUID of the Input Context.
356      * @param trans The Transaction object holds the events.
357      */
358     void send_imengine_event    (int                 ic,
359                                  const String       &ic_uuid,
360                                  const Transaction  &trans) const;
361
362     /**
363      * @brief Send a KeyEvent to an IMEngineInstance.
364      *
365      * @param ic The handle of the IMEngineInstance to receive the event.
366      *        -1 means the currently focused IMEngineInstance.
367      * @param ic_uuid The UUID of the IMEngineInstance. Empty means don't match.
368      * @param key The KeyEvent to be sent.
369      */
370     void send_key_event         (int                 ic,
371                                  const String       &ic_uuid,
372                                  const KeyEvent     &key) const;
373
374     /**
375      * @brief Forward a KeyEvent to client application directly.
376      *
377      * @param ic The handle of the client Input Context to receive the event.
378      *        -1 means the currently focused Input Context.
379      * @param ic_uuid The UUID of the IMEngine used by the Input Context.
380      *        Empty means don't match.
381      * @param key The KeyEvent to be forwarded.
382      */
383     void forward_key_event      (int                 ic,
384                                  const String       &ic_uuid,
385                                  const KeyEvent     &key) const;
386
387     /**
388      * @brief Commit a WideString to client application directly.
389      *
390      * @param ic The handle of the client Input Context to receive the WideString.
391      *        -1 means the currently focused Input Context.
392      * @param ic_uuid The UUID of the IMEngine used by the Input Context.
393      *        Empty means don't match.
394      * @param wstr The WideString to be committed.
395      */
396     void commit_string          (int                 ic,
397                                  const String       &ic_uuid,
398                                  const WideString   &wstr) const;
399
400     /**
401      * @brief Commit a UTF-8 String to client application directly.
402      *
403      * @param ic The handle of the client Input Context to receive the commit string.
404      *        -1 means the currently focused Input Context.
405      * @param ic_uuid The UUID of the IMEngine used by the Input Context.
406      *        Empty means don't match.
407      * @param buf The byte array of UTF-8 string to be committed.
408      * @param buflen The buf size in bytes.
409      */
410     void commit_string          (int                 ic,
411                                  const String       &ic_uuid,
412                                  const char         *buf,
413                                  int                 buflen) const;
414
415     /**
416      * @brief Request to show preedit string.
417      *
418      * @param ic The handle of the client Input Context to receive the request.
419      *        -1 means the currently focused Input Context.
420      * @param ic_uuid The UUID of the IMEngine used by the Input Context.
421      *        Empty means don't match.
422      */
423     void show_preedit_string    (int                 ic,
424                                  const String       &ic_uuid) const;
425
426     /**
427      * @brief Request to show aux string.
428      */
429     void show_aux_string        (void) const;
430
431     /**
432      * @brief Request to show candidate string.
433      */
434     void show_candidate_string  (void) const;
435
436     /**
437      * @brief Request to show associate string.
438      */
439     void show_associate_string  (void) const;
440
441     /**
442      * @brief Request to hide preedit string.
443      *
444      * @param ic The handle of the client Input Context to receive the request.
445      *        -1 means the currently focused Input Context.
446      * @param ic_uuid The UUID of the IMEngine used by the Input Context.
447      *        Empty means don't match.
448      */
449     void hide_preedit_string    (int                 ic,
450                                  const String       &ic_uuid) const;
451
452     /**
453      * @brief Request to hide aux string.
454      */
455     void hide_aux_string        (void) const;
456
457     /**
458      * @brief Request to hide candidate string.
459      */
460     void hide_candidate_string  (void) const;
461
462     /**
463      * @brief Request to hide associate string.
464      */
465     void hide_associate_string  (void) const;
466
467     /**
468      * @brief Update a new WideString for preedit.
469      *
470      * @param ic The handle of the client Input Context to receive the WideString.
471      *        -1 means the currently focused Input Context.
472      * @param ic_uuid The UUID of the IMEngine used by the Input Context.
473      *        Empty means don't match.
474      * @param wstr The WideString to be updated.
475      * @param attrs The attribute list for preedit string.
476      */
477     void update_preedit_string  (int                 ic,
478                                  const String       &ic_uuid,
479                                  const WideString   &wstr,
480                                  const AttributeList &attrs) const;
481
482     /**
483      * @brief Update a new UTF-8 string for preedit.
484      *
485      * @param ic The handle of the client Input Context to receive the UTF-8 String.
486      *        -1 means the currently focused Input Context.
487      * @param ic_uuid The UUID of the IMEngine used by the Input Context.
488      *        Empty means don't match.
489      * @param buf The byte array of UTF-8 string to be updated.
490      * @param buflen The buf size in bytes.
491      * @param attrs The attribute list for preedit string.
492      */
493     void update_preedit_string  (int                 ic,
494                                  const String       &ic_uuid,
495                                  const char         *buf,
496                                  int                 buflen,
497                                  const AttributeList &attrs) const;
498
499     /**
500      * @brief Update a new WideString and caret for preedit.
501      *
502      * @param ic The handle of the client Input Context to receive the WideString.
503      *        -1 means the currently focused Input Context.
504      * @param ic_uuid The UUID of the IMEngine used by the Input Context.
505      *        Empty means don't match.
506      * @param wstr The WideString to be updated.
507      * @param attrs The attribute list for preedit string.
508      * @param caret The caret position in preedit string.
509      */
510     void update_preedit_string  (int                 ic,
511                                  const String       &ic_uuid,
512                                  const WideString    &wstr,
513                                  const AttributeList &attrs,
514                                  int                 caret) const;
515
516     /**
517      * @brief Update a new UTF-8 string and caret for preedit.
518      *
519      * @param ic The handle of the client Input Context to receive the UTF-8 String.
520      *        -1 means the currently focused Input Context.
521      * @param ic_uuid The UUID of the IMEngine used by the Input Context.
522      *        Empty means don't match.
523      * @param buf The byte array of UTF-8 string to be updated.
524      * @param buflen The buf size in bytes.
525      * @param attrs The attribute list for preedit string.
526      * @param caret The caret position in preedit string.
527      */
528     void update_preedit_string  (int                 ic,
529                                  const String       &ic_uuid,
530                                  const char         *buf,
531                                  int                 buflen,
532                                  const AttributeList &attrs,
533                                  int                 caret) const;
534
535     /**
536      * @brief Update a new WideString and caret for preedit.
537      *
538      * @param ic The handle of the client Input Context to receive the WideString.
539      *        -1 means the currently focused Input Context.
540      * @param ic_uuid The UUID of the IMEngine used by the Input Context.
541      *        Empty means don't match.
542      * @param preedit The WideString to be updated.
543      * @param commit The WideString to be commited on reset.
544      * @param attrs The attribute list for preedit string.
545      * @param caret The caret position in preedit string.
546      *
547      * The commit string can be used to replace the preedit string on reset
548      * for example on unfocus.
549      */
550
551     void update_preedit_string (int                  ic,
552                                             const String        &ic_uuid,
553                                             const WideString    &preedit,
554                                             const WideString    &commit,
555                                             const AttributeList &attrs,
556                                             int                  caret) const;
557
558     /**
559      * @brief Update a new string for aux.
560      *
561      * @param str The string to be updated.
562      * @param attrs The attribute list for aux string.
563      */
564     void update_aux_string      (const String       &str,
565                                  const AttributeList &attrs) const;
566
567     /**
568      * @brief Request to update candidate.
569      *
570      * @param table The lookup table for candidate.
571      */
572     void update_candidate_string (const LookupTable &table) const;
573
574     /**
575      * @brief Request to update associate.
576      *
577      * @param table The lookup table for associate.
578      */
579     void update_associate_string (const LookupTable &table) const;
580
581     /**
582      * @brief When the input context of ISE is changed,
583      *         ISE can call this function to notify application
584      *
585      * @param type  type of event.
586      * @param value value of event.
587      */
588     void update_input_context     (uint32                       type,
589                                    uint32                       value) const;
590
591     /**
592      * @brief Request to get surrounding text asynchronously.
593      *
594      * @param uuid The helper ISE UUID.
595      * @param maxlen_before The max length of before.
596      * @param maxlen_after The max length of after.
597      */
598     void get_surrounding_text     (const String                &uuid,
599                                    int                          maxlen_before,
600                                    int                          maxlen_after) const;
601
602     /**
603      * @brief Request to get surrounding text synchronously.
604      *
605      * @param maxlen_before The max length of before.
606      * @param maxlen_after The max length of after.
607      * @param text The surounding text.
608      * @param cursor The cursor position.
609      */
610     void get_surrounding_text (int maxlen_before, int maxlen_after, String &text, int &cursor);
611
612     /**
613      * @brief Request to delete surrounding text.
614      *
615      * @param offset The offset for cursor position.
616      * @param len The length for delete text.
617      */
618     void delete_surrounding_text  (int                          offset,
619                                    int                          len) const;
620
621     /**
622      * @brief Request to get selection.
623      *
624      * @param uuid The helper ISE UUID.
625      */
626     void get_selection       (const String                &uuid) const;
627
628     /**
629      * @brief Request to get selection text synchronously.
630      *
631      * @param text The selection text.
632      */
633     void get_selection_text       (String                      &text);
634
635     /**
636      * @brief Request to selected text.
637      *
638      * @param start The start position in text.
639      * @param end The end position in text.
640      */
641     void set_selection       (int                          start,
642                               int                          end) const;
643
644     /**
645      * @brief Set candidate position in screen.
646      *
647      * @param left The x position in screen.
648      * @param top The y position in screen.
649      */
650     void set_candidate_position   (int                          left,
651                                    int                          top) const;
652
653     /**
654      * @brief Request to hide candidate window.
655      */
656     void candidate_hide           (void) const;
657
658     /**
659      * @brief Request to get candidate window size and position.
660      *
661      * @param uuid The helper ISE UUID.
662      */
663     void get_candidate_window_geometry (const String           &uuid) const;
664
665     /**
666      * @brief Set current keyboard ISE.
667      *
668      * @param uuid The keyboard ISE UUID.
669      */
670     void set_keyboard_ise_by_uuid (const String                &uuid) const;
671
672     /**
673      * @brief Request to get current keyboard ISE information.
674      *
675      * @param uuid The helper ISE UUID.
676      */
677     void get_keyboard_ise         (const String                &uuid) const;
678
679     /**
680      * @brief Request to get uuid list of all keyboard ISEs.
681      *
682      * @param uuid The helper ISE UUID.
683      */
684     void get_keyboard_ise_list    (const String                &uuid) const;
685
686     /**
687      * @brief Update ISE window geometry.
688      *
689      * @param x      The x position in screen.
690      * @param y      The y position in screen.
691      * @param width  The ISE window width.
692      * @param height The ISE window height.
693      */
694     void update_geometry          (int                          x,
695                                    int                          y,
696                                    int                          width,
697                                    int                          height) const;
698
699     /**
700      * @brief Request to expand candidate window.
701      */
702     void expand_candidate         (void) const;
703
704     /**
705      * @brief Request to contract candidate window.
706      */
707     void contract_candidate       (void) const;
708
709     /**
710      * @brief Send selected candidate string index number.
711      */
712     void select_candidate         (int index) const;
713
714     /**
715      * @brief Update ise exit status
716      */
717     void update_ise_exit          (void) const;
718
719     /**
720      * @brief Update the preedit caret position in the preedit string.
721      *
722      * @param caret - the new position of the preedit caret.
723      */
724     void update_preedit_caret     (int                          caret) const;
725
726     /**
727      * @brief Set candidate style.
728      *
729      * @param portrait_line - the displayed line number for portrait.
730      * @param mode          - candidate window mode.
731      */
732     void set_candidate_style      (ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line = ONE_LINE_CANDIDATE,
733                                    ISF_CANDIDATE_MODE_T          mode = SOFT_CANDIDATE_WINDOW) const;
734
735     /**
736      * @brief Request to reset keyboard ISE.
737      */
738     void reset_keyboard_ise       (void) const;
739
740     /**
741      * @brief Request to flush keyboard ISE.
742      */
743     void flush_keyboard_ise       (void) const;
744
745     /**
746      * @brief Send a private command to an application
747      *
748      * @param command The private command sent from IME.
749      */
750     void send_private_command     (const String                &command) const;
751
752     /**
753      * @brief Request panel to hide ISE, since in some cases ISE cannot hide itself (e.g. WAYLAND)
754      */
755     void request_ise_hide         (void) const;
756
757 public:
758     /**
759      * @brief Connect a slot to Helper exit signal.
760      *
761      * This signal is used to let the Helper exit.
762      *
763      * The prototype of the slot is:
764      *
765      * void exit (const HelperAgent *agent, int ic, const String &ic_uuid);
766      *
767      * Parameters:
768      * - agent    The pointer to the HelperAgent object which emits this signal.
769      * - ic       An opaque handle of the currently focused input context.
770      * - ic_uuid  The UUID of the IMEngineInstance associated with the focused input context.
771      */
772     Connection signal_connect_exit                   (HelperAgentSlotVoid        *slot);
773
774     /**
775      * @brief Connect a slot to Helper attach input context signal.
776      *
777      * This signal is used to attach an input context to this helper.
778      *
779      * When an input context requst to start this helper, then this
780      * signal will be emitted as soon as the helper is started.
781      *
782      * When an input context want to start an already started helper,
783      * this signal will also be emitted.
784      *
785      * Helper can send some events back to the IMEngineInstance in this
786      * signal-slot, to inform that it has been started sccessfully.
787      *
788      * The prototype of the slot is:
789      *
790      * void attach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
791      */
792     Connection signal_connect_attach_input_context   (HelperAgentSlotVoid        *slot);
793
794     /**
795      * @brief Connect a slot to Helper detach input context signal.
796      *
797      * This signal is used to detach an input context from this helper.
798      *
799      * When an input context requst to stop this helper, then this
800      * signal will be emitted.
801      *
802      * Helper shouldn't send any event back to the IMEngineInstance, because
803      * the IMEngineInstance attached to the ic should have been destroyed.
804      *
805      * The prototype of the slot is:
806      *
807      * void detach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
808      */
809     Connection signal_connect_detach_input_context   (HelperAgentSlotVoid        *slot);
810
811     /**
812      * @brief Connect a slot to Helper reload config signal.
813      *
814      * This signal is used to let the Helper reload configuration.
815      *
816      * The prototype of the slot is:
817      *
818      * void reload_config (const HelperAgent *agent, int ic, const String &ic_uuid);
819      */
820     Connection signal_connect_reload_config          (HelperAgentSlotVoid        *slot);
821
822     /**
823      * @brief Connect a slot to Helper update screen signal.
824      *
825      * This signal is used to let the Helper move its GUI to another screen.
826      * It can only be emitted when SCIM_HELPER_NEED_SCREEN_INFO is set in HelperInfo.option.
827      *
828      * The prototype of the slot is:
829      *
830      * void update_screen (const HelperAgent *agent, int ic, const String &ic_uuid, int screen_number);
831      */
832     Connection signal_connect_update_screen          (HelperAgentSlotInt         *slot);
833
834     /**
835      * @brief Connect a slot to Helper update spot location signal.
836      *
837      * This signal is used to let the Helper move its GUI according to the current spot location.
838      * It can only be emitted when SCIM_HELPER_NEED_SPOT_LOCATION_INFO is set in HelperInfo.option.
839      *
840      * The prototype of the slot is:
841      * void update_spot_location (const HelperAgent *agent, int ic, const String &ic_uuid, int x, int y);
842      */
843     Connection signal_connect_update_spot_location   (HelperAgentSlotIntInt      *slot);
844
845     /**
846      * @brief Connect a slot to Helper update cursor position signal.
847      *
848      * This signal is used to let the Helper get the cursor position information.
849      *
850      * The prototype of the slot is:
851      * void update_cursor_position (const HelperAgent *agent, int ic, const String &ic_uuid, int cursor_pos);
852      */
853     Connection signal_connect_update_cursor_position (HelperAgentSlotInt         *slot);
854
855     /**
856      * @brief Connect a slot to Helper update surrounding text signal.
857      *
858      * This signal is used to let the Helper get the surrounding text.
859      *
860      * The prototype of the slot is:
861      * void update_surrounding_text (const HelperAgent *agent, int ic, const String &text, int cursor);
862      */
863     Connection signal_connect_update_surrounding_text (HelperAgentSlotInt        *slot);
864
865     /**
866      * @brief Connect a slot to Helper update selection signal.
867      *
868      * This signal is used to let the Helper get the selection.
869      *
870      * The prototype of the slot is:
871      * void update_selection (const HelperAgent *agent, int ic, const String &text);
872      */
873     Connection signal_connect_update_selection (HelperAgentSlotVoid        *slot);
874
875     /**
876      * @brief Connect a slot to Helper trigger property signal.
877      *
878      * This signal is used to trigger a property registered by this Helper.
879      * A property will be triggered when user clicks on it.
880      *
881      * The prototype of the slot is:
882      * void trigger_property (const HelperAgent *agent, int ic, const String &ic_uuid, const String &property);
883      */
884     Connection signal_connect_trigger_property       (HelperAgentSlotString      *slot);
885
886     /**
887      * @brief Connect a slot to Helper process imengine event signal.
888      *
889      * This signal is used to deliver the events sent from IMEngine to Helper.
890      *
891      * The prototype of the slot is:
892      * void process_imengine_event (const HelperAgent *agent, int ic, const String &ic_uuid, const Transaction &transaction);
893      */
894     Connection signal_connect_process_imengine_event (HelperAgentSlotTransaction *slot);
895
896     /**
897      * @brief Connect a slot to Helper focus out signal.
898      *
899      * This signal is used to do something when input context is focus out.
900      *
901      * The prototype of the slot is:
902      * void focus_out (const HelperAgent *agent, int ic, const String &ic_uuid);
903      */
904     Connection signal_connect_focus_out                         (HelperAgentSlotVoid                *slot);
905
906     /**
907      * @brief Connect a slot to Helper focus in signal.
908      *
909      * This signal is used to do something when input context is focus in.
910      *
911      * The prototype of the slot is:
912      * void focus_in (const HelperAgent *agent, int ic, const String &ic_uuid);
913      */
914     Connection signal_connect_focus_in                          (HelperAgentSlotVoid                *slot);
915
916     /**
917      * @brief Connect a slot to Helper show signal.
918      *
919      * This signal is used to show Helper ISE window.
920      *
921      * The prototype of the slot is:
922      * void ise_show (const HelperAgent *agent, int ic, char *buf, size_t &len);
923      */
924     Connection signal_connect_ise_show                          (HelperAgentSlotIntRawVoid          *slot);
925
926     /**
927      * @brief Connect a slot to Helper hide signal.
928      *
929      * This signal is used to hide Helper ISE window.
930      *
931      * The prototype of the slot is:
932      * void ise_hide (const HelperAgent *agent, int ic, const String &ic_uuid);
933      */
934     Connection signal_connect_ise_hide                          (HelperAgentSlotVoid                *slot);
935
936     /**
937      * @brief Connect a slot to Helper get ISE window geometry signal.
938      *
939      * This signal is used to get Helper ISE window size and position.
940      *
941      * The prototype of the slot is:
942      * void get_geometry (const HelperAgent *agent, struct rectinfo &info);
943      */
944     Connection signal_connect_get_geometry                      (HelperAgentSlotSize                *slot);
945
946     /**
947      * @brief Connect a slot to Helper set mode signal.
948      *
949      * This signal is used to set Helper ISE mode.
950      *
951      * The prototype of the slot is:
952      * void set_mode (const HelperAgent *agent, uint32 &mode);
953      */
954     Connection signal_connect_set_mode                          (HelperAgentSlotUintVoid            *slot);
955
956     /**
957      * @brief Connect a slot to Helper set language signal.
958      *
959      * This signal is used to set Helper ISE language.
960      *
961      * The prototype of the slot is:
962      * void set_language (const HelperAgent *agent, uint32 &language);
963      */
964     Connection signal_connect_set_language                      (HelperAgentSlotUintVoid            *slot);
965
966     /**
967      * @brief Connect a slot to Helper set im data signal.
968      *
969      * This signal is used to send im data to Helper ISE.
970      *
971      * The prototype of the slot is:
972      * void set_imdata (const HelperAgent *agent, char *buf, size_t &len);
973      */
974     Connection signal_connect_set_imdata                        (HelperAgentSlotRawVoid             *slot);
975
976     /**
977      * @brief Connect a slot to Helper get im data signal.
978      *
979      * This signal is used to get im data from Helper ISE.
980      *
981      * The prototype of the slot is:
982      * void get_imdata (const HelperAgent *, char **buf, size_t &len);
983      */
984     Connection signal_connect_get_imdata                        (HelperAgentSlotGetRawVoid          *slot);
985
986     /**
987      * @brief Connect a slot to Helper get language locale.
988      *
989      * This signal is used to get language locale from Helper ISE.
990      *
991      * The prototype of the slot is:
992      * void get_language_locale (const HelperAgent *, int ic, char **locale);
993      */
994     Connection signal_connect_get_language_locale               (HelperAgentSlotIntGetStringVoid    *slot);
995
996     /**
997      * @brief Connect a slot to Helper set return key type signal.
998      *
999      * This signal is used to set return key type to Helper ISE.
1000      *
1001      * The prototype of the slot is:
1002      * void set_return_key_type (const HelperAgent *agent, uint32 &type);
1003      */
1004     Connection signal_connect_set_return_key_type               (HelperAgentSlotUintVoid            *slot);
1005
1006     /**
1007      * @brief Connect a slot to Helper get return key type signal.
1008      *
1009      * This signal is used to get return key type from Helper ISE.
1010      *
1011      * The prototype of the slot is:
1012      * void get_return_key_type (const HelperAgent *agent, uint32 &type);
1013      */
1014     Connection signal_connect_get_return_key_type               (HelperAgentSlotUintVoid            *slot);
1015
1016     /**
1017      * @brief Connect a slot to Helper set return key disable signal.
1018      *
1019      * This signal is used to set return key disable to Helper ISE.
1020      *
1021      * The prototype of the slot is:
1022      * void set_return_key_disable (const HelperAgent *agent, uint32 &disabled);
1023      */
1024     Connection signal_connect_set_return_key_disable            (HelperAgentSlotUintVoid            *slot);
1025
1026     /**
1027      * @brief Connect a slot to Helper get return key disable signal.
1028      *
1029      * This signal is used to get return key disable from Helper ISE.
1030      *
1031      * The prototype of the slot is:
1032      * void get_return_key_disable (const HelperAgent *agent, uint32 &disabled);
1033      */
1034     Connection signal_connect_get_return_key_disable            (HelperAgentSlotUintVoid            *slot);
1035
1036     /**
1037      * @brief Connect a slot to Helper get layout signal.
1038      *
1039      * This signal is used to get Helper ISE layout.
1040      *
1041      * The prototype of the slot is:
1042      * void get_layout (const HelperAgent *agent, uint32 &layout);
1043      */
1044     Connection signal_connect_get_layout                        (HelperAgentSlotUintVoid            *slot);
1045
1046     /**
1047      * @brief Connect a slot to Helper set layout signal.
1048      *
1049      * This signal is used to set Helper ISE layout.
1050      *
1051      * The prototype of the slot is:
1052      * void set_layout (const HelperAgent *agent, uint32 &layout);
1053      */
1054     Connection signal_connect_set_layout                        (HelperAgentSlotUintVoid            *slot);
1055
1056     /**
1057      * @brief Connect a slot to Helper set shift mode signal.
1058      *
1059      * This signal is used to set Helper shift mode.
1060      *
1061      * The prototype of the slot is:
1062      * void set_caps_mode (const HelperAgent *agent, uint32 &mode);
1063      */
1064     Connection signal_connect_set_caps_mode                     (HelperAgentSlotUintVoid            *slot);
1065
1066     /**
1067      * @brief Connect a slot to Helper reset input context signal.
1068      *
1069      * This signal is used to reset Helper ISE input context.
1070      *
1071      * The prototype of the slot is:
1072      * void reset_input_context (const HelperAgent *agent, int ic, const String &uuid);
1073      */
1074     Connection signal_connect_reset_input_context               (HelperAgentSlotVoid                *slot);
1075
1076     /**
1077      * @brief Connect a slot to Helper update candidate window geometry signal.
1078      *
1079      * This signal is used to get candidate window size and position.
1080      *
1081      * The prototype of the slot is:
1082      * void update_candidate_geometry (const HelperAgent *agent, int ic, const String &uuid, const rectinfo &info);
1083      */
1084     Connection signal_connect_update_candidate_geometry         (HelperAgentSlotRect                *slot);
1085
1086     /**
1087      * @brief Connect a slot to Helper update keyboard ISE signal.
1088      *
1089      * This signal is used to get current keyboard ISE name and uuid.
1090      *
1091      * The prototype of the slot is:
1092      * void update_keyboard_ise (const HelperAgent *agent, int ic, const String &uuid,
1093      *                           const String &ise_name, const String &ise_uuid);
1094      */
1095     Connection signal_connect_update_keyboard_ise               (HelperAgentSlotString2             *slot);
1096
1097     /**
1098      * @brief Connect a slot to Helper update keyboard ISE list signal.
1099      *
1100      * This signal is used to get uuid list of all keyboard ISEs.
1101      *
1102      * The prototype of the slot is:
1103      * void update_keyboard_ise_list (const HelperAgent *agent, int ic, const String &uuid,
1104      *                                const std::vector<String> &ise_list);
1105      */
1106     Connection signal_connect_update_keyboard_ise_list          (HelperAgentSlotStringVector        *slot);
1107
1108     /**
1109      * @brief Connect a slot to Helper candidate more window show signal.
1110      *
1111      * This signal is used to do someting when candidate more window is showed.
1112      *
1113      * The prototype of the slot is:
1114      * void candidate_more_window_show (const HelperAgent *agent, int ic, const String &uuid);
1115      */
1116     Connection signal_connect_candidate_more_window_show        (HelperAgentSlotVoid                *slot);
1117
1118     /**
1119      * @brief Connect a slot to Helper candidate more window hide signal.
1120      *
1121      * This signal is used to do someting when candidate more window is hidden.
1122      *
1123      * The prototype of the slot is:
1124      * void candidate_more_window_hide (const HelperAgent *agent, int ic, const String &uuid);
1125      */
1126     Connection signal_connect_candidate_more_window_hide        (HelperAgentSlotVoid                *slot);
1127
1128     /**
1129      * @brief Connect a slot to Helper candidate show signal.
1130      *
1131      * This signal is used to do candidate show.
1132      *
1133      * The prototype of the slot is:
1134      * void candidate_show (const HelperAgent *agent, int ic, const String &uuid);
1135      */
1136     Connection signal_connect_candidate_show                    (HelperAgentSlotVoid                *slot);
1137
1138     /**
1139      * @brief Connect a slot to Helper candidate hide signal.
1140      *
1141      * This signal is used to do candidate hide.
1142      *
1143      * The prototype of the slot is:
1144      * void candidate_hide (const HelperAgent *agent,int ic, const String &uuid);
1145      */
1146     Connection signal_connect_candidate_hide                    (HelperAgentSlotVoid                *slot);
1147
1148     /**
1149      * @brief Connect a slot to Helper update lookup table signal.
1150      *
1151      * This signal is used to do someting when update lookup table.
1152      *
1153      * The prototype of the slot is:
1154      * void update_lookup_table (const HelperAgent *agent, int ic, const String &uuid, LookupTable &Table);
1155      */
1156     Connection signal_connect_update_lookup_table               (HelperAgentSlotLookupTable          *slot);
1157
1158     /**
1159      * @brief Connect a slot to Helper select aux signal.
1160      *
1161      * This signal is used to do something when aux is selected.
1162      *
1163      * The prototype of the slot is:
1164      * void select_aux (const HelperAgent *agent, int ic, const String &uuid, int index);
1165      */
1166     Connection signal_connect_select_aux                        (HelperAgentSlotInt                 *slot);
1167
1168     /**
1169      * @brief Connect a slot to Helper select candidate signal.
1170      *
1171      * This signal is used to do something when candidate is selected.
1172      *
1173      * The prototype of the slot is:
1174      * void select_candidate (const HelperAgent *agent, int ic, const String &uuid, int index);
1175      */
1176     Connection signal_connect_select_candidate                  (HelperAgentSlotInt                 *slot);
1177
1178     /**
1179      * @brief Connect a slot to Helper candidate table page up signal.
1180      *
1181      * This signal is used to do something when candidate table is paged up.
1182      *
1183      * The prototype of the slot is:
1184      * void candidate_table_page_up (const HelperAgent *agent, int ic, const String &uuid);
1185      */
1186     Connection signal_connect_candidate_table_page_up           (HelperAgentSlotVoid                *slot);
1187
1188     /**
1189      * @brief Connect a slot to Helper candidate table page down signal.
1190      *
1191      * This signal is used to do something when candidate table is paged down.
1192      *
1193      * The prototype of the slot is:
1194      * void candidate_table_page_down (const HelperAgent *agent, int ic, const String &uuid);
1195      */
1196     Connection signal_connect_candidate_table_page_down         (HelperAgentSlotVoid                *slot);
1197
1198     /**
1199      * @brief Connect a slot to Helper update candidate table page size signal.
1200      *
1201      * This signal is used to do something when candidate table page size is changed.
1202      *
1203      * The prototype of the slot is:
1204      * void update_candidate_table_page_size (const HelperAgent *, int ic, const String &uuid, int page_size);
1205      */
1206     Connection signal_connect_update_candidate_table_page_size  (HelperAgentSlotInt                 *slot);
1207
1208     /**
1209      * @brief Connect a slot to Helper select associate signal.
1210      *
1211      * This signal is used to do something when associate is selected.
1212      *
1213      * The prototype of the slot is:
1214      * void select_associate (const HelperAgent *agent, int ic, const String &uuid, int index);
1215      */
1216     Connection signal_connect_select_associate                  (HelperAgentSlotInt                 *slot);
1217
1218     /**
1219      * @brief Connect a slot to Helper associate table page up signal.
1220      *
1221      * This signal is used to do something when associate table is paged up.
1222      *
1223      * The prototype of the slot is:
1224      * void associate_table_page_up (const HelperAgent *agent, int ic, const String &uuid);
1225      */
1226     Connection signal_connect_associate_table_page_up           (HelperAgentSlotVoid                *slot);
1227
1228     /**
1229      * @brief Connect a slot to Helper associate table page down signal.
1230      *
1231      * This signal is used to do something when associate table is paged down.
1232      *
1233      * The prototype of the slot is:
1234      * void associate_table_page_down (const HelperAgent *agent, int ic, const String &uuid);
1235      */
1236     Connection signal_connect_associate_table_page_down         (HelperAgentSlotVoid                *slot);
1237
1238     /**
1239      * @brief Connect a slot to Helper update associate table page size signal.
1240      *
1241      * This signal is used to do something when associate table page size is changed.
1242      *
1243      * The prototype of the slot is:
1244      * void update_associate_table_page_size (const HelperAgent *, int ic, const String &uuid, int page_size);
1245      */
1246     Connection signal_connect_update_associate_table_page_size  (HelperAgentSlotInt                 *slot);
1247
1248     /**
1249      * @brief Connect a slot to Helper turn on log signal.
1250      *
1251      * This signal is used to turn on Helper ISE debug information.
1252      *
1253      * The prototype of the slot is:
1254      * void turn_on_log (const HelperAgent *agent, uint32 &on);
1255      */
1256     Connection signal_connect_turn_on_log                       (HelperAgentSlotUintVoid            *slot);
1257
1258     /**
1259      * @brief Connect a slot to Helper update displayed candidate number signal.
1260      *
1261      * This signal is used to inform helper ISE displayed candidate number.
1262      *
1263      * The prototype of the slot is:
1264      * void update_displayed_candidate_number (const HelperAgent *, int ic, const String &uuid, int number);
1265      */
1266     Connection signal_connect_update_displayed_candidate_number (HelperAgentSlotInt                 *slot);
1267
1268     /**
1269      * @brief Connect a slot to Helper longpress candidate signal.
1270      *
1271      * This signal is used to do something when candidate is longpress.
1272      *
1273      * The prototype of the slot is:
1274      * void longpress_candidate (const HelperAgent *agent, int ic, const String &uuid, int index);
1275      */
1276     Connection signal_connect_longpress_candidate               (HelperAgentSlotInt                 *slot);
1277
1278     /**
1279      * @brief Connect a slot to Helper update candidate item layout signal.
1280      *
1281      * The prototype of the slot is:
1282      * void update_candidate_item_layout (const HelperAgent *, const std::vector<uint32> &row_items);
1283      */
1284     Connection signal_connect_update_candidate_item_layout      (HelperAgentSlotUintVector          *slot);
1285
1286      /**
1287      * @brief Connect a slot to Helper process key event signal.
1288      *
1289      * The prototype of the slot is:
1290      * void process_key_event (const HelperAgent *, KeyEvent &key, uint32 &ret);
1291      */
1292     Connection signal_connect_process_key_event (HelperAgentSlotKeyEventUint *slot);
1293
1294     /**
1295      * @brief Connect a slot to Helper set input mode signal.
1296      *
1297      * This signal is used to set Helper ISE input mode.
1298      *
1299      * The prototype of the slot is:
1300      * void set_input_mode (const HelperAgent *agent, uint32 &input_mode);
1301      */
1302     Connection signal_connect_set_input_mode                        (HelperAgentSlotUintVoid            *slot);
1303
1304     /**
1305      * @brief Connect a slot to Helper set input hint signal.
1306      *
1307      * This signal is used to set Helper ISE input hint.
1308      *
1309      * The prototype of the slot is:
1310      * void set_input_hint (const HelperAgent *agent, uint32 &input_hint);
1311      */
1312     Connection signal_connect_set_input_hint                        (HelperAgentSlotUintVoid            *slot);
1313
1314     /**
1315      * @brief Connect a slot to Helper update bidi direction signal.
1316      *
1317      * This signal is used to update Helper ISE bidi direction.
1318      *
1319      * The prototype of the slot is:
1320      * void update_bidi_direction (const HelperAgent *agent, uint32 &bidi_direction);
1321      */
1322     Connection signal_connect_update_bidi_direction                 (HelperAgentSlotUintVoid            *slot);
1323
1324     /**
1325      * @brief Connect a slot to Helper show option window.
1326      *
1327      * This signal is used to do request the ISE to show option window.
1328      *
1329      * The prototype of the slot is:
1330      * void show_option_window (const HelperAgent *agent, int ic, const String &uuid);
1331      */
1332     Connection signal_connect_show_option_window                    (HelperAgentSlotVoid                *slot);
1333
1334     /**
1335      * @brief Connect a slot to Helper resume option window.
1336      *
1337      * This signal is used to do request the ISE to resume option window.
1338      *
1339      * The prototype of the slot is:
1340      * void resume_option_window (const HelperAgent *agent, int ic, const String &uuid);
1341      */
1342     Connection signal_connect_resume_option_window                    (HelperAgentSlotVoid                *slot);
1343
1344     /**
1345      * @brief Connect a slot to Helper check if the option is available.
1346      *
1347      * This signal is used to request ISE to reply if the option (setting) is available.
1348      *
1349      * The prototype of the slot is:
1350      * void check_option_window (const HelperAgent *agent, uint32 &avail);
1351      */
1352     Connection signal_connect_check_option_window                   (HelperAgentSlotUintVoid            *slot);
1353
1354     /**
1355     * @brief Connect a slot to Helper process unconventional input device event signal.
1356     *
1357     * The prototype of the slot is:
1358     * void process_input_device_event (const HelperAgent *, uint32 &type, char *data, size_t &size, uint32 &ret);
1359     */
1360     Connection signal_connect_process_input_device_event            (HelperAgentSlotUintCharSizeUint *slot);
1361 };
1362
1363 /**  @} */
1364
1365 } /* namespace scim */
1366
1367 struct ArgInfo
1368 {
1369     char **argv;
1370     int    argc;
1371 };
1372
1373 #endif /* __SCIM_HELPER_H */
1374
1375 /*
1376 vi:ts=4:nowrap:ai:expandtab
1377 */
1378