Re: [gtkmm] signals



>Hello!
>
>The callbacks in the GTK interface for C always provide something like
>a `gpointer user_data'. I noticed that the signal functions in gtkmm
>does not provide those `user_data' parameters. E.g. does that mean that
>I have to create a function (or methode) for every button in my
>application?

you are working with C++, and 98% of all your signal handlers will be
member functions that are provided with an implicit "this"
pointer. there is therefore little or no need for the "user_data"
argument. 

to attach extra data to a signal handler, as in your example, do this:

  on_clicked.connect (bind (slot (SomeObjectReference, 
				  &SomeObject::some_method)), 1);

this will require the handler to look like:

   class SomeObject {
      ...
      void some_method (int which);
      ...
   };

the extra "int which" argument is handled by using the "bind"
technique.

--p




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