gi-gtk-3.0.11: Gtk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.EntryCompletion

Contents

Description

EntryCompletion is an auxiliary object to be used in conjunction with Entry to provide the completion functionality. It implements the CellLayout interface, to allow the user to add extra cells to the TreeView with completion matches.

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

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 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 entrySetCompletion.

In addition to regular completion matches, which will be inserted into the entry when they are selected, EntryCompletion 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 EntryCompletion::action-activated signal is emitted.

GtkEntryCompletion uses a TreeModelFilter model to represent the subset of the entire model that is currently matching. While the GtkEntryCompletion signals EntryCompletion::match-selected and EntryCompletion::cursor-on-match take the original model and an iter pointing to that model as arguments, other callbacks and signals (such as GtkCellLayoutDataFuncs or CellArea::apply-attributes) will generally take the filter model as argument. As long as you are only calling gtk_tree_model_get(), this will make no difference to you. If for some reason, you need the original model, use treeModelFilterGetModel. Don’t forget to use treeModelFilterConvertIterToChildIter to obtain a matching iter.

Synopsis

Exported types

Methods

complete

entryCompletionComplete Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m () 

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.

Since: 2.4

computePrefix

entryCompletionComputePrefix Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: the entry completion

-> Text

key: The text to complete for

-> m (Maybe Text)

Returns: The common prefix all rows starting with key or Nothing if no row matches key.

Computes the common prefix that is shared by all rows in completion that start with key. If no row matches key, Nothing will be returned. Note that a text column must have been set for this function to work, see entryCompletionSetTextColumn for details.

Since: 3.4

deleteAction

entryCompletionDeleteAction Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> Int32

index_: the index of the item to delete

-> m () 

Deletes the action at index_ from completion’s action list.

Note that index_ is a relative position and the position of an action may have changed since it was inserted.

Since: 2.4

getCompletionPrefix

entryCompletionGetCompletionPrefix Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m Text

Returns: the prefix for the current completion

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

Since: 2.12

getEntry

entryCompletionGetEntry Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m Widget

Returns: The entry completion has been attached to

Gets the entry completion has been attached to.

Since: 2.4

getInlineCompletion

entryCompletionGetInlineCompletion Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m Bool

Returns: True if inline completion is turned on

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

Since: 2.6

getInlineSelection

entryCompletionGetInlineSelection Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m Bool

Returns: True if inline-selection mode is on

Returns True if inline-selection mode is turned on.

Since: 2.12

getMinimumKeyLength

entryCompletionGetMinimumKeyLength Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m Int32

Returns: The currently used minimum key length

Returns the minimum key length as set for completion.

Since: 2.4

getModel

entryCompletionGetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m (Maybe TreeModel)

Returns: A TreeModel, or Nothing if none is currently being used

Returns the model the EntryCompletion is using as data source. Returns Nothing if the model is unset.

Since: 2.4

getPopupCompletion

entryCompletionGetPopupCompletion Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m Bool

Returns: True if popup completion is turned on

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

Since: 2.6

getPopupSetWidth

entryCompletionGetPopupSetWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m Bool

Returns: True if the popup window will be resized to the width of the entry

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

Since: 2.8

getPopupSingleMatch

entryCompletionGetPopupSingleMatch Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m Bool

Returns: True if the popup window will appear regardless of the number of matches

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

Since: 2.8

getTextColumn

entryCompletionGetTextColumn Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m Int32

Returns: the column containing the strings

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

Since: 2.6

insertActionMarkup

entryCompletionInsertActionMarkup Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> Int32

index_: the index of the item to insert

-> Text

markup: markup of the item to insert

-> m () 

Inserts an action in completion’s action item list at position index_ with markup markup.

Since: 2.4

insertActionText

entryCompletionInsertActionText Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> Int32

index_: the index of the item to insert

-> Text

text: text of the item to insert

-> m () 

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 entryCompletionInsertActionMarkup.

Note that index_ is a relative position in the list of actions and the position of an action can change when deleting a different action.

Since: 2.4

insertPrefix

entryCompletionInsertPrefix Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> m () 

Requests a prefix insertion.

Since: 2.6

new

entryCompletionNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m EntryCompletion

Returns: A newly created EntryCompletion object

Creates a new EntryCompletion object.

Since: 2.4

newWithArea

entryCompletionNewWithArea Source #

Arguments

:: (HasCallStack, MonadIO m, IsCellArea a) 
=> a

area: the CellArea used to layout cells

-> m EntryCompletion

Returns: A newly created EntryCompletion object

