SignalListItemFactoryProtocol

public protocol SignalListItemFactoryProtocol : ListItemFactoryProtocol

GtkSignalListItemFactory is a GtkListItemFactory that emits signals to to manage listitems.

Signals are emitted for every listitem in the same order:

  1. [signalGtk.SignalListItemFactory::setup] is emitted to set up permanent things on the listitem. This usually means constructing the widgets used in the row and adding them to the listitem.

  2. [signalGtk.SignalListItemFactory::bind] is emitted to bind the item passed via [propertyGtk.ListItem:item] to the widgets that have been created in step 1 or to add item-specific widgets. Signals are connected to listen to changes - both to changes in the item to update the widgets or to changes in the widgets to update the item. After this signal has been called, the listitem may be shown in a list widget.

  3. [signalGtk.SignalListItemFactory::unbind] is emitted to undo everything done in step 2. Usually this means disconnecting signal handlers. Once this signal has been called, the listitem will no longer be used in a list widget.

  4. [signalGtk.SignalListItemFactory::bind] and [signalGtk.SignalListItemFactory::unbind] may be emitted multiple times again to bind the listitem for use with new items. By reusing listitems, potentially costly setup can be avoided. However, it means code needs to make sure to properly clean up the listitem in step 3 so that no information from the previous use leaks into the next use.

    1. [signalGtk.SignalListItemFactory::teardown] is emitted to allow undoing the effects of [signalGtk.SignalListItemFactory::setup]. After this signal was emitted on a listitem, the listitem will be destroyed and not be used again.

Note that during the signal emissions, changing properties on the GtkListItems passed will not trigger notify signals as the listitem’s notifications are frozen. See g_object_freeze_notify() for details.

For tracking changes in other properties in the GtkListItem, the notify signal is recommended. The signal can be connected in the [signalGtk.SignalListItemFactory::setup] signal and removed again during [signalGtk.SignalListItemFactory::teardown].

The SignalListItemFactoryProtocol protocol exposes the methods and properties of an underlying GtkSignalListItemFactory 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 SignalListItemFactory. Alternatively, use SignalListItemFactoryRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkSignalListItemFactory instance.

    Declaration

    Swift

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

    Typed pointer to the underlying GtkSignalListItemFactory instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkSignalListItemFactory instance.

    Declaration

    Swift

    var signal_list_item_factory_ptr: UnsafeMutablePointer<GtkSignalListItemFactory>! { get }
  • Required Initialiser for types conforming to SignalListItemFactoryProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

SignalListItemFactory signals

  • Connect a Swift signal handler to the given, typed SignalListItemFactorySignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: SignalListItemFactorySignalName, 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 by userData

    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 a C signal handler to the given, typed SignalListItemFactorySignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: SignalListItemFactorySignalName, 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 by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • onBind(flags:handler:) Extension method

    Emitted when a new [propertyGtk.ListItem:item] has been set on the listitem and should be bound for use.

    After this signal was emitted, the listitem might be shown in a [classGtk.ListView] or other list widget.

    The [signalGtk.SignalListItemFactory::unbind] signal is the opposite of this signal and can be used to undo everything done in this signal.

    Note

    This represents the underlying bind signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onBind(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SignalListItemFactoryRef, _ listitem: ListItemRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    listitem

    The GtkListItem to bind

    handler

    The signal handler to call Run the given callback whenever the bind signal is emitted

  • bindSignal Extension method

    Typed bind signal for using the connect(signal:) methods

    Declaration

    Swift

    static var bindSignal: SignalListItemFactorySignalName { get }
  • onSetup(flags:handler:) Extension method

    Emitted when a new listitem has been created and needs to be setup for use.

    It is the first signal emitted for every listitem.

    The [signalGtk.SignalListItemFactory::teardown] signal is the opposite of this signal and can be used to undo everything done in this signal.

    Note

    This represents the underlying setup signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onSetup(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SignalListItemFactoryRef, _ listitem: ListItemRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    listitem

    The GtkListItem to set up

    handler

    The signal handler to call Run the given callback whenever the setup signal is emitted

  • setupSignal Extension method

    Typed setup signal for using the connect(signal:) methods

    Declaration

    Swift

    static var setupSignal: SignalListItemFactorySignalName { get }
  • onTeardown(flags:handler:) Extension method

    Emitted when a listitem is about to be destroyed.

    It is the last signal ever emitted for this listitem.

    This signal is the opposite of the [signalGtk.SignalListItemFactory::setup] signal and should be used to undo everything done in that signal.

    Note

    This represents the underlying teardown signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onTeardown(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SignalListItemFactoryRef, _ listitem: ListItemRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    listitem

    The GtkListItem to teardown

    handler

    The signal handler to call Run the given callback whenever the teardown signal is emitted

  • teardownSignal Extension method

    Typed teardown signal for using the connect(signal:) methods

    Declaration

    Swift

    static var teardownSignal: SignalListItemFactorySignalName { get }
  • onUnbind(flags:handler:) Extension method

    Emitted when a listitem has been removed from use in a list widget and its new [propertyGtk.ListItem:item] is about to be unset.

    This signal is the opposite of the [signalGtk.SignalListItemFactory::bind] signal and should be used to undo everything done in that signal.

    Note

    This represents the underlying unbind signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onUnbind(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SignalListItemFactoryRef, _ listitem: ListItemRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    listitem

    The GtkListItem to unbind

    handler

    The signal handler to call Run the given callback whenever the unbind signal is emitted

  • unbindSignal Extension method

    Typed unbind signal for using the connect(signal:) methods

    Declaration

    Swift

    static var unbindSignal: SignalListItemFactorySignalName { get }