man Gtk2::TreeSortable () - Gtk2::TreeSortable

NAME

Gtk2::TreeSortable

HIERARCHY

  Glib::Object::_Unregistered::GInterface
  +----Gtk2::TreeSortable

METHODS

$sortable->sort_column_changed

Returns sort_column_id, an integer and order, a Gtk2::SortType.

IMPLEMENTING THE GtkTreeSortable INTERACE

If you want your custom tree model to be sortable, you need to implement the GtkTreeSortable 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 CWGtk2::TreeSortable to the CWinterfaces key. For example:

  package MyModel;
  use Gtk2;
  use Glib::Object::Subclass
      Glib::Object::,
      interfaces => [ Gtk2::TreeModel::, Gtk2::TreeSortable:: ],
      ;

The virtual methods you need to implement are listed below.

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 sort_column_changed because there is a signal for it, which means you can use the normal signal overriding mechanism documented in Glib::Object::Subclass.

(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. Sets the sort column to the one specified by $id and the sorting order to $order. Sets the function that is to be used for sorting the column $id. Sets the function that is to be used for sorting columns that don't have a sorting function attached to them. The $func and $data 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 $data. For example:
  $retval = $func->($list, $a, $b, $data);
bool = HAS_DEFAULT_SORT_FUNC ($list)
Returns a bool indicating whether $list has a default sorting function.

SIGNALS

sort-column-changed (Gtk2::TreeSortable)

ENUMS AND FLAGS

enum Gtk2::SortType

* 'ascending' / 'GTK_SORT_ASCENDING'
* 'descending' / 'GTK_SORT_DESCENDING'

SEE ALSO

Gtk2, Glib::Object::_Unregistered::GInterface

COPYRIGHT

Copyright (C) 2003-2005 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.