Re: Gtk::TreeModel::ColumnsRecord's children



Sergio,

Do you mean, how do you get to the rows in a TreeStore or ListStore?

I think the function you're looking for is Gtk::TreeModel::children()

TreeStore and ListStore both implement this method. The following is a
recusive method to visit all rows in a TreeStore.  The linear
ListStore should be a simple case to extract.

Assume _store is a Glib::RefPtr< Gtk::TreeStore > type member variable of Foo.

void
Foo::go()
{
	traverse( _store->children() ) ;
}

void
Foo::traverse( Gtk::TreeModel::Children children )
{
	if( children.empty() )
	{
		return ;
	}

	Gtk::TreeModel::Children::iterator iter ;

	for( iter = children.begin() ; iter != children.end() ; iter++ )
	{
		traverse( (*iter)->children() ) ;
	}
}

Paul


On 4/26/07, Sergio Perticone <g4ll0ws gmail com> wrote:
I've this classes:

class Window : public Gtk::Window {
    // ...

protected:
      class ModelColumns : public Gtk::TreeModel::ColumnRecord {
          // ...
      };


      ModelColumns columns;
};

How I can have access to the children?
I've tried columns.children() but g++ says:
error: 'class Htc::Window::ModelColumns' has no member named 'children'

Thanks,

s.

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list




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