scim::PanelAgent Class Reference
Panel

The class to implement all socket protocol in Panel. More...

`#include <scim_panel_agent.h>`

## Public Member Functions

| PanelAgent ()
| ~PanelAgent ()
bool | initialize (const String &config, const String &display, bool resident=false)
| Initialize this PanelAgent.
bool | valid (void) const
| Check if this PanelAgent is initialized correctly and ready to run.
bool | run (void)
| Run this PanelAgent.
void | stop (void)
| Stop this PanelAgent.
int | get_helper_list (std::vector< HelperInfo > &helpers) const
| Get the list of all helpers.
bool | move_preedit_caret (uint32 position)
| Let the focused IMEngineInstance object move the preedit caret.
bool | request_help (void)
| Request help information from the focused IMEngineInstance object.
bool | request_factory_menu (void)
| Request factory menu from the focused FrontEnd.
bool | change_factory (const String &uuid)
| Change the factory used by the focused IMEngineInstance object.
bool | select_candidate (uint32 item)
| Let the focused IMEngineInstance object select a candidate in current lookup table.
bool | lookup_table_page_up (void)
| Let the focused IMEngineInstance object flip the LookupTable to previous page.
bool | lookup_table_page_down (void)
| Let the focused IMEngineInstance object flip the LookupTable to next page.
bool | update_lookup_table_page_size (uint32 size)
| Let the focused IMEngineInstance object update the page size of the LookupTable.
bool | trigger_property (const String &property)
| Trigger a property of the focused IMEngineInstance object.
bool | trigger_helper_property (int client, const String &property)
| Trigger a property of a Helper object.
bool | start_helper (const String &uuid)
| Start a stand alone helper.
bool | reload_config (void)
| Let all FrontEnds and Helpers reload configuration.
bool | exit (void)
| Let all FrontEnds, Helpers and this Panel exit.
Connection | signal_connect_reload_config (PanelAgentSlotVoid *slot)
| Signal: Reload configuration.
Connection | signal_connect_turn_on (PanelAgentSlotVoid *slot)
| Signal: Turn on.
Connection | signal_connect_turn_off (PanelAgentSlotVoid *slot)
| Signal: Turn off.
Connection | signal_connect_update_screen (PanelAgentSlotInt *slot)
| Signal: Update screen.
Connection | signal_connect_update_spot_location (PanelAgentSlotIntInt *slot)
| Signal: Update spot location.
Connection | signal_connect_update_factory_info (PanelAgentSlotFactoryInfo *slot)
| Signal: Update factory information.
Connection | signal_connect_show_help (PanelAgentSlotString *slot)
| Signal: Show help.
Connection | signal_connect_show_factory_menu (PanelAgentSlotFactoryInfoVector *slot)
| Signal: Show factory menu.
Connection | signal_connect_show_preedit_string (PanelAgentSlotVoid *slot)
| Signal: Show preedit string.
Connection | signal_connect_show_aux_string (PanelAgentSlotVoid *slot)
| Signal: Show aux string.
Connection | signal_connect_show_lookup_table (PanelAgentSlotVoid *slot)
| Signal: Show lookup table.
Connection | signal_connect_hide_preedit_string (PanelAgentSlotVoid *slot)
| Signal: Hide preedit string.
Connection | signal_connect_hide_aux_string (PanelAgentSlotVoid *slot)
| Signal: Hide aux string.
Connection | signal_connect_hide_lookup_table (PanelAgentSlotVoid *slot)
| Signal: Hide lookup table.
Connection | signal_connect_update_preedit_string (PanelAgentSlotAttributeString *slot)
| Signal: Update preedit string.
Connection | signal_connect_update_preedit_caret (PanelAgentSlotInt *slot)
| Signal: Update preedit caret.
Connection | signal_connect_update_aux_string (PanelAgentSlotAttributeString *slot)
| Signal: Update aux string.
Connection | signal_connect_update_lookup_table (PanelAgentSlotLookupTable *slot)
| Signal: Update lookup table.
Connection | signal_connect_register_properties (PanelAgentSlotPropertyList *slot)
| Signal: Register properties.
Connection | signal_connect_update_property (PanelAgentSlotProperty *slot)
| Signal: Update property.
Connection | signal_connect_register_helper_properties (PanelAgentSlotIntPropertyList *slot)
| Signal: Register properties of a helper.
Connection | signal_connect_update_helper_property (PanelAgentSlotIntProperty *slot)
| Signal: Update helper property.
Connection | signal_connect_register_helper (PanelAgentSlotIntHelperInfo *slot)
| Signal: Register a helper object.
Connection | signal_connect_remove_helper (PanelAgentSlotInt *slot)
| Signal: Remove a helper object.
Connection | signal_connect_transaction_start (PanelAgentSlotVoid *slot)
| Signal: A transaction is started.
Connection | signal_connect_transaction_end (PanelAgentSlotVoid *slot)
| Signal: A transaction is finished.
Connection | signal_connect_lock (PanelAgentSlotVoid *slot)
| Signal: Lock the exclusive lock for this PanelAgent.
Connection | signal_connect_unlock (PanelAgentSlotVoid *slot)
| Signal: Unlock the exclusive lock for this PanelAgent.

