scim  1.4.18
scim::FrontEndBase Class Referenceabstract

The base class to implement the FrontEnd objects. More...

#include <scim_frontend.h>

Public Member Functions

 FrontEndBase (const BackEndPointer &backend)
 Constructor. More...
 
virtual ~FrontEndBase ()
 Virtual destructor. More...
 
virtual void init (int argc, char **argv)=0
 init the frontend. More...
 
virtual void run ()=0
 run the frontend. More...
 
- Public Member Functions inherited from scim::ReferencedObject
bool is_referenced () const
 
void ref ()
 Increase an object's reference count by one. More...
 
void unref ()
 

Protected Member Functions

functions can be used by derived classes.
uint32 get_factory_list_for_encoding (std::vector< String > &uuids, const String &encoding) const
 Get the IMEngine factories list for specific encoding. More...
 
uint32 get_factory_list_for_language (std::vector< String > &uuids, const String &language) const
 Get the IMEngine factories list for specific language. More...
 
String get_default_factory (const String &language, const String &encoding) const
 Get the default IMEngineFactory UUID for a specific language and encoding. More...
 
void set_default_factory (const String &language, const String &uuid)
 Set the default IMEngineFactory for a specific language. More...
 
String get_next_factory (const String &language, const String &encoding, const String &cur_uuid) const
 Get the next IMEngineFactory for a specific language and encoding. More...
 
String get_previous_factory (const String &language, const String &encoding, const String &cur_uuid) const
 Get the previous IMEngineFactory for a specific language and encoding. More...
 
WideString get_factory_name (const String &uuid) const
 get the name of an IMEngine factory. More...
 
WideString get_factory_authors (const String &uuid) const
 get the authors info of an IMEngine factory. More...
 
WideString get_factory_credits (const String &uuid) const
 get the credits info of an IMEngine factory. More...
 
WideString get_factory_help (const String &uuid) const
 get the help info of an IMEngine factory. More...
 
String get_factory_icon_file (const String &uuid) const
 get the icon file of an IMEngine factory. More...
 
String get_factory_locales (const String &uuid) const
 get the supported locales of an IMEngine factory. More...
 
String get_factory_language (const String &uuid) const
 get the language of an IMEngine factory. More...
 
bool validate_factory (const String &uuid, const String &encoding=String("")) const
 Check if an IMEngine factory is valid and the given encoding is supported by it. More...
 
String get_all_locales () const
 get all locales supported by BackEnd. More...
 
int new_instance (const String &sf_uuid, const String &encoding)
 create a new IMEngine instance for specific encoding. More...
 
bool replace_instance (int si_id, const String &sf_uuid)
 replace an IMEngine instance by a new instance created by another factory. More...
 
bool delete_instance (int id)
 delete an IMEngine instance according to its id. More...
 
void delete_all_instances ()
 delete all IMEngine instances. More...
 
String get_instance_uuid (int id) const
 get the factory uuid of this instance. More...
 
String get_instance_encoding (int id) const
 get the working encoding of an IMEngine instance. More...
 
WideString get_instance_name (int id) const
 get the name of an IMEngine instance. More...
 
WideString get_instance_authors (int id) const
 get the authors info of an IMEngine instance. More...
 
WideString get_instance_credits (int id) const
 get the credits info of an IMEngine instance. More...
 
WideString get_instance_help (int id) const
 get the help of an IMEngine instance. More...
 
String get_instance_icon_file (int id) const
 get the icon file of an IMEngine instance. More...
 
bool process_key_event (int id, const KeyEvent &key) const
 process a key event using specific IMEngine instance. More...
 
void move_preedit_caret (int id, unsigned int pos) const
 let a specific IMEngine instance move its preedit caret. More...
 
void select_candidate (int id, unsigned int index) const
 let a specific IMEngine instance select a candidate in its current lookup table. More...
 
void update_lookup_table_page_size (int id, unsigned int page_size) const
 update the page size of a specific IMEngine instance's lookup table. More...
 
void lookup_table_page_up (int id) const
 Let a specific IMEngine instance flip its lookup table to the previous page. More...
 
