Gtk::TreeStore Class Reference
[TreeView Classes]

Inherits Glib::Object, Gtk::TreeModel, Gtk::TreeSortable, Gtk::TreeDragSource, and Gtk::TreeDragDest.

Collaboration diagram for Gtk::TreeStore:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~TreeStore ()
GtkTreeStore* gobj ()
 Provides access to the underlying C GObject.
const GtkTreeStore* gobj () const
 Provides access to the underlying C GObject.
GtkTreeStore* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void set_column_types (const TreeModelColumnRecord& columns)
iterator erase (const iterator& iter)
 Removes the given row from the list store.
iterator insert (const iterator& iter)
 Creates a new row before the position.
iterator insert_after (const iterator& iter)
 Creates a new row after the position.
iterator prepend ()
 Creates a new row at the start of the top-level.
iterator prepend (const TreeNodeChildren& node)
 Creates a new row at the start of the row's children.
iterator append ()
 Creates a new row at the end of the top-level.
iterator append (const TreeNodeChildren& node)
 Creates a new row at the end of the row's children.
void iter_swap (const iterator& a, const iterator& b)
 Swaps a and b in the same level of tree_store.
void move (const iterator& source, const iterator& destination)
 Moves source to the position at destination.
void reorder (const TreeNodeChildren& node, const Glib::ArrayHandle< int >& new_order)
 Reorders the children of node to follow the order indicated by new_order.
void clear ()
 Removes all rows from tree_store.
bool is_ancestor (const iterator& iter, const iterator& descendant) const
 Returns true if iter is an ancestor of descendant.
int iter_depth (const iterator& iter) const
 Returns the depth of iter.
bool iter_is_valid (const iterator& iter) const
 WARNING: This function is slow.

Static Public Member Functions

static Glib::RefPtr< TreeStorecreate (const TreeModelColumnRecord& columns)
 Instantiate a new TreeStore.

Protected Member Functions

 TreeStore ()
 When using this constructor, you must use set_column_types() immediately afterwards.
 TreeStore (const TreeModelColumnRecord& columns)
virtual void set_value_impl (const iterator& row, int column, const Glib::ValueBase&value)
 Override and implement this in a derived TreeModel class, so that Row::operator() and Row::set_value() work.

Related Functions

(Note that these are not member functions.)



