gtk.entry_completion

Module for [EntryCompletion] class

Types 3

[gtk.entry_completion.EntryCompletion] is an auxiliary object to provide completion functionality for [gtk.entry.Entry].

It implements the [gtk.cell_layout.CellLayout] interface, to allow the user to add extra cells to the [gtk.tree_view.TreeView] with completion matches.

“Completion functionality” means that when the user modifies the text in the entry, [gtk.entry_completion.EntryCompletion] 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 [gtk.entry_completion.EntryCompletion.setTextColumn]), but this can be overridden with a custom match function (see [gtk.entry_completion.EntryCompletion.setMatchFunc]).

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 [gtk.entry.Entry.setCompletion].

[gtk.entry_completion.EntryCompletion] uses a [gtk.tree_model_filter.TreeModelFilter] model to represent the subset of the entire model that is currently matching. While the [gtk.entry_completion.EntryCompletion] 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 [gtk.types.CellLayoutDataFunc] or signal@Gtk.CellArea::apply-attributes) will generally take the filter model as argument. As long as you are only calling [gtk.tree_model.TreeModel.get], this will make no difference to you. If for some reason, you need the original model, use [gtk.tree_model_filter.TreeModelFilter.getModel]. Don’t forget to use [gtk.tree_model_filter.TreeModelFilter.convertIterToChildIter] to obtain a matching iter.

