Logo Search packages:      
Sourcecode: ardour version File versions  Download package

Gtk::TreeModel Class Reference
[TreeView Classes]

#include <treemodel.h>

Inheritance diagram for Gtk::TreeModel:

sigc::trackable Gtk::ListStore Gtk::TreeModelSort

List of all members.


Detailed Description

This class defines a generic tree interface for use by the Gtk::TreeView widget.

It is is designed to be usable with any appropriate data structure. The programmer just has to implement this interface on their own data type for it to be viewable by a Gtk::TreeView widget.

The model is represented as a hierarchical tree of strongly-typed, columned data. In other words, the model can be seen as a tree where every node has different values depending on which column is being queried. The type of data found in a column is determined by TreeModel::Column<> templates. The types are homogeneous per column across all nodes. It is important to note that this interface only provides a way of examining a model and observing changes. The implementation of each individual model decides how and if changes are made.

In order to make life simpler for programmers who do not need to write their own specialized model, two generic models are provided - the Gtk::TreeStore and the Gtk::ListStore. To use these, the developer simply pushes data into these models as necessary. These models provide the data structure as well as all appropriate tree interfaces. As a result, implementing drag and drop, sorting, and storing data is trivial. For the vast majority of trees and lists, these two models are sufficient.

Models are accessed on a node/column level of granularity. One can query for the value of a model at a certain node and a certain column on that node. There are two structures used to reference a particular node in a model. They are the Path and the iterator. Most of the interface consists of operations on an iterator.

A Gtk::TreeModel::Path is essentially a potential node. It is a location on a model that may or may not actually correspond to a node on a specific model.

By contrast, an Gtk::TreeModel::iterator is a reference to a specific node on a specific model. One can convert a path to an iterator by calling Gtk::TreeModel::get_iter(). These iterators are the primary way of accessing a model and are similar to the iterators used by Gtk::TextBuffer. The model interface defines a set of operations using them for navigating the model.

The RowReference is also useful, because it remains valid as long as there is an existing row pointed to by it's path. You can convert between RowReferences and iterators and Path s.

Definition at line 162 of file treemodel.h.


Public Types

typedef GtkTreeModelIface BaseClassType
typedef GtkTreeModel BaseObjectType
typedef TreeNodeChildren Children
typedef TreeModelColumnRecord ColumnRecord
typedef Children::const_iterator const_iterator
typedef
Children::const_reverse_iterator 
const_reverse_iterator
typedef TreeModel_Class CppClassType
typedef TreeModel CppObjectType
typedef Children::iterator iterator
typedef TreePath Path
typedef Children::reverse_iterator reverse_iterator
typedef TreeRow Row
typedef TreeRowReference RowReference
typedef sigc::slot< bool,
const TreeModel::iterator & > 
SlotForeachIter
typedef sigc::slot< bool,
const TreeModel::Path & > 
SlotForeachPath
typedef sigc::slot< bool,
const TreeModel::Path &, const
TreeModel::iterator & > 
SlotForeachPathAndIter

Public Member Functions

bool _cpp_destruction_is_in_progress () const
Children children () const
 This returns an STL-like container API, for iterating over the rows.
Children children ()
 This returns an STL-like container API, for iterating over the rows.
void foreach (const SlotForeachPathAndIter &slot)
void foreach_iter (const SlotForeachIter &slot)
void foreach_path (const SlotForeachPath &slot)
GType get_column_type (int index) const
TreeModelFlags get_flags () const
iterator get_iter (const Glib::ustring &path_string)
iterator get_iter (const Path &path)
int get_n_columns () const
TreeModel::Path get_path (const iterator &iter) const
template<class PropertyType>
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 You probably want to use a specific property_*() accessor method instead.
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 You probably want to use a specific property_*() accessor method instead.
Glib::ustring get_string (const iterator &iter) const
const GtkTreeModel * gobj () const
 Provides access to the underlying C GObject.
GtkTreeModel * gobj ()
 Provides access to the underlying C GObject.
