gtk.list_box
Module for [ListBox] class
Types 3
A GtkListBox is a vertical container that contains GtkListBoxRow children. These rows can be 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 gtk.container.Container.add, 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, #GtkListBox::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.
The GtkListBox widget was added in GTK+ 3.10.
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 gtk.list_box.ListBox.setPlaceholder for info.
CSS nodes
list
╰── row[.activatable]GtkListBox uses a single CSS node named list. Each GtkListBoxRow uses a single CSS node named row. The row nodes get the .activatable style class added when appropriate.
ListBoxGidBuilder builder() static nothrowGet builder for [gtk.list_box.ListBox] Returns: New builder objectvoid bindModel(gio.list_model.ListModel model = null, gtk.types.ListBoxCreateWidgetFunc createWidgetFunc = null) nothrowBinds model to box.void dragHighlightRow(gtk.list_box_row.ListBoxRow row) nothrowThis is a helper function for implementing DnD onto a #GtkListBox. The passed in row will be highlighted via [gtk.widget.Widget.dragHighlight], and any previously highlighted row will be unhighligh...void dragUnhighlightRow() nothrowIf a row has previously been highlighted via [gtk.list_box.ListBox.dragHighlightRow] it will have the highlight removed.bool getActivateOnSingleClick() nothrowReturns whether rows activate on single clicks. Returns: true if rows are activated on single click, false otherwisegtk.adjustment.Adjustment getAdjustment() nothrowGets the adjustment (if any) that the widget uses to for vertical scrolling. Returns: the adjustmentgtk.list_box_row.ListBoxRow getRowAtIndex(int index) nothrowGets 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.gtk.list_box_row.ListBoxRow[] getSelectedRows() nothrowCreates a list of all selected children. Returns: A #GList containing the #GtkWidget for each selected child. Free with [glib.list.List.free] when done.gtk.types.SelectionMode getSelectionMode() nothrowGets the selection mode of the listbox. Returns: a #GtkSelectionModevoid insert(gtk.widget.Widget child, int position) nothrowInsert the child into the box at position. If a sort function is set, the widget will actually be inserted at the calculated position and this function has the same effect of [gtk.container.Contain...void invalidateFilter() nothrowUpdate 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 ...void invalidateHeaders() nothrowUpdate the separators for all rows. Call this when result of the header function on the box is changed due to an external factor.void invalidateSort() nothrowUpdate the sorting for all rows. Call this when result of the sort function on the box is changed due to an external factor.void prepend(gtk.widget.Widget child) nothrowPrepend a widget to the list. If a sort function is set, the widget will actually be inserted at the calculated position and this function has the same effect of [gtk.container.Container.add].void selectedForeach(gtk.types.ListBoxForeachFunc func) nothrowCalls a function for each selected child.void setActivateOnSingleClick(bool single) nothrowIf single is true, rows will be activated when you click on them, otherwise you need to double-click.void setAdjustment(gtk.adjustment.Adjustment adjustment = null) nothrowSets 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.void setFilterFunc(gtk.types.ListBoxFilterFunc filterFunc = null) nothrowBy 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 ...void setHeaderFunc(gtk.types.ListBoxUpdateHeaderFunc updateHeader = null) nothrowBy 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 he...void setPlaceholder(gtk.widget.Widget placeholder = null) nothrowSets the placeholder widget that is shown in the list when it doesn't display any visible children.void setSelectionMode(gtk.types.SelectionMode mode) nothrowSets how selection works in the listbox. See #GtkSelectionMode for details.void setSortFunc(gtk.types.ListBoxSortFunc sortFunc = null) nothrowBy setting a sort function on the box one can dynamically reorder the rows of the list, based on the contents of the rows.void unselectRow(gtk.list_box_row.ListBoxRow row) nothrowUnselects a single row of box, if the selection mode allows it.gulong connectActivateCursorRow(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.list_box.ListBox)))
&& Parameters!T.length < 2) nothrowConnect to `ActivateCursorRow` signal.gulong connectMoveCursor(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.MovementStep)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == int)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gtk.list_box.ListBox)))
&& Parameters!T.length < 4) nothrowConnect to `MoveCursor` signal.gulong connectRowActivated(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.list_box_row.ListBoxRow)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.list_box.ListBox)))
&& Parameters!T.length < 3) nothrowConnect to `RowActivated` signal.gulong connectRowSelected(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.list_box_row.ListBoxRow)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.list_box.ListBox)))
&& Parameters!T.length < 3) nothrowConnect to `RowSelected` signal.gulong connectSelectAll(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.list_box.ListBox)))
&& Parameters!T.length < 2) nothrowConnect to `SelectAll` signal.gulong connectSelectedRowsChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.list_box.ListBox)))
&& Parameters!T.length < 2) nothrowConnect to `SelectedRowsChanged` signal.gulong connectToggleCursorRow(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.list_box.ListBox)))
&& Parameters!T.length < 2) nothrowConnect to `ToggleCursorRow` signal.gulong connectUnselectAll(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.list_box.ListBox)))
&& Parameters!T.length < 2) nothrowConnect to `UnselectAll` signal.Fluent builder implementation template for gtk.list_box.ListBox
T activateOnSingleClick(bool propval) nothrowT selectionMode(gtk.types.SelectionMode propval) nothrowFluent builder for gtk.list_box.ListBox