EntryCompletion

open class EntryCompletion(pointer: <Error class: unknown class><<Error class: unknown class>>) : Buildable, CellLayout

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

Link copied to clipboard
constructor()

Creates a new GtkEntryCompletion object.

constructor(area: CellArea)

Creates a new GtkEntryCompletion object using the specified @area.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val gtkBuildablePointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val gtkCellLayoutPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
val gtkEntryCompletionPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

Determines whether the common prefix of the possible completions should be inserted automatically in the entry.

Link copied to clipboard

Determines whether the possible completions on the popup will appear in the entry as you navigate through them.

Link copied to clipboard
Link copied to clipboard
open var model: TreeModel?
Link copied to clipboard

Determines whether the possible completions should be shown in a popup window.

Link copied to clipboard

Determines whether the completions popup window will be resized to the width of the entry.

Link copied to clipboard

Determines whether the completions popup window will shown for a single possible completion.

Link copied to clipboard
open var textColumn: Int

The column of the model containing the strings.

Functions

Link copied to clipboard
open fun addAttribute(cell: CellRenderer, attribute: String, column: Int)

Adds an attribute mapping to the list in @cell_layout.

Link copied to clipboard
open fun clear()

Unsets all the mappings on all renderers on @cell_layout and removes all renderers from @cell_layout.

Link copied to clipboard

Clears all existing attributes previously set with gtk_cell_layout_set_attributes().

Link copied to clipboard
open fun complete()

Requests a completion operation, or in other words a refiltering of the current list with completions, using the current key.

Link copied to clipboard
open fun computePrefix(key: String): String?

Computes the common prefix that is shared by all rows in @completion that start with @key.

Link copied to clipboard
fun connectCursorOnMatch(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (model: TreeModel, iter: TreeIter) -> Boolean): <Error class: unknown class>

Emitted when a match from the cursor is on a match of the list.

Link copied to clipboard
fun connectInsertPrefix(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (prefix: String) -> Boolean): <Error class: unknown class>

Emitted when the inline autocompletion is triggered.

Link copied to clipboard
fun connectMatchSelected(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (model: TreeModel, iter: TreeIter) -> Boolean): <Error class: unknown class>

Emitted when a match from the list is selected.

Link copied to clipboard
fun connectNoMatches(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the filter model has zero number of rows in completion_complete method.

Link copied to clipboard
open fun getArea(): CellArea?

Returns the underlying GtkCellArea which might be @cell_layout if called on a GtkCellArea or might be null if no GtkCellArea is used by @cell_layout.

Link copied to clipboard
open fun getBuildableId(): String?

Gets the ID of the @buildable object.

Link copied to clipboard
open fun getCells(): <Error class: unknown class>

Returns the cell renderers which have been added to @cell_layout.

Link copied to clipboard

Get the original text entered by the user that triggered the completion or null if there’s no completion ongoing.

Link copied to clipboard
open fun getEntry(): Widget

Gets the entry @completion has been attached to.

Link copied to clipboard

Returns whether the common prefix of the possible completions should be automatically inserted in the entry.

Link copied to clipboard

Returns true if inline-selection mode is turned on.

Link copied to clipboard

Returns the minimum key length as set for @completion.

Link copied to clipboard
open fun getModel(): TreeModel?

Returns the model the GtkEntryCompletion is using as data source.

Link copied to clipboard

Returns whether the completions should be presented in a popup window.

Link copied to clipboard

Returns whether the completion popup window will be resized to the width of the entry.

Link copied to clipboard

Returns whether the completion popup window will appear even if there is only a single match.

Link copied to clipboard
open fun getTextColumn(): Int

Returns the column in the model of @completion to get strings from.

Link copied to clipboard
open fun insertPrefix()

Requests a prefix insertion.

Link copied to clipboard
open fun packEnd(cell: CellRenderer, expand: Boolean)

Adds the @cell to the end of @cell_layout. If @expand is false, then the

Link copied to clipboard
open fun packStart(cell: CellRenderer, expand: Boolean)

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.

Link copied to clipboard
open fun reorder(cell: CellRenderer, position: Int)

Re-inserts @cell at @position.

Link copied to clipboard

Sets the GtkCellLayoutDataFunc to use for @cell_layout.

Link copied to clipboard
open fun setInlineCompletion(inlineCompletion: Boolean)

Sets whether the common prefix of the possible completions should be automatically inserted in the entry.

Link copied to clipboard
open fun setInlineSelection(inlineSelection: Boolean)

Sets whether it is possible to cycle through the possible completions inside the entry.

Link copied to clipboard

Sets the match function for @completion to be @func.

Link copied to clipboard
open fun setMinimumKeyLength(length: Int)

Requires the length of the search key for @completion to be at least

Link copied to clipboard
open fun setModel(model: TreeModel? = null)

Sets the model for a GtkEntryCompletion.

Link copied to clipboard
open fun setPopupCompletion(popupCompletion: Boolean)

Sets whether the completions should be presented in a popup window.

Link copied to clipboard
open fun setPopupSetWidth(popupSetWidth: Boolean)

Sets whether the completion popup window will be resized to be the same width as the entry.

Link copied to clipboard
open fun setPopupSingleMatch(popupSingleMatch: Boolean)

Sets whether the completion popup window will appear even if there is only a single match.

Link copied to clipboard
open fun setTextColumn(column: Int)

Convenience function for setting up the most used case of this code: a completion list with just strings.