gtkmm 4.16.0
|
The interface for sortable models used by Gtk::TreeView. More...
#include <gtkmm/treesortable.h>
Public Types | |
enum | { DEFAULT_SORT_COLUMN_ID = -1 , DEFAULT_UNSORTED_COLUMN_ID = -2 } |
typedef sigc::slot< int(const Gtk::TreeModel::const_iterator &, const Gtk::TreeModel::const_iterator &)> | SlotCompare |
This callback should return -1 if a compares before b, 0 if they compare equal, 1 if a compares after b. | |
Public Member Functions | |
TreeSortable (TreeSortable &&src) noexcept | |
TreeSortable & | operator= (TreeSortable &&src) noexcept |
~TreeSortable () noexcept override | |
GtkTreeSortable * | gobj () |
Provides access to the underlying C GObject. | |
const GtkTreeSortable * | gobj () const |
Provides access to the underlying C GObject. | |
bool | get_sort_column_id (int &sort_column_id, SortType & order) const |
Fills in sort_column_id and order with the current sort column and the order. | |
void | set_sort_column (const TreeModelColumnBase &sort_column_id, SortType order) |
Sets the current sort column to be sort_column_id. | |
void | set_sort_column (int sort_column_id, SortType order) |
Sets the current sort column to be sort_column_id. | |
void | set_sort_func (const TreeModelColumnBase &sort_column, const SlotCompare &slot) |
Sets the comparison function used when sorting a certain column. | |
void | set_sort_func (int sort_column_id, const SlotCompare &slot) |
Sets the comparison function used when sorting a certain column. | |
void | set_default_sort_func (const SlotCompare &slot) |
Sets the default comparison function used when sorting. | |
void | unset_default_sort_func () |
Sets the default comparison function used when sorting. | |
bool | has_default_sort_func () const |
Returns true if the model has a default sort function. | |
void | sort_column_changed () |
Emits a GtkTreeSortable::sort-column-changed signal on sortable. | |
Glib::SignalProxy< void()> | signal_sort_column_changed () |
Static Public Member Functions | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
Protected Member Functions | |
TreeSortable () | |
You should derive from this class to use it. | |
virtual bool | get_sort_column_id_vfunc (int *sort_column_id, SortType * order) const |
virtual void | set_sort_column_id_vfunc (int sort_column_id, SortType order) |
virtual void | set_sort_func_vfunc (int sort_column_id, GtkTreeIterCompareFunc func, void *data, GDestroyNotify destroy) |
virtual void | set_default_sort_func_vfunc (GtkTreeIterCompareFunc func, void *data, GDestroyNotify destroy) |
virtual bool | has_default_sort_func_vfunc () const |
virtual void | sort_column_changed_vfunc () const |
virtual void | on_sort_column_changed () |
This is a default handler for the signal signal_sort_column_changed(). | |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gtk::TreeSortable > | wrap (GtkTreeSortable *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
The interface for sortable models used by Gtk::TreeView.
Gtk::TreeSortable is an interface to be implemented by tree models which support sorting. The Gtk::TreeView uses the methods provided by this interface to sort the model.
typedef sigc::slot<int(const Gtk::TreeModel::const_iterator&, const Gtk::TreeModel::const_iterator&)> Gtk::TreeSortable::SlotCompare |
This callback should return -1 if a compares before b, 0 if they compare equal, 1 if a compares after b.
For instance, int on_sort_compare(const Gtk::TreeModel::const_iterator& a, const Gtk::TreeModel::const_iterator& b);
Enumerator | |
---|---|
DEFAULT_SORT_COLUMN_ID | See set_default_sort_func() and set_sort_column(). |
DEFAULT_UNSORTED_COLUMN_ID |
|
protected |
You should derive from this class to use it.
|
noexcept |
|
overridenoexcept |
bool Gtk::TreeSortable::get_sort_column_id | ( | int & | sort_column_id, |
SortType & | order | ||
) | const |
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.
Deprecated: 4.10
sort_column_id | The sort column id to be filled in. |
order | The Gtk::SortType to be filled in. |
true
if the sort column is not one of the special sort column ids.
|
protectedvirtual |
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
bool Gtk::TreeSortable::has_default_sort_func | ( | ) | const |
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.
Deprecated: 4.10
true
, if the model has a default sort function.
|
protectedvirtual |
This is a default handler for the signal signal_sort_column_changed().
|
noexcept |
void Gtk::TreeSortable::set_default_sort_func | ( | const SlotCompare & | slot | ) |
Sets the default comparison function used when sorting.
If the current sort column id of sortable is DEFAULT_SORT_COLUMN_ID, then the model will sort using this function. See also unset_default_sort_func().
slot | The sorting function |
|
protectedvirtual |
void Gtk::TreeSortable::set_sort_column | ( | const TreeModelColumnBase & | sort_column_id, |
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:
Deprecated: 4.10
sort_column_id | The sort column id to set. |
order | The sort order of the column. |
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:
Deprecated: 4.10
sort_column_id | The sort column id to set. |
order | The sort order of the column. |
|
protectedvirtual |
void Gtk::TreeSortable::set_sort_func | ( | const TreeModelColumnBase & | sort_column, |
const SlotCompare & | slot | ||
) |
Sets the comparison function used when sorting a certain column.
If the current sort column is the same as sort_column, then the model will sort using this function.
sort_column | the sort column to set the function for |
slot | The sorting slot callback. |
void Gtk::TreeSortable::set_sort_func | ( | int | sort_column_id, |
const SlotCompare & | slot | ||
) |
Sets the comparison function used when sorting a certain column.
If the current sort column id is the same as sort_column_id, then the model will sort using this function.
sort_column_id | the sort column id to set the function for |
slot | The sorting slot callback. |
|
protectedvirtual |
Glib::SignalProxy< void()> Gtk::TreeSortable::signal_sort_column_changed | ( | ) |
void on_my_sort_column_changed()
Flags: Run Last
The signal_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.
void Gtk::TreeSortable::sort_column_changed | ( | ) |
Emits a GtkTreeSortable::sort-column-changed
signal on sortable.
Deprecated: 4.10
void Gtk::TreeSortable::unset_default_sort_func | ( | ) |
Sets the default comparison function used when sorting.
After calling this method 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 DEFAULT_SORT_COLUMN_ID, the model will be unsorted.
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |