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




Paul Davis wrote:
Sergio,

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

Yep.

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() ) ;
    }
}

Ok, Understood. Thanks a lot!

Paul



s.



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