GObject * gobj_copy () const
virtual void reference () const
void row_changed (const Path &path, const iterator &iter)
void row_deleted (const Path &path)
void row_has_child_toggled (const Path &path, const iterator &iter)
void row_inserted (const Path &path, const iterator &iter)
void rows_reordered (const Path &path, const iterator &iter, int *new_order)
void rows_reordered (const Path &path, const iterator &iter, const Glib::ArrayHandle< int > &new_order)
template<class PropertyType>
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 You probably want to use a specific property_*() accessor method instead.
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 You probably want to use a specific property_*() accessor method instead.
Glib::SignalProxy2< void,
const TreeModel::Path &, const
TreeModel::iterator & > 
signal_row_changed ()
Glib::SignalProxy1< void,
const TreeModel::Path & > 
signal_row_deleted ()
Glib::SignalProxy2< void,
const TreeModel::Path &, const
TreeModel::iterator & > 
signal_row_has_child_toggled ()
Glib::SignalProxy2< void,
const TreeModel::Path &, const
TreeModel::iterator & > 
signal_row_inserted ()
Glib::SignalProxy3< void,
const TreeModel::Path &, const
TreeModel::iterator &, int * > 
signal_rows_reordered ()
virtual void unreference () const

Static Public Member Functions

static ObjectBase * _get_current_wrapper (GObject *object)
static void add_interface (GType gtype_implementer)
static GType get_base_type () G_GNUC_CONST
static GType get_type () G_GNUC_CONST

Protected Member Functions

void _set_current_wrapper (GObject *object)
virtual void destroy_notify_ ()
virtual GType get_column_type_vfunc (int index) const
virtual TreeModelFlags get_flags_vfunc () const
virtual bool get_iter_vfunc (const Path &path, iterator &iter) const
virtual int get_n_columns_vfunc () const
virtual TreeModel::Path get_path_vfunc (const iterator &iter) const
virtual void get_value_impl (const iterator &row, int column, Glib::ValueBase &value) const
virtual void get_value_vfunc (const iterator &iter, int column, Glib::ValueBase &value) const
void initialize (GObject *castitem)
bool is_anonymous_custom_ () const
bool is_derived_ () const
virtual bool iter_children_vfunc (const iterator &parent, iterator &iter) const
virtual bool iter_has_child_vfunc (const iterator &iter) const
virtual bool iter_is_valid (const iterator &iter) const
virtual int iter_n_children_vfunc (const iterator &iter) const
virtual int iter_n_root_children_vfunc () const
virtual bool iter_next_vfunc (const iterator &iter, iterator &iter_next) const
virtual bool iter_nth_child_vfunc (const iterator &parent, int n, iterator &iter) const
virtual bool iter_nth_root_child_vfunc (int n, iterator &iter) const
virtual bool iter_parent_vfunc (const iterator &child, iterator &iter) const
virtual void on_row_changed (const TreeModel::Path &path, const TreeModel::iterator &iter)
virtual void on_row_deleted (const TreeModel::Path &path)
virtual void on_row_has_child_toggled (const TreeModel::Path &path, const TreeModel::iterator &iter)
virtual void on_row_inserted (const TreeModel::Path &path, const TreeModel::iterator &iter)
virtual void on_rows_reordered (const TreeModel::Path &path, const TreeModel::iterator &iter, int *new_order)
virtual void ref_node_vfunc (const iterator &iter) const
virtual void set_value_impl (const iterator &row, int column, const Glib::ValueBase &value)
 TreeModel (GtkTreeModel *castitem)
virtual void unref_node_vfunc (const iterator &iter) const

Static Protected Member Functions

static void destroy_notify_callback_ (void *data)

Protected Attributes

bool cpp_destruction_in_progress_
const char * custom_type_name_
GObject * gobject_

Package Functions

void add_destroy_notify_callback (void *data, func_destroy_notify func) const
void notify_callbacks ()
 Execute and remove all previously installed callbacks.
void remove_destroy_notify_callback (void *data) const

Package Attributes

 __pad0__:func_destroy_notify func_destroy_notify

Private Member Functions

TreeModeloperator= (const TreeModel &)
 TreeModel (const TreeModel &)

Static Private Attributes

static CppClassType treemodel_class_

Friends

class Glib::GSigConnectionNode
class Gtk::TreeIter
class Gtk::TreeModelSort
class Gtk::TreeRow
class TreeModel_Class

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::TreeModelwrap (GtkTreeModel *object, bool take_copy=false)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index