gtk-entry-completion is an auxiliary object to be used in conjunction with gtk-entry to provide the completion functionality. It implements the gtk-cell-layout interface, to allow the user to add extra cells to the gtk-tree-view with completion matches.
"Completion functionality" means that when the user modifies the text in the entry, gtk-entry-completion checks which rows in the model match the current content of the entry, and displays a list of matches. By default, the matching is done by comparing the entry text case-insensitively against the text column of the model, see the function gtk-entry-completion-text-column, but this can be overridden with a custom match function, see the function gtk-entry-completion-set-match-func.
When the user selects a completion, the content of the entry is updated. By default, the content of the entry is replaced by the text column of the model, but this can be overridden by connecting to the "match-selected" signal and updating the entry in the signal handler. Note that you should return true from the signal handler to suppress the default behaviour.
To add completion functionality to an entry, use the function gtk-entry-set-completion.
In addition to regular completion matches, which will be inserted into the entry when they are selected, gtk-entry-completion also allows to display "actions" in the popup window. Their appearance is similar to menu items, to differentiate them clearly from completion strings. When an action is selected, the "action-activated" signal is emitted.
gtk-entry-completion uses a gtk-tree-model-filter model to represent the subset of the entire model that is currently matching. While the gtk-entry-completion signals "match-selected" and "cursor-on-match" take the original model and an iter pointing to that model as arguments, other callbacks and signals, such as GtkCellLayoutDataFuncs or "apply-attributes", will generally take the filter model as argument. As long as you are only calling the function gtk-tree-model-get, this will make no difference to you. If for some reason, you need the original model, use the function gtk-tree-model-filter-get-model. Do not forget to use the function gtk-tree-model-filter-convert-iter-to-child-iter to obtain a matching iter.
The "action-activated" signal
lambda (widget index) : Run LastGets emitted when an action is activated.
The "cursor-on-match" signal
lambda (widget model iter) : Run LastGets emitted when a match from the cursor is on a match of the list. The default behaviour is to replace the contents of the entry with the contents of the text column in the row pointed to by iter. Note that model is the model that was passed to the function gtk-entry-completion-model.
The "insert-prefix" signal
lambda (widget prefix) : Run LastGets emitted when the inline autocompletion is triggered. The default behaviour is to make the entry display the whole prefix and select the newly inserted part. Applications may connect to this signal in order to insert only a smaller part of the prefix into the entry - e. g. the entry used in the gtk-file-chooser inserts only the part of the prefix up to the next '/'.
The "match-selected" signal
lambda (widget model iter) : Run LastGets emitted when a match from the list is selected. The default behaviour is to replace the contents of the entry with the contents of the text column in the row pointed to by iter. Note that model is the model that was passed to the function gtk-entry-completion-model.
The "no-matches" signal
lambda (widget) : Run LastGets emitted when the filter model has zero number of rows in completion_complete method. In other words when gtk-entry-completion is out of suggestions.
Slot Access Functions
Inherited Slot Access Functions