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
.
Instance methods
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.
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
);
}
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. | |
get_before_text |
|
No description available. | |
get_after_text |
|
No description available. | |
set_surrounding_text |
|
No description available. | |
set_language |
|
No description available. | |
get_display_name |
|
No description available. |
Virtual methods
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.