Methods
GType _gType() @property
EntryCompletion self()Returns `this`, for use in `with` statements.
EntryCompletionGidBuilder builder()Get builder for [gtk.entry_completion.EntryCompletion] Returns: New builder object
gtk.cell_area.CellArea cellArea() @propertyGet `cellArea` property. Returns: The [gtk.cell_area.CellArea] used to layout cell renderers in the treeview column.
bool inlineCompletion() @propertyGet `inlineCompletion` property. Returns: Determines whether the common prefix of the possible completions should be inserted automatically in the entry.
void inlineCompletion(bool propval) @propertySet `inlineCompletion` property. Params: propval = Determines whether the common prefix of the possible completions should be inserted automatically in the entry.
bool inlineSelection() @propertyGet `inlineSelection` property. Returns: Determines whether the possible completions on the popup will appear in the entry as you navigate through them.
void inlineSelection(bool propval) @propertySet `inlineSelection` property. Params: propval = Determines whether the possible completions on the popup will appear in the entry as you navigate through them.
int minimumKeyLength() @property
void minimumKeyLength(int propval) @property
void model(gtk.tree_model.TreeModel propval) @property
bool popupCompletion() @propertyGet `popupCompletion` property. Returns: Determines whether the possible completions should be shown in a popup window.
void popupCompletion(bool propval) @propertySet `popupCompletion` property. Params: propval = Determines whether the possible completions should be shown in a popup window.
bool popupSetWidth() @propertyGet `popupSetWidth` property. Returns: Determines whether the completions popup window will be resized to the width of the entry.
void popupSetWidth(bool propval) @propertySet `popupSetWidth` property. Params: propval = Determines whether the completions popup window will be resized to the width of the entry.
bool popupSingleMatch() @propertyGet `popupSingleMatch` property. Returns: Determines whether the completions popup window will shown for a single possible completion.
void popupSingleMatch(bool propval) @propertySet `popupSingleMatch` property. Params: propval = Determines whether the completions popup window will shown for a single possible completion.
int textColumn() @propertyGet `textColumn` property. Returns: The column of the model containing the strings.
void textColumn(int propval) @propertySet `textColumn` property. Params: propval = The column of the model containing the strings.
gtk.entry_completion.EntryCompletion newWithArea(gtk.cell_area.CellArea area)Creates a new [gtk.entry_completion.EntryCompletion] object using the specified area.
void complete()Requests a completion operation, or in other words a refiltering of the current list with completions, using the current key.
string computePrefix(string key)Computes the common prefix that is shared by all rows in completion that start with key.
string getCompletionPrefix()Get the original text entered by the user that triggered the completion or null if there’s no completion ongoing. Returns: the prefix for the current completion
gtk.widget.Widget getEntry()Gets the entry completion has been attached to. Returns: The entry completion has been attached to
bool getInlineCompletion()Returns whether the common prefix of the possible completions should be automatically inserted in the entry. Returns: true if inline completion is turned on
bool getInlineSelection()Returns true if inline-selection mode is turned on. Returns: true if inline-selection mode is on
int getMinimumKeyLength()Returns the minimum key length as set for completion. Returns: The currently used minimum key length
gtk.tree_model.TreeModel getModel()Returns the model the [gtk.entry_completion.EntryCompletion] is using as data source.
bool getPopupCompletion()Returns whether the completions should be presented in a popup window. Returns: true if popup completion is turned on
bool getPopupSetWidth()Returns whether the completion popup window will be resized to the width of the entry. Returns: true if the popup window will be resized to the width of the entry
bool getPopupSingleMatch()Returns whether the completion popup window will appear even if there is only a single match. Returns: true if the popup window will appear regardless of the number of matches
int getTextColumn()Returns the column in the model of completion to get strings from. Returns: the column containing the strings
void insertPrefix()Requests a prefix insertion.
void setInlineCompletion(bool inlineCompletion)Sets whether the common prefix of the possible completions should be automatically inserted in the entry.
void setInlineSelection(bool inlineSelection)Sets whether it is possible to cycle through the possible completions inside the entry.
void setMatchFunc(gtk.types.EntryCompletionMatchFunc func)Sets the match function for completion to be func.
void setMinimumKeyLength(int length)Requires the length of the search key for completion to be at least length.
void setModel(gtk.tree_model.TreeModel model = null)Sets the model for a [gtk.entry_completion.EntryCompletion].
void setPopupCompletion(bool popupCompletion)Sets whether the completions should be presented in a popup window.
void setPopupSetWidth(bool popupSetWidth)Sets whether the completion popup window will be resized to be the same width as the entry.
void setPopupSingleMatch(bool popupSingleMatch)Sets whether the completion popup window will appear even if there is only a single match.
void setTextColumn(int column)Convenience function for setting up the most used case of this code: a completion list with just strings.
gulong connectCursorOnMatch(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == bool) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.tree_model.TreeModel))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == gtk.tree_iter.TreeIter))) && (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.entry_completion.EntryCompletion))) && Parameters!T.length < 4)Connect to `CursorOnMatch` signal.
gulong connectInsertPrefix(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == bool) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == string))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.entry_completion.EntryCompletion))) && Parameters!T.length < 3)Connect to `InsertPrefix` signal.
gulong connectMatchSelected(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == bool) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.tree_model.TreeModel))) && (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == gtk.tree_iter.TreeIter))) && (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.entry_completion.EntryCompletion))) && Parameters!T.length < 4)Connect to `MatchSelected` signal.
gulong connectNoMatches(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.entry_completion.EntryCompletion))) && Parameters!T.length < 2)Connect to `NoMatches` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new [gtk.entrycompletion.EntryCompletion] object. Returns: A newly created [gtk.entrycompletion.EntryCompletion] object
Methods
T cellArea(gtk.cell_area.CellArea propval)Set `cellArea` property. Params: propval = The [gtk.cell_area.CellArea] used to layout cell renderers in the treeview column.
T inlineCompletion(bool propval)Set `inlineCompletion` property. Params: propval = Determines whether the common prefix of the possible completions should be inserted automatically in the entry.
T inlineSelection(bool propval)Set `inlineSelection` property. Params: propval = Determines whether the possible completions on the popup will appear in the entry as you navigate through them. Returns: Builder instance for fluen...
T minimumKeyLength(int propval)
T popupCompletion(bool propval)Set `popupCompletion` property. Params: propval = Determines whether the possible completions should be shown in a popup window. Returns: Builder instance for fluent chaining
T popupSetWidth(bool propval)Set `popupSetWidth` property. Params: propval = Determines whether the completions popup window will be resized to the width of the entry. Returns: Builder instance for fluent chaining
T popupSingleMatch(bool propval)Set `popupSingleMatch` property. Params: propval = Determines whether the completions popup window will shown for a single possible completion.
T textColumn(int propval)Set `textColumn` property. Params: propval = The column of the model containing the strings.

Fluent builder for [gtk.entry_completion.EntryCompletion]