Handling multiple selections in a Gtk::TreeView



Hi,

I'm working on a widget which uses a TreeView with the ListStore model.
Now, multiple selections should be possible. However, the documentation in 
this case is rather lacking, I can't get it to work.

First of all, some basic questions.

1) What exactly do I need that callback function for that I pass to 
TreeSelection::selected_foreach and when is it called?

2) What is a ListHandle_Path and how do I use it?

3) What is a slot, and what is a path?

What I have is this:

(in the ctor of my widget)

m_selection->set_mode( Gtk::SELECTION_MULTIPLE );
m_selection->selected_foreach_iter( sigc::mem_fun( *this,    
&FileBrowser::selection_callback ) );
m_selection->signal_changed().connect( sigc::mem_fun( *this, 
&FileBrowser::on_selection_changed ) );

... where m_selection is a TreeSelection RefPtr.

Furthermore:

void FileBrowser::selection_callback( const Gtk::TreeModel::iterator & iter )
{
    Gtk::TreeModel::Row row = *iter;
    cout << "selection_callback" << endl;
}

void FileBrowser::on_selection_changed()
{
    cout << "on_selection_changed" << endl;
}

However, selecting multiple rows only seems to issue the selection handler. 
The callback function is never called.

Can you point me to the right direction?

Thanks in advance,
Matthias



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