Glib::RefPtr< Gtk::TreeStorewrap (GtkTreeStore* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Constructor & Destructor Documentation

virtual Gtk::TreeStore::~TreeStore (  )  [virtual]
Gtk::TreeStore::TreeStore (  )  [protected]

When using this constructor, you must use set_column_types() immediately afterwards.

This can be useful when deriving from this class, with a fixed TreeModelColumnRecord that is a member of the class. There is no create() method that corresponds to this constructor, because this constructor should only be used by derived classes.

Gtk::TreeStore::TreeStore ( const TreeModelColumnRecord columns  )  [explicit, protected]

Member Function Documentation

iterator Gtk::TreeStore::append ( const TreeNodeChildren node  ) 

Creates a new row at the end of the row's children.

The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value(). See also insert() and prepend().

Parameters:
node The list of the parent row's children, as returned by Gtk::TreeModel::iterator::children().
Returns:
An iterator to the new row.
iterator Gtk::TreeStore::append (  ) 

Creates a new row at the end of the top-level.

The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value(). See also insert() and prepend().

Returns:
An iterator to the new row.
void Gtk::TreeStore::clear (  ) 

Removes all rows from tree_store.

static Glib::RefPtr<TreeStore> Gtk::TreeStore::create ( const TreeModelColumnRecord columns  )  [static]

Instantiate a new TreeStore.

Parameters:
columns The column types for this tree model.
Returns:
The new TreeStore.
iterator Gtk::TreeStore::erase ( const iterator iter  ) 

Removes the given row from the list store.

Parameters:
iter The iterator to the row to be removed.
Returns:
An iterator to the next row, or end() if there is none.
const GtkTreeStore* Gtk::TreeStore::gobj (  )  const [inline]

Provides access to the underlying C GObject.

Reimplemented from Gtk::TreeDragDest.

GtkTreeStore* Gtk::TreeStore::gobj (  )  [inline]

Provides access to the underlying C GObject.

Reimplemented from Gtk::TreeDragDest.

GtkTreeStore* Gtk::TreeStore::gobj_copy (  ) 

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

iterator Gtk::TreeStore::insert ( const iterator iter  ) 

Creates a new row before the position.

If iter is end() then a new row will be appended to the list. The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value(). See also prepend() and append().

Parameters:
iter An iterator to the row before which the new row will be inserted.
Returns:
An iterator to the new row.
iterator Gtk::TreeStore::insert_after ( const iterator iter  ) 

Creates a new row after the position.

If iter is end() then a new row will be prepended to the list. The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value(). See also prepend() and append().

Parameters:
iter An iterator to the row after which the new row will be inserted.
Returns:
An iterator to the new row.
bool Gtk::TreeStore::is_ancestor ( const iterator iter,
const iterator descendant 
) const

Returns true if iter is an ancestor of descendant.

That is, iter is the parent (or grandparent or great-grandparent) of descendant.

Parameters:
iter A valid Gtk::TreeIter.
descendant A valid Gtk::TreeIter.
Returns:
true, if iter is an ancestor of descendant.
int Gtk::TreeStore::iter_depth ( const iterator iter  )  const

Returns the depth of iter.

This will be 0 for anything on the root level, 1 for anything down a level, etc.

Parameters:
iter A valid Gtk::TreeIter.
Returns:
The depth of iter.
bool Gtk::TreeStore::iter_is_valid ( const iterator iter  )  const [virtual]

WARNING: This function is slow.

Only use it for debugging and/or testing purposes.

Checks if the given iter is a valid iter for this Gtk::TreeStore.

Since gtkmm 2.2:
Parameters:
iter A Gtk::TreeIter.
Returns:
true if the iter is valid, false if the iter is invalid.

Reimplemented from Gtk::TreeModel.

void Gtk::TreeStore::iter_swap ( const iterator a,
const iterator b 
)

Swaps a and b in the same level of tree_store.

Note that this function only works with unsorted stores.

Since gtkmm 2.2:
Parameters:
a A Gtk::TreeIter.
b Another Gtk::TreeIter.
void Gtk::TreeStore::move ( const iterator source,
const iterator destination 
)

Moves source to the position at destination.

source and destination should be at the same level. Note that this function only works with unsorted stores.

Parameters:
source The row that should be moved.
destination The position to move to.
iterator Gtk::TreeStore::prepend ( const TreeNodeChildren node  ) 

Creates a new row at the start of the row's children.

The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value(). See also insert() and append().

Parameters:
node The list of the parent row's children, as returned by Gtk::TreeModel::iterator::children().
Returns:
An iterator to the new row.
iterator Gtk::TreeStore::prepend (  ) 

Creates a new row at the start of the top-level.

The row will be empty - to fill in values, you need to dereference the returned iterator and use Row::operator[] or Row::set_value(). See also insert() and append().

Returns:
An iterator to the new row.
void Gtk::TreeStore::reorder ( const TreeNodeChildren node,
const Glib::ArrayHandle< int > &  new_order 
)

Reorders the children of node to follow the order indicated by new_order.

Note that this function only works with unsorted stores.

void Gtk::TreeStore::set_column_types ( const TreeModelColumnRecord columns  ) 
virtual void Gtk::TreeStore::set_value_impl ( const iterator row,
int  column,
const Glib::ValueBase value 
) [protected, virtual]

Override and implement this in a derived TreeModel class, so that Row::operator() and Row::set_value() work.

You can probably just implement this by calling set_value_vfunc(). Your implementation of set_value_impl() should also call row_changed() after changing the value.

Reimplemented from Gtk::TreeModel.


Friends And Related Function Documentation

Glib::RefPtr< Gtk::TreeStore > wrap ( GtkTreeStore *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
object The C instance.
take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.

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

Generated on Tue May 4 13:22:06 2010 for gtkmm by  doxygen 1.6.1