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 gtk.entry_completion.EntryCompletion.matchSelected 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 gtk.entry_completion.EntryCompletion.matchSelected and gtk.entry_completion.EntryCompletion.cursorOnMatch take the original model and an iter pointing to that model as arguments, other callbacks and signals (such as gtk.types.CellLayoutDataFunc or gtk.cell_area.CellArea.applyAttributes 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 _getGType() static nothrow
GType _gType() @property nothrow
EntryCompletion self() nothrowReturns `this`, for use in `with` statements.
EntryCompletionGidBuilder builder() static nothrowGet builder for [gtk.entry_completion.EntryCompletion] Returns: New builder object
gtk.cell_area.CellArea cellArea() @property nothrowGet `cellArea` property. Returns: The [gtk.cell_area.CellArea] used to layout cell renderers in the treeview column.
bool inlineCompletion() @property nothrowGet `inlineCompletion` property. Returns: Determines whether the common prefix of the possible completions should be inserted automatically in the entry.
void inlineCompletion(bool propval) @property nothrowSet `inlineCompletion` property. Params: propval = Determines whether the common prefix of the possible completions should be inserted automatically in the entry.
bool inlineSelection() @property nothrowGet `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) @property nothrowSet `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 nothrow
void minimumKeyLength(int propval) @property nothrow
gtk.tree_model.TreeModel model() @property nothrow
void model(gtk.tree_model.TreeModel propval) @property nothrow
bool popupCompletion() @property nothrowGet `popupCompletion` property. Returns: Determines whether the possible completions should be shown in a popup window.
void popupCompletion(bool propval) @property nothrowSet `popupCompletion` property. Params: propval = Determines whether the possible completions should be shown in a popup window.
bool popupSetWidth() @property nothrowGet `popupSetWidth` property. Returns: Determines whether the completions popup window will be resized to the width of the entry.
void popupSetWidth(bool propval) @property nothrowSet `popupSetWidth` property. Params: propval = Determines whether the completions popup window will be resized to the width of the entry.
bool popupSingleMatch() @property nothrowGet `popupSingleMatch` property. Returns: Determines whether the completions popup window will shown for a single possible completion.
void popupSingleMatch(bool propval) @property nothrowSet `popupSingleMatch` property. Params: propval = Determines whether the completions popup window will shown for a single possible completion.
int textColumn() @property nothrowGet `textColumn` property. Returns: The column of the model containing the strings.
void textColumn(int propval) @property nothrowSet `textColumn` property. Params: propval = The column of the model containing the strings.
gtk.entry_completion.EntryCompletion newWithArea(gtk.cell_area.CellArea area) static nothrowCreates a new [gtk.entry_completion.EntryCompletion] object using the specified area.
void complete() nothrowRequests a completion operation, or in other words a refiltering of the current list with completions, using the current key.
string computePrefix(string key) nothrowComputes the common prefix that is shared by all rows in completion that start with key.
string getCompletionPrefix() nothrowGet 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() nothrowGets the entry completion has been attached to. Returns: The entry completion has been attached to
bool getInlineCompletion() nothrowReturns 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() nothrowReturns true if inline-selection mode is turned on. Returns: true if inline-selection mode is on
int getMinimumKeyLength() nothrowReturns the minimum key length as set for completion. Returns: The currently used minimum key length
gtk.tree_model.TreeModel getModel() nothrowReturns the model the [gtk.entry_completion.EntryCompletion] is using as data source.
bool getPopupCompletion() nothrowReturns whether the completions should be presented in a popup window. Returns: true if popup completion is turned on
bool getPopupSetWidth() nothrowReturns 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() nothrowReturns 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() nothrowReturns the column in the model of completion to get strings from. Returns: the column containing the strings
void insertPrefix() nothrowRequests a prefix insertion.
void setInlineCompletion(bool inlineCompletion) nothrowSets whether the common prefix of the possible completions should be automatically inserted in the entry.
void setInlineSelection(bool inlineSelection) nothrowSets whether it is possible to cycle through the possible completions inside the entry.
void setMatchFunc(gtk.types.EntryCompletionMatchFunc func) nothrowSets the match function for completion to be func.
void setMinimumKeyLength(int length) nothrowRequires the length of the search key for completion to be at least length.
void setModel(gtk.tree_model.TreeModel model = null) nothrowSets the model for a [gtk.entry_completion.EntryCompletion].
void setPopupCompletion(bool popupCompletion) nothrowSets whether the completions should be presented in a popup window.
void setPopupSetWidth(bool popupSetWidth) nothrowSets whether the completion popup window will be resized to be the same width as the entry.
void setPopupSingleMatch(bool popupSingleMatch) nothrowSets whether the completion popup window will appear even if there is only a single match.
void setTextColumn(int column) nothrowConvenience 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) nothrowConnect 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) nothrowConnect 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) nothrowConnect 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) nothrowConnect to `NoMatches` signal.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new [gtk.entry_completion.EntryCompletion] object. Returns: A newly created [gtk.entry_completion.EntryCompletion] object

Fluent builder implementation template for gtk.entry_completion.EntryCompletion

Methods
T cellArea(gtk.cell_area.CellArea propval) nothrowSet `cellArea` property. Params: propval = The [gtk.cell_area.CellArea] used to layout cell renderers in the treeview column.
T inlineCompletion(bool propval) nothrowSet `inlineCompletion` property. Params: propval = Determines whether the common prefix of the possible completions should be inserted automatically in the entry.
T inlineSelection(bool propval) nothrowSet `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) nothrow
T model(gtk.tree_model.TreeModel propval) nothrow
T popupCompletion(bool propval) nothrowSet `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) nothrowSet `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) nothrowSet `popupSingleMatch` property. Params: propval = Determines whether the completions popup window will shown for a single possible completion.
T textColumn(int propval) nothrowSet `textColumn` property. Params: propval = The column of the model containing the strings.
Methods
EntryCompletion build() nothrowCreate object from builder. Returns: New object