Creates a new EntryCompletion object using the specified area to layout cells in the underlying TreeViewColumn for the drop-down menu.

Since: 3.0

setInlineCompletion

entryCompletionSetInlineCompletion Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> Bool

inlineCompletion: True to do inline completion

-> m () 

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

Since: 2.6

setInlineSelection

entryCompletionSetInlineSelection Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> Bool

inlineSelection: True to do inline selection

-> m () 

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

Since: 2.12

setMatchFunc

entryCompletionSetMatchFunc Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> EntryCompletionMatchFunc

func: the EntryCompletionMatchFunc to use

-> m () 

Sets the match function for completion to be func. The match function is used to determine if a row should or should not be in the completion list.

Since: 2.4

setMinimumKeyLength

entryCompletionSetMinimumKeyLength Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> Int32

length: the minimum length of the key in order to start completing

-> m () 

Requires the length of the search key for completion to be at least length. This is useful for long lists, where completing using a small key takes a lot of time and will come up with meaningless results anyway (ie, a too large dataset).

Since: 2.4

setModel

entryCompletionSetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a, IsTreeModel b) 
=> a

completion: a EntryCompletion

-> Maybe b

model: the TreeModel

-> m () 

Sets the model for a EntryCompletion. If completion already has a model set, it will remove it before setting the new model. If model is Nothing, then it will unset the model.

Since: 2.4

setPopupCompletion

entryCompletionSetPopupCompletion Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> Bool

popupCompletion: True to do popup completion

-> m () 

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

Since: 2.6

setPopupSetWidth

entryCompletionSetPopupSetWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> Bool

popupSetWidth: True to make the width of the popup the same as the entry

-> m () 

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

Since: 2.8

setPopupSingleMatch

entryCompletionSetPopupSingleMatch Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> Bool

popupSingleMatch: True if the popup should appear even for a single match

-> m () 

Sets whether the completion popup window will appear even if there is only a single match. You may want to set this to False if you are using [inline completion][GtkEntryCompletion--inline-completion].

Since: 2.8

setTextColumn

entryCompletionSetTextColumn Source #

Arguments

:: (HasCallStack, MonadIO m, IsEntryCompletion a) 
=> a

completion: a EntryCompletion

-> Int32

column: the column in the model of completion to get strings from

-> m () 

Convenience function for setting up the most used case of this code: a completion list with just strings. This function will set up completion to have a list displaying all (and just) strings in the completion list, and to get those strings from column in the model of completion.

This functions creates and adds a CellRendererText for the selected column. If you need to set the text column, but don't want the cell renderer, use g_object_set() to set the EntryCompletion:text-column property directly.

Since: 2.4

Properties

cellArea

data EntryCompletionCellAreaPropertyInfo Source #

Instances

AttrInfo EntryCompletionCellAreaPropertyInfo Source # 
type AttrOrigin EntryCompletionCellAreaPropertyInfo Source # 
type AttrLabel EntryCompletionCellAreaPropertyInfo Source # 
type AttrGetType EntryCompletionCellAreaPropertyInfo Source # 
type AttrBaseTypeConstraint EntryCompletionCellAreaPropertyInfo Source # 
type AttrSetTypeConstraint EntryCompletionCellAreaPropertyInfo Source # 
type AttrAllowedOps EntryCompletionCellAreaPropertyInfo Source # 

inlineCompletion

data EntryCompletionInlineCompletionPropertyInfo Source #

Instances

AttrInfo EntryCompletionInlineCompletionPropertyInfo Source # 
type AttrOrigin EntryCompletionInlineCompletionPropertyInfo Source # 
type AttrLabel EntryCompletionInlineCompletionPropertyInfo Source # 
type AttrGetType EntryCompletionInlineCompletionPropertyInfo Source # 
type AttrBaseTypeConstraint EntryCompletionInlineCompletionPropertyInfo Source # 
type AttrSetTypeConstraint EntryCompletionInlineCompletionPropertyInfo Source # 
type AttrAllowedOps EntryCompletionInlineCompletionPropertyInfo Source # 

inlineSelection

data EntryCompletionInlineSelectionPropertyInfo Source #

Instances

AttrInfo EntryCompletionInlineSelectionPropertyInfo Source # 
type AttrOrigin EntryCompletionInlineSelectionPropertyInfo Source # 
type AttrLabel EntryCompletionInlineSelectionPropertyInfo Source # 
type AttrGetType EntryCompletionInlineSelectionPropertyInfo Source # 
type AttrBaseTypeConstraint EntryCompletionInlineSelectionPropertyInfo Source # 
type AttrSetTypeConstraint EntryCompletionInlineSelectionPropertyInfo Source # 
type AttrAllowedOps EntryCompletionInlineSelectionPropertyInfo Source # 

