Copying GtkTreeStore rows
- From: "Paul Davis" <pjdavis engineering uiowa edu>
- To: gtk-list gnome org
- Subject: Copying GtkTreeStore rows
- Date: Sun, 24 Sep 2006 01:14:11 -0500
Hey,
I've been working with Gtkmm to create a Gtk::TreeStore that is capable
of re-parenting rows. As far as I can tell the C++ api (and the
underlying C api) have no method for moving rows between different
parent rows. Murray Cumming suggested I inquire here to see if I
there's an easier way to accomplish what I want.
I've really only got the C++ side of things to go on, so if this
explanation is wrong, ask and I'll try and track down what parts of the
C api I'm actually using.
The basic idea is that instead of doing a real re-parent type of
operation, I just copy from one node in a tree to a new node and delete
the original node.
In C++ this requires copying from one Gtk::TreeModel::iterator to another Gtk::TreeModel::iterator.
The gtkmm api has two methods in the TreeModel that are:
Gtk::TreeModel::get_value_impl( Gtk::TreeModel::iterator& iter, gint column, Glib::ValueBase& value )
Gtk::TreeModel::set_value_impl( Gtk::TreeModel::iterator& iter, gint column, Glib::ValueBase& value )
These two methods seem to be wrapping:
gtk_tree_model_get_value( GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value ) ;
gtk_tree_store_set_value( GtkTreeStore *tree_store, GtkTreeIter *iter, gint column, GValue *value ) ;
So all I do is to iterate over the columns in a Gtk::TreeModel and copy one Glib::ValueBase to the other.
And repeat the copy procedure recursively.
So there are two main questions:
Is there something in the API that I'm missing that would allow me to
move an iterator from an arbitrary position in a GtkTreeStore to
another position?
Is there an easier way to copy the values from on iterator to another?
If anyone can make sense of that, I'd like to hear if I'm doing something dumb.
Thanks,
Paul
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]