Widget callbacks » History » Version 4
iri, 02/28/2011 02:02 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 | 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 | |||
28 | 3 | iri | table |
29 | |1. *widget*|ObjGtkWidget|a widget| | |
||
30 | |2. *userparam*|u0|a user parameter, at your convenience| | |
||
31 | |3. *signal*|I|the type of the signal|SCOL_GTK_EVENT_BUTTON_PRESSED (one click),| |
||
32 | | | | |SCOL_GTK_EVENT_BUTTON_PRESSED2 (double click),| |
||
33 | | | | |SCOL_GTK_EVENT_BUTTON_PRESSED3 (triple click),| |
||
34 | | | | |SCOL_GTK_EVENT_BUTTON_RELEASE (button released).| |
||
35 | | | | |So you can make one function to several definitions| |
||
36 | |4. *button*|I|the mouse button|SCOL_GTK_EVENT_BUTTON_1,| |
||
37 | | | | |SCOL_GTK_EVENT_BUTTON_2,| |
||
38 | | | | |SCOL_GTK_EVENT_BUTTON_3,| |
||
39 | | | | |SCOL_GTK_EVENT_BUTTON_4,| |
||
40 | | | | |SCOL_GTK_EVENT_BUTTON_5,| |
||
41 | |5. *mask*|I|the mask of the modifier keys|SCOL_GTK_EVENT_KEY_SHIFT| |
||
42 | | | | |SCOL_GTK_EVENT_KEY_CONTROL,| |
||
43 | | | | |SCOL_GTK_EVENT_KEY_ALT,| |
||
44 | 4 | iri | | | | |SCOL_GTK_EVENT_KEY_CAPS (can not work : system, window manager, ...)| |
45 | | | | |SCOL_GTK_EVENT_KEY_HYPER (can not work : system, window manager, ...)| |
||
46 | | | | |SCOL_GTK_EVENT_KEY_SUPER (can not work : system, window manager, ...)| |
||
47 | 3 | iri | | | | |SCOL_GTK_EVENT_KEY_OTHER (or nothing)| |
48 | |6. *position*|I|the position of the click [x y], relative to the widget| | |
||
49 | 1 | iri | |
50 | |||
51 | 3 | iri | h2. SCOL_GTK_WIDGET_BUTTONRELEASED |
52 | 1 | iri | |
53 | 3 | iri | a mouse button has been released on a widget. |
54 | Prototype : *fun [ObjGtkWidget u0 I I I [I I]] u2* |
||
55 | 1 | iri | |
56 | 3 | iri | See 'SCOL_GTK_WIDGET_BUTTONPRESSED' above. |
57 | 1 | iri | |
58 | Return [[Widgets]] |