Shows a vertical list.
<picture> <source srcset="list-box-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkListBox" src="list-box.png"> </picture> A GtkListBox only contains GtkListBoxRow children. These rows can by dynamically sorted and filtered, and headers can be added dynamically depending on the row content. It also allows keyboard and mouse navigation and selection like a typical list.
Using GtkListBox is often an alternative to GtkTreeView, especially when the list contents has a more complicated layout than what is allowed by a GtkCellRenderer, or when the contents is interactive (i.e. has a button in it).
Although a GtkListBox must have only GtkListBoxRow children, you can add any kind of widget to it via [methodGtk.ListBox.prepend], [methodGtk.ListBox.append] and [methodGtk.ListBox.insert] and a GtkListBoxRow widget will automatically be inserted between the list and the widget.
GtkListBoxRows can be marked as activatable or selectable. If a row is activatable, [signalGtk.ListBox::row-activated] will be emitted for it when the user tries to activate it. If it is selectable, the row will be marked as selected when the user tries to select it.
# GtkListBox as GtkBuildable
The GtkListBox implementation of the GtkBuildable interface supports setting a child as the placeholder by specifying "placeholder" as the "type" attribute of a <child> element. See [methodGtk.ListBox.set_placeholder] for info.
# Shortcuts and Gestures
The following signals have default keybindings:
[signalGtk.ListBox::move-cursor] - [signalGtk.ListBox::select-all] -
[signalGtk.ListBox::toggle-cursor-row] - [signalGtk.ListBox::unselect-all]
# CSS nodes
row[.activatable] ```
`GtkListBox` uses a single CSS node named list. It may carry the
.separators style class, when the [propertyGtk.ListBox:show-separators]
property is set. Each `GtkListBoxRow` uses a single CSS node named row. The
row nodes get the .activatable style class added when appropriate.
It may also carry the .boxed-list style class. In this case, the list will
be automatically surrounded by a frame and have separators.
The main list node may also carry style classes to select the style of
[list presentation](section-list-widget.htmllist-styles): .rich-list,
.navigation-sidebar or .data-table.
# Accessibility
`GtkListBox` uses the [enumGtk.AccessibleRole.list] role and
`GtkListBoxRow` uses the [enumGtk.AccessibleRole.list_item] role.
<group>Trees and Lists</group>
<gtkada_demo>create_list_box_complex.adb</gtkada_demo>
function "+"
(Widget : access Gtk_List_Box_Record'Class)
return Gtk.Accessible.Gtk_Accessible
function "+"
(Widget : access Gtk_List_Box_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "+"
(Widget : access Gtk_List_Box_Record'Class)
return Gtk.Constraint_Target.Gtk_Constraint_Target
function "-"
(Interf : Gtk.Accessible.Gtk_Accessible)
return Gtk_List_Box
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_List_Box
function "-"
(Interf : Gtk.Constraint_Target.Gtk_Constraint_Target)
return Gtk_List_Box
Accept_Unpaired_Release_Property : constant Glib.Properties.Property_Boolean;
Whether to accept unpaired release events.
Activate_On_Single_Click_Property : constant Glib.Properties.Property_Boolean;
Determines whether children can be activated with a single click, or require a double-click.
procedure Announce
(Self : not null access Gtk_List_Box_Record;
Message : UTF8_String;
Priority : Gtk.Accessible.Gtk_Accessible_Announcement_Priority)
procedure Append
(Self : not null access Gtk_List_Box_Record;
Child : not null access Gtk.Widget.Gtk_Widget_Record'Class)
Append a widget to the list. If a sort function is set, the widget will actually be inserted at the calculated position.
the GtkWidget to add
procedure Bind_Model
(Self : not null access Gtk_List_Box_Record;
Model : Glib.List_Model.Glist_Model;
Create_Widget_Func : Gtk_List_Box_Create_Widget_Func)
Binds Model to Box. If Box was already bound to a model, that previous binding is destroyed. The contents of Box are cleared and then filled with widgets that represent items from Model. Box is updated whenever Model changes. If Model is null, Box is left empty. It is undefined to add or remove widgets directly (for example, with [methodGtk.ListBox.insert]) while Box is bound to a model. Note that using a model is incompatible with the filtering and sorting functionality in GtkListBox. When using a model, filtering and sorting should be implemented by the model.
the GListModel to be bound to Box
a function that creates widgets for items or null in case you also passed null as Model
type Cb_GObject_Gtk_List_Box_Row_Or_Null_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
Row : access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class);
type Cb_GObject_Gtk_List_Box_Row_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
Row : not null access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class);
type Cb_GObject_Gtk_Movement_Step_Gint_Boolean_Boolean_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
Step : Gtk.Enums.Gtk_Movement_Step;
Count : Glib.Gint;
Extend : Boolean;
Modify : Boolean);
type Cb_GObject_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class);
type Cb_Gtk_List_Box_Gtk_List_Box_Row_Or_Null_Void is not null access procedure
(Self : access Gtk_List_Box_Record'Class;
Row : access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class);
type Cb_Gtk_List_Box_Gtk_List_Box_Row_Void is not null access procedure
(Self : access Gtk_List_Box_Record'Class;
Row : not null access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class);
type Cb_Gtk_List_Box_Gtk_Movement_Step_Gint_Boolean_Boolean_Void is not null access procedure
(Self : access Gtk_List_Box_Record'Class;
Step : Gtk.Enums.Gtk_Movement_Step;
Count : Glib.Gint;
Extend : Boolean;
Modify : Boolean);
type Cb_Gtk_List_Box_Void is not null access procedure (Self : access Gtk_List_Box_Record'Class);
procedure Drag_Highlight_Row
(Self : not null access Gtk_List_Box_Record;
Row : not null access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class)
Add a drag highlight to a row. This is a helper function for implementing DnD onto a GtkListBox. The passed in Row will be highlighted by setting the Gtk.Enums.Gtk_State_Flag_Drop_Active state and any previously highlighted row will be unhighlighted. The row will also be unhighlighted when the widget gets a drag leave event.
a GtkListBoxRow
procedure Drag_Unhighlight_Row
(Self : not null access Gtk_List_Box_Record)
If a row has previously been highlighted via Gtk.List_Box.Drag_Highlight_Row, it will have the highlight removed.
function Get_Accessible_Id
(Self : not null access Gtk_List_Box_Record) return UTF8_String
function Get_Accessible_Parent
(Self : not null access Gtk_List_Box_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Accessible_Role
(Self : not null access Gtk_List_Box_Record)
return Gtk.Accessible.Gtk_Accessible_Role
function Get_Activate_On_Single_Click
(Self : not null access Gtk_List_Box_Record) return Boolean
Returns whether rows activate on single clicks.
True if rows are activated on single click, False otherwise
function Get_Adjustment
(Self : not null access Gtk_List_Box_Record)
return Gtk.Adjustment.Gtk_Adjustment
Gets the adjustment (if any) that the widget uses to for vertical scrolling.
the adjustment. Has transfer-ownership='none'.
function Get_At_Context
(Self : not null access Gtk_List_Box_Record)
return Gtk.Atcontext.Gtk_Atcontext
function Get_Bounds
(Self : not null access Gtk_List_Box_Record;
X : out Glib.Gint;
Y : out Glib.Gint;
Width : out Glib.Gint;
Height : out Glib.Gint) return Boolean
function Get_First_Accessible_Child
(Self : not null access Gtk_List_Box_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Next_Accessible_Sibling
(Self : not null access Gtk_List_Box_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Platform_State
(Self : not null access Gtk_List_Box_Record;
State : Gtk.Accessible.Gtk_Accessible_Platform_State) return Boolean
function Get_Row_At_Index
(Self : not null access Gtk_List_Box_Record;
Index : Glib.Gint) return Gtk.List_Box_Row.Gtk_List_Box_Row
Gets the n-th child in the list (not counting headers). If Index_ is negative or larger than the number of items in the list, null is returned.
the index of the row
the child GtkWidget. Has transfer-ownership='none'.
function Get_Row_At_Y
(Self : not null access Gtk_List_Box_Record;
Y : Glib.Gint) return Gtk.List_Box_Row.Gtk_List_Box_Row
Gets the row at the Y position.
position
the row. Has transfer-ownership='none'.
function Get_Selected_Row
(Self : not null access Gtk_List_Box_Record)
return Gtk.List_Box_Row.Gtk_List_Box_Row
Gets the selected row, or null if no rows are selected. Note that the box may allow multiple selection, in which case you should use [methodGtk.ListBox.selected_foreach] to find all selected rows.
the selected row. Has transfer-ownership='none'.
function Get_Selected_Rows
(Self : not null access Gtk_List_Box_Record)
return Gtk.List_Box_Row.List_Box_Row_List.Glist
Creates a list of all selected children.
A GList containing the GtkWidget for each selected child. Free with g_list_free when done.
function Get_Selection_Mode
(Self : not null access Gtk_List_Box_Record)
return Gtk.Enums.Gtk_Selection_Mode
Gets the selection mode of the listbox.
a GtkSelectionMode
function Get_Show_Separators
(Self : not null access Gtk_List_Box_Record) return Boolean
Returns whether the list box should show separators between rows.
True if the list box shows separators
function Get_Tab_Behavior
(Self : not null access Gtk_List_Box_Record)
return Gtk.Enums.Gtk_List_Tab_Behavior
Returns the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys. Since: gtk+ 4.18
the tab behavior
function Get_Type return Glib.GType
type Gtk_List_Box is access all Gtk_List_Box_Record'Class;
type Gtk_List_Box_Create_Widget_Func is access function (Item : System.Address) return Gtk.Widget.Gtk_Widget;
Called for list boxes that are bound to a GListModel with Gtk.List_Box.Bind_Model for each item that gets added to the model. If the widget returned is not a Gtk.List_Box_Row.Gtk_List_Box_Row widget, then the widget will be inserted as the child of an intermediate Gtk.List_Box_Row.Gtk_List_Box_Row.
the item from the model for which to create a widget for
a GtkWidget that represents Item. Has transfer-ownership='full'.
type Gtk_List_Box_Filter_Func is access function
(Row : not null access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class)
return Boolean;
Will be called whenever the row changes or is added and lets you control if the row should be visible or not.
the row that may be filtered
True if the row should be visible, False otherwise
type Gtk_List_Box_Foreach_Func is access procedure
(Box : not null access Gtk_List_Box_Record'Class;
Row : not null access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class);
A function used by Gtk.List_Box.Selected_Foreach. It will be called on every selected child of the Box.
a GtkListBox
a GtkListBoxRow
function Gtk_List_Box_New return Gtk_List_Box
Creates a new GtkListBox container.
type Gtk_List_Box_Record is new Gtk_Widget_Record with null record;
type Gtk_List_Box_Sort_Func is access function
(Row1 : not null access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class;
Row2 : not null access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class)
return Glib.Gint;
Compare two rows to determine which should be first.
the first row
the second row
< 0 if Row1 should be before Row2, 0 if they are equal and > 0 otherwise
type Gtk_List_Box_Update_Header_Func is access procedure
(Row : not null access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class;
Before : access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class);
Whenever Row changes or which row is before Row changes this is called, which lets you update the header on Row. You may remove or set a new one via [methodGtk.ListBoxRow.set_header] or just change the state of the current header widget.
the row to update
the row before Row, or null if it is first
procedure Gtk_New (Self : out Gtk_List_Box)
Creates a new GtkListBox container. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
package Implements_Gtk_Accessible is new Glib.Types.Implements
(Gtk.Accessible.Gtk_Accessible, Gtk_List_Box_Record, Gtk_List_Box);
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_List_Box_Record, Gtk_List_Box);
package Implements_Gtk_Constraint_Target is new Glib.Types.Implements
(Gtk.Constraint_Target.Gtk_Constraint_Target, Gtk_List_Box_Record, Gtk_List_Box);
procedure Initialize (Self : not null access Gtk_List_Box_Record'Class)
Creates a new GtkListBox container. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
procedure Insert
(Self : not null access Gtk_List_Box_Record;
Child : not null access Gtk.Widget.Gtk_Widget_Record'Class;
Position : Glib.Gint)
Insert the Child into the Box at Position. If a sort function is set, the widget will actually be inserted at the calculated position. If Position is -1, or larger than the total number of items in the Box, then the Child will be appended to the end.
the GtkWidget to add
the position to insert Child in
procedure Invalidate_Filter (Self : not null access Gtk_List_Box_Record)
Update the filtering for all rows. Call this when result of the filter function on the Box is changed due to an external factor. For instance, this would be used if the filter function just looked for a specific search string and the entry with the search string has changed.
procedure Invalidate_Headers (Self : not null access Gtk_List_Box_Record)
Update the separators for all rows. Call this when result of the header function on the Box is changed due to an external factor.
procedure Invalidate_Sort (Self : not null access Gtk_List_Box_Record)
Update the sorting for all rows. Call this when result of the sort function on the Box is changed due to an external factor.
procedure On_Activate_Cursor_Row
(Self : not null access Gtk_List_Box_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the cursor row is activated.
procedure On_Activate_Cursor_Row
(Self : not null access Gtk_List_Box_Record;
Call : Cb_Gtk_List_Box_Void;
After : Boolean := False)
Emitted when the cursor row is activated.
procedure On_Move_Cursor
(Self : not null access Gtk_List_Box_Record;
Call : Cb_GObject_Gtk_Movement_Step_Gint_Boolean_Boolean_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the user initiates a cursor movement.
The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifier does not. There are too many key combinations to list them all here.
<kbd>â</kbd>, <kbd>â</kbd>, <kbd>â</kbd>, <kbd>â</kbd> move by
individual children - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages
Callback parameters: -- @param Step the granularity of the move, as a GtkMovementStep -- @param Count the number of Step units to move -- @param Extend whether to extend the selection -- @param Modify whether to modify the selection
procedure On_Move_Cursor
(Self : not null access Gtk_List_Box_Record;
Call : Cb_Gtk_List_Box_Gtk_Movement_Step_Gint_Boolean_Boolean_Void;
After : Boolean := False)
Emitted when the user initiates a cursor movement.
The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifier does not. There are too many key combinations to list them all here.
<kbd>â</kbd>, <kbd>â</kbd>, <kbd>â</kbd>, <kbd>â</kbd> move by
individual children - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages
Callback parameters: -- @param Step the granularity of the move, as a GtkMovementStep -- @param Count the number of Step units to move -- @param Extend whether to extend the selection -- @param Modify whether to modify the selection
procedure On_Row_Activated
(Self : not null access Gtk_List_Box_Record;
Call : Cb_GObject_Gtk_List_Box_Row_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when a row has been activated by the user.
procedure On_Row_Activated
(Self : not null access Gtk_List_Box_Record;
Call : Cb_Gtk_List_Box_Gtk_List_Box_Row_Void;
After : Boolean := False)
Emitted when a row has been activated by the user.
procedure On_Row_Selected
(Self : not null access Gtk_List_Box_Record;
Call : Cb_GObject_Gtk_List_Box_Row_Or_Null_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when a new row is selected, or (with a null Row) when the selection is cleared.
When the Box is using Gtk.Enums.Selection_Multiple, this signal will not give you the full picture of selection changes, and you should use the [signalGtk.ListBox::selected-rows-changed] signal instead.
procedure On_Row_Selected
(Self : not null access Gtk_List_Box_Record;
Call : Cb_Gtk_List_Box_Gtk_List_Box_Row_Or_Null_Void;
After : Boolean := False)
Emitted when a new row is selected, or (with a null Row) when the selection is cleared.
When the Box is using Gtk.Enums.Selection_Multiple, this signal will not give you the full picture of selection changes, and you should use the [signalGtk.ListBox::selected-rows-changed] signal instead.
procedure On_Select_All
(Self : not null access Gtk_List_Box_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted to select all children of the box, if the selection mode permits it.
This is a keybinding signal.
The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>.
procedure On_Select_All
(Self : not null access Gtk_List_Box_Record;
Call : Cb_Gtk_List_Box_Void;
After : Boolean := False)
Emitted to select all children of the box, if the selection mode permits it.
This is a keybinding signal.
The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>.
procedure On_Selected_Rows_Changed
(Self : not null access Gtk_List_Box_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the set of selected rows changes.
procedure On_Selected_Rows_Changed
(Self : not null access Gtk_List_Box_Record;
Call : Cb_Gtk_List_Box_Void;
After : Boolean := False)
Emitted when the set of selected rows changes.
procedure On_Toggle_Cursor_Row
(Self : not null access Gtk_List_Box_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the cursor row is toggled.
The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>â£</kbd>.
procedure On_Toggle_Cursor_Row
(Self : not null access Gtk_List_Box_Record;
Call : Cb_Gtk_List_Box_Void;
After : Boolean := False)
Emitted when the cursor row is toggled.
The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>â£</kbd>.
procedure On_Unselect_All
(Self : not null access Gtk_List_Box_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted to unselect all children of the box, if the selection mode permits it.
This is a keybinding signal.
The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>.
procedure On_Unselect_All
(Self : not null access Gtk_List_Box_Record;
Call : Cb_Gtk_List_Box_Void;
After : Boolean := False)
Emitted to unselect all children of the box, if the selection mode permits it.
This is a keybinding signal.
The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>.
procedure Prepend
(Self : not null access Gtk_List_Box_Record;
Child : not null access Gtk.Widget.Gtk_Widget_Record'Class)
Prepend a widget to the list. If a sort function is set, the widget will actually be inserted at the calculated position.
the GtkWidget to add
procedure Remove
(Self : not null access Gtk_List_Box_Record;
Child : not null access Gtk.Widget.Gtk_Widget_Record'Class)
Removes a child from Box.
the child to remove
procedure Remove_All (Self : not null access Gtk_List_Box_Record)
Removes all rows from Box. This function does nothing if Box is backed by a model. Since: gtk+ 4.12
procedure Reset_Property
(Self : not null access Gtk_List_Box_Record;
Property : Gtk.Accessible.Gtk_Accessible_Property)
procedure Reset_Relation
(Self : not null access Gtk_List_Box_Record;
Relation : Gtk.Accessible.Gtk_Accessible_Relation)
procedure Reset_State
(Self : not null access Gtk_List_Box_Record;
State : Gtk.Accessible.Gtk_Accessible_State)
procedure Select_All (Self : not null access Gtk_List_Box_Record)
Select all children of Box, if the selection mode allows it.
procedure Select_Row
(Self : not null access Gtk_List_Box_Record;
Row : access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class)
Make Row the currently selected row.
The row to select
procedure Selected_Foreach
(Self : not null access Gtk_List_Box_Record;
Func : Gtk_List_Box_Foreach_Func)
Calls a function for each selected child. Note that the selection cannot be modified from within this function.
the function to call for each selected child
Selection_Mode_Property : constant Gtk.Enums.Property_Gtk_Selection_Mode;
The selection mode used by the list box.
procedure Set_Accessible_Parent
(Self : not null access Gtk_List_Box_Record;
Parent : Gtk.Accessible.Gtk_Accessible;
Next_Sibling : Gtk.Accessible.Gtk_Accessible)
procedure Set_Activate_On_Single_Click
(Self : not null access Gtk_List_Box_Record;
Single : Boolean)
If Single is True, rows will be activated when you click on them, otherwise you need to double-click.
a boolean
procedure Set_Adjustment
(Self : not null access Gtk_List_Box_Record;
Adjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class)
Sets the adjustment (if any) that the widget uses to for vertical scrolling. For instance, this is used to get the page size for PageUp/Down key handling. In the normal case when the Box is packed inside a GtkScrolledWindow the adjustment from that will be picked up automatically, so there is no need to manually do that.
the adjustment
procedure Set_Filter_Func
(Self : not null access Gtk_List_Box_Record;
Filter_Func : Gtk_List_Box_Filter_Func)
By setting a filter function on the Box one can decide dynamically which of the rows to show. For instance, to implement a search function on a list that filters the original list to only show the matching rows. The Filter_Func will be called for each row after the call, and it will continue to be called each time a row changes (via [methodGtk.ListBoxRow.changed]) or when [methodGtk.ListBox.invalidate_filter] is called. Note that using a filter function is incompatible with using a model (see [methodGtk.ListBox.bind_model]).
callback that lets you filter which rows to show
procedure Set_Header_Func
(Self : not null access Gtk_List_Box_Record;
Update_Header : Gtk_List_Box_Update_Header_Func)
Sets a header function. By setting a header function on the Box one can dynamically add headers in front of rows, depending on the contents of the row and its position in the list. For instance, one could use it to add headers in front of the first item of a new kind, in a list sorted by the kind. The Update_Header can look at the current header widget using [methodGtk.ListBoxRow.get_header] and either update the state of the widget as needed, or set a new one using [methodGtk.ListBoxRow.set_header]. If no header is needed, set the header to null. Note that you may get many calls Update_Header to this for a particular row when e.g. changing things that don't affect the header. In this case it is important for performance to not blindly replace an existing header with an identical one. The Update_Header function will be called for each row after the call, and it will continue to be called each time a row changes (via [methodGtk.ListBoxRow.changed]) and when the row before changes (either by [methodGtk.ListBoxRow.changed] on the previous row, or when the previous row becomes a different row). It is also called for all rows when [methodGtk.ListBox.invalidate_headers] is called.
callback that lets you add row headers
procedure Set_Placeholder
(Self : not null access Gtk_List_Box_Record;
Placeholder : access Gtk.Widget.Gtk_Widget_Record'Class)
Sets the placeholder widget that is shown in the list when it doesn't display any visible children.
a GtkWidget
procedure Set_Selection_Mode
(Self : not null access Gtk_List_Box_Record;
Mode : Gtk.Enums.Gtk_Selection_Mode)
Sets how selection works in the listbox.
The GtkSelectionMode
procedure Set_Show_Separators
(Self : not null access Gtk_List_Box_Record;
Show_Separators : Boolean)
Sets whether the list box should show separators between rows.
True to show separators
procedure Set_Sort_Func
(Self : not null access Gtk_List_Box_Record;
Sort_Func : Gtk_List_Box_Sort_Func)
Sets a sort function. By setting a sort function on the Box one can dynamically reorder the rows of the list, based on the contents of the rows. The Sort_Func will be called for each row after the call, and will continue to be called each time a row changes (via [methodGtk.ListBoxRow.changed]) and when [methodGtk.ListBox.invalidate_sort] is called. Note that using a sort function is incompatible with using a model (see [methodGtk.ListBox.bind_model]).
the sort function
procedure Set_Tab_Behavior
(Self : not null access Gtk_List_Box_Record;
Behavior : Gtk.Enums.Gtk_List_Tab_Behavior)
Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys. Since: gtk+ 4.18
the tab behavior
Show_Separators_Property : constant Glib.Properties.Property_Boolean;
Whether to show separators between rows.
Signal_Activate_Cursor_Row : constant Glib.Signal_Name := "activate-cursor-row";
Emitted when the cursor row is activated.
Signal_Move_Cursor : constant Glib.Signal_Name := "move-cursor";
Emitted when the user initiates a cursor movement.
The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifier does not. There are too many key combinations to list them all here.
<kbd>â</kbd>, <kbd>â</kbd>, <kbd>â</kbd>, <kbd>â</kbd> move by
individual children - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages
Callback parameters: -- @param Step the granularity of the move, as a GtkMovementStep -- @param Count the number of Step units to move -- @param Extend whether to extend the selection -- @param Modify whether to modify the selection
Signal_Row_Activated : constant Glib.Signal_Name := "row-activated";
Emitted when a row has been activated by the user.
Signal_Row_Selected : constant Glib.Signal_Name := "row-selected";
Emitted when a new row is selected, or (with a null Row) when the selection is cleared.
When the Box is using Gtk.Enums.Selection_Multiple, this signal will not give you the full picture of selection changes, and you should use the [signalGtk.ListBox::selected-rows-changed] signal instead.
Signal_Select_All : constant Glib.Signal_Name := "select-all";
Emitted to select all children of the box, if the selection mode permits it.
This is a keybinding signal.
The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>.
Signal_Selected_Rows_Changed : constant Glib.Signal_Name := "selected-rows-changed";
Emitted when the set of selected rows changes.
Signal_Toggle_Cursor_Row : constant Glib.Signal_Name := "toggle-cursor-row";
Emitted when the cursor row is toggled.
The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>â£</kbd>.
Signal_Unselect_All : constant Glib.Signal_Name := "unselect-all";
Emitted to unselect all children of the box, if the selection mode permits it.
This is a keybinding signal.
The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>.
Tab_Behavior_Property : constant Gtk.Enums.Property_Gtk_List_Tab_Behavior;
Behavior of the <kbd>Tab</kbd> key
procedure Unselect_All (Self : not null access Gtk_List_Box_Record)
Unselect all children of Box, if the selection mode allows it.
procedure Unselect_Row
(Self : not null access Gtk_List_Box_Record;
Row : not null access Gtk.List_Box_Row.Gtk_List_Box_Row_Record'Class)
Unselects a single row of Box, if the selection mode allows it.
the row to unselect
procedure Update_Next_Accessible_Sibling
(Self : not null access Gtk_List_Box_Record;
New_Sibling : Gtk.Accessible.Gtk_Accessible)
procedure Update_Platform_State
(Self : not null access Gtk_List_Box_Record;
State : Gtk.Accessible.Gtk_Accessible_Platform_State)