Class ListItem

All Implemented Interfaces:
PointerInterface

public class ListItem extends Object
`GtkListItem` is used by list widgets to represent items in a `GListModel`.

The `GtkListItem`s are managed by the list widget (with its factory)
and cannot be created by applications, but they need to be populated
by application code. This is done by calling [method@Gtk.ListItem.set_child].

`GtkListItem`s exist in 2 stages:

1. The unbound stage where the listitem is not currently connected to
an item in the list. In that case, the [property@Gtk.ListItem:item]
property is set to %NULL.

2. The bound stage where the listitem references an item from the list.
The [property@Gtk.ListItem:item] property is not %NULL.

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

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getActivatable

      public boolean getActivatable()
      Checks if a list item has been set to be activatable via
      gtk_list_item_set_activatable().
      Returns:
      %TRUE if the item is activatable
    • getChild

      public Widget getChild()
      Gets the child previously set via gtk_list_item_set_child() or
      %NULL if none was set.
      Returns:
      The child
    • getItem

      public Pointer getItem()
      Gets the model item that associated with @self.

      If @self is unbound, this function returns %NULL.
      Returns:
      The item displayed
    • getPosition

      public int getPosition()
      Gets the position in the model that @self currently displays.

      If @self is unbound, %GTK_INVALID_LIST_POSITION is returned.
      Returns:
      The position of this item
    • getSelectable

      public boolean getSelectable()
      Checks if a list item has been set to be selectable via
      gtk_list_item_set_selectable().

      Do not confuse this function with [method@Gtk.ListItem.get_selected].
      Returns:
      %TRUE if the item is selectable
    • getSelected

      public boolean getSelected()
      Checks if the item is displayed as selected.

      The selected state is maintained by the liste widget and its model
      and cannot be set otherwise.
      Returns:
      %TRUE if the item is selected.
    • setActivatable

      public void setActivatable(boolean activatable)
      Sets @self to be activatable.

      If an item is activatable, double-clicking on the item, using
      the Return key or calling gtk_widget_activate() will activate
      the item. Activating instructs the containing view to handle
      activation. `GtkListView` for example will be emitting the
      [signal@Gtk.ListView::activate] signal.

      By default, list items are activatable.
      Parameters:
      activatable - if the item should be activatable
    • setChild

      public void setChild(@Nullable Widget child)
      Sets the child to be used for this listitem.

      This function is typically called by applications when
      setting up a listitem so that the widget can be reused when
      binding it multiple times.
      Parameters:
      child - The list item's child or %NULL to unset
    • setSelectable

      public void setSelectable(boolean selectable)
      Sets @self to be selectable.

      If an item is selectable, clicking on the item or using the keyboard
      will try to select or unselect the item. If this succeeds is up to
      the model to determine, as it is managing the selected state.

      Note that this means that making an item non-selectable has no
      influence on the selected state at all. A non-selectable item
      may still be selected.

      By default, list items are selectable. When rebinding them to
      a new item, they will also be reset to be selectable by GTK.
      Parameters:
      selectable - if the item should be selectable
    • 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()