Widget callbacks » History » Version 1
iri, 02/28/2011 12:02 AM
| 1 | 1 | iri | h1. Widget callbacks |
|---|---|---|---|
| 2 | |||
| 3 | A signal will be emitted when an event occurs on a widget. |
||
| 4 | To run any actions when a signal is emitted, you should define a _callback_, a function will run these actions. |
||
| 5 | |||
| 6 | Here, you can define all callbacks with an one function : *_gtkWidgetCB* |
||
| 7 | |||
| 8 | Its prototype is : *fun [ObjGtkWidget u1 u0 I I] ObjGtkWidget* |
||
| 9 | |||
| 10 | # *ObjGtkWidget* : Scol object : the widget |
||
| 11 | # *u1* : the prototype of the callback (see below) |
||
| 12 | # *u0* : the user parameter, at your convenience |
||
| 13 | # *I* : the flag of the callback = which signal is affected ? (see below) |
||
| 14 | # *I* : the mask : propagate or not the signal to the container ? Two values are availables |
||
| 15 | * SCOL_GTK_SIGNAL_MASK_PROPAGATE |
||
| 16 | * SCOL_GTK_SIGNAL_MASK_STOP |
||
| 17 | |||
| 18 | +Warning+ : the prototype of the callback is different for each flag ! |
||
| 19 | |||
| 20 | Flag currently availables : |
||
| 21 | |||
| 22 | h2. SCOL_GTK_WIDGET_BUTTONPRESSED |
||
| 23 | |||
| 24 | a mouse button has been pressed on a widget. |
||
| 25 | Prototype : *fun [ObjGtkWidget u0 I I I [I I]] u2* |
||
| 26 | |||
| 27 | h3. 1. the widget |
||
| 28 | |||
| 29 | h3. 2. the user parameter |
||
| 30 | |||
| 31 | h3. 3. the type of signal : |
||
| 32 | |||
| 33 | * SCOL_GTK_EVENT_BUTTON_PRESSED (one click), |
||
| 34 | * SCOL_GTK_EVENT_BUTTON_PRESSED2 (double click), |
||
| 35 | * SCOL_GTK_EVENT_BUTTON_PRESSED3 (triple click), |
||
| 36 | * SCOL_GTK_EVENT_BUTTON_RELEASE (button released). |
||
| 37 | So you can make one function to several definitions |
||
| 38 | |||
| 39 | h3. 4. The button : |
||
| 40 | |||
| 41 | * SCOL_GTK_EVENT_BUTTON_1, |
||
| 42 | * SCOL_GTK_EVENT_BUTTON_2, |
||
| 43 | * SCOL_GTK_EVENT_BUTTON_3, |
||
| 44 | * SCOL_GTK_EVENT_BUTTON_4, |
||
| 45 | * SCOL_GTK_EVENT_BUTTON_5 |
||
| 46 | |||
| 47 | h3. 5. The mask of the modifier keys |
||
| 48 | |||
| 49 | * SCOL_GTK_EVENT_KEY_SHIFT, |
||
| 50 | * SCOL_GTK_EVENT_KEY_CONTROL, |
||
| 51 | * SCOL_GTK_EVENT_KEY_ALT, |
||
| 52 | * SCOL_GTK_EVENT_KEY_CAPS, |
||
| 53 | * SCOL_GTK_EVENT_KEY_HYPER, |
||
| 54 | * SCOL_GTK_EVENT_KEY_SUPER, |
||
| 55 | * SCOL_GTK_EVENT_KEY_OTHER (or nothing) |
||
| 56 | |||
| 57 | h3. 6. the position of the click [x y], relative to the widget |
||
| 58 | |||
| 59 | Return [[Widgets]] |