Re: [gtk-list] callback question




On Fri, 5 Jun 1998, John Looney wrote:
> How do I workout how callbacks work ? Is there someway that I can remind
> me what callbacks a widget has, from the header files ?
> 

You need to look at the class structure for the widget, and all parent
widgets. The function pointers there are the signals you can connect to.

>  Also, for things like the Eventbox widget, how do I get access to the
> details of the Event ? Is the data passed to the callback function a
> gdkevent structure, and if so, what sort ?
> 

Yep. The type of the event structure is determined by the callback;
again, look at the class structure of the widget and parent widgets. e.g.,
GtkWidgetClass in gtkwidget.h includes this:

  gint (* key_press_event)	   (GtkWidget	       *widget,
				    GdkEventKey	       *event);

which means if you connect to key_press_event your callback should be:

gint key_press_cb(GtkWidget * w, GdkEventKey * e, gpointer data);

Most if not all of the events are in GtkWidget, I think, so for events
that's the first place to look. 

>  <if this isn't a newbie gtk list, laugh me off>
> 

It's the only Gtk list - newbies and experts both live here. :-)

Havoc Pennington ==== http://pobox.com/~hp



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