## Detailed Description

The class to implement all socket protocol in Panel.

This class acts like a stand alone SocketServer. It has its own dedicated main loop, and will be blocked when run () is called. So run () must be called within a separated thread, in order to not block the main loop of the Panel program itself.

Before calling run (), the panel must hook the callback functions to the corresponding signals.

Note that, there are two special signals: lock(void) and unlock(void). These two signals are used to provide a thread lock to PanelAgent, so that PanelAgent can run correctly within a multi-threading Panel program.

## Constructor & Destructor Documentation

## PanelAgent()

scim::PanelAgent::PanelAgent | ( |  | ) |

## ~PanelAgent()

scim::PanelAgent::~PanelAgent | ( |  | ) |

## Member Function Documentation

## initialize()

bool scim::PanelAgent::initialize | ( | const String & | config,
|  | const String & | display,
|  | bool | resident = false )

Initialize this PanelAgent.

Parameters

  config | The name of the config module to be used by Helpers.
  display | The name of display, on which the Panel should run.
  resident | If this is true then this PanelAgent will keep running even if there is no more client connected.

Returns
  true if the PanelAgent is initialized correctly and ready to run.

## valid()

bool scim::PanelAgent::valid | ( | void |  | ) | const

Check if this PanelAgent is initialized correctly and ready to run.

Returns
  true if this PanelAgent is ready to run.

## run()

bool scim::PanelAgent::run | ( | void |  | ) |

Run this PanelAgent.

This method has its own dedicated main loop, so it should be run in a separated thread.

Returns
  false if the Panel SocketServer encountered an error when running. Otherwise, it won't return until the server exits.

## stop()

void scim::PanelAgent::stop | ( | void |  | ) |

Stop this PanelAgent.

## get_helper_list()

int scim::PanelAgent::get_helper_list | ( | std::vector< HelperInfo > & | helpers | ) | const

Get the list of all helpers.

Panel program should provide a menu which contains all stand alone but not auto start Helpers, so that users can activate the Helpers by clicking in the menu.

All auto start Helpers should be started by Panel after running PanelAgent by calling PanelAgent::start_helper().

Parameters

  helpers | A list contains information of all Helpers.

## move_preedit_caret()

bool scim::PanelAgent::move_preedit_caret | ( | uint32 | position | ) |

Let the focused IMEngineInstance object move the preedit caret.

Parameters

  position | The new preedit caret position.

Returns
  true if the command was sent correctly.

## request_help()

bool scim::PanelAgent::request_help | ( | void |  | ) |

Request help information from the focused IMEngineInstance object.

Returns
  true if the command was sent correctly.

## request_factory_menu()

bool scim::PanelAgent::request_factory_menu | ( | void |  | ) |

Request factory menu from the focused FrontEnd.

Returns
  true if the command was sent correctly.

## change_factory()

bool scim::PanelAgent::change_factory | ( | const String & | uuid | ) |

Change the factory used by the focused IMEngineInstance object.

Parameters

  uuid | The uuid of the new factory.

Returns
  true if the command was sent correctly.

## select_candidate()

bool scim::PanelAgent::select_candidate | ( | uint32 | item | ) |

Let the focused IMEngineInstance object select a candidate in current lookup table.

Parameters

  item | The index of the selected candidate.

Returns
  true if the command was sent correctly.

## lookup_table_page_up()

bool scim::PanelAgent::lookup_table_page_up | ( | void |  | ) |

Let the focused IMEngineInstance object flip the LookupTable to previous page.

Returns
  true if the command was sent correctly.

## lookup_table_page_down()

bool scim::PanelAgent::lookup_table_page_down | ( | void |  | ) |

Let the focused IMEngineInstance object flip the LookupTable to next page.

Returns
  true if the command was sent correctly.

## update_lookup_table_page_size()

bool scim::PanelAgent::update_lookup_table_page_size | ( | uint32 | size | ) |

Let the focused IMEngineInstance object update the page size of the LookupTable.

