4
* Copyright (c) 2006 Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation and
10
* appearing in the file LICENSE.LGPL included in the package of this file.
11
* You can also redistribute it and/or modify it under the terms of
12
* the GNU General Public License as published by the Free Software Foundation and
13
* appearing in the file LICENSE.GPL included in the package of this file.
15
* This library is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23
* @author Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
24
* @brief This is the header of the panel clients for SCIMBridge.
27
#ifndef SCIMBRIDGEAGENTPANELCLIENT_H
28
#define SCIMBRIDGEAGENTPANELCLIENT_H
30
#define Uses_SCIM_EVENT
31
#define Uses_SCIM_PANEL_CLIENT
32
#define Uses_SCIM_SIGNAL
33
#define Uses_SCIM_SOCKET
34
#define Uses_SCIM_TRANSACTION
35
#define Uses_SCIM_TRANS_COMMANDS
39
#include "scim-bridge.h"
40
#include "scim-bridge-display.h"
41
#include "scim-bridge-imcontext.h"
43
typedef scim::Slot1<void, int> ScimBridgeAgentPanelClientSlotVoid;
44
typedef scim::Slot2<void, int, int> ScimBridgeAgentPanelClientSlotInt;
45
typedef scim::Slot2<void, int, const scim::String&> ScimBridgeAgentPanelClientSlotString;
46
typedef scim::Slot2<void, int, const scim::WideString&> ScimBridgeAgentPanelClientSlotWideString;
47
typedef scim::Slot4<void, int, const scim::String&, const scim::String&, const scim::Transaction&> ScimBridgeAgentPanelClientSlotStringStringTransaction;
48
typedef scim::Slot2<void, int, const scim::KeyEvent&> ScimBridgeAgentPanelClientSlotKeyEvent;
52
* The class of panel clients.
54
class ScimBridgeAgentPanelClient
60
* Alloc an panel client.
62
* @param config_name The name of the configuration.
63
* @param display The display.
64
* @return The new panel client.
66
static ScimBridgeAgentPanelClient *alloc (const scim::String &config_name, const ScimBridgeDisplay *display);
72
virtual ~ScimBridgeAgentPanelClient ();
76
* Open a connection with the panel.
78
virtual int open_connection () = 0;
82
* Close a connection with the panel.
84
virtual void close_connection () = 0;
88
* Get the connection number with the panel.
90
* @return The connection number with the panel.
92
virtual int get_connection_number () const = 0;
96
* See if the connection with the panel is active.
98
* @return true if the connection is active.
100
virtual bool is_connected () const = 0;
104
* See if there is pending events.
106
* @return true if there is pending events.
108
virtual bool has_pending_event () const = 0;
112
* Filter events from the panel.
114
* @return RETVAL_FAILED if errors have occurred.
116
virtual retval_t filter_event () = 0;
120
* Prepare the panel to do some actions.
122
* @param imcontext_id.
123
* @return RETVAL_FAILED if errors have occurred.
125
virtual retval_t prepare (scim_bridge_imcontext_id_t imcontext_id) = 0;
129
* Send stored commands to the panel.
131
* @return RETVAL_FAILED if errors have occurred.
133
virtual retval_t send () = 0;
137
* Turn on the IME on the panel.
139
virtual void turn_on () = 0;
142
* Turn off the IME on the panel.
144
virtual void turn_off () = 0;
148
* Update specific screen of the panel.
150
virtual void update_screen () = 0;
154
* Show the help text.
156
* @param help_text The text to show.
158
virtual void show_help (const scim::String &help_text) = 0;
162
* Show the factory menu.
164
* @param menu The menu items.
166
virtual void show_factory_menu (const std::vector<scim::PanelFactoryInfo> &menu) = 0;
170
* Focus in the specific IME.
172
* @param uuid The uuid of the IME.
174
virtual void focus_in (const scim::String &uuid) = 0;
178
* Focus out the current IME.
180
virtual void focus_out () = 0;
184
* Update the status information of the IME on the panel.
186
* @param info The infomation of the IME.
188
virtual void update_factory_info (const scim::PanelFactoryInfo &info) = 0;
192
* Update the cursor location.
194
* @param x The X location of the cursor.
195
* @param y The Y location of the cursor.
197
virtual void update_spot_location (int x, int y) = 0;
201
* Show the floating preedit string.
203
virtual void show_preedit_string () = 0;
207
* Show the aux string.
209
virtual void show_aux_string () = 0;
212
* Show the lookup table.
214
virtual void show_lookup_table () = 0;
218
* Hide the floating preedit string.
220
virtual void hide_preedit_string () = 0;
224
* Hide the aux string.
226
virtual void hide_aux_string () = 0;
230
* Hide the lookup table.
232
virtual void hide_lookup_table () = 0;
236
* Update the string in the flaoting preedit.
238
* @param str The string to show.
239
* @param attrs The attributes of the string.
241
virtual void update_preedit_string (const scim::WideString &str, const scim::AttributeList &attrs) = 0;
244
* Update the cursor position in the flaoting preedit.
246
* @param cursor_position The cursor position.
248
virtual void update_preedit_caret (int cursor_position) = 0;
251
* Update the aux string.
253
* @param str The string to show.
254
* @param attrs The attributes of the string.
256
virtual void update_aux_string (const scim::WideString &str, const scim::AttributeList &attrs) = 0;
260
* Update the lookup table.
262
* @param table The lookup table.
264
virtual void update_lookup_table (const scim::LookupTable &table) = 0;
267
* Register properties into the panel.
269
* @param properties The properties.
271
virtual void register_properties (const scim::PropertyList &properties) = 0;
276
* @param property The property.
278
virtual void update_property (const scim::Property &property) = 0;
282
* Launch a helper process.
284
* @param helper_uuid The uuid of the helper.
286
virtual void start_helper (const scim::String &helper_uuid) = 0;
290
* Shutdown a helper process.
292
* @param helper_uuid The uuid of the helper.
294
virtual void stop_helper (const scim::String &helper_uuid) = 0;
298
* Send a message to a helper.
300
* @param helper_uuid The uuid of the helper.
301
* @param trans The transaction with the helper process.
303
virtual void send_helper_event (const scim::String &helper_uuid, const scim::Transaction &trans) = 0;
307
* Register a input context (IMContext).
309
* @param uuid The uuid of the IME.
311
virtual void register_input_context (const scim::String &uuid) = 0;
315
* Deregister the current input context (IMContext).
317
virtual void remove_input_context () = 0;
321
* Connect the signal of reload_config.
323
* @param slot The slot to connect the signal.
324
* @return The new connection.
326
virtual scim::Connection signal_connect_reload_config (ScimBridgeAgentPanelClientSlotVoid *slot) = 0;
330
* Connect the signal of exit.
332
* @param slot The slot to connect the signal.
333
* @return The new connection.
335
virtual scim::Connection signal_connect_exit (ScimBridgeAgentPanelClientSlotVoid *slot) = 0;
339
* Connect the signal of update_lookup_table_page_size.
341
* @param slot The slot to connect the signal.
342
* @return The new connection.
344
virtual scim::Connection signal_connect_update_lookup_table_page_size (ScimBridgeAgentPanelClientSlotInt *slot) = 0;
348
* Connect the signal of lookup_table_page_up.
350
* @param slot The slot to connect the signal.
351
* @return The new connection.
353
virtual scim::Connection signal_connect_lookup_table_page_up (ScimBridgeAgentPanelClientSlotVoid *slot) = 0;
357
* Connect the signal of lookup_table_page_down.
359
* @param slot The slot to connect the signal.
360
* @return The new connection.
362
virtual scim::Connection signal_connect_lookup_table_page_down (ScimBridgeAgentPanelClientSlotVoid *slot) = 0;
366
* Connect the signal of trigger_property.
368
* @param slot The slot to connect the signal.
369
* @return The new connection.
371
virtual scim::Connection signal_connect_trigger_property (ScimBridgeAgentPanelClientSlotString *slot) = 0;
375
* Connect the signal of process_helper_event.
377
* @param slot The slot to connect the signal.
378
* @return The new connection.
380
virtual scim::Connection signal_connect_process_helper_event (ScimBridgeAgentPanelClientSlotStringStringTransaction *slot) = 0;
384
* Connect the signal of move_preedit_caret.
386
* @param slot The slot to connect the signal.
387
* @return The new connection.
389
virtual scim::Connection signal_connect_move_preedit_caret (ScimBridgeAgentPanelClientSlotInt *slot) = 0;
393
* Connect the signal of select_candidate.
395
* @param slot The slot to connect the signal.
396
* @return The new connection.
398
virtual scim::Connection signal_connect_select_candidate (ScimBridgeAgentPanelClientSlotInt *slot) = 0;
402
* Connect the signal of process_key_event.
404
* @param slot The slot to connect the signal.
405
* @return The new connection.
407
virtual scim::Connection signal_connect_process_key_event (ScimBridgeAgentPanelClientSlotKeyEvent *slot) = 0;
411
* Connect the signal of commit_string.
413
* @param slot The slot to connect the signal.
414
* @return The new connection.
416
virtual scim::Connection signal_connect_commit_string (ScimBridgeAgentPanelClientSlotWideString *slot) = 0;
420
* Connect the signal of forward_key_event.
422
* @param slot The slot to connect the signal.
423
* @return The new connection.
425
virtual scim::Connection signal_connect_forward_key_event (ScimBridgeAgentPanelClientSlotKeyEvent *slot) = 0;
429
* Connect the signal of request_help.
431
* @param slot The slot to connect the signal.
432
* @return The new connection.
434
virtual scim::Connection signal_connect_request_help (ScimBridgeAgentPanelClientSlotVoid *slot) = 0;
438
* Connect the signal of request_factory_menu.
440
* @param slot The slot to connect the signal.
441
* @return The new connection.
443
virtual scim::Connection signal_connect_request_factory_menu (ScimBridgeAgentPanelClientSlotVoid *slot) = 0;
447
* Connect the signal of change_factory.
449
* @param slot The slot to connect the signal.
450
* @return The new connection.
452
virtual scim::Connection signal_connect_change_factory (ScimBridgeAgentPanelClientSlotString *slot) = 0;
456
ScimBridgeAgentPanelClient ();
458
#endif /*SCIMBRIDGEAGENTPANELCLIENT_H*/