2 * @file scim_panel_agent_base.h
3 * @brief Defines scim::PanelAgentBase and their related types.
5 * scim::PanelAgentBase is a class used to write Panel daemons.
8 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
11 * Smart Common Input Method
13 * Copyright (c) 2004-2005 James Su <suzhe@tsinghua.org.cn>
14 * Copyright (c) 2012-2016 Samsung Electronics Co., Ltd.
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2 of the License, or (at your option) any later version.
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Lesser General Public License for more details.
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this program; if not, write to the
29 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
30 * Boston, MA 02111-1307 USA
34 #ifndef __ISF_PANEL_AGENT_BASE_H
35 #define __ISF_PANEL_AGENT_BASE_H
37 #include <scim_panel_common.h>
48 * @ingroup InputServiceFramework
49 * The accessory classes to help develop Panel daemons and FrontEnds
50 * which need to communicate with Panel daemons.
54 typedef struct _ISE_INFO {
63 typedef struct _HELPER_ISE_INFO {
64 std::vector<String> appid;
65 std::vector<String> label;
66 std::vector<uint32> is_enabled;
67 std::vector<uint32> is_preinstalled;
68 std::vector<uint32> has_option;
72 typedef struct DefaultIse {
76 DefaultIse () : type (TOOLBAR_KEYBOARD_MODE), uuid (""), name ("") { }
83 * @typedef typedef Pointer <PanelAgentBase> PanelAgentPointer;
85 * A smart pointer for scim::PanelAgentBase and its derived classes.
87 typedef Pointer <PanelAgentBase> PanelAgentPointer;
90 * @brief The class to implement all socket protocol in Panel.
92 * This class acts like a stand alone SocketServer.
93 * It has its own dedicated main loop, and will be blocked when run () is called.
94 * So run () must be called within a separated thread, in order to not block
95 * the main loop of the Panel program itself.
97 * Before calling run (), the panel must hook the callback functions to the
98 * corresponding signals.
100 * Note that, there are two special signals: lock(void) and unlock(void). These
101 * two signals are used to provide a thread lock to PanelAgent, so that PanelAgent
102 * can run correctly within a multi-threading Panel program.
104 class EXAPI PanelAgentBase : public ReferencedObject
106 class PanelAgentBaseImpl;
107 PanelAgentBaseImpl* m_impl;
109 PanelAgentBase (const PanelAgentBase&);
110 const PanelAgentBase& operator = (const PanelAgentBase&);
113 PanelAgentBase (const String& name);
114 virtual ~PanelAgentBase ();
117 * @brief Initialize this PanelAgent.
119 * @param config The name of the config module to be used by Helpers.
120 * @param display The name of display, on which the Panel should run.
121 * @param resident If this is true then this PanelAgent will keep running
122 * even if there is no more client connected.
124 * @return true if the PanelAgent is initialized correctly and ready to run.
126 virtual bool initialize (InfoManager* info_manager, const String& display, bool resident = false);
129 * @brief Check if this PanelAgent is initialized correctly and ready to run.
131 * @return true if this PanelAgent is ready to run.
133 virtual bool valid (void) const;
136 * @brief Stop this PanelAgent.
138 virtual void stop (void);
143 * @brief Notice helper ISE to focus out.
145 * @param uuid The helper ISE uuid.
147 virtual void focus_out_helper (int client, uint32 context, const String& uuid);
150 * @brief Notice helper ISE to focus in.
152 * @param uuid The helper ISE uuid.
154 virtual void focus_in_helper (int client, uint32 context, const String& uuid);
157 * @brief Notice helper ISE to show window.
159 * @param uuid The helper ISE uuid.
161 virtual void show_helper (int client, uint32 context, const String& uuid, char* data, size_t& len);
164 * @brief Notice helper ISE to hide window.
166 * @param uuid The helper ISE uuid.
168 virtual void hide_helper (int client, uint32 context, const String& uuid);
171 * @brief Reset keyboard ISE.
173 * @return true if this operation is successful, otherwise return false.
175 virtual void reset_keyboard_ise (int client, uint32 context);
178 * @brief Change the factory used by the focused IMEngineInstance object.
180 * @param uuid The uuid of the new factory.
181 * @return true if the command was sent correctly.
183 virtual void change_factory (int client, uint32 context, const String& uuid);
186 * @brief Notice Helper ISE that candidate more window is showed.
187 * @return true if the command was sent correctly.
189 virtual void candidate_more_window_show (int client, uint32 context);
192 * @brief Notice Helper ISE that candidate more window is hidden.
193 * @return true if the command was sent correctly.
195 virtual void candidate_more_window_hide (int client, uint32 context);
198 * @brief Notice Helper ISE that show candidate.
199 * @return true if the command was sent correctly.
201 virtual void helper_candidate_show (int client, uint32 context, const String& uuid);
204 * @brief Notice Helper ISE that hide candidate.
205 * @return true if the command was sent correctly.
207 virtual void helper_candidate_hide (int client, uint32 context, const String& uuid);
210 * @brief Update helper lookup table.
211 * @return true if the command was sent correctly.
213 virtual void update_helper_lookup_table (int client, uint32 context, const String& uuid, const LookupTable& table);
216 * @brief Let the focused IMEngineInstance object
217 * select a aux in current aux string.
219 * @param item The index of the selected aux.
220 * @return true if the command was sent correctly.
222 virtual void select_aux (int client, uint32 context, uint32 item);
225 * @brief Let the focused IMEngineInstance object
226 * select a candidate in current lookup table.
228 * @param item The index of the selected candidate.
229 * @return true if the command was sent correctly.
231 virtual void select_candidate (int client, uint32 context, uint32 item);
234 * @brief Let the focused IMEngineInstance object
235 * flip the LookupTable to previous page.
236 * @return true if the command was sent correctly.
238 virtual void lookup_table_page_up (int client, uint32 context);
241 * @brief Let the focused IMEngineInstance object
242 * flip the LookupTable to next page.
243 * @return true if the command was sent correctly.
245 virtual void lookup_table_page_down (int client, uint32 context);
248 * @brief Let the focused IMEngineInstance object
249 * update the page size of the LookupTable.
251 * @param size The new page size.
252 * @return true if the command was sent correctly.
254 virtual void update_lookup_table_page_size (int client, uint32 context, uint32 size);
257 * @brief Let the focused IMEngineInstance object
258 * update candidate items layout.
260 * @param row_items The items of each row.
261 * @return true if the command was sent correctly.
263 virtual void update_candidate_item_layout (int client, uint32 context, const std::vector<uint32>& row_items);
266 * @brief Let the focused IMEngineInstance object
267 * select a associate in current associate table.
269 * @param item The index of the selected associate.
270 * @return true if the command was sent correctly.
272 virtual void select_associate (int client, uint32 context, uint32 item);
275 * @brief Let the focused IMEngineInstance object
276 * flip the AssociateTable to previous page.
277 * @return true if the command was sent correctly.
279 virtual void associate_table_page_up (int client, uint32 context);
282 * @brief Let the focused IMEngineInstance object
283 * flip the AssociateTable to next page.
284 * @return true if the command was sent correctly.
286 virtual void associate_table_page_down (int client, uint32 context);
289 * @brief Let the focused IMEngineInstance object
290 * update the page size of the AssociateTable.
292 * @param size The new page size.
293 * @return true if the command was sent correctly.
295 virtual void update_associate_table_page_size (int client, uint32 context, uint32 size);
298 * @brief Inform helper ISE to update displayed candidate number.
300 * @param size The displayed candidate number.
301 * @return true if the command was sent correctly.
303 virtual void update_displayed_candidate_number (int client, uint32 context, uint32 size);
306 * @brief Trigger a property of the focused IMEngineInstance object.
308 * @param property The property key to be triggered.
309 * @return true if the command was sent correctly.
311 virtual void trigger_property (int client, uint32 context, const String& property);
314 * @brief Let all FrontEnds and Helpers reload configuration.
315 * @return true if the command was sent correctly.
317 virtual void reload_config (int client);
320 * @brief Let all FrontEnds, Helpers and this Panel exit.
321 * @return true if the command was sent correctly.
323 virtual void exit (int client, uint32 context);
326 * @brief Send candidate longpress event to ISE.
328 * @param index The candidate object index.
332 virtual void send_longpress_event (int client, uint32 context, uint32 index);
335 * @brief update_panel_event.
341 virtual void update_panel_event (int client, uint32 context, int cmd, uint32 nType, uint32 nValue);
344 * @brief update_keyboard_ise_list.
350 virtual void update_keyboard_ise_list (int client, uint32 context);
353 * @brief set_helper_mode.
359 virtual void set_helper_mode (int client, uint32 context, const String& uuid, uint32& mode);
362 * @brief set_helper_language.
368 virtual void set_helper_language (int client, uint32 context, const String& uuid, uint32& language);
371 * @brief set_helper_imdata.
377 virtual void set_helper_imdata (int client, uint32 context, const String& uuid, const char* imdata, size_t& len);
380 * @brief set_helper_return_key_type.
386 virtual void set_helper_return_key_type (int client, uint32 context, const String& uuid, uint32 type);
389 * @brief get_helper_return_key_type.
395 virtual void get_helper_return_key_type (int client, uint32 context, const String& uuid, _OUT_ uint32& type);
398 * @brief set_helper_return_key_disable.
404 virtual void set_helper_return_key_disable (int client, uint32 context, const String& uuid, uint32 disabled);
407 * @brief get_helper_return_key_disable.
413 virtual void get_helper_return_key_disable (int client, uint32 context, const String& uuid, _OUT_ uint32& disabled);
416 * @brief set_helper_layout.
422 virtual void set_helper_layout (int client, uint32 context, const String& uuid, uint32& layout);
425 * @brief set_helper_input_mode.
431 virtual void set_helper_input_mode (int client, uint32 context, const String& uuid, uint32& mode);
434 * @brief set_helper_input_hint.
440 virtual void set_helper_input_hint (int client, uint32 context, const String& uuid, uint32& hint);
443 * @brief set_helper_bidi_direction.
449 virtual void set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction);
452 * @brief set_helper_caps_mode.
458 virtual void set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode);
461 * @brief show_helper_option_window.
467 virtual void show_helper_option_window (int client, uint32 context, const String& uuid);
470 * @brief process_key_event.
476 virtual bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result);
479 * @brief get_helper_geometry.
485 virtual bool get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info);
488 * @brief get_helper_imdata.
494 virtual void get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len);
497 * @brief get_helper_layout.
503 virtual void get_helper_layout (int client, uint32 context, String& uuid, uint32& layout);
506 * @brief get_ise_language_locale.
512 virtual void get_ise_language_locale (int client, uint32 context, String& uuid, _OUT_ char* data, _OUT_ size_t& len);
515 * @brief check_option_window.
521 virtual void check_option_window (int client, uint32 context, String& uuid, _OUT_ uint32& avail);
524 * @brief reset_ise_option.
530 virtual void reset_ise_option (int client, uint32 context);
533 * @brief reset_helper_context.
539 virtual void reset_helper_context (int client, uint32 context, const String& uuid);
542 * @brief socket_update_surrounding_text.
548 virtual void socket_update_surrounding_text (int client, uint32 context,const String& uuid, String& text, uint32 cursor);
551 * @brief socket_update_selection.
557 virtual void socket_update_selection (int client, uint32 context, String& uuid, String text);
560 * @brief socket_get_keyboard_ise_list.
566 virtual void socket_get_keyboard_ise_list (int client, uint32 context, const String& uuid, std::vector<String>& list);
569 * @brief socket_get_candidate_ui.
575 virtual void socket_get_candidate_ui (int client, uint32 context, const String& uuid, int style, int mode);
578 * @brief socket_get_candidate_geometry.
584 virtual void socket_get_candidate_geometry (int client, uint32 context, const String& uuid, struct rectinfo& info);
587 * @brief socket_get_keyboard_ise.
593 virtual void socket_get_keyboard_ise (int client, uint32 context, const String& uuid, String& ise_name, String& ise_uuid);
596 * @brief socket_start_helper.
602 virtual void socket_start_helper (int client, uint32 context, const String& ic_uuid);
605 * @brief helper_detach_input_context.
611 virtual void helper_detach_input_context (int client, uint32 context, const String& ic_uuid);
614 * @brief helper_process_imengine_event.
620 virtual void helper_process_imengine_event (int client, uint32 context, const String& ic_uuid, const Transaction& nest_transaction);
623 * @brief process_helper_event.
629 virtual void process_helper_event (int client, uint32 context, String target_uuid, String active_uuid, Transaction& nest_trans);
632 * @brief socket_helper_key_event.
638 virtual void socket_helper_key_event (int client, uint32 context, int cmd , KeyEvent& key);
641 * @brief socket_helper_get_surrounding_text.
647 virtual void socket_helper_get_surrounding_text (int client, uint32 context, uint32 maxlen_before, uint32 maxlen_after);
650 * @brief socket_helper_delete_surrounding_text.
656 virtual void socket_helper_delete_surrounding_text (int client, uint32 context, uint32 offset, uint32 len);
659 * @brief socket_helper_get_selection.
665 virtual void socket_helper_get_selection (int client, uint32 context);
668 * @brief socket_helper_set_selection.
674 virtual void socket_helper_set_selection (int client, uint32 context, uint32 start, uint32 end);
677 * @brief update_ise_input_context.
683 virtual void update_ise_input_context (int client, uint32 context, uint32 type, uint32 value);
686 * @brief send_private_command.
692 virtual void send_private_command (int client, uint32 context, String command);
695 * @brief helper_all_update_spot_location.
701 virtual void helper_all_update_spot_location (int client, uint32 context, String uuid, int x, int y);
704 * @brief helper_all_update_cursor_position.
710 virtual void helper_all_update_cursor_position (int client, uint32 context, String uuid, int cursor_pos);
713 * @brief helper_all_update_screen.
719 virtual void helper_all_update_screen (int client, uint32 context, String uuid, int screen);
722 * @brief commit_string.
728 virtual void commit_string (int client, uint32 context,const WideString& wstr);
731 * @brief show_preedit_string.
737 virtual void show_preedit_string (int client, uint32 context);
740 * @brief hide_preedit_string.
746 virtual void hide_preedit_string (int client, uint32 context);
749 * @brief update_preedit_string.
755 virtual void update_preedit_string (int client, uint32 context, WideString wstr, AttributeList& attrs, uint32 caret);
758 * @brief update_preedit_caret.
764 virtual void update_preedit_caret (int client, uint32 context, uint32 caret);
767 * @brief attach_input_context and update_screen.
773 virtual void helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index, uint32 current_screen);
776 * @brief hide_helper_ise.
782 virtual void hide_helper_ise (int client, uint32 context);
787 } /* namespace scim */
789 #endif /* __ISF_PANEL_AGENT_BASE_H */
792 vi:ts=4:nowrap:ai:expandtab