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
GtkListBox
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
list_box_ptr
Default implementationTyped pointer to the underlying
GtkListBox
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkListBox
instance.Declaration
Swift
var list_box_ptr: UnsafeMutablePointer<GtkListBox>! { get }
-
Required Initialiser for types conforming to
ListBoxProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ListBoxPropertyName
source 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 : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a ListBox property
Declaration
Swift
@inlinable func get(property: ListBoxPropertyName) -> GLibObject.Value
Parameters
property
the 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
property
the 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
ListBoxSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ListBoxSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
handler
The 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
ListBoxSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ListBoxSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
signalHandler
The 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-row
signalDeclaration
Swift
@discardableResult @inlinable func onActivateCursorRow(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
activateCursorRow
signal is emitted -
activateCursorRowSignal
Extension methodTyped
activate-cursor-row
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var activateCursorRowSignal: ListBoxSignalName { get }
-
onMoveCursor(flags:
Extension methodhandler: ) Note
This represents the underlyingmove-cursor
signalDeclaration
Swift
@discardableResult @inlinable func onMoveCursor(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ object: MovementStep, _ p0: Int, _ p1: Bool, _ p2: Bool) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
object
none
p0
none
p1
none
p2
none
handler
The signal handler to call Run the given callback whenever the
moveCursor
signal is emitted -
moveCursorSignal
Extension methodTyped
move-cursor
signal 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-activated
signalDeclaration
Swift
@discardableResult @inlinable func onRowActivated(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ row: ListBoxRowRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
row
the activated row
handler
The signal handler to call Run the given callback whenever the
rowActivated
signal is emitted -
rowActivatedSignal
Extension methodTyped
row-activated
signal 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
nil
row
) when the selection is cleared.When the
box
is 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-selected
signalDeclaration
Swift
@discardableResult @inlinable func onRowSelected(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ row: ListBoxRowRef?) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
row
the selected row
handler
The signal handler to call Run the given callback whenever the
rowSelected
signal is emitted -
rowSelectedSignal
Extension methodTyped
row-selected
signal 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-all
signalDeclaration
Swift
@discardableResult @inlinable func onSelectAll(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
selectAll
signal is emitted -
selectAllSignal
Extension methodTyped
select-all
signal 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-changed
signalDeclaration
Swift
@discardableResult @inlinable func onSelectedRowsChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
selectedRowsChanged
signal is emitted -
selectedRowsChangedSignal
Extension methodTyped
selected-rows-changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var selectedRowsChangedSignal: ListBoxSignalName { get }
-
onToggleCursorRow(flags:
Extension methodhandler: ) Note
This represents the underlyingtoggle-cursor-row
signalDeclaration
Swift
@discardableResult @inlinable func onToggleCursorRow(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
toggleCursorRow
signal is emitted -
toggleCursorRowSignal
Extension methodTyped
toggle-cursor-row
signal 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-all
signalDeclaration
Swift
@discardableResult @inlinable func onUnselectAll(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
unselectAll
signal is emitted -
unselectAllSignal
Extension methodTyped
unselect-all
signal 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 innotify
being 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-release
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyAcceptUnpairedRelease(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyAcceptUnpairedRelease
signal is emitted -
notifyAcceptUnpairedReleaseSignal
Extension methodTyped
notify::accept-unpaired-release
signal 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 innotify
being 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-click
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyActivateOnSingleClick(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyActivateOnSingleClick
signal is emitted -
notifyActivateOnSingleClickSignal
Extension methodTyped
notify::activate-on-single-click
signal 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 innotify
being 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-mode
signalDeclaration
Swift
@discardableResult @inlinable func onNotifySelectionMode(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifySelectionMode
signal is emitted -
notifySelectionModeSignal
Extension methodTyped
notify::selection-mode
signal 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 innotify
being 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-separators
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyShowSeparators(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ListBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pspec
the
GParamSpec
of the property which changed.handler
The signal handler to call Run the given callback whenever the
notifyShowSeparators
signal is emitted -
notifyShowSeparatorsSignal
Extension methodTyped
notify::show-separators
signal 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
model
tobox
.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 frommodel
.box
is updated whenevermodel
changes. Ifmodel
isnil
,box
is left empty.It is undefined to add or remove widgets directly (for example, with [method
Gtk.ListBox.insert
]) whilebox
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.Declaration
Swift
@inlinable func bind(model: GIO.ListModelRef? = nil, createWidgetFunc: GtkListBoxCreateWidgetFunc? = nil, userData: gpointer! = nil, userDataFreeFunc: GDestroyNotify?)
-
bind(model:
Extension methodcreateWidgetFunc: userData: userDataFreeFunc: ) Binds
model
tobox
.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 frommodel
.box
is updated whenevermodel
changes. Ifmodel
isnil
,box
is left empty.It is undefined to add or remove widgets directly (for example, with [method
Gtk.ListBox.insert
]) whilebox
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.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 inrow
will be highlighted by setting theGTK_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.
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,nil
is returned.Declaration
Swift
@inlinable func getRowAt(index: Int) -> ListBoxRowRef!
-
getRowAt(y:
Extension method) Gets the row at the
y
position.Declaration
Swift
@inlinable func getRowAt(y: Int) -> ListBoxRowRef!
-
getSelectedRow()
Extension methodGets the selected row, or
nil
if 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
child
into thebox
atposition
.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 thebox
, then thechild
will 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
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.Declaration
Swift
@inlinable func invalidateFilter()
-
invalidateHeaders()
Extension methodUpdate the separators for all rows.
Call this when result of the header function on the
box
is 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
box
is 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
row
the currently selected row.Declaration
Swift
@inlinable func select(row: ListBoxRowRef? = nil)
-
select(row:
Extension method) Make
row
the 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
single
istrue
, 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
box
is packed inside aGtkScrolledWindow
the 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
box
is packed inside aGtkScrolledWindow
the 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
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 [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
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 tonil
.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.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
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 [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
-
activateOnSingleClick
Extension methodReturns whether rows activate on single clicks.
Declaration
Swift
@inlinable var activateOnSingleClick: Bool { get nonmutating set }
-
adjustment
Extension methodGets the adjustment (if any) that the widget uses to for vertical scrolling.
Declaration
Swift
@inlinable var adjustment: AdjustmentRef! { get nonmutating set }
-
selectedRow
Extension methodGets the selected row, or
nil
if 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 }
-
selectedRows
Extension methodCreates a list of all selected children.
Declaration
Swift
@inlinable var selectedRows: GLib.ListRef! { get }
-
selectionMode
Extension methodGets the selection mode of the listbox.
Declaration
Swift
@inlinable var selectionMode: GtkSelectionMode { get nonmutating set }
-
showSeparators
Extension methodReturns whether the list box should show separators between rows.
Declaration
Swift
@inlinable var showSeparators: Bool { get nonmutating set }