ListBoxProtocol
public protocol ListBoxProtocol : WidgetProtocol
GtkListBox is a vertical list.
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.
CSS nodes
(plain Language Example):
list[.separators][.rich-list][.navigation-sidebar]
╰── 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.
The main list node may also carry style classes to select the style of list presentation: .rich-list, .navigation-sidebar or .data-table.
Accessibility
GtkListBox uses the GTK_ACCESSIBLE_ROLE_LIST role and GtkListBoxRow uses
the GTK_ACCESSIBLE_ROLE_LIST_ITEM role.
The ListBoxProtocol protocol exposes the methods and properties of an underlying GtkListBox instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see ListBox.
Alternatively, use ListBoxRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkListBoxinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
list_box_ptrDefault implementationTyped pointer to the underlying
GtkListBoxinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkListBoxinstance.Declaration
Swift
var list_box_ptr: UnsafeMutablePointer<GtkListBox>! { get } -
Required Initialiser for types conforming to
ListBoxProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ListBoxPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: ListBoxPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a ListBox property
Declaration
Swift
@inlinable func get(property: ListBoxPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a ListBox property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: ListBoxPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
ListBoxSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ListBoxSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe Swift signal handler (function or callback) to invoke on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
connect(signal:Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
ListBoxSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ListBoxSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onActivateCursorRow(flags:Extension methodhandler: ) Note
This represents the underlyingactivate-cursor-rowsignalDeclaration
Swift
@discardableResult @inlinable func onActivateCursorRow(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
activateCursorRowsignal is emitted -
activateCursorRowSignalExtension methodTyped
activate-cursor-rowsignal for using theconnect(signal:)methodsDeclaration
Swift
static var activateCursorRowSignal: ListBoxSignalName { get } -
onMoveCursor(flags:Extension methodhandler: ) Note
This represents the underlyingmove-cursorsignalDeclaration
Swift
@discardableResult @inlinable func onMoveCursor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ object: MovementStep, _ p0: Int, _ p1: Bool, _ p2: Bool) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
objectnone
p0none
p1none
p2none
handlerThe signal handler to call Run the given callback whenever the
moveCursorsignal is emitted -
moveCursorSignalExtension methodTyped
move-cursorsignal for using theconnect(signal:)methodsDeclaration
Swift
static var moveCursorSignal: ListBoxSignalName { get } -
onRowActivated(flags:Extension methodhandler: ) Emitted when a row has been activated by the user.
Note
This represents the underlyingrow-activatedsignalDeclaration
Swift
@discardableResult @inlinable func onRowActivated(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ row: ListBoxRowRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
rowthe activated row
handlerThe signal handler to call Run the given callback whenever the
rowActivatedsignal is emitted -
rowActivatedSignalExtension methodTyped
row-activatedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var rowActivatedSignal: ListBoxSignalName { get } -
onRowSelected(flags:Extension methodhandler: ) Emitted when a new row is selected, or (with a
nilrow) when the selection is cleared.When the
boxis usingGTK_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.Note
This represents the underlyingrow-selectedsignalDeclaration
Swift
@discardableResult @inlinable func onRowSelected(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ row: ListBoxRowRef?) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
rowthe selected row
handlerThe signal handler to call Run the given callback whenever the
rowSelectedsignal is emitted -
rowSelectedSignalExtension methodTyped
row-selectedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var rowSelectedSignal: ListBoxSignalName { get } -
onSelectAll(flags:Extension methodhandler: ) 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>.
Note
This represents the underlyingselect-allsignalDeclaration
Swift
@discardableResult @inlinable func onSelectAll(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
selectAllsignal is emitted -
selectAllSignalExtension methodTyped
select-allsignal for using theconnect(signal:)methodsDeclaration
Swift
static var selectAllSignal: ListBoxSignalName { get } -
onSelectedRowsChanged(flags:Extension methodhandler: ) Emitted when the set of selected rows changes.
Note
This represents the underlyingselected-rows-changedsignalDeclaration
Swift
@discardableResult @inlinable func onSelectedRowsChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
selectedRowsChangedsignal is emitted -
selectedRowsChangedSignalExtension methodTyped
selected-rows-changedsignal for using theconnect(signal:)methodsDeclaration
Swift
static var selectedRowsChangedSignal: ListBoxSignalName { get } -
onToggleCursorRow(flags:Extension methodhandler: ) Note
This represents the underlyingtoggle-cursor-rowsignalDeclaration
Swift
@discardableResult @inlinable func onToggleCursorRow(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
toggleCursorRowsignal is emitted -
toggleCursorRowSignalExtension methodTyped
toggle-cursor-rowsignal for using theconnect(signal:)methodsDeclaration
Swift
static var toggleCursorRowSignal: ListBoxSignalName { get } -
onUnselectAll(flags:Extension methodhandler: ) 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>.
Note
This represents the underlyingunselect-allsignalDeclaration
Swift
@discardableResult @inlinable func onUnselectAll(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
unselectAllsignal is emitted -
unselectAllSignalExtension methodTyped
unselect-allsignal for using theconnect(signal:)methodsDeclaration
Swift
static var unselectAllSignal: ListBoxSignalName { get } -
onNotifyAcceptUnpairedRelease(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::accept-unpaired-releasesignalDeclaration
Swift
@discardableResult @inlinable func onNotifyAcceptUnpairedRelease(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyAcceptUnpairedReleasesignal is emitted -
notifyAcceptUnpairedReleaseSignalExtension methodTyped
notify::accept-unpaired-releasesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyAcceptUnpairedReleaseSignal: ListBoxSignalName { get } -
onNotifyActivateOnSingleClick(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::activate-on-single-clicksignalDeclaration
Swift
@discardableResult @inlinable func onNotifyActivateOnSingleClick(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyActivateOnSingleClicksignal is emitted -
notifyActivateOnSingleClickSignalExtension methodTyped
notify::activate-on-single-clicksignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyActivateOnSingleClickSignal: ListBoxSignalName { get } -
onNotifySelectionMode(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::selection-modesignalDeclaration
Swift
@discardableResult @inlinable func onNotifySelectionMode(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifySelectionModesignal is emitted -
notifySelectionModeSignalExtension methodTyped
notify::selection-modesignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifySelectionModeSignal: ListBoxSignalName { get } -
onNotifyShowSeparators(flags:Extension methodhandler: ) The notify signal is emitted on an object when one of its properties has its value set through
g_object_set_property(),g_object_set(), et al.Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with
G_PARAM_EXPLICIT_NOTIFY, then any call tog_object_set_property()results innotifybeing emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly callg_object_notify()org_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the
g_signal_connect()call, like this:(C Language Example):
g_signal_connect (text_view->buffer, "notify::paste-target-list", G_CALLBACK (gtk_text_view_target_list_notify), text_view)It is important to note that you must use canonical parameter names as detail strings for the notify signal.
Note
This represents the underlyingnotify::show-separatorssignalDeclaration
Swift
@discardableResult @inlinable func onNotifyShowSeparators(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ pspec: ParamSpecRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pspecthe
GParamSpecof the property which changed.handlerThe signal handler to call Run the given callback whenever the
notifyShowSeparatorssignal is emitted -
notifyShowSeparatorsSignalExtension methodTyped
notify::show-separatorssignal for using theconnect(signal:)methodsDeclaration
Swift
static var notifyShowSeparatorsSignal: ListBoxSignalName { get }
-
append(child:Extension method) Append a widget to the list.
If a sort function is set, the widget will actually be inserted at the calculated position.
Declaration
Swift
@inlinable func append<WidgetT>(child: WidgetT) where WidgetT : WidgetProtocol -
bind(model:Extension methodcreateWidgetFunc: userData: userDataFreeFunc: ) Binds
modeltobox.If
boxwas already bound to a model, that previous binding is destroyed.The contents of
boxare cleared and then filled with widgets that represent items frommodel.boxis updated whenevermodelchanges. Ifmodelisnil,boxis left empty.It is undefined to add or remove widgets directly (for example, with [method
Gtk.ListBox.insert]) whileboxis 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.Declaration
Swift
@inlinable func bind(model: GIO.ListModelRef? = nil, createWidgetFunc: GtkListBoxCreateWidgetFunc? = nil, userData: gpointer! = nil, userDataFreeFunc: GDestroyNotify?) -
bind(model:Extension methodcreateWidgetFunc: userData: userDataFreeFunc: ) Binds
modeltobox.If
boxwas already bound to a model, that previous binding is destroyed.The contents of
boxare cleared and then filled with widgets that represent items frommodel.boxis updated whenevermodelchanges. Ifmodelisnil,boxis left empty.It is undefined to add or remove widgets directly (for example, with [method
Gtk.ListBox.insert]) whileboxis 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.Declaration
Swift
@inlinable func bind<ListModelT>(model: ListModelT?, createWidgetFunc: GtkListBoxCreateWidgetFunc? = nil, userData: gpointer! = nil, userDataFreeFunc: GDestroyNotify?) where ListModelT : ListModelProtocol -
dragHighlight(row:Extension method) Add a drag highlight to a row.
This is a helper function for implementing DnD onto a
GtkListBox. The passed inrowwill be highlighted by setting theGTK_STATE_FLAG_DROP_ACTIVEstate and any previously highlighted row will be unhighlighted.The row will also be unhighlighted when the widget gets a drag leave event.
Declaration
Swift
@inlinable func dragHighlight<ListBoxRowT>(row: ListBoxRowT) where ListBoxRowT : ListBoxRowProtocol -
dragUnhighlightRow()Extension methodIf a row has previously been highlighted via
gtk_list_box_drag_highlight_row(), it will have the highlight removed.Declaration
Swift
@inlinable func dragUnhighlightRow() -
getActivateOnSingleClick()Extension methodReturns whether rows activate on single clicks.
Declaration
Swift
@inlinable func getActivateOnSingleClick() -> Bool -
getAdjustment()Extension methodGets the adjustment (if any) that the widget uses to for vertical scrolling.
Declaration
Swift
@inlinable func getAdjustment() -> AdjustmentRef! -
getRowAt(index:Extension method) 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,nilis returned.Declaration
Swift
@inlinable func getRowAt(index: Int) -> ListBoxRowRef! -
getRowAt(y:Extension method) Gets the row at the
yposition.Declaration
Swift
@inlinable func getRowAt(y: Int) -> ListBoxRowRef! -
getSelectedRow()Extension methodGets the selected row, or
nilif no rows are selected.Note that the box may allow multiple selection, in which case you should use [method
Gtk.ListBox.selected_foreach] to find all selected rows.Declaration
Swift
@inlinable func getSelectedRow() -> ListBoxRowRef! -
getSelectedRows()Extension methodCreates a list of all selected children.
Declaration
Swift
@inlinable func getSelectedRows() -> GLib.ListRef! -
getSelectionMode()Extension methodGets the selection mode of the listbox.
Declaration
Swift
@inlinable func getSelectionMode() -> GtkSelectionMode -
getShowSeparators()Extension methodReturns whether the list box should show separators between rows.
Declaration
Swift
@inlinable func getShowSeparators() -> Bool -
insert(child:Extension methodposition: ) Insert the
childinto theboxatposition.If a sort function is set, the widget will actually be inserted at the calculated position.
If
positionis -1, or larger than the total number of items in thebox, then thechildwill be appended to the end.Declaration
Swift
@inlinable func insert<WidgetT>(child: WidgetT, position: Int) where WidgetT : WidgetProtocol -
invalidateFilter()Extension methodUpdate the filtering for all rows.
Call this when result of the filter function on the
boxis 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.Declaration
Swift
@inlinable func invalidateFilter() -
invalidateHeaders()Extension methodUpdate the separators for all rows.
Call this when result of the header function on the
boxis changed due to an external factor.Declaration
Swift
@inlinable func invalidateHeaders() -
invalidateSort()Extension methodUpdate the sorting for all rows.
Call this when result of the sort function on the
boxis changed due to an external factor.Declaration
Swift
@inlinable func invalidateSort() -
prepend(child:Extension method) Prepend a widget to the list.
If a sort function is set, the widget will actually be inserted at the calculated position.
Declaration
Swift
@inlinable func prepend<WidgetT>(child: WidgetT) where WidgetT : WidgetProtocol -
remove(child:Extension method) Removes a child from
box.Declaration
Swift
@inlinable func remove<WidgetT>(child: WidgetT) where WidgetT : WidgetProtocol -
selectAll()Extension methodSelect all children of
box, if the selection mode allows it.Declaration
Swift
@inlinable func selectAll() -
select(row:Extension method) Make
rowthe currently selected row.Declaration
Swift
@inlinable func select(row: ListBoxRowRef? = nil) -
select(row:Extension method) Make
rowthe currently selected row.Declaration
Swift
@inlinable func select<ListBoxRowT>(row: ListBoxRowT?) where ListBoxRowT : ListBoxRowProtocol -
selectedForeach(func:Extension methoddata: ) Calls a function for each selected child.
Note that the selection cannot be modified from within this function.
Declaration
Swift
@inlinable func selectedForeach(func: GtkListBoxForeachFunc?, data: gpointer! = nil) -
setActivateOnSingleClick(single:Extension method) If
singleistrue, rows will be activated when you click on them, otherwise you need to double-click.Declaration
Swift
@inlinable func setActivateOnSingleClick(single: Bool) -
set(adjustment:Extension method) 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
boxis packed inside aGtkScrolledWindowthe adjustment from that will be picked up automatically, so there is no need to manually do that.Declaration
Swift
@inlinable func set(adjustment: AdjustmentRef? = nil) -
set(adjustment:Extension method) 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
boxis packed inside aGtkScrolledWindowthe adjustment from that will be picked up automatically, so there is no need to manually do that.Declaration
Swift
@inlinable func set<AdjustmentT>(adjustment: AdjustmentT?) where AdjustmentT : AdjustmentProtocol -
set(filterFunc:Extension methoduserData: destroy: ) By setting a filter function on the
boxone 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_funcwill 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 [method
Gtk.ListBox.bind_model]).Declaration
Swift
@inlinable func set(filterFunc: GtkListBoxFilterFunc? = nil, userData: gpointer! = nil, destroy: GDestroyNotify?) -
setHeaderFunc(updateHeader:Extension methoduserData: destroy: ) Sets a header function.
By setting a header function on the
boxone 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_headercan 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 tonil.Note that you may get many calls
update_headerto 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_headerfunction 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.Declaration
Swift
@inlinable func setHeaderFunc(updateHeader: GtkListBoxUpdateHeaderFunc? = nil, userData: gpointer! = nil, destroy: GDestroyNotify?) -
set(placeholder:Extension method) Sets the placeholder widget that is shown in the list when it doesn’t display any visible children.
Declaration
Swift
@inlinable func set(placeholder: WidgetRef? = nil) -
set(placeholder:Extension method) Sets the placeholder widget that is shown in the list when it doesn’t display any visible children.
Declaration
Swift
@inlinable func set<WidgetT>(placeholder: WidgetT?) where WidgetT : WidgetProtocol -
setSelection(mode:Extension method) Sets how selection works in the listbox.
Declaration
Swift
@inlinable func setSelection(mode: GtkSelectionMode) -
set(showSeparators:Extension method) Sets whether the list box should show separators between rows.
Declaration
Swift
@inlinable func set(showSeparators: Bool) -
set(sortFunc:Extension methoduserData: destroy: ) Sets a sort function.
By setting a sort function on the
boxone can dynamically reorder the rows of the list, based on the contents of the rows.The
sort_funcwill 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 [method
Gtk.ListBox.bind_model]).Declaration
Swift
@inlinable func set(sortFunc: GtkListBoxSortFunc? = nil, userData: gpointer! = nil, destroy: GDestroyNotify?) -
unselectAll()Extension methodUnselect all children of
box, if the selection mode allows it.Declaration
Swift
@inlinable func unselectAll() -
unselect(row:Extension method) Unselects a single row of
box, if the selection mode allows it.Declaration
Swift
@inlinable func unselect<ListBoxRowT>(row: ListBoxRowT) where ListBoxRowT : ListBoxRowProtocol -
activateOnSingleClickExtension methodReturns whether rows activate on single clicks.
Declaration
Swift
@inlinable var activateOnSingleClick: Bool { get nonmutating set } -
adjustmentExtension methodGets the adjustment (if any) that the widget uses to for vertical scrolling.
Declaration
Swift
@inlinable var adjustment: AdjustmentRef! { get nonmutating set } -
selectedRowExtension methodGets the selected row, or
nilif no rows are selected.Note that the box may allow multiple selection, in which case you should use [method
Gtk.ListBox.selected_foreach] to find all selected rows.Declaration
Swift
@inlinable var selectedRow: ListBoxRowRef! { get } -
selectedRowsExtension methodCreates a list of all selected children.
Declaration
Swift
@inlinable var selectedRows: GLib.ListRef! { get } -
selectionModeExtension methodGets the selection mode of the listbox.
Declaration
Swift
@inlinable var selectionMode: GtkSelectionMode { get nonmutating set } -
showSeparatorsExtension methodReturns whether the list box should show separators between rows.
Declaration
Swift
@inlinable var showSeparators: Bool { get nonmutating set }
View on GitHub
Install in Dash
ListBoxProtocol Protocol Reference