Re: Documentation Request



Murray Cumming wrote:
On Mon, 2005-03-21 at 11:00 -0600, Bob Caryl wrote:
Murray Cumming wrote:
On Mon, 2005-03-21 at 10:35 -0600, Bob Caryl wrote:

Hello everyone,

Can someone tell me to what the formal parameters of the following template refer? I am guessing that the path is for the row that has a child row toggled, and the iterator is for the toggled child row. Am I correct?

Glib::SignalProxy2< void, const TreeModel::Path&, const TreeModel::iterator& >Gtk::TreeModel::signal_row_has_child_toggled()
The similar function of the same name gives some clue:
signal_row_has_child_toggled
http://gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeModel.html#a16

signals are not well documented in gtkmm. I'm still looking for a way to
get their documentation automatically from the GTK+ documentation.
Eventaully we will give up and do it manually. In this case, even GTK+
does not have any docs for the signal:
http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeModel.html#GtkTreeModel-row-has-child-toggled

That deserves a bugzilla bug for GTK+.

Luckily, gtkmm has less signals than GTK+, so it is a bit clearer.


Ok... from what I see from the links you provided it appears that I will know only the parent row's path and iterator. Does this mean that I will have to scan all the child rows for this parent row to discover the data state of the child that was toggled? I see a test program to find out exactly what I'm getting passed to me in this case. I will report to the list what these parms actually are.

I'm not sure exactly what you are trying to do. I guess, but I don't
know, that this signal is emitted when the last child is removed, or the
first child is added.

But if you are just interested in whether a Gtk::CellRendererToggle has
been toggled, then handle its "toggled" signal. This should be well
covered in the book and the examples.

Hey Murray,

As it turns out, what I really wanted was to connect to the "signal_changed" funtion of a Gtk::TreeView::Selection object. As for what I'm doing: <deep breath>

My launcher application configures a menu based on the contents of an xml file. I am writing a configuration utility that parses that same xml file into a Gtk::TreeStore, storeing all the elements necessary to create a new xml file with an abbreviated version of the full menu. Along with the fields I need for a new xml file, I also insert the a "bool" data type to get an editable check box.

What I need to do is: When a row is selected (and probably when the state of the check box is toggled) I need to determine the ancestor of the current row if it has one. I then need to determine if any of its children's checkboxes are "activated" and then activate the ancestor's check box, proceeding recursively up the treestore until I hit the top level.

So, what I am struggling with now is deriving my own version of Gtk::TreeModel so that I can call "iter_parent_vfunc" to get the iterator of a particular row's parent. I have derived a class, but when I try to reference it using Glib::RefPtr<> so that Gtk::TreeView::Selection::get_model can populate it, I get all kinds of errors. My derivation is very simple:

class MyTreeModel : public Gtk::TreeModel
{
   public:
virtual bool iter_parent_vfunc(const iterator& child, iterator& parent) (Gtk::TreeModel::iter_parent_vfunc(child,parent););
}

My problem is that when I declare an instance of this new class:

Glib::RefPtr<MyTreeModel> mymodel;

The compiler has a hissy and I still cannot use my new class. If I declare it this way:

MyTreeModel *mymodel;

and try to use (MyTreeModel *)Gtk::TreeView::TreeSelection::get_model() to get my model object, the compiler again complains that it cannot convert Glib::RefPtr<Gtk::TreeModel> to MyTreeModel * .

Any ideas on what I'm doing wrong?

Thanks,

Bob Caryl



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]