void lookup_table_page_down (int id) const
 Let a specific IMEngine instance flip its lookup table to the previous page. More...
 
void reset (int id) const
 reset a specific IMEngine instance. More...
 
void focus_in (int id) const
 focus in a specific IMEngine instance. More...
 
void focus_out (int id) const
 focus out a specific IMEngine instance. More...
 
void trigger_property (int id, const String &property) const
 trigger a property of a specific IMEngine instance. More...
 
void process_helper_event (int id, const String &helper_uuid, const Transaction &trans) const
 let a specific IMEngine instance to process the events sent from a Helper process. More...
 
void update_client_capabilities (int id, unsigned int cap) const
 let a specific IMEngine instance to update itself according to the capabilities of the client application. More...
 
Virtual protected methods.

The following methods should be implemented by derivation classes. these functions handle the real things.

virtual void show_preedit_string (int id)
 show preedit string area for an IMEngine instance. More...
 
virtual void show_aux_string (int id)
 show aux string area for an IMEngine instance. More...
 
virtual void show_lookup_table (int id)
 show lookup table area for an IMEngine instance. More...
 
virtual void hide_preedit_string (int id)
 hide preedit string area for an IMEngine instance. More...
 
virtual void hide_aux_string (int id)
 hide aux string area for an IMEngine instance. More...
 
virtual void hide_lookup_table (int id)
 hide lookup table area for an IMEngine instance. More...
 
virtual void update_preedit_caret (int id, int caret)
 update the position of preedit caret for an IMEngine instance. More...
 
virtual void update_preedit_string (int id, const WideString &str, const AttributeList &attrs)
 update the content of preedit string for an IMEngine instance. More...
 
virtual void update_aux_string (int id, const WideString &str, const AttributeList &attrs)
 update the content of aux string for an IMEngine instance. More...
 
virtual void update_lookup_table (int id, const LookupTable &table)
 update the content of lookup table for an IMEngine instance. More...
 
virtual void commit_string (int id, const WideString &str)
 commit a string to client for an IMEngine instance. More...
 
virtual void forward_key_event (int id, const KeyEvent &key)
 forward a keyevent to the client of an IMEngine instance. More...
 
virtual void register_properties (int id, const PropertyList &properties)
 register all the properties of an IMEngine instance into this FrontEnd. More...
 
virtual void update_property (int id, const Property &property)
 update a property of an IMEngine instance. More...
 
virtual void beep (int id)
 generate a short beep. More...
 
virtual void start_helper (int id, const String &helper_uuid)
 start a Client Helper process. More...
 
virtual void stop_helper (int id, const String &helper_uuid)
 stop a Client Helper process. More...
 
virtual void send_helper_event (int id, const String &helper_uuid, const Transaction &trans)
 send an events transaction to a Client Helper process. More...
 
virtual bool get_surrounding_text (int id, WideString &text, int &cursor, int maxlen_before, int maxlen_after)
 Retrieves context around the insertion point. More...
 
virtual bool delete_surrounding_text (int id, int offset, int len)
 Ask the client to delete characters around the cursor position. More...
 
- Protected Member Functions inherited from scim::ReferencedObject
 ReferencedObject ()
 Constructor. More...
 
virtual ~ReferencedObject ()=0
 Destructor. More...
 
void set_referenced (bool reference)
 

Friends

class FrontEndBaseImpl
 

Detailed Description

The base class to implement the FrontEnd objects.

FrontEnd is an interface between IMEngineFactory/IMEngineInstance objects and the user applications. It forward the user requests to IMEngineFactory/IMEngineInstance objects, and handle the requests sent back.

Constructor & Destructor Documentation

◆ FrontEndBase()

scim::FrontEndBase::FrontEndBase ( const BackEndPointer backend)

Constructor.

Parameters
backendA BackEnd object which holds all IMEngineFactory objects.

◆ ~FrontEndBase()

virtual scim::FrontEndBase::~FrontEndBase ( )
virtual

Virtual destructor.

Member Function Documentation

◆ get_factory_list_for_encoding()

