Widget callbacks » History » Version 6
iri, 02/28/2011 09:26 PM
| 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 | 5 | iri | {{>toc}} |
| 23 | |||
| 24 | 1 | iri | h2. SCOL_GTK_WIDGET_BUTTONPRESSED |
| 25 | |||
| 26 | a mouse button has been pressed on a widget. |
||
| 27 | Prototype : *fun [ObjGtkWidget u0 I I I [I I]] u2* |
||
| 28 | |||
| 29 | |||
| 30 | 3 | iri | table |
| 31 | |1. *widget*|ObjGtkWidget|a widget| | |
||
| 32 | |2. *userparam*|u0|a user parameter, at your convenience| | |
||
| 33 | |3. *signal*|I|the type of the signal|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 | |4. *button*|I|the mouse button|SCOL_GTK_EVENT_BUTTON_1,| |
||
| 39 | | | | |SCOL_GTK_EVENT_BUTTON_2,| |
||
| 40 | | | | |SCOL_GTK_EVENT_BUTTON_3,| |
||
| 41 | | | | |SCOL_GTK_EVENT_BUTTON_4,| |
||
| 42 | | | | |SCOL_GTK_EVENT_BUTTON_5,| |
||
| 43 | |5. *mask*|I|the mask of the modifier keys|SCOL_GTK_EVENT_KEY_SHIFT| |
||
| 44 | | | | |SCOL_GTK_EVENT_KEY_CONTROL,| |
||
| 45 | | | | |SCOL_GTK_EVENT_KEY_ALT,| |
||
| 46 | 4 | iri | | | | |SCOL_GTK_EVENT_KEY_CAPS (can not work : system, window manager, ...)| |
| 47 | | | | |SCOL_GTK_EVENT_KEY_HYPER (can not work : system, window manager, ...)| |
||
| 48 | | | | |SCOL_GTK_EVENT_KEY_SUPER (can not work : system, window manager, ...)| |
||
| 49 | 3 | iri | | | | |SCOL_GTK_EVENT_KEY_OTHER (or nothing)| |
| 50 | |6. *position*|I|the position of the click [x y], relative to the widget| | |
||
| 51 | 1 | iri | |
| 52 | |||
| 53 | 3 | iri | h2. SCOL_GTK_WIDGET_BUTTONRELEASED |
| 54 | 1 | iri | |
| 55 | 3 | iri | a mouse button has been released on a widget. |
| 56 | Prototype : *fun [ObjGtkWidget u0 I I I [I I]] u2* |
||
| 57 | 1 | iri | |
| 58 | 3 | iri | See 'SCOL_GTK_WIDGET_BUTTONPRESSED' above. |
| 59 | 5 | iri | |
| 60 | h2. SCOL_GTK_WIDGET_MOVERESIZE |
||
| 61 | |||
| 62 | a window has moved and/or resized. |
||
| 63 | Prototype : *fun [ObjGtkWidget u0 [I I] [I I]] u2* |
||
| 64 | |||
| 65 | The supplementals parameters are two tuples : |
||
| 66 | # is the new position (x and y, relative at its parents or at the screen) |
||
| 67 | # is the new size (width and height) |
||
| 68 | 1 | iri | |
| 69 | 6 | iri | h2. SCOL_GTK_WIDGET_DESTROY |
| 70 | |||
| 71 | when a widget (typically a window or all top level container) is destroyed (all reference are destroyed). |
||
| 72 | Prototype : *fun [ObjGtkWidget u0] u2* |
||
| 73 | |||
| 74 | |||
| 75 | 1 | iri | Return [[Widgets]] |