Class EntryCompletion
- All Implemented Interfaces:
Buildable,CellLayout,Proxy
GtkEntryCompletion is an auxiliary object to provide completion functionality
for GtkEntry.
It implements the 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
setTextColumn(int)), but this can be overridden
with a custom match function (see setMatchFunc(org.gnome.gtk.EntryCompletionMatchFunc)).
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.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
Entry.setCompletion(org.gnome.gtk.EntryCompletion).
GtkEntryCompletion uses a TreeModelFilter model to
represent the subset of the entire model that is currently matching.
While the GtkEntryCompletion signals
Gtk.EntryCompletion::match-selected and
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
Gtk.CellArea::apply-attributes)
will generally take the filter model as argument. As long as you are
only calling TreeModel.get(org.gnome.gtk.TreeIter, java.lang.Object...), this will make no difference to
you. If for some reason, you need the original model, use
TreeModelFilter.getModel(). Don’t forget to use
TreeModelFilter.convertIterToChildIter(org.gnome.gtk.TreeIter, org.gnome.gtk.TreeIter) to obtain a
matching iter.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEntryCompletion.Builder<B extends EntryCompletion.Builder<B>>Deprecated.Inner class implementing a builder pattern to construct a GObject with properties.static interfaceDeprecated.Functional interface declaration of theCursorOnMatchCallbackcallback.static interfaceDeprecated.Functional interface declaration of theInsertPrefixCallbackcallback.static interfaceDeprecated.Functional interface declaration of theMatchSelectedCallbackcallback.static interfaceDeprecated.Functional interface declaration of theNoMatchesCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface org.gnome.gtk.CellLayout
CellLayout.CellLayout$Impl, CellLayout.CellLayoutIface -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new EntryCompletion.EntryCompletion(MemorySegment address) Deprecated.Create a EntryCompletion proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected EntryCompletionasParent()Deprecated.Returns this instance as if it were its parent type.static EntryCompletion.Builder<? extends EntryCompletion.Builder> builder()Deprecated.AEntryCompletion.Builderobject constructs aEntryCompletionwith the specified properties.voidcomplete()Deprecated.GtkEntryCompletion will be removed in GTK 5.@Nullable StringcomputePrefix(String key) Deprecated.GtkEntryCompletion will be removed in GTK 5.booleanemitCursorOnMatch(@Nullable TreeModel model, @Nullable TreeIter iter) Deprecated.Emits the "cursor-on-match" signal.booleanemitInsertPrefix(String prefix) Deprecated.Emits the "insert-prefix" signal.booleanemitMatchSelected(@Nullable TreeModel model, @Nullable TreeIter iter) Deprecated.Emits the "match-selected" signal.voidDeprecated.Emits the "no-matches" signal.@Nullable StringDeprecated.GtkEntryCompletion will be removed in GTK 5.getEntry()Deprecated.GtkEntryCompletion will be removed in GTK 5.booleanDeprecated.GtkEntryCompletion will be removed in GTK 5.booleanDeprecated.GtkEntryCompletion will be removed in GTK 5.intDeprecated.GtkEntryCompletion will be removed in GTK 5.@Nullable TreeModelgetModel()Deprecated.GtkEntryCompletion will be removed in GTK 5.booleanDeprecated.GtkEntryCompletion will be removed in GTK 5.booleanDeprecated.GtkEntryCompletion will be removed in GTK 5.booleanDeprecated.GtkEntryCompletion will be removed in GTK 5.intDeprecated.GtkEntryCompletion will be removed in GTK 5.static @Nullable TypegetType()Deprecated.Get the GType of the EntryCompletion classvoidDeprecated.GtkEntryCompletion will be removed in GTK 5.Deprecated.Emitted when a match from the cursor is on a match of the list.Deprecated.Emitted when the inline autocompletion is triggered.Deprecated.Emitted when a match from the list is selected.Deprecated.Emitted when the filter model has zero number of rows in completion_complete method.voidsetInlineCompletion(boolean inlineCompletion) Deprecated.GtkEntryCompletion will be removed in GTK 5.voidsetInlineSelection(boolean inlineSelection) Deprecated.GtkEntryCompletion will be removed in GTK 5.voidsetMatchFunc(@Nullable EntryCompletionMatchFunc func) Deprecated.GtkEntryCompletion will be removed in GTK 5.voidsetMinimumKeyLength(int length) Deprecated.GtkEntryCompletion will be removed in GTK 5.voidDeprecated.GtkEntryCompletion will be removed in GTK 5.voidsetPopupCompletion(boolean popupCompletion) Deprecated.GtkEntryCompletion will be removed in GTK 5.voidsetPopupSetWidth(boolean popupSetWidth) Deprecated.GtkEntryCompletion will be removed in GTK 5.voidsetPopupSingleMatch(boolean popupSingleMatch) Deprecated.GtkEntryCompletion will be removed in GTK 5.voidsetTextColumn(int column) Deprecated.GtkEntryCompletion will be removed in GTK 5.static EntryCompletionDeprecated.GtkEntryCompletion will be removed in GTK 5.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Buildable
getBuildableIdMethods inherited from interface org.gnome.gtk.CellLayout
addAttribute, clear, clearAttributes, getArea, getCells, packEnd, packStart, reorder, setAttributes, setCellDataFunc
-
Constructor Details
-
EntryCompletion
Deprecated.Create a EntryCompletion proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
EntryCompletion
public EntryCompletion()Deprecated.Creates a new EntryCompletion.
-
-
Method Details
-
getType
Deprecated.Get the GType of the EntryCompletion class- Returns:
- the GType
-
asParent
Deprecated.Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
withArea
Deprecated.GtkEntryCompletion will be removed in GTK 5.Creates a newGtkEntryCompletionobject using the specifiedarea.The
GtkCellAreais used to layout cells in the underlyingGtkTreeViewColumnfor the drop-down menu.- Parameters:
area- theGtkCellAreaused to layout cells- Returns:
- A newly created
GtkEntryCompletionobject
-
complete
Deprecated.GtkEntryCompletion will be removed in GTK 5.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.
-
computePrefix
Deprecated.GtkEntryCompletion will be removed in GTK 5.Computes the common prefix that is shared by all rows in this EntryCompletion that start withkey.If no row matches
key,nullwill be returned. Note that a text column must have been set for this function to work, seesetTextColumn(int)for details.- Parameters:
key- The text to complete for- Returns:
- The common prefix all rows
starting with
key
-
getCompletionPrefix
Deprecated.GtkEntryCompletion will be removed in GTK 5.Get the original text entered by the user that triggered the completion ornullif there’s no completion ongoing.- Returns:
- the prefix for the current completion
-
getEntry
Deprecated.GtkEntryCompletion will be removed in GTK 5.Gets the entry this EntryCompletion has been attached to.- Returns:
- The entry this EntryCompletion has been attached to
-
getInlineCompletion
Deprecated.GtkEntryCompletion will be removed in GTK 5.Returns whether the common prefix of the possible completions should be automatically inserted in the entry.- Returns:
trueif inline completion is turned on
-
getInlineSelection
Deprecated.GtkEntryCompletion will be removed in GTK 5.Returnstrueif inline-selection mode is turned on.- Returns:
trueif inline-selection mode is on
-
getMinimumKeyLength
Deprecated.GtkEntryCompletion will be removed in GTK 5.Returns the minimum key length as set forcompletion.- Returns:
- The currently used minimum key length
-
getModel
Deprecated.GtkEntryCompletion will be removed in GTK 5.Returns the model theGtkEntryCompletionis using as data source.Returns
nullif the model is unset.- Returns:
- A
GtkTreeModel
-
getPopupCompletion
Deprecated.GtkEntryCompletion will be removed in GTK 5.Returns whether the completions should be presented in a popup window.- Returns:
trueif popup completion is turned on
-
getPopupSetWidth
Deprecated.GtkEntryCompletion will be removed in GTK 5.Returns whether the completion popup window will be resized to the width of the entry.- Returns:
trueif the popup window will be resized to the width of the entry
-
getPopupSingleMatch
Deprecated.GtkEntryCompletion will be removed in GTK 5.Returns whether the completion popup window will appear even if there is only a single match.- Returns:
trueif the popup window will appear regardless of the number of matches
-
getTextColumn
Deprecated.GtkEntryCompletion will be removed in GTK 5.Returns the column in the model of this EntryCompletion to get strings from.- Returns:
- the column containing the strings
-
insertPrefix
Deprecated.GtkEntryCompletion will be removed in GTK 5.Requests a prefix insertion. -
setInlineCompletion
Deprecated.GtkEntryCompletion will be removed in GTK 5.Sets whether the common prefix of the possible completions should be automatically inserted in the entry.- Parameters:
inlineCompletion-trueto do inline completion
-
setInlineSelection
Deprecated.GtkEntryCompletion will be removed in GTK 5.Sets whether it is possible to cycle through the possible completions inside the entry.- Parameters:
inlineSelection-trueto do inline selection
-
setMatchFunc
Deprecated.GtkEntryCompletion will be removed in GTK 5.Sets the match function for this EntryCompletion to befunc.The match function is used to determine if a row should or should not be in the completion list.
- Parameters:
func- theGtkEntryCompletionMatchFunc to use
-
setMinimumKeyLength
Deprecated.GtkEntryCompletion will be removed in GTK 5.Requires the length of the search key for this EntryCompletion to be at leastlength.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).
- Parameters:
length- the minimum length of the key in order to start completing
-
setModel
Deprecated.GtkEntryCompletion will be removed in GTK 5.Sets the model for aGtkEntryCompletion.If this EntryCompletion already has a model set, it will remove it before setting the new model. If model is
null, then it will unset the model.- Parameters:
model- theGtkTreeModel
-
setPopupCompletion
Deprecated.GtkEntryCompletion will be removed in GTK 5.Sets whether the completions should be presented in a popup window.- Parameters:
popupCompletion-trueto do popup completion
-
setPopupSetWidth
Deprecated.GtkEntryCompletion will be removed in GTK 5.Sets whether the completion popup window will be resized to be the same width as the entry.- Parameters:
popupSetWidth-trueto make the width of the popup the same as the entry
-
setPopupSingleMatch
Deprecated.GtkEntryCompletion will be removed in GTK 5.Sets whether the completion popup window will appear even if there is only a single match.You may want to set this to
falseif you are usingGtk.EntryCompletion:inline-completion.- Parameters:
popupSingleMatch-trueif the popup should appear even for a single match
-
setTextColumn
Deprecated.GtkEntryCompletion will be removed in GTK 5.Convenience function for setting up the most used case of this code: a completion list with just strings.This function will set up this EntryCompletion to have a list displaying all (and just) strings in the completion list, and to get those strings from
columnin the model ofcompletion.This functions creates and adds a
GtkCellRendererTextfor the selected column. If you need to set the text column, but don't want the cell renderer, use g_object_set() to set theGtk.EntryCompletion:text-columnproperty directly.- Parameters:
column- the column in the model of this EntryCompletion to get strings from
-
onCursorOnMatch
public SignalConnection<EntryCompletion.CursorOnMatchCallback> onCursorOnMatch(EntryCompletion.CursorOnMatchCallback handler) Deprecated.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.Note that
modelis the model that was passed tosetModel(org.gnome.gtk.TreeModel).- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitCursorOnMatch
Deprecated.Emits the "cursor-on-match" signal. SeeonCursorOnMatch(org.gnome.gtk.EntryCompletion.CursorOnMatchCallback). -
onInsertPrefix
public SignalConnection<EntryCompletion.InsertPrefixCallback> onInsertPrefix(EntryCompletion.InsertPrefixCallback handler) Deprecated.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
prefixinto the entry - e.g. the entry used in theGtkFileChooserinserts only the part of the prefix up to the next '/'.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitInsertPrefix
Deprecated.Emits the "insert-prefix" signal. SeeonInsertPrefix(org.gnome.gtk.EntryCompletion.InsertPrefixCallback). -
onMatchSelected
public SignalConnection<EntryCompletion.MatchSelectedCallback> onMatchSelected(EntryCompletion.MatchSelectedCallback handler) Deprecated.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.Note that
modelis the model that was passed tosetModel(org.gnome.gtk.TreeModel).- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitMatchSelected
Deprecated.Emits the "match-selected" signal. SeeonMatchSelected(org.gnome.gtk.EntryCompletion.MatchSelectedCallback). -
onNoMatches
public SignalConnection<EntryCompletion.NoMatchesCallback> onNoMatches(EntryCompletion.NoMatchesCallback handler) Deprecated.Emitted when the filter model has zero number of rows in completion_complete method.In other words when
GtkEntryCompletionis out of suggestions.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitNoMatches
public void emitNoMatches()Deprecated.Emits the "no-matches" signal. SeeonNoMatches(org.gnome.gtk.EntryCompletion.NoMatchesCallback). -
builder
Deprecated.AEntryCompletion.Builderobject constructs aEntryCompletionwith the specified properties. Use the variousset...()methods to set properties, and finish construction withEntryCompletion.Builder.build().- Returns:
- the builder object
-