uint32 scim::FrontEndBase::get_factory_list_for_encoding ( std::vector< String > &  uuids,
const String encoding 
) const
protected

Get the IMEngine factories list for specific encoding.

Parameters
uuidsthe vector to store the factories' uuids which support the encoding.
encodingthe encoding to be queried. If empty, all IMEngine factories will be returned.
Returns
the number of IMEngine factories found.

◆ get_factory_list_for_language()

uint32 scim::FrontEndBase::get_factory_list_for_language ( std::vector< String > &  uuids,
const String language 
) const
protected

Get the IMEngine factories list for specific language.

Parameters
uuidsthe vector to store the factories' uuids which support the encoding.
languagethe language to be queried. If empty, all IMEngine factories will be returned.
Returns
the number of IMEngine factories found.

◆ get_default_factory()

String scim::FrontEndBase::get_default_factory ( const String language,
const String encoding 
) const
protected

Get the default IMEngineFactory UUID for a specific language and encoding.

Parameters
languagethe language to be queried.
encodingthe encoding to be queried, if empty then don't match encoding.
Returns
the UUID of the default IMEngineFactory for this language.

◆ set_default_factory()

void scim::FrontEndBase::set_default_factory ( const String language,
const String uuid 
)
protected

Set the default IMEngineFactory for a specific language.

Parameters
languagethe language to be set.
uuidthe uuid of the default IMEngineFactory for this language.

◆ get_next_factory()

String scim::FrontEndBase::get_next_factory ( const String language,
const String encoding,
const String cur_uuid 
) const
protected

Get the next IMEngineFactory for a specific language and encoding.

Parameters
languagethe language to be queried, if empty then don't match language.
encodingthe encoding to be queried, if empty then don't match encoding.
cur_uuidthe UUID of current IMEngineFactory.
Returns
the UUID of the next IMEngineFactory for this language and encoding corresponding to the current IMEngineFactory.

◆ get_previous_factory()

String scim::FrontEndBase::get_previous_factory ( const String language,
const String encoding,
const String cur_uuid 
) const
protected

Get the previous IMEngineFactory for a specific language and encoding.

Parameters
languagethe language to be queried, if empty then don't match language.
encodingthe encoding to be queried, if empty then don't match encoding.
cur_uuidthe UUID of current IMEngineFactory.
Returns
the UUID of the previous IMEngineFactory for this language and encoding corresponding to the current IMEngineFactory.

◆ get_factory_name()

WideString scim::FrontEndBase::get_factory_name ( const String uuid) const
protected

get the name of an IMEngine factory.

Parameters
uuidthe uuid of the IMEngine factory
Returns
the name of the IMEngine factory.

◆ get_factory_authors()

WideString scim::FrontEndBase::get_factory_authors ( const String uuid) const
protected

get the authors info of an IMEngine factory.

Parameters
uuidthe uuid of the IMEngine factory
Returns
the authors info of the IMEngine factory.

◆ get_factory_credits()

WideString scim::FrontEndBase::get_factory_credits ( const String uuid) const
protected

get the credits info of an IMEngine factory.

Parameters
uuidthe uuid of the IMEngine factory
Returns
the credits info of the IMEngine factory.

◆ get_factory_help()

WideString scim::FrontEndBase::get_factory_help ( const String uuid) const
protected

get the help info of an IMEngine factory.

Parameters
uuidthe uuid of the IMEngine factory
Returns
the help info of the IMEngine factory.

◆ get_factory_icon_file()

String scim::FrontEndBase::get_factory_icon_file ( const String uuid) const
protected

get the icon file of an IMEngine factory.

Parameters
uuidthe uuid of the IMEngine factory
Returns
the icon file name of the IMEngine factory.

◆ get_factory_locales()

String scim::FrontEndBase::get_factory_locales ( const String uuid) const
protected

get the supported locales of an IMEngine factory.

Parameters
uuidthe uuid of the IMEngine factory
Returns
a comma separated list of the supported locales.

◆ get_factory_language()

String scim::FrontEndBase::get_factory_language ( const String uuid) const
protected

