TreeSortableProtocol

public protocol TreeSortableProtocol : TreeModelProtocol

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.

  • ptr

    Untyped pointer to the underlying GtkTreeSortable instance.

    Declaration

    Swift

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

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

TreeSortable signals

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

    Declaration

    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 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 TreeSortableSignalName signal

    Declaration

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

  • The sort-column-changed signal is emitted when the sort column or sort order of sortable is changed. The signal is emitted before the contents of sortable are resorted.

    Note

    This represents the underlying sort-column-changed signal

    Declaration

    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 method

    Typed sort-column-changed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var sortColumnChangedSignal: TreeSortableSignalName { get }

TreeSortable Interface: TreeSortableProtocol extension (methods and fields)

  • get(sortColumnID:order:) Extension method

    Fills in sort_column_id and order with the current sort column and the order. It returns true unless the sort_column_id is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.

    Declaration

    Swift

    @inlinable
    func get(sortColumnID: UnsafeMutablePointer<gint>!, order: UnsafeMutablePointer<GtkSortType>!) -> Bool
  • hasDefaultSortFunc() Extension method

    Returns 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
  • Sets the default comparison function used when sorting to be sort_func. If the current sort column id of sortable is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using this function.

    If sort_func is nil, 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 of sortable is GTK_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:order:) Extension method

    Sets the current sort column to be sort_column_id. The sortable will resort itself to reflect this change, after emitting a GtkTreeSortable::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 set

    • GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID: no sorting will occur

    Declaration

    Swift

    @inlinable
    func set(sortColumnID: Int, order: GtkSortType)
  • Sets the comparison function used when sorting to be sort_func. If the current sort column id of sortable is the same as sort_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 method

    Emits a GtkTreeSortable::sort-column-changed signal on sortable.

    Declaration

    Swift

    @inlinable
    func sortColumnChanged()