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:
[signal
Gtk.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.[signal
Gtk.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.[signal
Gtk.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.[signal
Gtk.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.- [signal
Gtk.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.
- [signal
Note that during the signal emissions, changing properties on the
GtkListItem
s 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.
-
Untyped pointer to the underlying
GtkSignalListItemFactory
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
signal_list_item_factory_ptr
Default implementationTyped 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)
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
SignalListItemFactorySignalName
signalDeclaration
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 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
SignalListItemFactorySignalName
signalDeclaration
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 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)
-
onBind(flags:
Extension methodhandler: ) Emitted when a new [property
Gtk.ListItem:item
] has been set on thelistitem
and should be bound for use.After this signal was emitted, the listitem might be shown in a [class
Gtk.ListView
] or other list widget.The [signal
Gtk.SignalListItemFactory::unbind
] signal is the opposite of this signal and can be used to undo everything done in this signal.Note
This represents the underlyingbind
signalDeclaration
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 bindhandler
The signal handler to call Run the given callback whenever the
bind
signal is emitted -
bindSignal
Extension methodTyped
bind
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var bindSignal: SignalListItemFactorySignalName { get }
-
onSetup(flags:
Extension methodhandler: ) 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 [signal
Gtk.SignalListItemFactory::teardown
] signal is the opposite of this signal and can be used to undo everything done in this signal.Note
This represents the underlyingsetup
signalDeclaration
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 uphandler
The signal handler to call Run the given callback whenever the
setup
signal is emitted -
setupSignal
Extension methodTyped
setup
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var setupSignal: SignalListItemFactorySignalName { get }
-
onTeardown(flags:
Extension methodhandler: ) 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 [signal
Gtk.SignalListItemFactory::setup
] signal and should be used to undo everything done in that signal.Note
This represents the underlyingteardown
signalDeclaration
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 teardownhandler
The signal handler to call Run the given callback whenever the
teardown
signal is emitted -
teardownSignal
Extension methodTyped
teardown
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var teardownSignal: SignalListItemFactorySignalName { get }
-
onUnbind(flags:
Extension methodhandler: ) Emitted when a listitem has been removed from use in a list widget and its new [property
Gtk.ListItem:item
] is about to be unset.This signal is the opposite of the [signal
Gtk.SignalListItemFactory::bind
] signal and should be used to undo everything done in that signal.Note
This represents the underlyingunbind
signalDeclaration
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 unbindhandler
The signal handler to call Run the given callback whenever the
unbind
signal is emitted -
unbindSignal
Extension methodTyped
unbind
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var unbindSignal: SignalListItemFactorySignalName { get }