TreeSortableProtocol
public protocol TreeSortableProtocol : TreeModelProtocol
The interface for sortable models used by GtkTreeView
GtkTreeSortable
is an interface to be implemented by tree models which
support sorting. The GtkTreeView
uses the methods provided by this interface
to sort the model.
The TreeSortableProtocol
protocol exposes the methods and properties of an underlying GtkTreeSortable
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 TreeSortable
.
Alternatively, use TreeSortableRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkTreeSortable
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
tree_sortable_ptr
Default implementationTyped pointer to the underlying
GtkTreeSortable
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkTreeSortable
instance.Declaration
Swift
var tree_sortable_ptr: UnsafeMutablePointer<GtkTreeSortable>! { get }
-
Required Initialiser for types conforming to
TreeSortableProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
TreeSortableSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: TreeSortableSignalName, 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
TreeSortableSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: TreeSortableSignalName, 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)
-
onSortColumnChanged(flags:
Extension methodhandler: ) The
sort-column-changed
signal is emitted when the sort column or sort order ofsortable
is changed. The signal is emitted before the contents ofsortable
are resorted.Note
This represents the underlyingsort-column-changed
signalDeclaration
Swift
@discardableResult @inlinable func onSortColumnChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TreeSortableRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
sortColumnChanged
signal is emitted -
sortColumnChangedSignal
Extension methodTyped
sort-column-changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var sortColumnChangedSignal: TreeSortableSignalName { get }
-
get(sortColumnId:
Extension methodorder: ) Fills in
sort_column_id
andorder
with the current sort column and the order. It returnstrue
unless thesort_column_id
isGTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
orGTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID
.Declaration
Swift
@inlinable func get(sortColumnId: UnsafeMutablePointer<gint>!, order: UnsafeMutablePointer<GtkSortType>!) -> Bool
-
hasDefaultSortFunc()
Extension methodReturns
true
if the model has a default sort function. This is used primarily by GtkTreeViewColumns in order to determine if a model can go back to the default state, or not.Declaration
Swift
@inlinable func hasDefaultSortFunc() -> Bool
-
setDefault(sortFunc:
Extension methoduserData: destroy: ) Sets the default comparison function used when sorting to be
sort_func
. If the current sort column id ofsortable
isGTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
, then the model will sort using this function.If
sort_func
isnil
, then there will be no default comparison function. This means that once the model has been sorted, it can’t go back to the default state. In this case, when the current sort column id ofsortable
isGTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
, the model will be unsorted.Declaration
Swift
@inlinable func setDefault(sortFunc: GtkTreeIterCompareFunc?, userData: gpointer! = nil, destroy: GDestroyNotify? = nil)
-
set(sortColumnId:
Extension methodorder: ) Sets the current sort column to be
sort_column_id
. Thesortable
will resort itself to reflect this change, after emitting aGtkTreeSortable
sort-column-changed`signal.
sort_column_id` may either be a regular column id, or one of the following special values:GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID:
the default sort function will be used, if it is setGTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID:
no sorting will occur
Declaration
Swift
@inlinable func set(sortColumnId: Int, order: GtkSortType)
-
setSortFunc(sortColumnId:
Extension methodsortFunc: userData: destroy: ) Sets the comparison function used when sorting to be
sort_func
. If the current sort column id ofsortable
is the same assort_column_id
, then the model will sort using this function.Declaration
Swift
@inlinable func setSortFunc(sortColumnId: Int, sortFunc: GtkTreeIterCompareFunc?, userData: gpointer! = nil, destroy: GDestroyNotify? = nil)
-
sortColumnChanged()
Extension methodEmits a
GtkTreeSortable
sort-column-changed`signal on
sortable`.Declaration
Swift
@inlinable func sortColumnChanged()