ListItemProtocol
public protocol ListItemProtocol : ObjectProtocol
GtkListItem
is used by list widgets to represent items in a GListModel
.
The GtkListItem
s 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
].
GtkListItem
s 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
GtkListItem
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
list_item_ptr
Default implementationTyped pointer to the underlying
GtkListItem
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkListItem
instance.Declaration
Swift
var list_item_ptr: UnsafeMutablePointer<GtkListItem>! { get }
-
Required Initialiser for types conforming to
ListItemProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ListItemPropertyName
source 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 : 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 ListItem property
Declaration
Swift
@inlinable func get(property: ListItemPropertyName) -> 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 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
property
the 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()
ornil
if none was set.Declaration
Swift
@inlinable func getChild() -> WidgetRef!
-
getItem()
Extension methodGets the model item that associated with
self
.If
self
is unbound, this function returnsnil
.Declaration
Swift
@inlinable func getItem() -> GLibObject.ObjectRef!
-
getPosition()
Extension methodGets the position in the model that
self
currently displays.If
self
is unbound,GTK_INVALID_LIST_POSITION
is 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
self
to 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.GtkListView
for 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
self
to 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)
-
activatable
Extension methodIf the item can be activated by the user.
Declaration
Swift
@inlinable var activatable: Bool { get nonmutating set }
-
child
Extension methodWidget used for display.
Declaration
Swift
@inlinable var child: WidgetRef! { get nonmutating set }
-
item
Extension methodDisplayed item.
Declaration
Swift
@inlinable var item: GLibObject.ObjectRef! { get }
-
position
Extension methodPosition of the item.
Declaration
Swift
@inlinable var position: Int { get }
-
selectable
Extension methodIf the item can be selected by the user.
Declaration
Swift
@inlinable var selectable: Bool { get nonmutating set }
-
selected
Extension methodIf the item is currently selected.
Declaration
Swift
@inlinable var selected: Bool { get }