Git init
[profile/ivi/isf.git] / ism / src / scim_panel_client.cpp
1 /** @file scim_panel_client.cpp
2  *  @brief Implementation of class PanelClient.
3  */
4
5 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
6
7 /*
8  * Smart Common Input Method
9  *
10  * Copyright (c) 2005 James Su <suzhe@tsinghua.org.cn>
11  *
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public
15  * License as published by the Free Software Foundation; either
16  * version 2 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this program; if not, write to the
25  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
26  * Boston, MA  02111-1307  USA
27  *
28  * $Id: scim_panel_client.cpp,v 1.6 2005/06/26 16:35:33 suzhe Exp $
29  *
30  */
31
32 #define Uses_SCIM_TRANSACTION
33 #define Uses_SCIM_TRANS_COMMANDS
34 #define Uses_SCIM_PANEL_CLIENT
35 #define Uses_SCIM_SOCKET
36 #define Uses_SCIM_EVENT
37
38 #include "scim_private.h"
39 #include "scim.h"
40
41 namespace scim {
42
43 typedef Signal1<void, int>
44         PanelClientSignalVoid;
45
46 typedef Signal2<void, int, int>
47         PanelClientSignalInt;
48
49 typedef Signal2<void, int, const String &>
50         PanelClientSignalString;
51
52 typedef Signal2<void, int, const WideString &>
53         PanelClientSignalWideString;
54
55 typedef Signal4<void, int, const String &, const String &, const Transaction &>
56         PanelClientSignalStringStringTransaction;
57
58 typedef Signal2<void, int, const KeyEvent &>
59         PanelClientSignalKeyEvent;
60
61 typedef Signal3<void, int, const WideString &, const AttributeList &>
62         PanelClientSignalStringAttrs;
63
64 class PanelClient::PanelClientImpl
65 {
66     SocketClient                                m_socket;
67     int                                         m_socket_timeout;
68     uint32                                      m_socket_magic_key;
69     Transaction                                 m_send_trans;
70     int                                         m_current_icid;
71     int                                         m_send_refcount;
72
73     PanelClientSignalVoid                       m_signal_reload_config;
74     PanelClientSignalVoid                       m_signal_exit;
75     PanelClientSignalInt                        m_signal_update_lookup_table_page_size;
76     PanelClientSignalVoid                       m_signal_lookup_table_page_up;
77     PanelClientSignalVoid                       m_signal_lookup_table_page_down;
78     PanelClientSignalVoid                       m_signal_reset_option;
79     PanelClientSignalString                     m_signal_trigger_property;
80     PanelClientSignalStringStringTransaction    m_signal_process_helper_event;
81     PanelClientSignalInt                        m_signal_move_preedit_caret;
82     PanelClientSignalInt                        m_signal_select_aux;
83     PanelClientSignalInt                        m_signal_select_candidate;
84     PanelClientSignalKeyEvent                   m_signal_process_key_event;
85     PanelClientSignalWideString                 m_signal_commit_string;
86     PanelClientSignalKeyEvent                   m_signal_forward_key_event;
87     PanelClientSignalVoid                       m_signal_request_help;
88     PanelClientSignalVoid                       m_signal_request_factory_menu;
89     PanelClientSignalString                     m_signal_change_factory;
90     PanelClientSignalVoid                       m_signal_reset_keyboard_ise;
91     PanelClientSignalVoid                       m_signal_update_keyboard_ise;
92     PanelClientSignalVoid                       m_signal_show_preedit_string;
93     PanelClientSignalVoid                       m_signal_hide_preedit_string;
94     PanelClientSignalStringAttrs                m_signal_update_preedit_string;
95
96 public:
97     PanelClientImpl ()
98         : m_socket_timeout (scim_get_default_socket_timeout ()),
99           m_socket_magic_key (0),
100           m_current_icid (-1),
101           m_send_refcount (0)
102     {
103     }
104
105     int  open_connection        (const String &config, const String &display)
106     {
107         String panel_address = scim_get_default_panel_socket_address (display);
108         SocketAddress addr (panel_address);
109
110         if (m_socket.is_connected ()) close_connection ();
111
112         bool ret;
113         int  i, count = 0;
114
115         /* Try three times. */
116         while (1) {
117             ret = m_socket.connect (addr);
118             if (ret == false) {
119                 scim_usleep (100000);
120                 launch_panel (config, display);
121                 std::cerr << " Re-connecting to PanelAgent server.";
122                 ISF_SYSLOG (" Re-connecting to PanelAgent server.\n");
123                 for (i = 0; i < 200; ++i) {
124                     if (m_socket.connect (addr)) {
125                         ret = true;
126                         break;
127                     }
128                     std::cerr << ".";
129                     scim_usleep (200000);
130                 }
131                 std::cerr << " Connected :" << i << "\n";
132                 ISF_SYSLOG ("  Connected :%d\n", i);
133                 if (m_socket.connect (addr) == false && count >= 2)
134                     break;
135             }
136
137             if (ret && scim_socket_open_connection (m_socket_magic_key, String ("FrontEnd"), String ("Panel"), m_socket, m_socket_timeout)) {
138                 ISF_SYSLOG (" PID=%d connect to PanelAgent (%s), connected:%d.\n", getpid (), panel_address.c_str (), count);
139                 break;
140             } else {
141                 std::cerr << " PID=" << getpid () << " cannot connect to PanelAgent (" << panel_address << "), connected:" << count << ".\n";
142                 ISF_SYSLOG (" PID=%d cannot connect to PanelAgent (%s), connected:%d.\n", getpid (), panel_address.c_str (), count);
143             }
144
145             m_socket.close ();
146
147             if (count++ >= 400) break;
148
149             scim_usleep (300000);
150         }
151
152         return m_socket.get_id ();
153     }
154
155     void close_connection       ()
156     {
157         m_socket.close ();
158         m_socket_magic_key = 0;
159     }
160
161     int  get_connection_number  () const
162     {
163         return m_socket.get_id ();
164     }
165
166     bool is_connected           () const
167     {
168         return m_socket.is_connected ();
169     }
170
171     bool has_pending_event      () const
172     {
173         return m_socket.is_connected () && m_socket.wait_for_data (0) > 0;
174     }
175
176     bool filter_event           ()
177     {
178         Transaction recv;
179
180         if (!m_socket.is_connected () || !recv.read_from_socket (m_socket, m_socket_timeout))
181             return false;
182
183         int cmd;
184         uint32 context = (uint32)(-1);
185
186         if (!recv.get_command (cmd) || cmd != SCIM_TRANS_CMD_REPLY)
187             return true;
188
189         /* No context id available, so there will be some global command. */
190         if (recv.get_data_type () == SCIM_TRANS_DATA_COMMAND) {
191             while (recv.get_command (cmd)) {
192                 switch (cmd) {
193                     case SCIM_TRANS_CMD_RELOAD_CONFIG:
194                         m_signal_reload_config ((int)context);
195                         break;
196                     case SCIM_TRANS_CMD_EXIT:
197                         m_signal_exit ((int)context);
198                         break;
199                     default:
200                         break;
201                 }
202             }
203             return true;
204         }
205
206         /* Now for context related command. */
207         if (!recv.get_data (context))
208             return true;
209
210         while (recv.get_command (cmd)) {
211             switch (cmd) {
212                 case SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE:
213                     {
214                         uint32 size;
215                         if (recv.get_data (size))
216                             m_signal_update_lookup_table_page_size ((int) context, (int) size);
217                     }
218                     break;
219                 case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP:
220                     {
221                         m_signal_lookup_table_page_up ((int) context);
222                     }
223                     break;
224                 case SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_DOWN:
225                     {
226                         m_signal_lookup_table_page_down ((int) context);
227                     }
228                     break;
229                 case ISM_TRANS_CMD_RESET_ISE_OPTION:
230                     {
231                         m_signal_reset_option ((int) context);
232                     }
233                     break;
234                 case SCIM_TRANS_CMD_TRIGGER_PROPERTY:
235                     {
236                         String property;
237                         if (recv.get_data (property))
238                             m_signal_trigger_property ((int) context, property);
239                     }
240                     break;
241                 case SCIM_TRANS_CMD_PROCESS_HELPER_EVENT:
242                     {
243                         String target_uuid;
244                         String helper_uuid;
245                         Transaction trans;
246                         if (recv.get_data (target_uuid) && recv.get_data (helper_uuid) && recv.get_data (trans))
247                             m_signal_process_helper_event ((int) context, target_uuid, helper_uuid, trans);
248                     }
249                     break;
250                 case SCIM_TRANS_CMD_MOVE_PREEDIT_CARET:
251                     {
252                         uint32 caret;
253                         if (recv.get_data (caret))
254                             m_signal_move_preedit_caret ((int) context, (int) caret);
255                     }
256                     break;
257                 case ISM_TRANS_CMD_SELECT_AUX:
258                     {
259                         uint32 item;
260                         if (recv.get_data (item))
261                             m_signal_select_aux ((int) context, (int) item);
262                     }
263                     break;
264                 case SCIM_TRANS_CMD_SELECT_CANDIDATE:
265                     {
266                         uint32 item;
267                         if (recv.get_data (item))
268                             m_signal_select_candidate ((int) context, (int) item);
269                     }
270                     break;
271                 case SCIM_TRANS_CMD_PROCESS_KEY_EVENT:
272                     {
273                         KeyEvent key;
274                         if (recv.get_data (key))
275                             m_signal_process_key_event ((int) context, key);
276                     }
277                     break;
278                 case SCIM_TRANS_CMD_COMMIT_STRING:
279                     {
280                         WideString wstr;
281                         if (recv.get_data (wstr))
282                             m_signal_commit_string ((int) context, wstr);
283                     }
284                     break;
285                 case SCIM_TRANS_CMD_FORWARD_KEY_EVENT:
286                     {
287                         KeyEvent key;
288                         if (recv.get_data (key))
289                             m_signal_forward_key_event ((int) context, key);
290                     }
291                     break;
292                 case SCIM_TRANS_CMD_PANEL_REQUEST_HELP:
293                     {
294                         m_signal_request_help ((int) context);
295                     }
296                     break;
297                 case SCIM_TRANS_CMD_PANEL_REQUEST_FACTORY_MENU:
298                     {
299                         m_signal_request_factory_menu ((int) context);
300                     }
301                     break;
302                 case SCIM_TRANS_CMD_PANEL_CHANGE_FACTORY:
303                     {
304                         String sfid;
305                         if (recv.get_data (sfid))
306                             m_signal_change_factory ((int) context, sfid);
307                     }
308                     break;
309                 case ISM_TRANS_CMD_PANEL_REQUEST_RESET_ISE:
310                     {
311                         m_signal_reset_keyboard_ise ((int) context);
312                     }
313                     break;
314                 case ISM_TRANS_CMD_PANEL_UPDATE_KEYBOARD_ISE:
315                     {
316                         m_signal_update_keyboard_ise ((int) context);
317                     }
318                     break;
319                 case SCIM_TRANS_CMD_SHOW_PREEDIT_STRING:
320                     {
321                         m_signal_show_preedit_string ((int) context);
322                     }
323                     break;
324                 case SCIM_TRANS_CMD_HIDE_PREEDIT_STRING:
325                     {
326                         m_signal_hide_preedit_string ((int) context);
327                     }
328                     break;
329                 case SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING:
330                     {
331                         WideString wstr;
332                         AttributeList attrs;
333                         if (recv.get_data (wstr) && recv.get_data (attrs))
334                             m_signal_update_preedit_string ((int) context, wstr, attrs);
335                     }
336                     break;
337                 case ISM_TRANS_CMD_TURN_ON_LOG:
338                     {
339                         printf ("<%s:%d>receive ISM_TRANS_CMD_TURN_ON_LOG\n", __FUNCTION__, __LINE__);
340                         uint32 isOn;
341                         if (recv.get_data (isOn)) {
342                             if (isOn) {
343                                 printf ("<%s:%d>turn on log\n", __FUNCTION__, __LINE__);
344                                 DebugOutput::enable_debug (SCIM_DEBUG_AllMask);
345                                 DebugOutput::set_verbose_level (7);
346                             } else {
347                                 printf ("<%s:%d>turn off log\n", __FUNCTION__, __LINE__);
348                                 DebugOutput::disable_debug (SCIM_DEBUG_AllMask);
349                                 DebugOutput::set_verbose_level (0);
350                             }
351                         }
352                     }
353                     break;
354                 default:
355                     break;
356             }
357         }
358         return true;
359     }
360
361     bool prepare                (int icid)
362     {
363         if (!m_socket.is_connected ()) return false;
364
365         int cmd;
366         uint32 data;
367
368         if (m_send_refcount <= 0) {
369             m_current_icid = icid;
370             m_send_trans.clear ();
371             m_send_trans.put_command (SCIM_TRANS_CMD_REQUEST);
372             m_send_trans.put_data (m_socket_magic_key);
373             m_send_trans.put_data ((uint32) icid);
374
375             if (m_send_trans.get_command (cmd) &&
376                 m_send_trans.get_data (data) &&
377                 m_send_trans.get_data (data))
378                 m_send_refcount = 0;
379             else
380                 return false;
381         }
382
383         if (m_current_icid == icid) {
384             m_send_refcount ++;
385             return true;
386         }
387         return false;
388     }
389
390     bool send                   ()
391     {
392         if (!m_socket.is_connected ()) return false;
393
394         if (m_send_refcount <= 0) return false;
395
396         m_send_refcount --;
397
398         if (m_send_refcount > 0) return false;
399
400         if (m_send_trans.get_data_type () != SCIM_TRANS_DATA_UNKNOWN)
401             return m_send_trans.write_to_socket (m_socket, 0x4d494353);
402
403         return false;
404     }
405
406 public:
407     void turn_on                (int icid)
408     {
409         if (m_send_refcount > 0 && m_current_icid == icid)
410             m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_TURN_ON);
411     }
412     void turn_off               (int icid)
413     {
414         if (m_send_refcount > 0 && m_current_icid == icid)
415             m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_TURN_OFF);
416     }
417     void update_screen          (int icid, int screen)
418     {
419         if (m_send_refcount > 0 && m_current_icid == icid) {
420             m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_SCREEN);
421             m_send_trans.put_data ((uint32) screen);
422         }
423     }
424     void show_help              (int icid, const String &help)
425     {
426         if (m_send_refcount > 0 && m_current_icid == icid) {
427             m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_SHOW_HELP);
428             m_send_trans.put_data (help);
429         }
430     }
431     void show_factory_menu      (int icid, const std::vector <PanelFactoryInfo> &menu)
432     {
433         if (m_send_refcount > 0 && m_current_icid == icid) {
434             m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_SHOW_FACTORY_MENU);
435             for (size_t i = 0; i < menu.size (); ++ i) {
436                 m_send_trans.put_data (menu [i].uuid);
437                 m_send_trans.put_data (menu [i].name);
438                 m_send_trans.put_data (menu [i].lang);
439                 m_send_trans.put_data (menu [i].icon);
440             }
441         }
442     }
443     void focus_in               (int icid, const String &uuid)
444     {
445         if (m_send_refcount > 0 && m_current_icid == icid) {
446             m_send_trans.put_command (SCIM_TRANS_CMD_FOCUS_IN);
447             m_send_trans.put_data (uuid);
448         }
449     }
450     void focus_out              (int icid)
451     {
452         if (m_send_refcount > 0 && m_current_icid == icid)
453             m_send_trans.put_command (SCIM_TRANS_CMD_FOCUS_OUT);
454     }
455     void update_factory_info    (int icid, const PanelFactoryInfo &info)
456     {
457         if (m_send_refcount > 0 && m_current_icid == icid) {
458             m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_UPDATE_FACTORY_INFO);
459             m_send_trans.put_data (info.uuid);
460             m_send_trans.put_data (info.name);
461             m_send_trans.put_data (info.lang);
462             m_send_trans.put_data (info.icon);
463         }
464     }
465     void update_spot_location   (int icid, int x, int y, int top_y)
466     {
467         if (m_send_refcount > 0 && m_current_icid == icid) {
468             m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION);
469             m_send_trans.put_data ((uint32) x);
470             m_send_trans.put_data ((uint32) y);
471             m_send_trans.put_data ((uint32) top_y);
472         }
473     }
474     void update_cursor_position (int icid, int cursor_pos)
475     {
476         if (m_send_refcount > 0 && m_current_icid == icid) {
477             m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_CURSOR_POSITION);
478             m_send_trans.put_data ((uint32) cursor_pos);
479         }
480     }
481     void show_preedit_string    (int icid)
482     {
483         if (m_send_refcount > 0 && m_current_icid == icid)
484             m_send_trans.put_command (SCIM_TRANS_CMD_SHOW_PREEDIT_STRING);
485     }
486     void show_aux_string        (int icid)
487     {
488         if (m_send_refcount > 0 && m_current_icid == icid)
489             m_send_trans.put_command (SCIM_TRANS_CMD_SHOW_AUX_STRING);
490     }
491     void show_lookup_table      (int icid)
492     {
493         if (m_send_refcount > 0 && m_current_icid == icid)
494             m_send_trans.put_command (SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE);
495     }
496     void hide_preedit_string    (int icid)
497     {
498         if (m_send_refcount > 0 && m_current_icid == icid)
499             m_send_trans.put_command (SCIM_TRANS_CMD_HIDE_PREEDIT_STRING);
500     }
501     void hide_aux_string        (int icid)
502     {
503         if (m_send_refcount > 0 && m_current_icid == icid)
504             m_send_trans.put_command (SCIM_TRANS_CMD_HIDE_AUX_STRING);
505     }
506     void hide_lookup_table      (int icid)
507     {
508         if (m_send_refcount > 0 && m_current_icid == icid)
509             m_send_trans.put_command (SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE);
510     }
511     void update_preedit_string  (int icid, const WideString &str, const AttributeList &attrs)
512     {
513         if (m_send_refcount > 0 && m_current_icid == icid) {
514             m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING);
515             m_send_trans.put_data (utf8_wcstombs (str));
516             m_send_trans.put_data (attrs);
517         }
518     }
519     void update_preedit_caret   (int icid, int caret)
520     {
521         if (m_send_refcount > 0 && m_current_icid == icid) {
522             m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET);
523             m_send_trans.put_data ((uint32) caret);
524         }
525     }
526     void update_aux_string      (int icid, const WideString &str, const AttributeList &attrs)
527     {
528         if (m_send_refcount > 0 && m_current_icid == icid) {
529             m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_AUX_STRING);
530             m_send_trans.put_data (utf8_wcstombs (str));
531             m_send_trans.put_data (attrs);
532         }
533     }
534     void update_lookup_table    (int icid, const LookupTable &table)
535     {
536         if (m_send_refcount > 0 && m_current_icid == icid) {
537             m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE);
538             m_send_trans.put_data (table);
539         }
540     }
541     void register_properties    (int icid, const PropertyList &properties)
542     {
543         if (m_send_refcount > 0 && m_current_icid == icid) {
544             m_send_trans.put_command (SCIM_TRANS_CMD_REGISTER_PROPERTIES);
545             m_send_trans.put_data (properties);
546         }
547     }
548     void update_property        (int icid, const Property &property)
549     {
550         if (m_send_refcount > 0 && m_current_icid == icid) {
551             m_send_trans.put_command (SCIM_TRANS_CMD_UPDATE_PROPERTY);
552             m_send_trans.put_data (property);
553         }
554     }
555     void start_default_ise      (int icid)
556     {
557         if (m_send_refcount > 0 && m_current_icid == icid) {
558             m_send_trans.put_command (ISM_TRANS_CMD_PANEL_START_DEFAULT_ISE);
559         }
560     }
561     void start_helper           (int icid, const String &helper_uuid)
562     {
563         if (m_send_refcount > 0 && m_current_icid == icid) {
564             m_send_trans.put_command (SCIM_TRANS_CMD_START_HELPER);
565             m_send_trans.put_data (helper_uuid);
566         }
567     }
568
569     void stop_helper            (int icid, const String &helper_uuid)
570     {
571         if (m_send_refcount > 0 && m_current_icid == icid) {
572             m_send_trans.put_command (SCIM_TRANS_CMD_STOP_HELPER);
573             m_send_trans.put_data (helper_uuid);
574         }
575     }
576     void send_helper_event      (int icid, const String &helper_uuid, const Transaction &trans)
577     {
578         if (m_send_refcount > 0 && m_current_icid == icid) {
579             m_send_trans.put_command (SCIM_TRANS_CMD_SEND_HELPER_EVENT);
580             m_send_trans.put_data (helper_uuid);
581             m_send_trans.put_data (trans);
582         }
583     }
584     void register_input_context (int icid, const String &uuid)
585     {
586         if (m_send_refcount > 0 && m_current_icid == icid) {
587             m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_REGISTER_INPUT_CONTEXT);
588             m_send_trans.put_data (uuid);
589         }
590     }
591     void remove_input_context   (int icid)
592     {
593         if (m_send_refcount > 0 && m_current_icid == icid)
594             m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_REMOVE_INPUT_CONTEXT);
595     }
596     void reset_input_context    (int icid)
597     {
598         if (m_send_refcount > 0 && m_current_icid == icid)
599             m_send_trans.put_command (SCIM_TRANS_CMD_PANEL_RESET_INPUT_CONTEXT);
600     }
601     void turn_on_log            (int icid, uint32 isOn)
602     {
603         m_send_trans.put_command (ISM_TRANS_CMD_TURN_ON_LOG);
604         m_send_trans.put_data (isOn);
605     }
606
607 public:
608     void reset_signal_handler                               (void)
609     {
610         m_signal_reload_config.reset();
611         m_signal_exit.reset();
612         m_signal_update_lookup_table_page_size.reset();
613         m_signal_lookup_table_page_up.reset();
614         m_signal_lookup_table_page_down.reset();
615         m_signal_reset_option.reset();
616         m_signal_trigger_property.reset();
617         m_signal_process_helper_event.reset();
618         m_signal_move_preedit_caret.reset();
619         m_signal_select_aux.reset();
620         m_signal_select_candidate.reset();
621         m_signal_process_key_event.reset();
622         m_signal_commit_string.reset();
623         m_signal_forward_key_event.reset();
624         m_signal_request_help.reset();
625         m_signal_request_factory_menu.reset();
626         m_signal_change_factory.reset();
627         m_signal_reset_keyboard_ise.reset();
628         m_signal_update_keyboard_ise.reset();
629         m_signal_show_preedit_string.reset();
630         m_signal_hide_preedit_string.reset();
631         m_signal_update_preedit_string.reset();
632     }
633
634     Connection signal_connect_reload_config                 (PanelClientSlotVoid                    *slot)
635     {
636         return m_signal_reload_config.connect (slot);
637     }
638     Connection signal_connect_exit                          (PanelClientSlotVoid                    *slot)
639     {
640         return m_signal_exit.connect (slot);
641     }
642     Connection signal_connect_update_lookup_table_page_size (PanelClientSlotInt                     *slot)
643     {
644         return m_signal_update_lookup_table_page_size.connect (slot);
645     }
646     Connection signal_connect_lookup_table_page_up          (PanelClientSlotVoid                    *slot)
647     {
648         return m_signal_lookup_table_page_up.connect (slot);
649     }
650     Connection signal_connect_lookup_table_page_down        (PanelClientSlotVoid                    *slot)
651     {
652         return m_signal_lookup_table_page_down.connect (slot);
653     }
654     Connection signal_connect_reset_option                  (PanelClientSlotVoid                    *slot)
655     {
656         return m_signal_reset_option.connect (slot);
657     }
658     Connection signal_connect_trigger_property              (PanelClientSlotString                  *slot)
659     {
660         return m_signal_trigger_property.connect (slot);
661     }
662     Connection signal_connect_process_helper_event          (PanelClientSlotStringStringTransaction *slot)
663     {
664         return m_signal_process_helper_event.connect (slot);
665     }
666     Connection signal_connect_move_preedit_caret            (PanelClientSlotInt                     *slot)
667     {
668         return m_signal_move_preedit_caret.connect (slot);
669     }
670     Connection signal_connect_select_aux                    (PanelClientSlotInt                     *slot)
671     {
672         return m_signal_select_aux.connect (slot);
673     }
674     Connection signal_connect_select_candidate              (PanelClientSlotInt                     *slot)
675     {
676         return m_signal_select_candidate.connect (slot);
677     }
678     Connection signal_connect_process_key_event             (PanelClientSlotKeyEvent                *slot)
679     {
680         return m_signal_process_key_event.connect (slot);
681     }
682     Connection signal_connect_commit_string                 (PanelClientSlotWideString              *slot)
683     {
684         return m_signal_commit_string.connect (slot);
685     }
686     Connection signal_connect_forward_key_event             (PanelClientSlotKeyEvent                *slot)
687     {
688         return m_signal_forward_key_event.connect (slot);
689     }
690     Connection signal_connect_request_help                  (PanelClientSlotVoid                    *slot)
691     {
692         return m_signal_request_help.connect (slot);
693     }
694     Connection signal_connect_request_factory_menu          (PanelClientSlotVoid                    *slot)
695     {
696         return m_signal_request_factory_menu.connect (slot);
697     }
698     Connection signal_connect_change_factory                (PanelClientSlotString                  *slot)
699     {
700         return m_signal_change_factory.connect (slot);
701     }
702
703     Connection signal_connect_reset_keyboard_ise            (PanelClientSlotVoid                    *slot)
704     {
705         return m_signal_reset_keyboard_ise.connect (slot);
706     }
707
708     Connection signal_connect_update_keyboard_ise           (PanelClientSlotVoid                    *slot)
709     {
710         return m_signal_update_keyboard_ise.connect (slot);
711     }
712
713     Connection signal_connect_show_preedit_string           (PanelClientSlotVoid                    *slot)
714     {
715         return m_signal_show_preedit_string.connect (slot);
716     }
717
718     Connection signal_connect_hide_preedit_string           (PanelClientSlotVoid                    *slot)
719     {
720         return m_signal_hide_preedit_string.connect (slot);
721     }
722
723     Connection signal_connect_update_preedit_string         (PanelClientSlotStringAttrs             *slot)
724     {
725         return m_signal_update_preedit_string.connect (slot);
726     }
727 private:
728     void launch_panel (const String &config, const String &display) const
729     {
730         scim_launch_panel (true, config, display, NULL);
731     }
732 };
733
734 PanelClient::PanelClient ()
735     : m_impl (new PanelClientImpl ())
736 {
737 }
738
739 PanelClient::~PanelClient ()
740 {
741     delete m_impl;
742 }
743
744 int
745 PanelClient::open_connection (const String &config, const String &display)
746 {
747     return m_impl->open_connection (config, display);
748 }
749
750 void
751 PanelClient::close_connection ()
752 {
753     m_impl->close_connection ();
754 }
755
756 int
757 PanelClient::get_connection_number () const
758 {
759     return m_impl->get_connection_number ();
760 }
761
762 bool
763 PanelClient::is_connected () const
764 {
765     return m_impl->is_connected ();
766 }
767
768 bool
769 PanelClient::has_pending_event () const
770 {
771     return m_impl->has_pending_event ();
772 }
773
774 bool
775 PanelClient::filter_event ()
776 {
777     return m_impl->filter_event ();
778 }
779
780 bool
781 PanelClient::prepare (int icid)
782 {
783     return m_impl->prepare (icid);
784 }
785
786 bool
787 PanelClient::send ()
788 {
789     return m_impl->send ();
790 }
791
792 void
793 PanelClient::turn_on                (int icid)
794 {
795     m_impl->turn_on (icid);
796 }
797 void
798 PanelClient::turn_off               (int icid)
799 {
800     m_impl->turn_off (icid);
801 }
802 void
803 PanelClient::update_screen          (int icid, int screen)
804 {
805     m_impl->update_screen (icid, screen);
806 }
807 void
808 PanelClient::show_help              (int icid, const String &help)
809 {
810     m_impl->show_help (icid, help);
811 }
812 void
813 PanelClient::show_factory_menu      (int icid, const std::vector <PanelFactoryInfo> &menu)
814 {
815     m_impl->show_factory_menu (icid, menu);
816 }
817 void
818 PanelClient::focus_in               (int icid, const String &uuid)
819 {
820     m_impl->focus_in (icid, uuid);
821 }
822 void
823 PanelClient::focus_out              (int icid)
824 {
825     m_impl->focus_out (icid);
826 }
827 void
828 PanelClient::update_factory_info    (int icid, const PanelFactoryInfo &info)
829 {
830     m_impl->update_factory_info (icid, info);
831 }
832 void
833 PanelClient::update_spot_location   (int icid, int x, int y, int top_y)
834 {
835     m_impl->update_spot_location (icid, x, y, top_y);
836 }
837 void
838 PanelClient::update_cursor_position (int icid, int cursor_pos)
839 {
840     m_impl->update_cursor_position (icid, cursor_pos);
841 }
842 void
843 PanelClient::show_preedit_string    (int icid)
844 {
845     m_impl->show_preedit_string (icid);
846 }
847 void
848 PanelClient::show_aux_string        (int icid)
849 {
850     m_impl->show_aux_string (icid);
851 }
852 void
853 PanelClient::show_lookup_table      (int icid)
854 {
855     m_impl->show_lookup_table (icid);
856 }
857 void
858 PanelClient::hide_preedit_string    (int icid)
859 {
860     m_impl->hide_preedit_string (icid);
861 }
862 void
863 PanelClient::hide_aux_string        (int icid)
864 {
865     m_impl->hide_aux_string (icid);
866 }
867 void
868 PanelClient::hide_lookup_table      (int icid)
869 {
870     m_impl->hide_lookup_table (icid);
871 }
872 void
873 PanelClient::update_preedit_string  (int icid, const WideString &str, const AttributeList &attrs)
874 {
875     m_impl->update_preedit_string (icid, str, attrs);
876 }
877 void
878 PanelClient::update_preedit_caret   (int icid, int caret)
879 {
880     m_impl->update_preedit_caret (icid, caret);
881 }
882 void
883 PanelClient::update_aux_string      (int icid, const WideString &str, const AttributeList &attrs)
884 {
885     m_impl->update_aux_string (icid, str, attrs);
886 }
887 void
888 PanelClient::update_lookup_table    (int icid, const LookupTable &table)
889 {
890     m_impl->update_lookup_table (icid, table);
891 }
892 void
893 PanelClient::register_properties    (int icid, const PropertyList &properties)
894 {
895     m_impl->register_properties (icid, properties);
896 }
897 void
898 PanelClient::update_property        (int icid, const Property &property)
899 {
900     m_impl->update_property (icid, property);
901 }
902 void
903 PanelClient::start_default_ise      (int icid)
904 {
905     m_impl->start_default_ise (icid);
906 }
907 void
908 PanelClient::start_helper           (int icid, const String &helper_uuid)
909 {
910     m_impl->start_helper (icid, helper_uuid);
911 }
912
913 void
914 PanelClient::stop_helper            (int icid, const String &helper_uuid)
915 {
916     m_impl->stop_helper (icid, helper_uuid);
917 }
918 void
919 PanelClient::send_helper_event      (int icid, const String &helper_uuid, const Transaction &trans)
920 {
921     m_impl->send_helper_event (icid, helper_uuid, trans);
922 }
923 void
924 PanelClient::register_input_context (int icid, const String &uuid)
925 {
926     m_impl->register_input_context (icid, uuid);
927 }
928 void
929 PanelClient::remove_input_context   (int icid)
930 {
931     m_impl->remove_input_context (icid);
932 }
933 void
934 PanelClient::reset_input_context    (int icid)
935 {
936     m_impl->reset_input_context (icid);
937 }
938
939 void
940 PanelClient::turn_on_log            (int icid, uint32 isOn)
941 {
942     m_impl->turn_on_log (icid, isOn);
943 }
944
945 void
946 PanelClient::reset_signal_handler                         (void)
947 {
948     m_impl->reset_signal_handler ();
949 }
950
951 Connection
952 PanelClient::signal_connect_reload_config                 (PanelClientSlotVoid                    *slot)
953 {
954     return m_impl->signal_connect_reload_config (slot);
955 }
956 Connection
957 PanelClient::signal_connect_exit                          (PanelClientSlotVoid                    *slot)
958 {
959     return m_impl->signal_connect_exit (slot);
960 }
961 Connection
962 PanelClient::signal_connect_update_lookup_table_page_size (PanelClientSlotInt                     *slot)
963 {
964     return m_impl->signal_connect_update_lookup_table_page_size (slot);
965 }
966 Connection
967 PanelClient::signal_connect_lookup_table_page_up          (PanelClientSlotVoid                    *slot)
968 {
969     return m_impl->signal_connect_lookup_table_page_up (slot);
970 }
971 Connection
972 PanelClient::signal_connect_lookup_table_page_down        (PanelClientSlotVoid                    *slot)
973 {
974     return m_impl->signal_connect_lookup_table_page_down (slot);
975 }
976 Connection
977 PanelClient::signal_connect_reset_option                  (PanelClientSlotVoid                    *slot)
978 {
979     return m_impl->signal_connect_reset_option (slot);
980 }
981 Connection
982 PanelClient::signal_connect_trigger_property              (PanelClientSlotString                  *slot)
983 {
984     return m_impl->signal_connect_trigger_property (slot);
985 }
986 Connection
987 PanelClient::signal_connect_process_helper_event          (PanelClientSlotStringStringTransaction *slot)
988 {
989     return m_impl->signal_connect_process_helper_event (slot);
990 }
991 Connection
992 PanelClient::signal_connect_move_preedit_caret            (PanelClientSlotInt                     *slot)
993 {
994     return m_impl->signal_connect_move_preedit_caret (slot);
995 }
996 Connection
997 PanelClient::signal_connect_select_aux                    (PanelClientSlotInt                     *slot)
998 {
999     return m_impl->signal_connect_select_aux (slot);
1000 }
1001 Connection
1002 PanelClient::signal_connect_select_candidate              (PanelClientSlotInt                     *slot)
1003 {
1004     return m_impl->signal_connect_select_candidate (slot);
1005 }
1006 Connection
1007 PanelClient::signal_connect_process_key_event             (PanelClientSlotKeyEvent                *slot)
1008 {
1009     return m_impl->signal_connect_process_key_event (slot);
1010 }
1011 Connection
1012 PanelClient::signal_connect_commit_string                 (PanelClientSlotWideString              *slot)
1013 {
1014     return m_impl->signal_connect_commit_string (slot);
1015 }
1016 Connection
1017 PanelClient::signal_connect_forward_key_event             (PanelClientSlotKeyEvent                *slot)
1018 {
1019     return m_impl->signal_connect_forward_key_event (slot);
1020 }
1021 Connection
1022 PanelClient::signal_connect_request_help                  (PanelClientSlotVoid                    *slot)
1023 {
1024     return m_impl->signal_connect_request_help (slot);
1025 }
1026 Connection
1027 PanelClient::signal_connect_request_factory_menu          (PanelClientSlotVoid                    *slot)
1028 {
1029     return m_impl->signal_connect_request_factory_menu (slot);
1030 }
1031 Connection
1032 PanelClient::signal_connect_change_factory                (PanelClientSlotString                  *slot)
1033 {
1034     return m_impl->signal_connect_change_factory (slot);
1035 }
1036
1037 Connection
1038 PanelClient::signal_connect_reset_keyboard_ise            (PanelClientSlotVoid                    *slot)
1039 {
1040     return m_impl->signal_connect_reset_keyboard_ise (slot);
1041 }
1042
1043 Connection
1044 PanelClient::signal_connect_update_keyboard_ise           (PanelClientSlotVoid                    *slot)
1045 {
1046     return m_impl->signal_connect_update_keyboard_ise (slot);
1047 }
1048
1049 Connection
1050 PanelClient::signal_connect_show_preedit_string           (PanelClientSlotVoid                    *slot)
1051 {
1052     return m_impl->signal_connect_show_preedit_string (slot);
1053 }
1054
1055 Connection
1056 PanelClient::signal_connect_hide_preedit_string           (PanelClientSlotVoid                    *slot)
1057 {
1058     return m_impl->signal_connect_hide_preedit_string (slot);
1059 }
1060
1061 Connection
1062 PanelClient::signal_connect_update_preedit_string         (PanelClientSlotStringAttrs             *slot)
1063 {
1064     return m_impl->signal_connect_update_preedit_string (slot);
1065 }
1066
1067
1068 } /* namespace scim */
1069
1070 /*
1071 vi:ts=4:nowrap:ai:expandtab
1072 */
1073