get the language of an IMEngine factory.

Parameters
uuidthe uuid of the IMEngine factory
Returns
the language of this IMEngine factory.

◆ validate_factory()

bool scim::FrontEndBase::validate_factory ( const String uuid,
const String encoding = String("") 
) const
protected

Check if an IMEngine factory is valid and the given encoding is supported by it.

Parameters
uuidThe uuid of the IMEngine factory to be checked.
encodingThe encoding should be supported by the factory.
Returns
true if the factory is valid and the given encoding is supported.

◆ get_all_locales()

String scim::FrontEndBase::get_all_locales ( ) const
protected

get all locales supported by BackEnd.

Returns
a comman separated list of all supported locales.

◆ new_instance()

int scim::FrontEndBase::new_instance ( const String sf_uuid,
const String encoding 
)
protected

create a new IMEngine instance for specific encoding.

Parameters
sf_uuidthe IMEngineFactory UUID.
encodingthe encoding to be used.
Returns
the newly created IMEngine instance id, -1 means error occurred.

◆ replace_instance()

bool scim::FrontEndBase::replace_instance ( int  si_id,
const String sf_uuid 
)
protected

replace an IMEngine instance by a new instance created by another factory.

This function is used to change the input method for an input context on the fly.

Parameters
si_idthe IMEngine instance to be replaced.
sf_uuidthe new IMEngine factory to be used.
Returns
true if success.

◆ delete_instance()

bool scim::FrontEndBase::delete_instance ( int  id)
protected

delete an IMEngine instance according to its id.

Parameters
idthe id of the IMEngine instance to be deleted.
Returns
true if success, false if there is no such instance.

◆ delete_all_instances()

void scim::FrontEndBase::delete_all_instances ( )
protected

delete all IMEngine instances.

This function should be called just before quitting the FrontEnd.

◆ get_instance_uuid()

String scim::FrontEndBase::get_instance_uuid ( int  id) const
protected

get the factory uuid of this instance.

Parameters
idthe IMEngine instance id.
Returns
the factory uuid of this instance.

◆ get_instance_encoding()

String scim::FrontEndBase::get_instance_encoding ( int  id) const
protected

get the working encoding of an IMEngine instance.

Parameters
idthe IMEngine instance id.
Returns
the working encoding of this IMEngine instance.

◆ get_instance_name()

WideString scim::FrontEndBase::get_instance_name ( int  id) const
protected

get the name of an IMEngine instance.

Parameters
idthe IMEngine instance id.
Returns
the name of this IMEngine instance, aka. the name of its factory.

◆ get_instance_authors()

WideString scim::FrontEndBase::get_instance_authors ( int  id) const
protected

get the authors info of an IMEngine instance.

Parameters
idthe IMEngine instance id.
Returns
the authors info of this IMEngine instance, aka. the authors of its factory.

◆ get_instance_credits()

WideString scim::FrontEndBase::get_instance_credits ( int  id) const
protected

get the credits info of an IMEngine instance.

Parameters
idthe IMEngine instance id.
Returns
the credits info of this IMEngine instance, aka. the credits of its factory.

◆ get_instance_help()

WideString scim::FrontEndBase::get_instance_help ( int  id) const
protected

get the help of an IMEngine instance.

Parameters
idthe IMEngine instance id.
Returns
the help of this IMEngine instance, aka. the help of its factory.

◆ get_instance_icon_file()

String scim::FrontEndBase::get_instance_icon_file ( int  id) const
protected

get the icon file of an IMEngine instance.

Parameters
idthe IMEngine instance id.
Returns
the icon file name of this IMEngine instance.

◆ process_key_event()

bool scim::FrontEndBase::process_key_event ( int  id,
const KeyEvent key 
) const
protected

process a key event using specific IMEngine instance.

Parameters
idthe IMEngine instance id.
keythe key event to be processed.
Returns
true if the event was processed successfully, false if the event was not processed and should be forward to the client application.

◆ move_preedit_caret()

void scim::FrontEndBase::move_preedit_caret ( int  id,
unsigned int  pos 
) const
protected

