Project

General

Profile

Widget callbacks » History » Version 9

iri, 02/28/2011 10:57 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 7 iri
h1. Any widgets
25
26 1 iri
h2. SCOL_GTK_WIDGET_BUTTONPRESSED
27
28
a mouse button has been pressed on a widget.
29
Prototype : *fun [ObjGtkWidget u0 I I I [I I]] u2*
30
31
32 3 iri
table
33
|1. *widget*|ObjGtkWidget|a widget| |
34
|2. *userparam*|u0|a user parameter, at your convenience| |
35
|3. *signal*|I|the type of the signal|SCOL_GTK_EVENT_BUTTON_PRESSED (one click),|
36
| | | |SCOL_GTK_EVENT_BUTTON_PRESSED2 (double click),|
37
| | | |SCOL_GTK_EVENT_BUTTON_PRESSED3 (triple click),|
38
| | | |SCOL_GTK_EVENT_BUTTON_RELEASE (button released).|
39
| | | |So you can make one function to several definitions|
40
|4. *button*|I|the mouse button|SCOL_GTK_EVENT_BUTTON_1,|
41
| | | |SCOL_GTK_EVENT_BUTTON_2,|
42
| | | |SCOL_GTK_EVENT_BUTTON_3,|
43
| | | |SCOL_GTK_EVENT_BUTTON_4,|
44
| | | |SCOL_GTK_EVENT_BUTTON_5,|
45
|5. *mask*|I|the mask of the modifier keys|SCOL_GTK_EVENT_KEY_SHIFT|
46
| | | |SCOL_GTK_EVENT_KEY_CONTROL,|
47
| | | |SCOL_GTK_EVENT_KEY_ALT,|
48 4 iri
| | | |SCOL_GTK_EVENT_KEY_CAPS (can not work : system, window manager, ...)|
49
| | | |SCOL_GTK_EVENT_KEY_HYPER (can not work : system, window manager, ...)|
50
| | | |SCOL_GTK_EVENT_KEY_SUPER (can not work : system, window manager, ...)|
51 3 iri
| | | |SCOL_GTK_EVENT_KEY_OTHER (or nothing)|
52
|6. *position*|I|the position of the click [x y], relative to the widget| |
53 1 iri
54
55 3 iri
h2. SCOL_GTK_WIDGET_BUTTONRELEASED
56 1 iri
57 3 iri
a mouse button has been released on a widget.
58
Prototype : *fun [ObjGtkWidget u0 I I I [I I]] u2*
59 1 iri
60 3 iri
See 'SCOL_GTK_WIDGET_BUTTONPRESSED' above.
61 5 iri
62
h2. SCOL_GTK_WIDGET_MOVERESIZE
63
64
a window has moved and/or resized.
65
Prototype : *fun [ObjGtkWidget u0 [I I] [I I]] u2*
66
67
The supplementals parameters are two tuples :
68
# is the new position (x and y, relative at its parents or at the screen)
69
# is the new size (width and height)
70 1 iri
71 6 iri
h2. SCOL_GTK_WIDGET_DESTROY
72
73
when a widget (typically a window or all top level container) is destroyed (all reference are destroyed).
74
Prototype : *fun [ObjGtkWidget u0] u2*
75
76 8 iri
h2. SCOL_GTK_WIDGET_ENTERLEAVE
77
78
when the pointer (typically a mouse) enter or leave a window (maybe an other object)
79
Prototype : *fun [ObjGtkWidget u0 I I I [I I]] u2*
80
81
The supplementals arguments are :
82
table
83
|1. *widget*|ObjGtkWidget|a widget (typically a window)| |
84
|2. *userparam*|u0|a user parameter, at your convenience| |
85
|3 *type*|I|the pointer enters or leaves|0 if enters, 1 if leaves|
86
|4 *mask*|I|the mask of the modifier keys|SCOL_GTK_EVENT_KEY_SHIFT|
87
| | | |SCOL_GTK_EVENT_KEY_CONTROL,|
88
| | | |SCOL_GTK_EVENT_KEY_ALT,|
89
| | | |SCOL_GTK_EVENT_KEY_CAPS (can not work : system, window manager, ...)|
90
| | | |SCOL_GTK_EVENT_KEY_HYPER (can not work : system, window manager, ...)|
91
| | | |SCOL_GTK_EVENT_KEY_SUPER (can not work : system, window manager, ...)|
92
| | | |SCOL_GTK_EVENT_KEY_OTHER (or nothing)|
93
|5 *focus*|I|the widget has (or not) the focus|1 if is the focus window or an inferior|
94
|6 *coord*|[I I]|the coordinate of the pointer (x, y)|
95
96 9 iri
h2. SCOL_GTK_WIDGET_KEYB_FOCUS
97
98
when the keyboard focus enters or leaves a widget.
99
Prototype : *fun [ObjGtkWidget u0 I] u2*
100
101
The supplemental parameter is :
102
*in* : I : 1 if enter, 0 if lost
103
104
105 6 iri
106 1 iri
Return [[Widgets]]