gtk.tree_sortable_mixin

Module for [TreeSortable] interface mixin

Templates 2

tmplTreeSortableT()

The interface for sortable models used by GtkTreeView

[gtk.tree_sortable.TreeSortable] is an interface to be implemented by tree models which support sorting. The [gtk.tree_view.TreeView] uses the methods provided by this interface to sort the model.

Deprecated

There is no replacement for this interface. You should

use [gtk.sort_list_model.SortListModel] to wrap your list model instead

Functions
bool getSortColumnId(out int sortColumnId, out gtk.types.SortType order)

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.types.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID] or [gtk.types.TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID].

Parameters

sortColumnIdThe sort column id to be filled in
orderThe [gtk.types.SortType] to be filled in

Returns

true if the sort column is not one of the special sort

column ids.

bool hasDefaultSortFunc()

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.

Returns

true, if the model has a default sort function
void setDefaultSortFunc(gtk.types.TreeIterCompareFunc sortFunc)

Sets the default comparison function used when sorting to be sort_func. If the current sort column id of sortable is [gtk.types.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID], then the model will sort using this function.

If sort_func is null, 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.types.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID], the model will be unsorted.

Parameters

sortFuncThe comparison function
void setSortColumnId(int sortColumnId, gtk.types.SortType order)

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.types.TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID]: the default sort function

will be used, if it is set

  • [gtk.types.TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID]: no sorting will occur

Parameters

sortColumnIdthe sort column id to set
orderThe sort order of the column
void setSortFunc(int sortColumnId, gtk.types.TreeIterCompareFunc sortFunc)

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.

Parameters

sortColumnIdthe sort column id to set the function for
sortFuncThe comparison function
void sortColumnChanged()

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

gulong connectSortColumnChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T && is(ReturnType!T == void) && (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.tree_sortable.TreeSortable))) && Parameters!T.length < 2)

Connect to SortColumnChanged signal.

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.

Parameters

callbacksignal callback delegate or function to connect void callback(gtk.tree_sortable.TreeSortable treeSortable) treeSortable the instance the signal is connected to (optional)
afterYes.After to execute callback after default handler, No.After to execute before (default)

Returns

Signal ID
tmplTreeSortableGidBuilderT()