Parameters

  size | The new page size.

Returns
  true if the command was sent correctly.

## trigger_property()

bool scim::PanelAgent::trigger_property | ( | const String & | property | ) |

Trigger a property of the focused IMEngineInstance object.

Parameters

  property | The property key to be triggered.

Returns
  true if the command was sent correctly.

## trigger_helper_property()

bool scim::PanelAgent::trigger_helper_property | ( | int | client,
|  | const String & | property )

Trigger a property of a Helper object.

Parameters

  client | The client id of the Helper object.
  property | The property key to be triggered.

Returns
  true if the command was sent correctly.

## start_helper()

bool scim::PanelAgent::start_helper | ( | const String & | uuid | ) |

Start a stand alone helper.

Parameters

  uuid | The uuid of the Helper object to be started.

Returns
  true if the command was sent correctly.

## reload_config()

bool scim::PanelAgent::reload_config | ( | void |  | ) |

Let all FrontEnds and Helpers reload configuration.

Returns
  true if the command was sent correctly.

## exit()

bool scim::PanelAgent::exit | ( | void |  | ) |

Let all FrontEnds, Helpers and this Panel exit.

Returns
  true if the command was sent correctly.

## signal_connect_reload_config()

Connection scim::PanelAgent::signal_connect_reload_config | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Reload configuration.

When a Helper object send a RELOAD_CONFIG event to this Panel, this signal will be emitted. Panel should reload all configuration here.

References scim::slot().

## signal_connect_turn_on()

Connection scim::PanelAgent::signal_connect_turn_on | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Turn on.

slot prototype: void turn_on (void);

References scim::slot().

## signal_connect_turn_off()

Connection scim::PanelAgent::signal_connect_turn_off | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Turn off.

slot prototype: void turn_off (void);

References scim::slot().

## signal_connect_update_screen()

Connection scim::PanelAgent::signal_connect_update_screen | ( | PanelAgentSlotInt * | slot | ) |

Signal: Update screen.

slot prototype: void update_screen (int screen);

References scim::slot().

## signal_connect_update_spot_location()

Connection scim::PanelAgent::signal_connect_update_spot_location | ( | PanelAgentSlotIntInt * | slot | ) |

Signal: Update spot location.

slot prototype: void update_spot_location (int x, int y);

References scim::slot().

## signal_connect_update_factory_info()

Connection scim::PanelAgent::signal_connect_update_factory_info | ( | PanelAgentSlotFactoryInfo * | slot | ) |

Signal: Update factory information.

slot prototype: void update_factory_info (const PanelFactoryInfo &info);

References scim::slot().

## signal_connect_show_help()

Connection scim::PanelAgent::signal_connect_show_help | ( | PanelAgentSlotString * | slot | ) |

Signal: Show help.

slot prototype: void show_help (const String &help);

References scim::slot().

## signal_connect_show_factory_menu()

Connection scim::PanelAgent::signal_connect_show_factory_menu | ( | PanelAgentSlotFactoryInfoVector * | slot | ) |

Signal: Show factory menu.

slot prototype: void show_factory_menu (const std::vector <PanelFactoryInfo> &menu);

References scim::slot().

## signal_connect_show_preedit_string()

Connection scim::PanelAgent::signal_connect_show_preedit_string | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Show preedit string.

slot prototype: void show_preedit_string (void):

References scim::slot().

## signal_connect_show_aux_string()

Connection scim::PanelAgent::signal_connect_show_aux_string | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Show aux string.

slot prototype: void show_aux_string (void):

References scim::slot().

## signal_connect_show_lookup_table()

Connection scim::PanelAgent::signal_connect_show_lookup_table | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Show lookup table.

slot prototype: void show_lookup_table (void):

References scim::slot().

## signal_connect_hide_preedit_string()

Connection scim::PanelAgent::signal_connect_hide_preedit_string | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Hide preedit string.

slot prototype: void hide_preedit_string (void);

References scim::slot().

## signal_connect_hide_aux_string()

Connection scim::PanelAgent::signal_connect_hide_aux_string | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Hide aux string.

slot prototype: void hide_aux_string (void);

References scim::slot().

## signal_connect_hide_lookup_table()

Connection scim::PanelAgent::signal_connect_hide_lookup_table | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Hide lookup table.

slot prototype: void hide_lookup_table (void);

References scim::slot().

## signal_connect_update_preedit_string()

Connection scim::PanelAgent::signal_connect_update_preedit_string | ( | PanelAgentSlotAttributeString * | slot | ) |

Signal: Update preedit string.

