Interface

PosCompleter

Description [src]

interface Pos.Completer : GObject.Object

Interface for completion engines.

Completion engines implement this interface so they can be used by the OSK to complete or correct user input. Users of this interface should fill the PosCompleter:preedit with user input and will get a list of possible completions in the completions property. Note that this can happen asynchronously as getting the completions can take time.

The completer can also instruct the user of this interface to commit a given text via the PosCompleter::commit-string signal. Implementations should emit this signal on word breaking characters to either take the user input as is or force “aggressive” autocorrection (picking a correction on the users behalf).

Prerequisite

In order to implement Completer, your type must inherit fromGObject.

Functions

pos_completer_error_quark
No description available.

Instance methods

pos_completer_feed_symbol

Feeds a symbol to be processed by the completer.

pos_completer_get_after_text

Returns the current PosCompleter:after-text.

pos_completer_get_before_text

Returns the current PosCompleter:before-text.

pos_completer_get_completions

Returns the current possible completions.

pos_completer_get_display_name
No description available.

pos_completer_get_name

Returns the completers name.

pos_completer_get_preedit

Returns the current preedit.

pos_completer_set_language

Let the completer pick a language based on the given language code and region. If an error occurs FALSE is returned and error set to the error.

pos_completer_set_preedit

Sets the current preedit. The preedit is the current word under completion.

pos_completer_set_surrounding_text

Set the text before and after the current cursor position. This can be used by the completer to improve the prediction.

Properties

Pos.Completer:after-text

The text after the current cursor position. The completer has to make sense of it e.g. by parsing forward for the next word end.

Pos.Completer:before-text

The text before the current cursor position. The completer has to make sense of it e.g. by parsing backwards for the last separation char. No guarantee is made that it contains the start of a sentence. It should be used as context for better completions.

Pos.Completer:completions

The list of completions for a given preedit.

Pos.Completer:name

The name of this completer.

Pos.Completer:preedit

The preedit is not yet submitted text at the current cursor position.

Signals

Pos.Completer::commit-string

The completer wants the given text to be committed as is. This can happen when the completer encounters a word separating character (e.g. space). preedit will be set to empty in this case.

Pos.Completer::update

The completer changed it’s preedit to the given string and wants the given number of bytes before and after the preedit removed.

Interface structure

struct PosCompleterInterface {
  GTypeInterface parent_iface;
  const char* (* get_name) (
    PosCompleter* self
  );
  gboolean (* feed_symbol) (
    PosCompleter* self,
    const char* symbol
  );
  const char* (* get_preedit) (
    PosCompleter* self
  );
  void (* set_preedit) (
    PosCompleter* self,
    const char* preedit
  );
  const char* (* get_before_text) (
    PosCompleter* self
  );
  const char* (* get_after_text) (
    PosCompleter* self
  );
  void (* set_surrounding_text) (
    PosCompleter* self,
    const char* before_text,
    const char* after_text
  );
  gboolean (* set_language) (
    PosCompleter* self,
    const char* lang,
    const char* region,
    GError** error
  );
  char* (* get_display_name) (
    PosCompleter* self
  );
  
}
No description available.
Interface members
parent_iface
GTypeInterface
 No description available.
get_name
const char* (* get_name) (
    PosCompleter* self
  )
 No description available.
feed_symbol
gboolean (* feed_symbol) (
    PosCompleter* self,
    const char* symbol
  )
 No description available.
get_preedit
const char* (* get_preedit) (
    PosCompleter* self
  )
 No description available.
set_preedit
void (* set_preedit) (
    PosCompleter* self,
    const char* preedit
  )
 No description available.
get_before_text
const char* (* get_before_text) (
    PosCompleter* self
  )
 No description available.
get_after_text
const char* (* get_after_text) (
    PosCompleter* self
  )
 No description available.
set_surrounding_text
void (* set_surrounding_text) (
    PosCompleter* self,
    const char* before_text,
    const char* after_text
  )
 No description available.
set_language
gboolean (* set_language) (
    PosCompleter* self,
    const char* lang,
    const char* region,
    GError** error
  )
 No description available.
get_display_name
char* (* get_display_name) (
    PosCompleter* self
  )
 No description available.

Virtual methods

Pos.Completer.feed_symbol

Feeds a symbol to be processed by the completer.

Pos.Completer.get_after_text

Returns the current PosCompleter:after-text.

Pos.Completer.get_before_text

Returns the current PosCompleter:before-text.

Pos.Completer.get_display_name
No description available.

Pos.Completer.get_name

Returns the completers name.

Pos.Completer.get_preedit

Returns the current preedit.

Pos.Completer.set_language

Let the completer pick a language based on the given language code and region. If an error occurs FALSE is returned and error set to the error.

Pos.Completer.set_preedit

Sets the current preedit. The preedit is the current word under completion.

Pos.Completer.set_surrounding_text

Set the text before and after the current cursor position. This can be used by the completer to improve the prediction.