minimumKeyLength

data EntryCompletionMinimumKeyLengthPropertyInfo Source #

Instances

AttrInfo EntryCompletionMinimumKeyLengthPropertyInfo Source # 
type AttrOrigin EntryCompletionMinimumKeyLengthPropertyInfo Source # 
type AttrLabel EntryCompletionMinimumKeyLengthPropertyInfo Source # 
type AttrGetType EntryCompletionMinimumKeyLengthPropertyInfo Source # 
type AttrBaseTypeConstraint EntryCompletionMinimumKeyLengthPropertyInfo Source # 
type AttrSetTypeConstraint EntryCompletionMinimumKeyLengthPropertyInfo Source # 
type AttrAllowedOps EntryCompletionMinimumKeyLengthPropertyInfo Source # 

model

data EntryCompletionModelPropertyInfo Source #

Instances

AttrInfo EntryCompletionModelPropertyInfo Source # 
type AttrOrigin EntryCompletionModelPropertyInfo Source # 
type AttrLabel EntryCompletionModelPropertyInfo Source # 
type AttrGetType EntryCompletionModelPropertyInfo Source # 
type AttrBaseTypeConstraint EntryCompletionModelPropertyInfo Source # 
type AttrSetTypeConstraint EntryCompletionModelPropertyInfo Source # 
type AttrAllowedOps EntryCompletionModelPropertyInfo Source # 

popupCompletion

data EntryCompletionPopupCompletionPropertyInfo Source #

Instances

AttrInfo EntryCompletionPopupCompletionPropertyInfo Source # 
type AttrOrigin EntryCompletionPopupCompletionPropertyInfo Source # 
type AttrLabel EntryCompletionPopupCompletionPropertyInfo Source # 
type AttrGetType EntryCompletionPopupCompletionPropertyInfo Source # 
type AttrBaseTypeConstraint EntryCompletionPopupCompletionPropertyInfo Source # 
type AttrSetTypeConstraint EntryCompletionPopupCompletionPropertyInfo Source # 
type AttrAllowedOps EntryCompletionPopupCompletionPropertyInfo Source # 

popupSetWidth

data EntryCompletionPopupSetWidthPropertyInfo Source #

Instances

AttrInfo EntryCompletionPopupSetWidthPropertyInfo Source # 
type AttrOrigin EntryCompletionPopupSetWidthPropertyInfo Source # 
type AttrLabel EntryCompletionPopupSetWidthPropertyInfo Source # 
type AttrGetType EntryCompletionPopupSetWidthPropertyInfo Source # 
type AttrBaseTypeConstraint EntryCompletionPopupSetWidthPropertyInfo Source # 
type AttrSetTypeConstraint EntryCompletionPopupSetWidthPropertyInfo Source # 
type AttrAllowedOps EntryCompletionPopupSetWidthPropertyInfo Source # 

popupSingleMatch

data EntryCompletionPopupSingleMatchPropertyInfo Source #

Instances

AttrInfo EntryCompletionPopupSingleMatchPropertyInfo Source # 
type AttrOrigin EntryCompletionPopupSingleMatchPropertyInfo Source # 
type AttrLabel EntryCompletionPopupSingleMatchPropertyInfo Source # 
type AttrGetType EntryCompletionPopupSingleMatchPropertyInfo Source # 
type AttrBaseTypeConstraint EntryCompletionPopupSingleMatchPropertyInfo Source # 
type AttrSetTypeConstraint EntryCompletionPopupSingleMatchPropertyInfo Source # 
type AttrAllowedOps EntryCompletionPopupSingleMatchPropertyInfo Source # 

textColumn

data EntryCompletionTextColumnPropertyInfo Source #

Instances

AttrInfo EntryCompletionTextColumnPropertyInfo Source # 
type AttrOrigin EntryCompletionTextColumnPropertyInfo Source # 
type AttrLabel EntryCompletionTextColumnPropertyInfo Source # 
type AttrGetType EntryCompletionTextColumnPropertyInfo Source # 
type AttrBaseTypeConstraint EntryCompletionTextColumnPropertyInfo Source # 
type AttrSetTypeConstraint EntryCompletionTextColumnPropertyInfo Source # 
type AttrAllowedOps EntryCompletionTextColumnPropertyInfo Source # 

Signals

actionActivated

cursorOnMatch

insertPrefix

matchSelected

noMatches