slot prototype: void update_preedit_string (const String &str, const AttributeList &attrs);

- str – The UTF-8 encoded string to be displayed in preedit area.
- attrs – The attributes of the string.

References scim::slot().

## signal_connect_update_preedit_caret()

Connection scim::PanelAgent::signal_connect_update_preedit_caret | ( | PanelAgentSlotInt * | slot | ) |

Signal: Update preedit caret.

slot prototype: void update_preedit_caret (int caret);

References scim::slot().

## signal_connect_update_aux_string()

Connection scim::PanelAgent::signal_connect_update_aux_string | ( | PanelAgentSlotAttributeString * | slot | ) |

Signal: Update aux string.

slot prototype: void update_aux_string (const String &str, const AttributeList &attrs);

- str – The UTF-8 encoded string to be displayed in aux area.
- attrs – The attributes of the string.

References scim::slot().

## signal_connect_update_lookup_table()

Connection scim::PanelAgent::signal_connect_update_lookup_table | ( | PanelAgentSlotLookupTable * | slot | ) |

Signal: Update lookup table.

slot prototype: void update_lookup_table (const LookupTable &table);

- table – The new LookupTable object.

References scim::slot().

## signal_connect_register_properties()

Connection scim::PanelAgent::signal_connect_register_properties | ( | PanelAgentSlotPropertyList * | slot | ) |

Signal: Register properties.

Register properties of the focused instance.

slot prototype: void register_properties (const PropertyList &props);

- props – The properties to be registered.

References scim::slot().

## signal_connect_update_property()

Connection scim::PanelAgent::signal_connect_update_property | ( | PanelAgentSlotProperty * | slot | ) |

Signal: Update property.

Update a property of the focused instance.

slot prototype: void update_property (const Property &prop);

- prop – The property to be updated.

References scim::slot().

## signal_connect_register_helper_properties()

Connection scim::PanelAgent::signal_connect_register_helper_properties | ( | PanelAgentSlotIntPropertyList * | slot | ) |

Signal: Register properties of a helper.

slot prototype: void register_helper_properties (int id, const PropertyList &props);

- id – The client id of the helper object.
- props – The properties to be registered.

References scim::slot().

## signal_connect_update_helper_property()

Connection scim::PanelAgent::signal_connect_update_helper_property | ( | PanelAgentSlotIntProperty * | slot | ) |

Signal: Update helper property.

slot prototype: void update_helper_property (int id, const Property &prop);

- id – The client id of the helper object.
- prop – The property to be updated.

References scim::slot().

## signal_connect_register_helper()

Connection scim::PanelAgent::signal_connect_register_helper | ( | PanelAgentSlotIntHelperInfo * | slot | ) |

Signal: Register a helper object.

A newly started helper object will send this event to Panel.

slot prototype: register_helper (int id, const HelperInfo &helper);

- id – The client id of the helper object.
- helper – The information of the helper object.

References scim::slot().

## signal_connect_remove_helper()

Connection scim::PanelAgent::signal_connect_remove_helper | ( | PanelAgentSlotInt * | slot | ) |

Signal: Remove a helper object.

If a running helper close its connection to Panel, then this signal will be triggered to tell Panel to remove all data associated to this helper.

slot prototype: void remove_helper (int id);

- id – The client id of the helper object to be removed.

References scim::slot().

## signal_connect_transaction_start()

Connection scim::PanelAgent::signal_connect_transaction_start | ( | PanelAgentSlotVoid * | slot | ) |

Signal: A transaction is started.

This signal infers that the Panel should disable update before this transaction finishes.

slot prototype: void signal_connect_transaction_start (void);

References scim::slot().

## signal_connect_transaction_end()

Connection scim::PanelAgent::signal_connect_transaction_end | ( | PanelAgentSlotVoid * | slot | ) |

Signal: A transaction is finished.

This signal will get emitted when a transaction is finished. This implys to re-enable panel GUI update

slot prototype: void signal_connect_transaction_end (void);

References scim::slot().

## signal_connect_lock()

Connection scim::PanelAgent::signal_connect_lock | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Lock the exclusive lock for this PanelAgent.

The panel program should provide a thread lock and hook a slot into this signal to lock it. PanelAgent will use this lock to ensure the data integrity.

slot prototype: void lock (void);

References scim::slot().

## signal_connect_unlock()

Connection scim::PanelAgent::signal_connect_unlock | ( | PanelAgentSlotVoid * | slot | ) |

Signal: Unlock the exclusive lock for this PanelAgent.

slot prototype: void unlock (void);

References scim::slot().

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

- scim_panel_agent.h