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:

  1. The unbound stage where the listitem is not currently connected to an item in the list. In that case, the [propertyGtk.ListItem:item] property is set to nil.

  2. The bound stage where the listitem references an item from the list. The [propertyGtk.ListItem:item] property is not nil.

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.

  • ptr

    Untyped pointer to the underlying GtkListItem instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • list_item_ptr Default implementation

    Typed 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)

ListItem Class

  • 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 transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return 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:value:) Extension method

    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

ListItem Class: ListItemProtocol extension (methods and fields)

  • getActivatable() Extension method

    Checks if a list item has been set to be activatable via gtk_list_item_set_activatable().

    Declaration

    Swift

    @inlinable
    func getActivatable() -> Bool
  • getChild() Extension method

    Gets the child previously set via gtk_list_item_set_child() or nil if none was set.

    Declaration

    Swift

    @inlinable
    func getChild() -> WidgetRef!
  • getItem() Extension method

    Gets the model item that associated with self.

    If self is unbound, this function returns nil.

    Declaration

    Swift

    @inlinable
    func getItem() -> GLibObject.ObjectRef!
  • getPosition() Extension method

    Gets 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 method

    Checks if a list item has been set to be selectable via gtk_list_item_set_selectable().

    Do not confuse this function with [methodGtk.ListItem.get_selected].

    Declaration

    Swift

    @inlinable
    func getSelectable() -> Bool
  • getSelected() Extension method

    Checks 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 method

    If the item can be activated by the user.

    Declaration

    Swift

    @inlinable
    var activatable: Bool { get nonmutating set }
  • child Extension method

    Widget used for display.

    Declaration

    Swift

    @inlinable
    var child: WidgetRef! { get nonmutating set }
  • item Extension method

    Displayed item.

    Declaration

    Swift

    @inlinable
    var item: GLibObject.ObjectRef! { get }
  • position Extension method

    Position of the item.

    Declaration

    Swift

    @inlinable
    var position: Int { get }
  • selectable Extension method

    If the item can be selected by the user.

    Declaration

    Swift

    @inlinable
    var selectable: Bool { get nonmutating set }
  • selected Extension method

    If the item is currently selected.

    Declaration

    Swift

    @inlinable
    var selected: Bool { get }