Reference Manual
Inti Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

Inti::Gtk::TreeSortable Class Reference

A GtkTreeSortable C++ wrapper class. More...

#include <inti/gtk/treesortable.h>

Inheritance diagram for Inti::Gtk::TreeSortable:

Inti::G::TypeInterface Inti::G::TypeInstance Inti::ReferencedBase Inti::Gtk::ListStore Inti::Gtk::TreeModelSort Inti::Gtk::TreeStore List of all members.

Public Types

Public Member Functions

Accessors
Methods
Signal Proxies

Protected Member Functions

Constructors
Signal Handlers

Detailed Description

A GtkTreeSortable C++ wrapper class.

The TreeSortable interface defines a generic interface for sorting a model. It is an abstract interface, and is designed to be usable with any derived class. The programmer just has to multiplely inherit this interface on their own model for it to be sortable. To make life easier two generic sortable models are already provided, ListStore and TreeStore.


Member Typedef Documentation

typedef Slot3<int, const TreeModel&, const TreeIter*, const TreeIter*> Inti::Gtk::TreeSortable::TreeIterCompareSlot
 

Signature of the callback slot to be used for comparison when sorting.

Example: Method signature for TreeIterCompareSlot.

             int method(const TreeModel& model, const TreeIter *a, const TreeIter *b);
            
             // model: The TreeModel being sorted.
             // a: A TreeIter.
             // b: Another TreeIter.
             // return: -1 if "a" comes before "b" in the tree, 1 if "a" comes after "b" in
             //         the tree and 0 if a and b point to the same location in the tree.


Member Function Documentation

bool Inti::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, if applicable.

Parameters:
sort_column_id The sort column id to be filled in.
order The SortType to be filled in.
Returns:
true if the sort column has been set.

If the sort column is not set, then false is returned, and the values in sort_column_id and order are unchanged.

bool Inti::Gtk::TreeSortable::has_default_sort_func  )  const
 

Returns true if the model has a default sort function.

Returns:
true if the model has a default sort function.

This is used primarily by TreeViewColumns in order to determine if a model can go back to its default state, or not.

void Inti::Gtk::TreeSortable::set_default_sort_func const TreeIterCompareSlot compare  ) 
 

Sets the default comparison callback slot used when sorting to be compare.

Parameters:
compare The sorting slot.

If the current sort_column_id of sortable is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using this function. If compare is null, then there will be no default comparison callback slot. This means that once the model has been sorted, it can't go back to its default state. In this case, when the current sort column id of sortable is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted.

void Inti::Gtk::TreeSortable::set_sort_column_id int  sort_column_id,
SortType  order
 

Sets the current sort column to be sort_column_id.

Parameters:
sort_column_id The sort column id to set.
order The sort order of the column.

The sortable will resort itself to reflect this change, after emitting a sort_column_changed signal. If sort_column_id is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the default sort function will be used, if it is set.

void Inti::Gtk::TreeSortable::set_sort_func int  sort_column_id,
const TreeIterCompareSlot compare
 

Sets the comparison callback slot used when sorting to be compare.

Parameters:
sort_column_id The sort column id to set the callback slot for.
compare The sorting slot to call.

If the current sort column id of sortable is the same as sort_column_id, then the model will sort using this function.


The documentation for this class was generated from the following file: Main Page - Footer


Generated on Sun Sep 14 20:08:21 2003 for Inti by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002