Re: [gtk-list] Re: C++ and gtk+





Thanks for your answer!
I have some more questions now ...

On Mon, 20 Dec 1999, Erik Mouw wrote:

> On Mon, 20 Dec 1999 10:47:18 +0100 (MET), David Pettersson wrote:
> > I tried to do a little program in c++ with gtk+. I have a 'class A' which
> > contains a 'widget *W'. If I have more then one instance of 'A' I can for
> > some signals (e.g. "clicked") send 'this' last data argument to
> > 'gtk_signal_connect()', and thus know what object the signal refer to.
> > With other signals (e.g. "configure_event") the last argument in the
> > callback function is used for other data, so my question is, how do I know
> > which of my objects the signal refers to?
> 
> I don't know what widget you're talking about, but here is an example for
> an eventbox widget:

I had no special widget in mind, but the problem occured when I worked
with the DrawingArea widget and "configure_event" and "expose_event"

> 
>     // get the button press events and connect it to a callback function 
>     gtk_widget_set_events(eventbox, GDK_BUTTON_PRESS_MASK);
>     gtk_signal_connect(GTK_OBJECT(eventbox), "button_press_event",
>                        GTK_SIGNAL_FUNC(gui3D_identRightButtonPressCallback), 
>                        this);
> 
> And the callback function:
> 
>   void gui3D_identRightButtonPressCallback(GtkWidget *widget, 
>                                            GdkEventButton *event, 
>                                            gpointer data)
>   {
>     gui3D *gui = (gui3D *)data;
>   
>     assert(gui != NULL);
>   
>     gui->identRightButtonPressCallback(widget, event);
>   }

Should different signals have different number of arguments in the
callback function? In the tutorial they use 2 arguments to all callbacks.
Can one use callbacks with 2 or 3 arguments to all signals?
Please excuse my ignorance.

> 
> 
> Erik
> 
> -- 
> J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
> of Electrical Engineering, Faculty of Information Technology and Systems,
> Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
> Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
> WWW: http://www-ict.its.tudelft.nl/~erik/
> 
> 
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 


David



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