Re: [gtk-list] Re : Re: gtk signals and events
- From: Tim Janik <timj gtk org>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re : Re: gtk signals and events
- Date: Mon, 22 Mar 1999 22:42:57 +0100 (CET)
On Mon, 22 Mar 1999 rlau@csc.com wrote:
>
>
> >> Events reflect X events. Signals are widget based.
> I know what X events are, but what do you mean when you
> said signals are widget based?
basically, incomming X events get translated to gdk events which will
then cause signal emissions on the widgets taht these gdk events belong to.
signals are introduced per widget class and provide (simply speaking) a
generic mechanism to hook callback functions into the call sequence upon
execution of an object method.
>
> When a button is clicked would that be an event or a signa>
>
so in principle, when you click a button, the following happens:
* Xserver generates an Xevent and sends it to app
* app picks up the Xevents at the gdk layer and translates it into a
gdk event (the mapping is pretty straight forward)
* gtk figures the associated widget through the Xwindow that the event
occoured on and then processes this event on the widget:
- the signal GtkWidgetClass::event is emitted, carying the raw gdk event
with it, if the last handler connected to this signal returns TRUE, the
processing is aborted (by default no handlers are provided).
- the signal GtkWidgetClass::button_press_event is emitted and triggers
execution of the GtkButtonClass:button_press_event method implementation
(gtk_button_button_press() in gtkbutton.c).
later on, if you release the mouse button again, the above steps are repeated
for the GtkWidgetClass::button_release_event, and upon execution of the
corresponding class method (gtk_real_button_released()), the GtkButton::clicked
signal is emitted, and that is the signal that users usually connect their
callbacks to, e.g.:
static void
callback (GtkWidget *button,
gpointer user_data)
{
printf ("a click occoured\n");
}
int main()
{
[...]
button = gtk_widget_new (GTK_TYPE_BUTTON, NULL);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (callback), NULL);
[...]
}
>
> Please elobrate.
>
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
>
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]