[gtkmm] Iterating through widgets; Passing data to callbackhandlers



Hello,

I have created a preferences window using libglademm and named all
widgets in Glade.

Now firstly, I would like to connect all the widget signals at once
using a loop. Is there a way to iterate through all widgets of a window
with an unlimited depth?

Secondly, I am trying to connect all the widget callbacks to *one*
function, which is bringing up another issue:

Inside the callback handler, I need to get the name (as defined in
Glade) and type of the widget that emitted the signal. In C this is
possible by passing user data along with every signal (and a pointer to
the widget is being passed, also).
I was not able to figure out how to get the widget that originally
emitted the signal.

e.g.:
------------------------------
entry1->signal_changed().connect(
        SigC::slot(*this, &PreferencesWindow::on_widget_changed));
entry2->signal_changed().connect(
        SigC::slot(*this, &PreferencesWindow::on_widget_changed));

void PreferencesWindow::on_widget_changed() {
  // How can I know which of the widgets emitted the signal?
}
------------------------------

Any ideas? Help greatly appreciated.

-Samuel



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