GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::Gtk::TreeSortable Class Reference

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

#include <gfc/gtk/treesortable.hh>

Inheritance diagram for GFC::Gtk::TreeSortable:

GFC::G::TypeInterface GFC::G::TypeInstance GFC::Trackable GFC::Gtk::ListStore GFC::Gtk::TreeModelSort GFC::Gtk::TreeStore List of all members.

Signal Prototypes

Public Types

Public Member Functions

Accessors
Methods
Signal Proxies

Protected Member Functions

Constructors

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 sigc::slot<int, const TreeModel&, const TreeIter&, const TreeIter&> GFC::Gtk::TreeSortable::CompareSlot
 

Signature of the callback slot to be used for comparing two TreeIter's when sorting.

Example: Method signature for CompareSlot.

             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 GFC::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 GFC::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 GFC::Gtk::TreeSortable::set_default_sort_func const CompareSlot 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 GFC::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 GFC::Gtk::TreeSortable::set_sort_func int  sort_column_id,
const CompareSlot 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.


Member Data Documentation

const SortColumnChangedSignalType GFC::Gtk::TreeSortable::sort_column_changed_signal [static, protected]
 

Sort column changed signal (see sig_sort_column_changed()).

Calls a slot with the signature:

             void function();


The documentation for this class was generated from the following file:
Generated on Tue Aug 24 00:34:44 2004 for GFC-UI by doxygen 1.3.8