.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Gtk2::TreeSortable 3pm" .TH Gtk2::TreeSortable 3pm "2019-09-16" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Gtk2::TreeSortable \- wrapper for GtkTreeSortable .SH "HIERARCHY" .IX Header "HIERARCHY" .Vb 2 \& Glib::Interface \& +\-\-\-\-Gtk2::TreeSortable .Ve .SH "METHODS" .IX Header "METHODS" .ie n .SS "$sortable\->\fBset_default_sort_func\fP ($sort_func, $user_data=undef)" .el .SS "\f(CW$sortable\fP\->\fBset_default_sort_func\fP ($sort_func, \f(CW$user_data\fP=undef)" .IX Subsection "$sortable->set_default_sort_func ($sort_func, $user_data=undef)" .IP "\(bu" 4 \&\f(CW$sort_func\fR (scalar) .IP "\(bu" 4 \&\f(CW$user_data\fR (scalar) .ie n .SS "boolean = $sortable\->\fBhas_default_sort_func\fP" .el .SS "boolean = \f(CW$sortable\fP\->\fBhas_default_sort_func\fP" .IX Subsection "boolean = $sortable->has_default_sort_func" .ie n .SS "$sortable\->\fBsort_column_changed\fP" .el .SS "\f(CW$sortable\fP\->\fBsort_column_changed\fP" .IX Subsection "$sortable->sort_column_changed" .ie n .SS "(sort_column_id, order) = $sortable\->\fBget_sort_column_id\fP" .el .SS "(sort_column_id, order) = \f(CW$sortable\fP\->\fBget_sort_column_id\fP" .IX Subsection "(sort_column_id, order) = $sortable->get_sort_column_id" Returns sort_column_id, an integer and order, a Gtk2::SortType. .ie n .SS "$sortable\->\fBset_sort_column_id\fP ($sort_column_id, $order)" .el .SS "\f(CW$sortable\fP\->\fBset_sort_column_id\fP ($sort_column_id, \f(CW$order\fP)" .IX Subsection "$sortable->set_sort_column_id ($sort_column_id, $order)" .IP "\(bu" 4 \&\f(CW$sort_column_id\fR (integer) .IP "\(bu" 4 \&\f(CW$order\fR (Gtk2::SortType) .ie n .SS "$sortable\->\fBset_sort_func\fP ($sort_column_id, $sort_func, $user_data=undef)" .el .SS "\f(CW$sortable\fP\->\fBset_sort_func\fP ($sort_column_id, \f(CW$sort_func\fP, \f(CW$user_data\fP=undef)" .IX Subsection "$sortable->set_sort_func ($sort_column_id, $sort_func, $user_data=undef)" .IP "\(bu" 4 \&\f(CW$sort_column_id\fR (integer) .IP "\(bu" 4 \&\f(CW$sort_func\fR (scalar) .IP "\(bu" 4 \&\f(CW$user_data\fR (scalar) .SH "IMPLEMENTING THE \fIGtkTreeSortable\fP INTERACE" .IX Header "IMPLEMENTING THE GtkTreeSortable INTERACE" If you want your custom tree model to be sortable, you need to implement the \&\fIGtkTreeSortable\fR interface. Just like with other interfaces, this boils down to announcing that your subclass implements the interface and providing a few virtual methods. The former is achieved by adding \f(CW\*(C`Gtk2::TreeSortable\*(C'\fR to the \&\f(CW\*(C`interfaces\*(C'\fR key. For example: .PP .Vb 6 \& package MyModel; \& use Gtk2; \& use Glib::Object::Subclass \& Glib::Object::, \& interfaces => [ Gtk2::TreeModel::, Gtk2::TreeSortable:: ], \& ; .Ve .PP The virtual methods you need to implement are listed below. .SS "\s-1VIRTUAL METHODS\s0" .IX Subsection "VIRTUAL METHODS" These virtual methods are called by perl when gtk+ attempts to modify the sorting behavior of your model. Implement them in your model's package. Note that we don't provide a wrapper for \fIsort_column_changed\fR because there is a signal for it, which means you can use the normal signal overriding mechanism documented in Glib::Object::Subclass. .IP "(is_not_special, id, order) = \s-1GET_SORT_COLUMN_ID\s0 ($model)" 4 .IX Item "(is_not_special, id, order) = GET_SORT_COLUMN_ID ($model)" Returns a boolean indicating whether the column is a special or normal one, its id and its sorting order. .ie n .IP "\s-1SET_SORT_COLUMN_ID\s0 ($list, $id, $order)" 4 .el .IP "\s-1SET_SORT_COLUMN_ID\s0 ($list, \f(CW$id\fR, \f(CW$order\fR)" 4 .IX Item "SET_SORT_COLUMN_ID ($list, $id, $order)" Sets the sort column to the one specified by \fI\f(CI$id\fI\fR and the sorting order to \&\fI\f(CI$order\fI\fR. .ie n .IP "\s-1SET_SORT_FUNC\s0 ($list, $id, $func, $data)" 4 .el .IP "\s-1SET_SORT_FUNC\s0 ($list, \f(CW$id\fR, \f(CW$func\fR, \f(CW$data\fR)" 4 .IX Item "SET_SORT_FUNC ($list, $id, $func, $data)" Sets the function that is to be used for sorting the column \fI\f(CI$id\fI\fR. .ie n .IP "\s-1SET_DEFAULT_SORT_FUNC\s0 ($list, $func, $data)" 4 .el .IP "\s-1SET_DEFAULT_SORT_FUNC\s0 ($list, \f(CW$func\fR, \f(CW$data\fR)" 4 .IX Item "SET_DEFAULT_SORT_FUNC ($list, $func, $data)" Sets the function that is to be used for sorting columns that don't have a sorting function attached to them. .Sp The \fI\f(CI$func\fI\fR and \fI\f(CI$data\fI\fR arguments passed to these two methods should be treated as blackboxes. They are generic containers for some callback that is to be invoked whenever you want to compare two tree iters. When you call them, make sure to always pass \fI\f(CI$data\fI\fR. For example: .Sp .Vb 1 \& $retval = $func\->($list, $a, $b, $data); .Ve .IP "bool = \s-1HAS_DEFAULT_SORT_FUNC\s0 ($list)" 4 .IX Item "bool = HAS_DEFAULT_SORT_FUNC ($list)" Returns a bool indicating whether \fI\f(CI$list\fI\fR has a default sorting function. .SH "SIGNALS" .IX Header "SIGNALS" .IP "\fBsort-column-changed\fR (Gtk2::TreeSortable)" 4 .IX Item "sort-column-changed (Gtk2::TreeSortable)" .SH "ENUMS AND FLAGS" .IX Header "ENUMS AND FLAGS" .SS "enum Gtk2::SortType" .IX Subsection "enum Gtk2::SortType" .PD 0 .IP "\(bu" 4 .PD \&'ascending' / '\s-1GTK_SORT_ASCENDING\s0' .IP "\(bu" 4 \&'descending' / '\s-1GTK_SORT_DESCENDING\s0' .SH "SEE ALSO" .IX Header "SEE ALSO" Gtk2, Glib::Interface .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2003\-2011 by the gtk2\-perl team. .PP This software is licensed under the \s-1LGPL.\s0 See Gtk2 for a full notice.