1Gtk2::TreeSortable(3) User Contributed Perl DocumentationGtk2::TreeSortable(3)
2
3
4

NAME

6       Gtk2::TreeSortable - wrapper for GtkTreeSortable
7

HIERARCHY

9         Glib::Interface
10         +----Gtk2::TreeSortable
11

METHODS

13   $sortable->set_default_sort_func ($sort_func, $user_data=undef)
14       •   $sort_func (scalar)
15
16       •   $user_data (scalar)
17
18   boolean = $sortable->has_default_sort_func
19   $sortable->sort_column_changed
20   (sort_column_id, order) = $sortable->get_sort_column_id
21       Returns sort_column_id, an integer and order, a Gtk2::SortType.
22
23   $sortable->set_sort_column_id ($sort_column_id, $order)
24       •   $sort_column_id (integer)
25
26       •   $order (Gtk2::SortType)
27
28   $sortable->set_sort_func ($sort_column_id, $sort_func, $user_data=undef)
29       •   $sort_column_id (integer)
30
31       •   $sort_func (scalar)
32
33       •   $user_data (scalar)
34

IMPLEMENTING THE GtkTreeSortable INTERACE

36       If you want your custom tree model to be sortable, you need to
37       implement the GtkTreeSortable interface.  Just like with other
38       interfaces, this boils down to announcing that your subclass implements
39       the interface and providing a few virtual methods.  The former is
40       achieved by adding "Gtk2::TreeSortable" to the "interfaces" key.  For
41       example:
42
43         package MyModel;
44         use Gtk2;
45         use Glib::Object::Subclass
46             Glib::Object::,
47             interfaces => [ Gtk2::TreeModel::, Gtk2::TreeSortable:: ],
48             ;
49
50       The virtual methods you need to implement are listed below.
51
52   VIRTUAL METHODS
53       These virtual methods are called by perl when gtk+ attempts to modify
54       the sorting behavior of your model.  Implement them in your model's
55       package.  Note that we don't provide a wrapper for sort_column_changed
56       because there is a signal for it, which means you can use the normal
57       signal overriding mechanism documented in Glib::Object::Subclass.
58
59       (is_not_special, id, order) = GET_SORT_COLUMN_ID ($model)
60           Returns a boolean indicating whether the column is a special or
61           normal one, its id and its sorting order.
62
63       SET_SORT_COLUMN_ID ($list, $id, $order)
64           Sets the sort column to the one specified by $id and the sorting
65           order to $order.
66
67       SET_SORT_FUNC ($list, $id, $func, $data)
68           Sets the function that is to be used for sorting the column $id.
69
70       SET_DEFAULT_SORT_FUNC ($list, $func, $data)
71           Sets the function that is to be used for sorting columns that don't
72           have a sorting function attached to them.
73
74           The $func and $data arguments passed to these two methods should be
75           treated as blackboxes.  They are generic containers for some
76           callback that is to be invoked whenever you want to compare two
77           tree iters.  When you call them, make sure to always pass $data.
78           For example:
79
80             $retval = $func->($list, $a, $b, $data);
81
82       bool = HAS_DEFAULT_SORT_FUNC ($list)
83           Returns a bool indicating whether $list has a default sorting
84           function.
85

SIGNALS

87       sort-column-changed (Gtk2::TreeSortable)
88

ENUMS AND FLAGS

90   enum Gtk2::SortType
91       •   'ascending' / 'GTK_SORT_ASCENDING'
92
93       •   'descending' / 'GTK_SORT_DESCENDING'
94

SEE ALSO

96       Gtk2, Glib::Interface
97
99       Copyright (C) 2003-2011 by the gtk2-perl team.
100
101       This software is licensed under the LGPL.  See Gtk2 for a full notice.
102
103
104
105perl v5.32.1                      2021-01-27             Gtk2::TreeSortable(3)
Impressum