Class ListBoxRow

All Implemented Interfaces:
Accessible, Actionable, Buildable, ConstraintTarget, Proxy
Direct Known Subclasses:
PreferencesRow

@Generated("org.javagi.JavaGI") public class ListBoxRow extends Widget implements Accessible, Actionable, Buildable, ConstraintTarget

The kind of widget that can be added to a GtkListBox.

ListBox will automatically wrap its children in a GtkListboxRow when necessary.

  • Constructor Details

    • ListBoxRow

      public ListBoxRow(MemorySegment address)
      Create a ListBoxRow instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ListBoxRow

      public ListBoxRow()
      Create a new ListBoxRow.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the ListBoxRow class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected ListBoxRow asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • changed

      public void changed()

      Marks this ListBoxRow as changed, causing any state that depends on this to be updated.

      This affects sorting, filtering and headers.

      Note that calls to this method must be in sync with the data used for the row functions. For instance, if the list is mirroring some external data set, and two rows changed in the external data set then when you call gtk_list_box_row_changed() on the first row the sort function must only read the new data for the first of the two changed rows, otherwise the resorting of the rows will be wrong.

      This generally means that if you don’t fully control the data model you have to duplicate the data that affects the listbox row functions into the row widgets themselves. Another alternative is to call ListBox.invalidateSort() on any model change, but that is more expensive.

    • getActivatable

      public boolean getActivatable()
      Gets whether the row is activatable.
      Returns:
      true if the row is activatable
    • getChild

      public @Nullable Widget getChild()
      Gets the child widget of row.
      Returns:
      the child widget of this ListBoxRow
    • getHeader

      public @Nullable Widget getHeader()

      Returns the current header of the row.

      This can be used in a Gtk.ListBoxUpdateHeaderFunc to see if there is a header set already, and if so to update the state of it.

      Returns:
      the current header
    • getIndex

      public int getIndex()
      Gets the current index of the this ListBoxRow in its GtkListBox container.
      Returns:
      the index of the row, or -1 if the this ListBoxRow is not in a listbox
    • getSelectable

      public boolean getSelectable()
      Gets whether the row can be selected.
      Returns:
      true if the row is selectable
    • isSelected

      public boolean isSelected()
      Returns whether the child is currently selected in its GtkListBox container.
      Returns:
      true if this ListBoxRow is selected
    • setActivatable

      public void setActivatable(boolean activatable)
      Set whether the row is activatable.
      Parameters:
      activatable - true to mark the row as activatable
    • setChild

      public void setChild(@Nullable Widget child)
      Sets the child widget of self.
      Parameters:
      child - the child widget
    • setHeader

      public void setHeader(@Nullable Widget header)

      Sets the current header of the row.

      This is only allowed to be called from a Gtk.ListBoxUpdateHeaderFunc. It will replace any existing header in the row, and be shown in front of the row in the listbox.

      Parameters:
      header - the header
    • setSelectable

      public void setSelectable(boolean selectable)
      Set whether the row can be selected.
      Parameters:
      selectable - true to mark the row as selectable
    • activate

      protected void activate()
    • onActivate

      This is a keybinding signal, which will cause this row to be activated.

      If you want to be notified when the user activates a row (by key or not), use the Gtk.ListBox::row-activated signal on the row’s parent GtkListBox.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitActivate

      public void emitActivate()
      Emits the "activate" signal. See onActivate(ListBoxRow.ActivateCallback).
    • builder

      public static ListBoxRow.Builder<? extends ListBoxRow.Builder> builder()
      A ListBoxRow.Builder object constructs a ListBoxRow with the specified properties. Use the various set...() methods to set properties, and finish construction with ListBoxRow.Builder.build().
      Returns:
      the builder object