let a specific IMEngine instance move its preedit caret.

Parameters
idthe IMEngine instance id.
posthe new preedit caret position.

◆ select_candidate()

void scim::FrontEndBase::select_candidate ( int  id,
unsigned int  index 
) const
protected

let a specific IMEngine instance select a candidate in its current lookup table.

Parameters
idthe IMEngine instance id.
indexthe candidate index in current lookup table page to be selected.

◆ update_lookup_table_page_size()

void scim::FrontEndBase::update_lookup_table_page_size ( int  id,
unsigned int  page_size 
) const
protected

update the page size of a specific IMEngine instance's lookup table.

Parameters
idthe IMEngine instance id.
page_sizethe new page size to be used.

◆ lookup_table_page_up()

void scim::FrontEndBase::lookup_table_page_up ( int  id) const
protected

Let a specific IMEngine instance flip its lookup table to the previous page.

◆ lookup_table_page_down()

void scim::FrontEndBase::lookup_table_page_down ( int  id) const
protected

Let a specific IMEngine instance flip its lookup table to the previous page.

◆ reset()

void scim::FrontEndBase::reset ( int  id) const
protected

reset a specific IMEngine instance.

Parameters
idthe id of the IMEngine instance to be reset.

◆ focus_in()

void scim::FrontEndBase::focus_in ( int  id) const
protected

focus in a specific IMEngine instance.

Parameters
idthe id of the IMEngine instance to be focused in.

◆ focus_out()

void scim::FrontEndBase::focus_out ( int  id) const
protected

focus out a specific IMEngine instance.

Parameters
idthe id of the IMEngine instance to be focused out.

◆ trigger_property()

void scim::FrontEndBase::trigger_property ( int  id,
const String property 
) const
protected

trigger a property of a specific IMEngine instance.

Parameters
idthe id of the IMEngine instance.
propertythe key of the property to be triggered.

◆ process_helper_event()

void scim::FrontEndBase::process_helper_event ( int  id,
const String helper_uuid,
const Transaction trans 
) const
protected

let a specific IMEngine instance to process the events sent from a Helper process.

Parameters
idthe id of the IMEngine instance.
helper_uuidthe uuid of the Helper process.
transthe transaction which contains the events.

◆ update_client_capabilities()

void scim::FrontEndBase::update_client_capabilities ( int  id,
unsigned int  cap 
) const
protected

let a specific IMEngine instance to update itself according to the capabilities of the client application.

Parameters
idthe id of the IMEngine instance.
capthe bitset of the capabilities which are supported by client.

◆ show_preedit_string()

virtual void scim::FrontEndBase::show_preedit_string ( int  id)
protectedvirtual

show preedit string area for an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.

◆ show_aux_string()

virtual void scim::FrontEndBase::show_aux_string ( int  id)
protectedvirtual

show aux string area for an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.

◆ show_lookup_table()

virtual void scim::FrontEndBase::show_lookup_table ( int  id)
protectedvirtual

show lookup table area for an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.

◆ hide_preedit_string()

virtual void scim::FrontEndBase::hide_preedit_string ( int  id)
protectedvirtual

hide preedit string area for an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.

◆ hide_aux_string()

virtual void scim::FrontEndBase::hide_aux_string ( int  id)
protectedvirtual

hide aux string area for an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.

◆ hide_lookup_table()

virtual void scim::FrontEndBase::hide_lookup_table ( int  id)
protectedvirtual

hide lookup table area for an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.

◆ update_preedit_caret()

virtual void scim::FrontEndBase::update_preedit_caret ( int  id,
int  caret 
)
protectedvirtual

update the position of preedit caret for an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
caretthe new caret position.

◆ update_preedit_string()

virtual void scim::FrontEndBase::update_preedit_string ( int  id,
const WideString str,
const AttributeList attrs 
)
protectedvirtual

update the content of preedit string for an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
strthe new content of preedit string.
attrsthe string attributes.

◆ update_aux_string()

virtual void scim::FrontEndBase::update_aux_string ( int  id,
const WideString str,
const AttributeList attrs 
)
protectedvirtual

