scim::HelperAgent Class Reference
Helper

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.
void | close_connection ()
| Close the socket connection to Panel.
int | get_connection_number () const
| Get the connection id previously returned by open_connection().
bool | is_connected () const
| Return whether this HelperAgent has been connected to a Panel.
bool | has_pending_event () const
| Check if there are any events available to be processed.
bool | filter_event ()
| Process the pending events.
void | reload_config () const
| Request SCIM to reload all configuration.
void | register_properties (const PropertyList &properties) const
| Register some properties into Panel.
void | update_property (const Property &property) const
| Update a registered property.
void | send_imengine_event (int ic, const String &ic_uuid, const Transaction &trans) const
| Send a set of events to an IMEngineInstance.
void | send_key_event (int ic, const String &ic_uuid, const KeyEvent &key) const
| Send a KeyEvent to an IMEngineInstance.
void | forward_key_event (int ic, const String &ic_uuid, const KeyEvent &key) const
| Forward a KeyEvent to client application directly.
void | commit_string (int ic, const String &ic_uuid, const WideString &wstr) const
| Commit a WideString to client application directly.
Connection | signal_connect_exit (HelperAgentSlotVoid *slot)
| Connect a slot to Helper exit signal.
Connection | signal_connect_attach_input_context (HelperAgentSlotVoid *slot)
| Connect a slot to Helper attach input context signal.
Connection | signal_connect_detach_input_context (HelperAgentSlotVoid *slot)
| Connect a slot to Helper detach input context signal.
Connection | signal_connect_reload_config (HelperAgentSlotVoid *slot)
| Connect a slot to Helper reload config signal.
Connection | signal_connect_update_screen (HelperAgentSlotInt *slot)
| Connect a slot to Helper update screen signal.
Connection | signal_connect_update_spot_location (HelperAgentSlotIntInt *slot)
| Connect a slot to Helper update spot location signal.
Connection | signal_connect_trigger_property (HelperAgentSlotString *slot)
| Connect a slot to Helper trigger property signal.
Connection | signal_connect_process_imengine_event (HelperAgentSlotTransaction *slot)
| Connect a slot to Helper process imengine event signal.

## Detailed Description

The accessory class to write a Helper object.

This class implements all Socket Transaction protocol between Helper object and Panel.

## Constructor & Destructor Documentation

## HelperAgent()

scim::HelperAgent::HelperAgent | ( |  | ) |

## ~HelperAgent()

scim::HelperAgent::~HelperAgent | ( |  | ) |

## Member Function Documentation

## open_connection()

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.

Parameters

  info | The information of this Helper object.
  display | The display which this Helper object should run on.

Returns
  The connection socket id. -1 means failed to create the connection.

## close_connection()

void scim::HelperAgent::close_connection | ( |  | ) |

Close the socket connection to Panel.

## get_connection_number()

int scim::HelperAgent::get_connection_number | ( |  | ) | const

Get the connection id previously returned by open_connection().

## is_connected()

bool scim::HelperAgent::is_connected | ( |  | ) | const

Return whether this HelperAgent has been connected to a Panel.

## has_pending_event()

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.

Returns
  true if there are any events available.

## filter_event()

bool scim::HelperAgent::filter_event | ( |  | ) |

Process the pending events.

This function will emit the corresponding signals according to the events.

Returns
  false if the connection is broken, otherwise return true.

## reload_config()

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.

## register_properties()

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.

Parameters

  properties | The list of Properties to be registered into Panel.

See also
  scim::Property.

## update_property()

void scim::HelperAgent::update_property | ( | const Property & | property | ) | const

Update a registered property.

Parameters

  property | The property to be updated.

## send_imengine_event()

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.

Parameters

  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.

## send_key_event()

void scim::HelperAgent::send_key_event | ( | int | ic,
|  | const String & | ic_uuid,
|  | const KeyEvent & | key ) const

Send a KeyEvent to an IMEngineInstance.

Parameters

  ic | The handle of the IMEngineInstance to receive the event. -1 means the currently focused IMEngineInstance.
  ic_uuid | The UUID of the IMEngineInstance. Empty means don't match.
  key | The KeyEvent to be sent.

## forward_key_event()

void scim::HelperAgent::forward_key_event | ( | int | ic,
|  | const String & | ic_uuid,
|  | const KeyEvent & | key ) const

Forward a KeyEvent to client application directly.

Parameters

  ic | The handle of the client Input Context to receive the event. -1 means the currently focused Input Context.
  ic_uuid | The UUID of the IMEngine used by the Input Context. Empty means don't match.
  key | The KeyEvent to be forwarded.

## commit_string()

void scim::HelperAgent::commit_string | ( | int | ic,
|  | const String & | ic_uuid,
|  | const WideString & | wstr ) const

Commit a WideString to client application directly.

Parameters

  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.

## signal_connect_exit()

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:

- agent The pointer to the HelperAgent object which emits this signal.
- ic An opaque handle of the currently focused input context.
- ic_uuid The UUID of the IMEngineInstance associated with the focused input context.

References scim::slot().

## signal_connect_attach_input_context()

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);

References scim::slot().

## signal_connect_detach_input_context()

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);

References scim::slot().

## signal_connect_reload_config()

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);

References scim::slot().

## signal_connect_update_screen()

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);

References scim::slot().

## signal_connect_update_spot_location()

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);

References scim::slot().

## signal_connect_trigger_property()

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);

References scim::slot().

## signal_connect_process_imengine_event()

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);

References scim::slot().

The documentation for this class was generated from the following file:

- scim_helper.h