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_capitalize_by_template
Returns a copy of completions with the capitalization of the strings set to match the capitalization in the template. Use with the preedit as template with completers which return only lower case completions.
pos_completer_find_prev_word_break
Scans text from the end and returns the last word break in bytes
counted from the end of the string. The word break is the position
of the last two words separated by completion_end_symbols.
Instance methods
pos_completer_lookup_completion
Given a given completion string lookup what should actually be completed. This allows completers to e.g. provide the full word as completion “handle” and fill in just the last chars as actual completions.
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.
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
);
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
);
void (* learn_accepted) (
PosCompleter* self,
const char* word
);
const char* (* lookup_completion) (
PosCompleter* self,
const char* completion
);
}
No description available.
Interface members
parent_iface |
|
No description available. |
|
get_name |
|
No description available. |
|
feed_symbol |
|
No description available. |
|
get_preedit |
|
No description available. |
|
set_preedit |
|
No description available. |
|
set_surrounding_text |
|
No description available. |
|
set_language |
|
No description available. |
|
get_display_name |
|
No description available. |
|
learn_accepted |
|
No description available. |
|
lookup_completion |
|
No description available. |
Virtual methods
Pos.Completer.lookup_completion
Given a given completion string lookup what should actually be completed. This allows completers to e.g. provide the full word as completion “handle” and fill in just the last chars as actual completions.
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.