update the content of aux string for an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
strthe new content of aux string.
attrsthe string attributes.

◆ update_lookup_table()

virtual void scim::FrontEndBase::update_lookup_table ( int  id,
const LookupTable table 
)
protectedvirtual

update the content of lookup table for an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
tablethe new lookup table.

◆ commit_string()

virtual void scim::FrontEndBase::commit_string ( int  id,
const WideString str 
)
protectedvirtual

commit a string to client for an IMEngine instance.

Parameters
idthe id of the IMEngine instance to commit the string.
strthe string to be committed.

◆ forward_key_event()

virtual void scim::FrontEndBase::forward_key_event ( int  id,
const KeyEvent key 
)
protectedvirtual

forward a keyevent to the client of an IMEngine instance.

Parameters
idthe id of the IMEngine instance.
keythe key event to be forwarded.

◆ register_properties()

virtual void scim::FrontEndBase::register_properties ( int  id,
const PropertyList properties 
)
protectedvirtual

register all the properties of an IMEngine instance into this FrontEnd.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
propertiesthe PropertyList contains all the properties of this IMEngine instance.

◆ update_property()

virtual void scim::FrontEndBase::update_property ( int  id,
const Property property 
)
protectedvirtual

update a property of an IMEngine instance.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
propertythe Property to be updated.

◆ beep()

virtual void scim::FrontEndBase::beep ( int  id)
protectedvirtual

generate a short beep.

Parameters
idthe id of the IMEngine instance. It must have been focused in.

◆ start_helper()

virtual void scim::FrontEndBase::start_helper ( int  id,
const String helper_uuid 
)
protectedvirtual

start a Client Helper process.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
helper_uuidThe UUID of the Helper object.

◆ stop_helper()

virtual void scim::FrontEndBase::stop_helper ( int  id,
const String helper_uuid 
)
protectedvirtual

stop a Client Helper process.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
helper_uuidThe UUID of the Helper object.

◆ send_helper_event()

virtual void scim::FrontEndBase::send_helper_event ( int  id,
const String helper_uuid,
const Transaction trans 
)
protectedvirtual

send an events transaction to a Client Helper process.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
helper_uuidThe UUID of the Helper object.
transthe transaction which contains events.

◆ get_surrounding_text()

virtual bool scim::FrontEndBase::get_surrounding_text ( int  id,
WideString text,
int &  cursor,
int  maxlen_before,
int  maxlen_after 
)
protectedvirtual

Retrieves context around the insertion point.

Input methods typically want context in order to constrain input text based on existing text; this is important for languages such as Thai where only some sequences of characters are allowed.

Unlike other signal activation actions, this action will return the result immediately.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
textlocation to store the context string around the insertion point.
cursorlocation to store index of the insertion cursor within .
maxlen_beforethe maxmium length of context string to be retrieved before the cursor; -1 means unlimited.
maxlen_afterthe maxmium length of context string to be retrieved after the cursor; -1 means unlimited.
Returns
true if surrounding text was provided.

◆ delete_surrounding_text()

virtual bool scim::FrontEndBase::delete_surrounding_text ( int  id,
int  offset,
int  len 
)
protectedvirtual

Ask the client to delete characters around the cursor position.

In order to use this function, you should first call get_surrounding_text () to get the current context, and call this function immediately afterwards to make sure that you know what you are deleting. You should also account for the fact that even if the signal was handled, the input context might not have deleted all the characters that were requested to be deleted.

Parameters
idthe id of the IMEngine instance. It must have been focused in.
offsetoffset from cursor position in chars; a negative value means start before the cursor.
lennumber of characters to delete.
Returns
true if the signal was handled.

◆ init()

virtual void scim::FrontEndBase::init ( int  argc,
char **  argv 
)
pure virtual

init the frontend.

This method must be implemented by derivation classes.

◆ run()

virtual void scim::FrontEndBase::run ( )
pure virtual

run the frontend.

This method must be implemented by derivation classes.

Friends And Related Function Documentation

◆ FrontEndBaseImpl

friend class FrontEndBaseImpl
friend

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