Superclass: g-object buildable cell-layout
entry-completion is an auxiliary object to be used in conjunction with entry to provide the completion functionality. It implements the cell-layout interface, to allow the user to add extra cells to the tree-view with completion matches.
"Completion functionality" means that when the user modifies the text in the entry, 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 entry-completion-text-column), but this can be overridden with a custom match function (see entry-completion-match-function).
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 entry-completion::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_set_completion().
In addition to regular completion matches, which will be inserted into the entry when they are selected, GtkEntryCompletion also allows to display "actions" in the popup window. Their appearance is similar to menuitems, to differentiate them clearly from completion strings. When an action is selected, the entry-completion::action-activated signal is emitted.
Slots:
entry-completion-entry
. Read-only.
The entry completion has been attached to.
boolean
. Accessor: entry-completion-inline-completion
.
Determines whether the common prefix of the possible completions should be inserted automatically in the entry. Note that this requires text-column to be set, even if you are using a custom match function.
Default value: FALSE
boolean
. Accessor: entry-completion-inline-selection
.
Determines whether the possible completions on the popup will appear in the entry as you navigate through them.
Default value: FALSE
entry-completion-match-function
. Write-only.
Sets the match function for completion. The match function is used to determine if a row should or should not be in the completion list.
The match function has the following signature: (completion entry-completion), (key string
), (tree-iter tree-iter) => should-be-displayed-p. This function which decides whether the row indicated by tree-iter matches a given key, and should be displayed as a possible completion for key. Note that key is normalized and case-folded (see g_utf8_normalize() and g_utf8_casefold()). If this is not appropriate, match functions have access to the unmodified key via entry-text of entry-completion-entry.
integer
. Accessor: entry-completion-minimum-key-length
.
Minimum length of the search key in order to look up matches.
Allowed values: >= 0
Default value: 1
entry-completion-model
.
The model to find matches in.
boolean
. Accessor: entry-completion-popup-completion
.
Determines whether the possible completions should be shown in a popup window.
Default value: TRUE
boolean
. Accessor: entry-completion-popup-set-width
.
Determines whether the completions popup window will be resized to the width of the entry.
Default value: TRUE
boolean
. Accessor: entry-completion-popup-single-match
.
Determines whether the completions popup window will shown for a single possible completion. You probably want to set this to FALSE if you are using inline completion.
Default value: TRUE
integer
. Accessor: entry-completion-text-column
.
The column of the model containing the strings.
Default value: -1
Signals:
integer
) => void. Options: run-last.
Gets emitted when an action is activated. index is the index of activated action.
boolean
. Options: run-last.
Gets 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.
string
) => boolean
. Options: run-last.
Gets 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 file-chooser inserts only the part of the prefix up to the next '/'.
boolean
. Options: run-last.
Gets 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.
(entry-completion-complete completion)
Requests a completion operation, or in other words a refiltering of the current list with completions, using the current key. The completion list view will be updated accordingly.
(entry-completion-completion-prefix completion) => string
Get the original text entered by the user that triggered the completion or NULL if there's no completion ongoing.
(entry-completion-insert-prefix completion)
Requests a prefix insertion.
(entry-completion-insert-action-text completion index text)
Inserts an action in completion's action item list at position index with text text. If you want the action item to have markup, use entry-completion-insert-action-markup.
(entry-completion-insert-action-markup completion index markup)
Inserts an action in completion's action item list at position index with markup markup.
(entry-completion-delete-action completion index)
Deletes the action at index from completion's action list.