Klasse SingleSelection

Alle implementierten Schnittstellen:
PointerInterface

public class SingleSelection extends PropertyHolder
A selection model that allows selecting a single item.

Note that the selection is *persistent* -- if the selected item is removed
and re-added in the same [signal@Gio.ListModel::items-changed] emission, it
stays selected. In particular, this means that changing the sort order of an
underlying sort model will preserve the selection.

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

  • Konstruktordetails

    • SingleSelection

      public SingleSelection(PointerContainer pointer)
    • SingleSelection

      public SingleSelection(@Nullable ListModel model)
      Creates a new selection to handle @model.
      Parameter:
      model - the `GListModel` to manage
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getAutoselect

      public boolean getAutoselect()
      Checks if autoselect has been enabled or disabled via
      gtk_single_selection_set_autoselect().
      Gibt zurück:
      %TRUE if autoselect is enabled
    • getCanUnselect

      public boolean getCanUnselect()
      If %TRUE, gtk_selection_model_unselect_item() is supported and allows
      unselecting the selected item.
      Gibt zurück:
      %TRUE to support unselecting
    • getModel

      public ListModel getModel()
      Gets the model that @self is wrapping.
      Gibt zurück:
      The model being wrapped
    • getSelected

      public int getSelected()
      Gets the position of the selected item.

      If no item is selected, %GTK_INVALID_LIST_POSITION is returned.
      Gibt zurück:
      The position of the selected item
    • getSelectedItem

      public Pointer getSelectedItem()
      Gets the selected item.

      If no item is selected, %NULL is returned.
      Gibt zurück:
      The selected item
    • setAutoselect

      public void setAutoselect(boolean autoselect)
      Enables or disables autoselect.

      If @autoselect is %TRUE, @self will enforce that an item is always
      selected. It will select a new item when the currently selected
      item is deleted and it will disallow unselecting the current item.
      Parameter:
      autoselect - %TRUE to always select an item
    • setCanUnselect

      public void setCanUnselect(boolean can_unselect)
      If %TRUE, unselecting the current item via
      gtk_selection_model_unselect_item() is supported.

      Note that setting [property@Gtk.SingleSelection:autoselect] will
      cause unselecting to not work, so it practically makes no sense
      to set both at the same time.
      Parameter:
      can_unselect - %TRUE to allow unselecting
    • setModel

      public void setModel(@Nullable ListModel model)
      Sets the model that @self should wrap.

      If @model is %NULL, @self will be empty.
      Parameter:
      model - A `GListModel` to wrap
    • setSelected

      public void setSelected(int position)
      Selects the item at the given position.

      If the list does not have an item at @position or
      %GTK_INVALID_LIST_POSITION is given, the behavior depends on the
      value of the [property@Gtk.SingleSelection:autoselect] property:
      If it is set, no change will occur and the old item will stay
      selected. If it is unset, the selection will be unset and no item
      will be selected. This also applies if [property@Gtk.SingleSelection:can-unselect]
      is set to %FALSE.
      Parameter:
      position - the item to select or %GTK_INVALID_LIST_POSITION
    • asListModel

      public ListModel asListModel()
      Implements interface ListModel. Call this to get access to interface functions.
      Gibt zurück:
      ListModel
    • asSectionModel

      public SectionModel asSectionModel()
      Implements interface SectionModel. Call this to get access to interface functions.
      Gibt zurück:
      SectionModel
    • asSelectionModel

      public SelectionModel asSelectionModel()
      Implements interface SelectionModel. Call this to get access to interface functions.
      Gibt zurück:
      SelectionModel
    • 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()