Klasse EntryCompletion

Alle implementierten Schnittstellen:
PointerInterface

public class EntryCompletion extends PropertyHolder
`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.

https://docs.gtk.org/gtk4/class.EntryCompletion.html

  • Felddetails

  • Konstruktordetails

    • EntryCompletion

      public EntryCompletion(PointerContainer pointer)
    • EntryCompletion

      @Deprecated public EntryCompletion()
      Veraltet.
      Creates a new `GtkEntryCompletion` object.
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newWithAreaEntryCompletion

      @Deprecated public static EntryCompletion newWithAreaEntryCompletion(@Nonnull CellArea area)
      Veraltet.
      Creates a new `GtkEntryCompletion` object using the
      specified @area.

      The `GtkCellArea` is used to layout cells in the underlying
      `GtkTreeViewColumn` for the drop-down menu.
      Parameter:
      area - the `GtkCellArea` used to layout cells
      Gibt zurück:
      A newly created `GtkEntryCompletion` object
    • complete

      @Deprecated public void complete()
      Veraltet.
      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 public Str computePrefix(@Nonnull Str key)
      Veraltet.
      Computes the common prefix that is shared by all rows in @completion
      that start with @key.

      If no row matches @key, %NULL will be returned.
      Note that a text column must have been set for this function to work,
      see [method@Gtk.EntryCompletion.set_text_column] for details.
      Parameter:
      key - The text to complete for
      Gibt zurück:
      The common prefix all rows starting with @key
    • computePrefix

      @Deprecated public Str computePrefix(String key)
      Veraltet.
      Computes the common prefix that is shared by all rows in @completion
      that start with @key.

      If no row matches @key, %NULL will be returned.
      Note that a text column must have been set for this function to work,
      see [method@Gtk.EntryCompletion.set_text_column] for details.
      Parameter:
      key - The text to complete for
      Gibt zurück:
      The common prefix all rows starting with @key
    • getCompletionPrefix

      @Deprecated public Str getCompletionPrefix()
      Veraltet.
      Get the original text entered by the user that triggered
      the completion or %NULL if there’s no completion ongoing.
      Gibt zurück:
      the prefix for the current completion
    • getEntry

      @Deprecated public Widget getEntry()
      Veraltet.
      Gets the entry @completion has been attached to.
      Gibt zurück:
      The entry @completion has been attached to
    • getInlineCompletion

      @Deprecated public boolean getInlineCompletion()
      Veraltet.
      Returns whether the common prefix of the possible completions should
      be automatically inserted in the entry.
      Gibt zurück:
      %TRUE if inline completion is turned on
    • getInlineSelection

      @Deprecated public boolean getInlineSelection()
      Veraltet.
      Returns %TRUE if inline-selection mode is turned on.
      Gibt zurück:
      %TRUE if inline-selection mode is on
    • getMinimumKeyLength

      @Deprecated public int getMinimumKeyLength()
      Veraltet.
      Returns the minimum key length as set for @completion.
      Gibt zurück:
      The currently used minimum key length
    • getModel

      @Deprecated public TreeModel getModel()
      Veraltet.
      Returns the model the `GtkEntryCompletion` is using as data source.

      Returns %NULL if the model is unset.
      Gibt zurück:
      A `GtkTreeModel`
    • getPopupCompletion

      @Deprecated public boolean getPopupCompletion()
      Veraltet.
      Returns whether the completions should be presented in a popup window.
      Gibt zurück:
      %TRUE if popup completion is turned on
    • getPopupSetWidth

      @Deprecated public boolean getPopupSetWidth()
      Veraltet.
      Returns whether the completion popup window will be resized to the
      width of the entry.
      Gibt zurück:
      %TRUE if the popup window will be resized to the width of the entry
    • getPopupSingleMatch

      @Deprecated public boolean getPopupSingleMatch()
      Veraltet.
      Returns whether the completion popup window will appear even if there is
      only a single match.
      Gibt zurück:
      %TRUE if the popup window will appear regardless of the number of matches
    • getTextColumn

      @Deprecated public int getTextColumn()
      Veraltet.
      Returns the column in the model of @completion to get strings from.
      Gibt zurück:
      the column containing the strings
    • insertPrefix

      @Deprecated public void insertPrefix()
      Veraltet.
      Requests a prefix insertion.
    • setInlineCompletion

      @Deprecated public void setInlineCompletion(boolean inline_completion)
      Veraltet.
      Sets whether the common prefix of the possible completions should
      be automatically inserted in the entry.
      Parameter:
      inline_completion - %TRUE to do inline completion
    • setInlineSelection

      @Deprecated public void setInlineSelection(boolean inline_selection)
      Veraltet.
      Sets whether it is possible to cycle through the possible completions
      inside the entry.
      Parameter:
      inline_selection - %TRUE to do inline selection
    • setMatchFunc

      @Deprecated public void setMatchFunc(EntryCompletion.OnEntryCompletionMatchFunc func, @Nullable Pointer func_data, EntryCompletion.OnDestroyNotify func_notify)
      Veraltet.
      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.
      Parameter:
      func - the `GtkEntryCompletion`MatchFunc to use
      func_data - user data for @func
      func_notify - destroy notify for @func_data.
    • setMinimumKeyLength

      @Deprecated public void setMinimumKeyLength(int length)
      Veraltet.
      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).
      Parameter:
      length - the minimum length of the key in order to start completing
    • setModel

      @Deprecated public void setModel(@Nullable TreeModel model)
      Veraltet.
      Sets the model for a `GtkEntryCompletion`.

      If @completion already has a model set, it will remove it
      before setting the new model. If model is %NULL, then it
      will unset the model.
      Parameter:
      model - the `GtkTreeModel`
    • setPopupCompletion

      @Deprecated public void setPopupCompletion(boolean popup_completion)
      Veraltet.
      Sets whether the completions should be presented in a popup window.
      Parameter:
      popup_completion - %TRUE to do popup completion
    • setPopupSetWidth

      @Deprecated public void setPopupSetWidth(boolean popup_set_width)
      Veraltet.
      Sets whether the completion popup window will be resized to be the same
      width as the entry.
      Parameter:
      popup_set_width - %TRUE to make the width of the popup the same as the entry
    • setPopupSingleMatch

      @Deprecated public void setPopupSingleMatch(boolean popup_single_match)
      Veraltet.
      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 [property@Gtk.EntryCompletion:inline-completion].
      Parameter:
      popup_single_match - %TRUE if the popup should appear even for a single match
    • setTextColumn

      @Deprecated public void setTextColumn(int column)
      Veraltet.
      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 `GtkCellRendererText` 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
      [property@Gtk.EntryCompletion:text-column] property directly.
      Parameter:
      column - the column in the model of @completion to get strings from
    • onCursorOnMatch

      public SignalHandler onCursorOnMatch(EntryCompletion.OnCursorOnMatch signal)
      Connect to signal "cursor-on-match".
      See EntryCompletion.OnCursorOnMatch.onCursorOnMatch(ch.bailu.gtk.gtk.TreeModel, ch.bailu.gtk.gtk.TreeIter) for signal description.
      Field SIGNAL_ON_CURSOR_ON_MATCH contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onInsertPrefix

      public SignalHandler onInsertPrefix(EntryCompletion.OnInsertPrefix signal)
      Connect to signal "insert-prefix".
      See EntryCompletion.OnInsertPrefix.onInsertPrefix(ch.bailu.gtk.type.Str) for signal description.
      Field SIGNAL_ON_INSERT_PREFIX contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onMatchSelected

      public SignalHandler onMatchSelected(EntryCompletion.OnMatchSelected signal)
      Connect to signal "match-selected".
      See EntryCompletion.OnMatchSelected.onMatchSelected(ch.bailu.gtk.gtk.TreeModel, ch.bailu.gtk.gtk.TreeIter) for signal description.
      Field SIGNAL_ON_MATCH_SELECTED contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onNoMatches

      public SignalHandler onNoMatches(EntryCompletion.OnNoMatches signal)
      Connect to signal "no-matches".
      See EntryCompletion.OnNoMatches.onNoMatches() for signal description.
      Field SIGNAL_ON_NO_MATCHES contains original signal name and can be used as resource reference.
      Parameter:
      signal - callback function (lambda).
      Gibt zurück:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Gibt zurück:
      Buildable
    • asCellLayout

      public CellLayout asCellLayout()
      Implements interface CellLayout. Call this to get access to interface functions.
      Gibt zurück:
      CellLayout
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()