scim
1.4.18
|
The accessory class to write a Helper object. More...
#include <scim_helper.h>
Public Member Functions | |
HelperAgent () | |
~HelperAgent () | |
int | open_connection (const HelperInfo &info, const String &display) |
Open socket connection to the Panel. More... | |
void | close_connection () |
Close the socket connection to Panel. More... | |
int | get_connection_number () const |
Get the connection id previously returned by open_connection(). More... | |
bool | is_connected () const |
Return whether this HelperAgent has been connected to a Panel. More... | |
bool | has_pending_event () const |
Check if there are any events available to be processed. More... | |
bool | filter_event () |
Process the pending events. More... | |
void | reload_config () const |
Request SCIM to reload all configuration. More... | |
void | register_properties (const PropertyList &properties) const |
Register some properties into Panel. More... | |
void | update_property (const Property &property) const |
Update a registered property. More... | |
void | send_imengine_event (int ic, const String &ic_uuid, const Transaction &trans) const |
Send a set of events to an IMEngineInstance. More... | |
void | send_key_event (int ic, const String &ic_uuid, const KeyEvent &key) const |
Send a KeyEvent to an IMEngineInstance. More... | |
void | forward_key_event (int ic, const String &ic_uuid, const KeyEvent &key) const |
Forward a KeyEvent to client application directly. More... | |
void | commit_string (int ic, const String &ic_uuid, const WideString &wstr) const |
Commit a WideString to client application directly. More... | |
Connection | signal_connect_exit (HelperAgentSlotVoid *slot) |
Connect a slot to Helper exit signal. More... | |
Connection | signal_connect_attach_input_context (HelperAgentSlotVoid *slot) |
Connect a slot to Helper attach input context signal. More... | |
Connection | signal_connect_detach_input_context (HelperAgentSlotVoid *slot) |
Connect a slot to Helper detach input context signal. More... | |
Connection | signal_connect_reload_config (HelperAgentSlotVoid *slot) |
Connect a slot to Helper reload config signal. More... | |
Connection | signal_connect_update_screen (HelperAgentSlotInt *slot) |
Connect a slot to Helper update screen signal. More... | |
Connection | signal_connect_update_spot_location (HelperAgentSlotIntInt *slot) |
Connect a slot to Helper update spot location signal. More... | |
Connection | signal_connect_trigger_property (HelperAgentSlotString *slot) |
Connect a slot to Helper trigger property signal. More... | |
Connection | signal_connect_process_imengine_event (HelperAgentSlotTransaction *slot) |
Connect a slot to Helper process imengine event signal. More... | |
The accessory class to write a Helper object.
This class implements all Socket Transaction protocol between Helper object and Panel.
scim::HelperAgent::HelperAgent | ( | ) |
scim::HelperAgent::~HelperAgent | ( | ) |
int scim::HelperAgent::open_connection | ( | const HelperInfo & | info, |
const String & | display | ||
) |
Open socket connection to the Panel.
Helper objects and Panel communicate with each other via the Socket created by Panel, just same as the Socket between FrontEnds and Panel.
Helper object can select/poll on the connection id returned by this function to see if there are any data available to be read. If any data are available, Helper object should call HelperAgent::filter_event() to process the data.
This method should be called after the necessary signal-slots are connected. If this Helper is started by an IMEngine Instance, then signal attach_input_context will be emitted during this call.
Signal update_screen will be emitted during this call as well to set the startup screen of this Helper. The ic and ic_uuid parameters are invalid here.
info | The information of this Helper object. |
display | The display which this Helper object should run on. |
void scim::HelperAgent::close_connection | ( | ) |
Close the socket connection to Panel.
int scim::HelperAgent::get_connection_number | ( | ) | const |
Get the connection id previously returned by open_connection().
bool scim::HelperAgent::is_connected | ( | ) | const |
Return whether this HelperAgent has been connected to a Panel.
bool scim::HelperAgent::has_pending_event | ( | ) | const |
Check if there are any events available to be processed.
If it returns true then Helper object should call HelperAgent::filter_event() to process them.
bool scim::HelperAgent::filter_event | ( | ) |
Process the pending events.
This function will emit the corresponding signals according to the events.
void scim::HelperAgent::reload_config | ( | ) | const |
Request SCIM to reload all configuration.
This function should only by used by Setup Helper to request scim's reloading the configuration.
void scim::HelperAgent::register_properties | ( | const PropertyList & | properties | ) | const |
Register some properties into Panel.
This function send the request to Panel to register a list of Properties.
properties | The list of Properties to be registered into Panel. |
void scim::HelperAgent::update_property | ( | const Property & | property | ) | const |
Update a registered property.
property | The property to be updated. |
void scim::HelperAgent::send_imengine_event | ( | int | ic, |
const String & | ic_uuid, | ||
const Transaction & | trans | ||
) | const |
Send a set of events to an IMEngineInstance.
All events should be put into a Transaction. And the events can only be received by one IMEngineInstance object.
ic | The handle of the Input Context to receive the events. |
ic_uuid | The UUID of the Input Context. |
trans | The Transaction object holds the events. |
void scim::HelperAgent::commit_string | ( | int | ic, |
const String & | ic_uuid, | ||
const WideString & | wstr | ||
) | const |
Commit a WideString to client application directly.
ic | The handle of the client Input Context to receive the WideString. -1 means the currently focused Input Context. |
ic_uuid | The UUID of the IMEngine used by the Input Context. Empty means don't match. |
wstr | The WideString to be committed. |
Connection scim::HelperAgent::signal_connect_exit | ( | HelperAgentSlotVoid * | slot | ) |
Connect a slot to Helper exit signal.
This signal is used to let the Helper exit.
The prototype of the slot is:
void exit (const HelperAgent *agent, int ic, const String &ic_uuid);
Parameters:
Connection scim::HelperAgent::signal_connect_attach_input_context | ( | HelperAgentSlotVoid * | slot | ) |
Connect a slot to Helper attach input context signal.
This signal is used to attach an input context to this helper.
When an input context requst to start this helper, then this signal will be emitted as soon as the helper is started.
When an input context want to start an already started helper, this signal will also be emitted.
Helper can send some events back to the IMEngineInstance in this signal-slot, to inform that it has been started sccessfully.
The prototype of the slot is:
void attach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
Connection scim::HelperAgent::signal_connect_detach_input_context | ( | HelperAgentSlotVoid * | slot | ) |
Connect a slot to Helper detach input context signal.
This signal is used to detach an input context from this helper.
When an input context requst to stop this helper, then this signal will be emitted.
Helper shouldn't send any event back to the IMEngineInstance, because the IMEngineInstance attached to the ic should have been destroyed.
The prototype of the slot is:
void detach_input_context (const HelperAgent *agent, int ic, const String &ic_uuid);
Connection scim::HelperAgent::signal_connect_reload_config | ( | HelperAgentSlotVoid * | slot | ) |
Connect a slot to Helper reload config signal.
This signal is used to let the Helper reload configuration.
The prototype of the slot is:
void reload_config (const HelperAgent *agent, int ic, const String &ic_uuid);
Connection scim::HelperAgent::signal_connect_update_screen | ( | HelperAgentSlotInt * | slot | ) |
Connect a slot to Helper update screen signal.
This signal is used to let the Helper move its GUI to another screen. It can only be emitted when SCIM_HELPER_NEED_SCREEN_INFO is set in HelperInfo.option.
The prototype of the slot is:
void update_screen (const HelperAgent *agent, int ic, const String &ic_uuid, int screen_number);
Connection scim::HelperAgent::signal_connect_update_spot_location | ( | HelperAgentSlotIntInt * | slot | ) |
Connect a slot to Helper update spot location signal.
This signal is used to let the Helper move its GUI according to the current spot location. It can only be emitted when SCIM_HELPER_NEED_SPOT_LOCATION_INFO is set in HelperInfo.option.
The prototype of the slot is: void update_spot_location (const HelperAgent *agent, int ic, const String &ic_uuid, int x, int y);
Connection scim::HelperAgent::signal_connect_trigger_property | ( | HelperAgentSlotString * | slot | ) |
Connect a slot to Helper trigger property signal.
This signal is used to trigger a property registered by this Helper. A property will be triggered when user clicks on it.
The prototype of the slot is: void trigger_property (const HelperAgent *agent, int ic, const String &ic_uuid, const String &property);
Connection scim::HelperAgent::signal_connect_process_imengine_event | ( | HelperAgentSlotTransaction * | slot | ) |
Connect a slot to Helper process imengine event signal.
This signal is used to deliver the events sent from IMEngine to Helper.
The prototype of the slot is: void process_imengine_event (const HelperAgent *agent, int ic, const String &ic_uuid, const Transaction &transaction);