how to remove selected rowS from a ListStore?



Hi,
I have to remove selected rows from a Gtk::ListStore (_ref_model), but I
have some trouble with Gtk::TreeSelection::get_selected_rows().
I tried something like this:

typedef std::list<Gtk::TreeRowReference>  ListRowRef;

// callback for my TreeView inherited from Gtk::TreeView
// (called by a popup menu item)
void TreeView::on_remove() 
{
    Glib::RefPtr<Gtk::TreeModel>& tree_model = 
	static_cast<Glib::RefPtr<Gtk::TreeModel> >(_ref_model); // sucks

    ListRowRef list = get_selection()->get_selected_rows(tree_model);

    for(ListRowRef::iterator i=list.begin(); i!= list.end(); i++) {
	// ...
    }
}

Which obviously doesn't work... What's the right way to do that?
I guess I can't use get_selected_rows() without arguments, it had const
cv-qualifier...

Should I use Gtk::TreeModel rather than Gtk::ListStore?

Thanks in advance,

s.



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