In addition to the signal mechanism described before, there is a set of events that reflect the X event mechanism. Callbacks may also be attached to these events. These events are:
In order to connect a callback method to one is these events you use the GLib::Instantiatable#signal_connect, as described previously, using one of the above event names as the signal_to_catch parameter. The callback method for events has a slightly different form than that for signals:
GLib::Instantiatable#signal_connect ( "signal_to_catch" ) { |widget, event| callback_method }
Below are the possible Gdk::Event types:
So, to connect a callback method to one of these events, we would use something like:
callback_method ( widget, event, data )
The value returned from this method indicates whether the event should be propageted further by the GTK event handling mechanism. Returning true indicates that the event has been handled, and that it should not propogate further. Returning false continues the normal event handling. See the section on Advanced Event and Signal Handling for more details on this propagation process.
For details on the Gdk::Event data types, see the appendix entitled GDK Event Types.
The GDK selection and drag-and-drop APIs also emit a number of events which are reflected in GTK by the signals. See the Signals on the source widget and Signals on the destination widget for details on the signatures of the callback methods for these signals:
Prev | Next |