EntryCompletion
GtkEntryCompletion
is an auxiliary object to provide completion functionality for GtkEntry
.
It implements the iface@Gtk.CellLayout interface, to allow the user to add extra cells to the GtkTreeView
with completion matches.
“Completion functionality” means that when the user modifies the text in the entry, GtkEntryCompletion
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 method@Gtk.EntryCompletion.set_text_column), but this can be overridden with a custom match function (see method@Gtk.EntryCompletion.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 signal@Gtk.EntryCompletion::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 method@Gtk.Entry.set_completion.
GtkEntryCompletion
uses a class@Gtk.TreeModelFilter model to represent the subset of the entire model that is currently matching. While the GtkEntryCompletion
signals signal@Gtk.EntryCompletion::match-selected and signal@Gtk.EntryCompletion::cursor-on-match take the original model and an iter pointing to that model as arguments, other callbacks and signals (such as GtkCellLayoutDataFunc
or signal@Gtk.CellArea::apply-attributes) will generally take the filter model as argument. As long as you are only calling method@Gtk.TreeModel.get, this will make no difference to you. If for some reason, you need the original model, use method@Gtk.TreeModelFilter.get_model. Don’t forget to use method@Gtk.TreeModelFilter.convert_iter_to_child_iter to obtain a matching iter.
Skipped during bindings generation
method
cell-area
: Property has no getter nor setter
Constructors
Properties
Determines whether the common prefix of the possible completions should be inserted automatically in the entry.
Determines whether the possible completions on the popup will appear in the entry as you navigate through them.
The minimum key length as set for completion.
Determines whether the possible completions should be shown in a popup window.
Determines whether the completions popup window will be resized to the width of the entry.
Determines whether the completions popup window will shown for a single possible completion.
The column of the model containing the strings.
Functions
Adds an attribute mapping to the list in @cell_layout.
Clears all existing attributes previously set with gtk_cell_layout_set_attributes().
Computes the common prefix that is shared by all rows in @completion that start with @key.
Emitted when a match from the cursor is on a match of the list.
Emitted when the inline autocompletion is triggered.
Emitted when a match from the list is selected.
Emitted when the filter model has zero number of rows in completion_complete method.
Gets the ID of the @buildable object.
Get the original text entered by the user that triggered the completion or null if there’s no completion ongoing.
Requests a prefix insertion.
Adds the @cell to the end of @cell_layout. If @expand is false, then the
Packs the @cell into the beginning of @cell_layout. If @expand is false, then the @cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which @expand is true.
Re-inserts @cell at @position.
Sets the GtkCellLayout
DataFunc to use for @cell_layout.
Sets the match function for @completion to be @func.