ListItemProtocol
public protocol ListItemProtocol : ObjectProtocol
GtkListItem is used by list widgets to represent items in a GListModel.
The GtkListItems are managed by the list widget (with its factory)
and cannot be created by applications, but they need to be populated
by application code. This is done by calling [methodGtk.ListItem.set_child].
GtkListItems exist in 2 stages:
The unbound stage where the listitem is not currently connected to an item in the list. In that case, the [property
Gtk.ListItem:item] property is set tonil.The bound stage where the listitem references an item from the list. The [property
Gtk.ListItem:item] property is notnil.
The ListItemProtocol protocol exposes the methods and properties of an underlying GtkListItem 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 ListItem.
Alternatively, use ListItemRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkListIteminstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
list_item_ptrDefault implementationTyped pointer to the underlying
GtkListIteminstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkListIteminstance.Declaration
Swift
var list_item_ptr: UnsafeMutablePointer<GtkListItem>! { get } -
Required Initialiser for types conforming to
ListItemProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ListItemPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: ListItemPropertyName, 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 ListItem property
Declaration
Swift
@inlinable func get(property: ListItemPropertyName) -> 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 ListItem property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: ListItemPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
getActivatable()Extension methodChecks if a list item has been set to be activatable via
gtk_list_item_set_activatable().Declaration
Swift
@inlinable func getActivatable() -> Bool -
getChild()Extension methodGets the child previously set via
gtk_list_item_set_child()ornilif none was set.Declaration
Swift
@inlinable func getChild() -> WidgetRef! -
getItem()Extension methodGets the model item that associated with
self.If
selfis unbound, this function returnsnil.Declaration
Swift
@inlinable func getItem() -> GLibObject.ObjectRef! -
getPosition()Extension methodGets the position in the model that
selfcurrently displays.If
selfis unbound,GTK_INVALID_LIST_POSITIONis returned.Declaration
Swift
@inlinable func getPosition() -> Int -
getSelectable()Extension methodChecks if a list item has been set to be selectable via
gtk_list_item_set_selectable().Do not confuse this function with [method
Gtk.ListItem.get_selected].Declaration
Swift
@inlinable func getSelectable() -> Bool -
getSelected()Extension methodChecks if the item is displayed as selected.
The selected state is maintained by the liste widget and its model and cannot be set otherwise.
Declaration
Swift
@inlinable func getSelected() -> Bool -
set(activatable:Extension method) Sets
selfto be activatable.If an item is activatable, double-clicking on the item, using the Return key or calling
gtk_widget_activate()will activate the item. Activating instructs the containing view to handle activation.GtkListViewfor example will be emitting the [signalGtk.ListView::activate] signal.By default, list items are activatable.
Declaration
Swift
@inlinable func set(activatable: Bool) -
set(child:Extension method) Sets the child to be used for this listitem.
This function is typically called by applications when setting up a listitem so that the widget can be reused when binding it multiple times.
Declaration
Swift
@inlinable func set(child: WidgetRef? = nil) -
set(child:Extension method) Sets the child to be used for this listitem.
This function is typically called by applications when setting up a listitem so that the widget can be reused when binding it multiple times.
Declaration
Swift
@inlinable func set<WidgetT>(child: WidgetT?) where WidgetT : WidgetProtocol -
set(selectable:Extension method) Sets
selfto be selectable.If an item is selectable, clicking on the item or using the keyboard will try to select or unselect the item. If this succeeds is up to the model to determine, as it is managing the selected state.
Note that this means that making an item non-selectable has no influence on the selected state at all. A non-selectable item may still be selected.
By default, list items are selectable. When rebinding them to a new item, they will also be reset to be selectable by GTK.
Declaration
Swift
@inlinable func set(selectable: Bool) -
activatableExtension methodIf the item can be activated by the user.
Declaration
Swift
@inlinable var activatable: Bool { get nonmutating set } -
childExtension methodWidget used for display.
Declaration
Swift
@inlinable var child: WidgetRef! { get nonmutating set } -
itemExtension methodDisplayed item.
Declaration
Swift
@inlinable var item: GLibObject.ObjectRef! { get } -
positionExtension methodPosition of the item.
Declaration
Swift
@inlinable var position: Int { get } -
selectableExtension methodIf the item can be selected by the user.
Declaration
Swift
@inlinable var selectable: Bool { get nonmutating set } -
selectedExtension methodIf the item is currently selected.
Declaration
Swift
@inlinable var selected: Bool { get }
View on GitHub
Install in Dash
ListItemProtocol Protocol Reference