Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::TreeModelFilter Class Reference

A GtkTreeModelFilter C++ wrapper class. More...

#include <xfc/gtk/treemodelfilter.hh>

Inheritance diagram for Xfc::Gtk::TreeModelFilter:

Xfc::G::Object Xfc::Gtk::TreeModel Xfc::Gtk::TreeDragSource Xfc::G::TypeInstance Xfc::G::TypeInterface Xfc::G::TypeInterface Xfc::Trackable Xfc::G::TypeInstance Xfc::G::TypeInstance Xfc::Trackable Xfc::Trackable List of all members.

Public Types

Public Member Functions

Accessors
Methods

Detailed Description

A GtkTreeModelFilter C++ wrapper class.

A TreeModelFilter is a tree model which wraps another tree model, and can do the following things:

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.


Member Typedef Documentation

typedef sigc::slot<bool, const TreeModel&, const TreeIter&> Xfc::Gtk::TreeModelFilter::VisibleSlot

Signature of the callback slot which decides whether the row indicated by TreeIter is visible.

Example: Method signature for VisibleSlot.

< bool method(const TreeModel& model, const TreeIter& iter);
< // model: The Gtk::TreeModelFilter.
< // iter: A Gtk::TreeIter pointing to the row whose visibility is determined.
< // return: Whether the row indicated by iter is visible.
<

typedef sigc::slot<void, const TreeModel&, const TreeIter&, G::Value&, int> Xfc::Gtk::TreeModelFilter::ModifySlot

Signature of the callback slot which calculates display values from raw values in the model.

Example: Method signature for ModifySlot.

< void method(const TreeModel& model, const TreeIter& iter, G::Value& value, int column);
< // model: The Gtk::TreeModelFilter.
< // iter: A Gtk::TreeIter pointing to the row whose display values are determined.
< // value: A G::Value already initialized with the correct type for the specifed column. 
< // column: The column whose display value is determined. 
<

The slot must fill the G::Value with the display value for the specified column in the row indicated by TreeIter. Since this slot is called for each data access, it's not a particularly efficient operation.


Constructor & Destructor Documentation

Xfc::Gtk::TreeModelFilter::TreeModelFilter ( GtkTreeModelFilter *  filter,
bool  owns_reference = true 
) [explicit, protected]

Construct a new TreeModelFilter from an existing GtkTreeModelFilter.

Parameters:
filter A pointer to a GtkTreeModelFilter.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The filter can be a newly created GtkTreeModelFilter or an existing GtkTreeModelFilter (see G::Object::Object).

Xfc::Gtk::TreeModelFilter::TreeModelFilter ( TreeModel child_model,
const TreePath root = 0 
)

Constructs a new TreeModelFilter, with child_model as the child_model and root as the virtual root.

Parameters:
child_model A Gtk::TreeModel.
root A Gtk::TreePath or null.
TreeModelFilter is created with a reference count of 1 that the caller owns.

Xfc::Gtk::TreeModelFilter::TreeModelFilter ( GtkTreeModelFilter *  filter,
bool  owns_reference = true 
) [explicit, protected]

Construct a new TreeModelFilter from an existing GtkTreeModelFilter.

Parameters:
filter A pointer to a GtkTreeModelFilter.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The filter can be a newly created GtkTreeModelFilter or an existing GtkTreeModelFilter (see G::Object::Object).

Xfc::Gtk::TreeModelFilter::TreeModelFilter ( TreeModel child_model,
const TreePath root = 0 
)

Constructs a new TreeModelFilter, with child_model as the child_model and root as the virtual root.

Parameters:
child_model A Gtk::TreeModel.
root A Gtk::TreePath or null.
TreeModelFilter is created with a reference count of 1 that the caller owns.


Member Function Documentation

TreeModel* Xfc::Gtk::TreeModelFilter::get_model (  )  const

Gets a pointer to the child model of the filter.

Returns:
The child model of the filter.

void Xfc::Gtk::TreeModelFilter::set_visible_func ( const VisibleSlot slot  ) 

Sets the visible function used when filtering the filter to be slot.

Parameters:
slot A Gtk::TreeModelFilter::VisibleSlot, the visible callack function.
The visible slot should return true if the given row should be visible and false otherwise.

void Xfc::Gtk::TreeModelFilter::set_modify_func ( int  n_columns,
const GType  types[],
const ModifySlot slot 
)

With the n_columns and types parameters, you give an array of column types for this model (which will be exposed to the parent model/view).

Parameters:
n_columns The number of columns in the filter model.
types The GTypes of the columns.
slot A Gtk::TreeModelFilter::ModifySlot, the modify callack function.
The modify slot will get called for each data access, the goal of the modify slot is to return the data which should be displayed at the location specified using the parameters of the modify slot.

void Xfc::Gtk::TreeModelFilter::set_visible_column ( int  column  ) 

Sets column of the filter's child model to be the column where the filter should look for visibility information.

Parameters:
column An integer which is the column containing the visible information.
The columns should be a column of type G_TYPE_BOOLEAN, where true means that a row is visible, and false if not.

TreeIter Xfc::Gtk::TreeModelFilter::convert_child_iter_to_iter ( const TreeIter child_iter  ) 

Returns a TreeIter that points to the row in the TreeModelFilter that corresponds to the row pointed at by child_iter.

Parameters:
child_iter A valid TreeIter pointing to a row on the child model.
Returns:
A TreeIter pointing to the row in the model being filtered.

TreeIter Xfc::Gtk::TreeModelFilter::convert_iter_to_child_iter ( const TreeIter filter_iter  ) 

Returns a TreeIter that points to the row on the child model that corresponds to the row pointed to by filter_iter.

Parameters:
filter_iter A valid TreeIter pointing to a row in the TreeModelFilter.
Returns:
A TreeIter pointing to the row in the child model.

Pointer<TreePath> Xfc::Gtk::TreeModelFilter::convert_child_path_to_path ( const TreePath child_path  ) 

Converts child_path to a path relative to the TreeModelFilter.

Parameters:
child_path A TreePath to convert.
Returns:
A newly allocated TreePath, or null.
The returned path will point to the same row in the filtered model. If child_path isn't a valid path on the child model, then null is returned.

Pointer<TreePath> Xfc::Gtk::TreeModelFilter::convert_path_to_child_path ( const TreePath filter_path  ) 

Converts filter_path to a path in the child model of the TreeModelFilter.

Parameters:
filter_path A TreePath to convert.
Returns:
A newly allocated TreePath, or null.
The returned path will point to the same row in the filtered model. If child_path isn't a valid path in the child model, then null is returned.

void Xfc::Gtk::TreeModelFilter::clear_cache (  ) 

This method should almost never be called.

It clears the filter of any cached iterators that haven't been reffed with ref_node(). This might be useful if the child model being filtered is static (and doesn't change often) and there has been a lot of unreffed access to nodes. As a side effect of this function, all unreffed iters will become invalid.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3