1Gtk2::TreeSortable(3) User Contributed Perl DocumentationGtk2::TreeSortable(3)
2
3
4
6 Gtk2::TreeSortable
7
9 Glib::Object::_Unregistered::GInterface
10 +----Gtk2::TreeSortable
11
13 $sortable->set_default_sort_func ($sort_func, $user_data=undef)
14
15 * $sort_func (scalar)
16 * $user_data (scalar)
17
18 boolean = $sortable->has_default_sort_func
19
20 $sortable->sort_column_changed
21
22 (sort_column_id, order) = $sortable->get_sort_column_id
23
24 Returns sort_column_id, an integer and order, a Gtk2::SortType.
25
26 $sortable->set_sort_column_id ($sort_column_id, $order)
27
28 * $sort_column_id (integer)
29 * $order (Gtk2::SortType)
30
31 $sortable->set_sort_func ($sort_column_id, $sort_func,
32 $user_data=undef)
33
34 * $sort_column_id (integer)
35 * $sort_func (scalar)
36 * $user_data (scalar)
37
39 If you want your custom tree model to be sortable, you need to imple‐
40 ment the GtkTreeSortable interface. Just like with other interfaces,
41 this boils down to announcing that your subclass implements the inter‐
42 face and providing a few virtual methods. The former is achieved by
43 adding "Gtk2::TreeSortable" to the "interfaces" key. For example:
44
45 package MyModel;
46 use Gtk2;
47 use Glib::Object::Subclass
48 Glib::Object::,
49 interfaces => [ Gtk2::TreeModel::, Gtk2::TreeSortable:: ],
50 ;
51
52 The virtual methods you need to implement are listed below.
53
54 VIRTUAL METHODS
55
56 These virtual methods are called by perl when gtk+ attempts to modify
57 the sorting behavior of your model. Implement them in your model's
58 package. Note that we don't provide a wrapper for sort_column_changed
59 because there is a signal for it, which means you can use the normal
60 signal overriding mechanism documented in Glib::Object::Subclass.
61
62 (is_not_special, id, order) = GET_SORT_COLUMN_ID ($model)
63 Returns a boolean indicating whether the column is a special or
64 normal one, its id and its sorting order.
65
66 SET_SORT_COLUMN_ID ($list, $id, $order)
67 Sets the sort column to the one specified by $id and the sorting
68 order to $order.
69
70 SET_SORT_FUNC ($list, $id, $func, $data)
71 Sets the function that is to be used for sorting the column $id.
72
73 SET_DEFAULT_SORT_FUNC ($list, $func, $data)
74 Sets the function that is to be used for sorting columns that don't
75 have a sorting function attached to them.
76
77 The $func and $data arguments passed to these two methods should be
78 treated as blackboxes. They are generic containers for some call‐
79 back that is to be invoked whenever you want to compare two tree
80 iters. When you call them, make sure to always pass $data. For
81 example:
82
83 $retval = $func->($list, $a, $b, $data);
84
85 bool = HAS_DEFAULT_SORT_FUNC ($list)
86 Returns a bool indicating whether $list has a default sorting func‐
87 tion.
88
90 sort-column-changed (Gtk2::TreeSortable)
91
93 enum Gtk2::SortType
94
95 * 'ascending' / 'GTK_SORT_ASCENDING'
96 * 'descending' / 'GTK_SORT_DESCENDING'
97
99 Gtk2, Glib::Object::_Unregistered::GInterface
100
102 Copyright (C) 2003-2007 by the gtk2-perl team.
103
104 This software is licensed under the LGPL. See Gtk2 for a full notice.
105
106
107
108perl v5.8.8 2007-03-18 Gtk2::TreeSortable(3)