Binding extra arguments


If you use one signal handler to catch the same signal from several widgets, you might like that signal handler to receive some extra information. For instance, you might want to know which button was clicked. You can do this with SigC::bind(). Here's some code from the helloworld2 example, which you will encounter later.
m_button1.signal_clicked().connect( SigC::bind<Glib::ustring>( SigC::slot(*this, &HelloWorld::on_button_clicked), "button 1") );
This says that we want the signal to send an extra Glib::ustring argument to the signal handler, and that the value of that argument should be "button 1". Of course we will need to add that extra argument to the declaration of our signal handler:
virtual void on_button_clicked(Glib::ustring data);
Of course, a normal "clicked" signal handler would have no arguments.