2 * @file isf_panel_agent_manager.h
3 * @brief Defines scim::PanelAgentManager and their related types.
5 * scim::PanelAgentManager is a class used to manage PanelAgent object.
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_MANAGER_H
35 #define __ISF_PANEL_AGENT_MANAGER_H
37 #include <scim_panel_common.h>
48 * @brief The class to implement all socket protocol in Panel.
50 * This class acts like a stand alone SocketServer.
51 * It has its own dedicated main loop, and will be blocked when run () is called.
52 * So run () must be called within a separated thread, in order to not block
53 * the main loop of the Panel program itself.
55 * Before calling run (), the panel must hook the callback functions to the
56 * corresponding signals.
58 * Note that, there are two special signals: lock(void) and unlock(void). These
59 * two signals are used to provide a thread lock to PanelAgent, so that PanelAgent
60 * can run correctly within a multi-threading Panel program.
62 class EXAPI PanelAgentManager
64 class PanelAgentManagerImpl;
65 PanelAgentManagerImpl* m_impl;
67 PanelAgentManager (const PanelAgentManager&);
68 const PanelAgentManager& operator = (const PanelAgentManager&);
72 ~PanelAgentManager ();
75 * @brief Initialize this PanelAgent.
77 * @param config The name of the config module to be used by Helpers.
78 * @param display The name of display, on which the Panel should run.
79 * @param resident If this is true then this PanelAgent will keep running
80 * even if there is no more client connected.
82 * @return true if the PanelAgent is initialized correctly and ready to run.
84 bool initialize (InfoManager* info_manager,const ConfigPointer& config ,const String& display, bool resident = false);
87 * @brief Check if this PanelAgent is initialized correctly and ready to run.
89 * @return true if this PanelAgent is ready to run.
91 bool valid (void) const;
94 * @brief Stop this PanelAgent.
101 * @brief Notice helper ISE to focus out.
103 * @param uuid The helper ISE uuid.
105 void focus_out_helper (int client, uint32 context, const String& uuid);
108 * @brief Notice helper ISE to focus in.
110 * @param uuid The helper ISE uuid.
112 void focus_in_helper (int client, uint32 context, const String& uuid);
115 * @brief Notice helper ISE to show window.
117 * @param uuid The helper ISE uuid.
119 void show_helper (int client, uint32 context, const String& uuid, char* data, size_t& len);
122 * @brief Notice helper ISE to hide window.
124 * @param uuid The helper ISE uuid.
126 void hide_helper (int client, uint32 context, const String& uuid);
129 * @brief Reset keyboard ISE.
131 * @return true if this operation is successful, otherwise return false.
133 void reset_keyboard_ise (int client, uint32 context);
136 * @brief Change the factory used by the focused IMEngineInstance object.
138 * @param uuid The uuid of the new factory.
139 * @return true if the command was sent correctly.
141 void change_factory (int client, uint32 context, const String& uuid);
144 * @brief Notice Helper ISE that candidate more window is showed.
145 * @return true if the command was sent correctly.
147 void candidate_more_window_show (int client, uint32 context);
150 * @brief Notice Helper ISE that candidate more window is hidden.
151 * @return true if the command was sent correctly.
153 void candidate_more_window_hide (int client, uint32 context);
156 * @brief Notice Helper ISE that show candidate.
157 * @return true if the command was sent correctly.
159 void helper_candidate_show (int client, uint32 context, const String& uuid);
162 * @brief Notice Helper ISE that hide candidate.
163 * @return true if the command was sent correctly.
165 void helper_candidate_hide (int client, uint32 context, const String& uuid);
168 * @brief Update helper lookup table.
169 * @return true if the command was sent correctly.
171 void update_helper_lookup_table (int client, uint32 context, const String& uuid, const LookupTable& table);
174 * @brief Let the focused IMEngineInstance object
175 * select a aux in current aux string.
177 * @param item The index of the selected aux.
178 * @return true if the command was sent correctly.
180 void select_aux (int client, uint32 context, uint32 item);
183 * @brief Let the focused IMEngineInstance object
184 * select a candidate in current lookup table.
186 * @param item The index of the selected candidate.
187 * @return true if the command was sent correctly.
189 void select_candidate (int client, uint32 context, uint32 item);
192 * @brief Let the focused IMEngineInstance object
193 * flip the LookupTable to previous page.
194 * @return true if the command was sent correctly.
196 void lookup_table_page_up (int client, uint32 context);
199 * @brief Let the focused IMEngineInstance object
200 * flip the LookupTable to next page.
201 * @return true if the command was sent correctly.
203 void lookup_table_page_down (int client, uint32 context);
206 * @brief Let the focused IMEngineInstance object
207 * update the page size of the LookupTable.
209 * @param size The new page size.
210 * @return true if the command was sent correctly.
212 void update_lookup_table_page_size (int client, uint32 context, uint32 size);
215 * @brief Let the focused IMEngineInstance object
216 * update candidate items layout.
218 * @param row_items The items of each row.
219 * @return true if the command was sent correctly.
221 void update_candidate_item_layout (int client, uint32 context, const std::vector<uint32>& row_items);
224 * @brief Let the focused IMEngineInstance object
225 * select a associate in current associate table.
227 * @param item The index of the selected associate.
228 * @return true if the command was sent correctly.
230 void select_associate (int client, uint32 context, uint32 item);
233 * @brief Let the focused IMEngineInstance object
234 * flip the AssociateTable to previous page.
235 * @return true if the command was sent correctly.
237 void associate_table_page_up (int client, uint32 context);
240 * @brief Let the focused IMEngineInstance object
241 * flip the AssociateTable to next page.
242 * @return true if the command was sent correctly.
244 void associate_table_page_down (int client, uint32 context);
247 * @brief Let the focused IMEngineInstance object
248 * update the page size of the AssociateTable.
250 * @param size The new page size.
251 * @return true if the command was sent correctly.
253 void update_associate_table_page_size (int client, uint32 context, uint32 size);
256 * @brief Inform helper ISE to update displayed candidate number.
258 * @param size The displayed candidate number.
259 * @return true if the command was sent correctly.
261 void update_displayed_candidate_number (int client, uint32 context, uint32 size);
264 * @brief Trigger a property of the focused IMEngineInstance object.
266 * @param property The property key to be triggered.
267 * @return true if the command was sent correctly.
269 void trigger_property (int client, uint32 context, const String& property);
274 * @brief Let all FrontEnds and Helpers reload configuration.
275 * @return true if the command was sent correctly.
277 void reload_config (int client);
280 * @brief Let all FrontEnds, Helpers and this Panel exit.
281 * @return true if the command was sent correctly.
283 void exit (int client, uint32 context);
286 * @brief Send candidate longpress event to ISE.
288 * @param type The candidate object type.
289 * @param index The candidate object index.
293 void send_longpress_event (int client, uint32 context, uint32 index);
294 void update_panel_event (int id, uint32 contextid, int cmd, uint32 nType, uint32 nValue);
295 void update_keyboard_ise_list (int id, uint32 contextid);
296 void set_helper_mode (int client, uint32 context, const String& uuid, uint32& mode);
297 void set_helper_language (int client, uint32 context, const String& uuid, uint32& language);
298 void set_helper_imdata (int client, uint32 context, const String& uuid, const char* imdata, size_t& len);
299 void set_helper_return_key_type (int client, uint32 context, const String& uuid, uint32 type);
300 void get_helper_return_key_type (int client, uint32 context, const String& uuid, _OUT_ uint32& type);
301 void set_helper_return_key_disable (int client, uint32 context, const String& uuid, uint32 disabled);
302 void get_helper_return_key_disable (int client, uint32 context, const String& uuid, _OUT_ uint32& disabled);
303 void set_helper_layout (int client, uint32 context, const String& uuid, uint32& layout);
304 void set_helper_input_mode (int client, uint32 context, const String& uuid, uint32& mode);
305 void set_helper_input_hint (int client, uint32 context, const String& uuid, uint32& hint);
306 void set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction);
307 void set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode);
308 void show_helper_option_window (int client, uint32 context, const String& uuid);
309 bool process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, _OUT_ uint32& result);
310 bool get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info);
311 void get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len);
312 void get_helper_layout (int client, uint32 context, String& uuid, uint32& layout);
313 void get_ise_language_locale (int client, uint32 context, String& uuid, _OUT_ char* data, _OUT_ size_t& len);
314 void check_option_window (int client, uint32 context, String& uuid, _OUT_ uint32& avail);
315 void reset_ise_option (int client_id, uint32 context);
316 void reset_helper_context (int client_id, uint32 context, const String& uuid);
317 void socket_update_surrounding_text (int client, uint32 context, const String& uuid, String& text, uint32 cursor);
318 void socket_update_selection (int client, uint32 context, String& uuid, String text);
319 void socket_get_keyboard_ise_list (int client, uint32 context, const String& uuid, std::vector<String>& list);
320 void socket_get_candidate_ui (int client, uint32 context, const String& uuid, int style, int mode);
321 void socket_get_candidate_geometry (int client, uint32 context, const String& uuid, struct rectinfo& info);
322 void socket_get_keyboard_ise (int client, uint32 context, const String& uuid, String& ise_name, String& ise_uuid);
323 void socket_start_helper (int client, uint32 context, const String& ic_uuid);
324 void helper_detach_input_context (int client, uint32 context, const String& ic_uuid);
325 void helper_process_imengine_event (int client, uint32 context, const String& ic_uuid, const Transaction& nest_transaction);
326 void process_helper_event (int client, uint32 context, String target_uuid, String active_uuid, Transaction& nest_trans);
327 void socket_helper_key_event (int client, uint32 context, int cmd , KeyEvent& key);
328 void socket_helper_get_surrounding_text (int client, uint32 context_id, uint32 maxlen_before, uint32 maxlen_after);
329 void socket_helper_delete_surrounding_text (int client, uint32 context_id, uint32 offset, uint32 len);
330 void socket_helper_get_selection (int client, uint32 context_id);
331 void socket_helper_set_selection (int client, uint32 context_id, uint32 start, uint32 end);
332 void update_ise_input_context (int focused_client, uint32 focused_context, uint32 type, uint32 value);
333 void send_private_command (int focused_client, uint32 focused_context, String command);
334 void helper_all_update_spot_location (int client_id, uint32 context_id, String uuid, int x, int y);
335 void helper_all_update_cursor_position (int client_id, uint32 context_id, String uuid, int cursor_pos);
336 void helper_all_update_screen (int client_id, uint32 context_id, String uuid, int screen);
337 void commit_string (int target_client, uint32 target_context,const WideString& wstr);
338 void show_preedit_string (int target_client, uint32 target_context);
339 void hide_preedit_string (int target_client, uint32 target_context);
340 void update_preedit_string (int target_client, uint32 target_context, WideString wstr, AttributeList& attrs, uint32 caret);
341 void update_preedit_caret (int focused_client, uint32 focused_context, uint32 caret);
342 void helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index, uint32 current_screen);
343 void hide_helper_ise (int id, uint32 context);
348 } /* namespace scim */
350 #endif /* __ISF_PANEL_AGENT_MANAGER_H */
353 vi:ts=4:nowrap:ai:expandtab