1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// Copyright (c) 2020 - Jonathan De Wachter
//
// This source file is part of the Byteplug framework which is released under the MIT license.
// Please refer to the LICENSE file that can be found at the root of the project directory.
//
// Written by Jonathan De Wachter <dewachter.jonathan@gmail.com>, January 2020
use crate;
use crate;
use crate;
use crateColor;
/// The widget move callback function
///
/// This function is called whenever the widget position changes. It's called
/// with the new widget position relative to its parent.
///
/// * `position` - The new widget position (relative to its parent).
///
pub type WidgetMoveFunction<Window, States> = fn ;
/// The widget resize callback function
///
/// This function is called whenever the widget size changes. It's called with
/// the new widget size.
///
/// * `size` - The new widget size.
///
pub type WidgetResizeFunction<Window, States> = fn ;
/// The widget redraw callback function
///
/// This function is called whenever the widget must be redrawn. It's called
/// with a mutable pointer to the widget pixels which are expected to be
/// updated. The widget pixels is expressed as an array of colors with a length
/// equal to "width x height" of the widget size.
///
/// * `pixels` - The widget pixels to be updated.
///
/// Note that the signature of this function will evolve to be more convenient
/// to work with, and to get rid of dependency on the `Color` struct (the
/// widget module should not depend on the image module).
///
pub type WidgetDrawFunction<Window, States> = fn ;
/// The focus gain callback function.
///
/// This function is called whenever the widget focus is gained. Only one widget
/// or no widget is focused at a time and a focused widget receives the keyboard
/// input. Usually it's visually decorated to indicate it's the focused widget.
///
pub type FocusGainFunction<Window, States> = fn ;
/// The focus gain callback function.
///
/// This function is called whenever the widget focus is lost. The widget does
/// not receive the keyboard input until it gains the focus back.
///
pub type FocusLoseFunction<Window, States> = fn ;
/// The keyboard key down callback function.
///
/// This function is called whenever a keyboard key is pressed when the widget
/// is focused. It's called with the identifier of the key being pressed and the
/// current keyboard modifiers.
///
/// * `key` - The identifier of the key being pressed.
/// * `modifiers` - The current keyboard modifiers.
///
pub type KeyDownFunction<Window, States> = fn ;
/// The keyboard key up callback function.
///
/// This function is called whenever a keyboard key is released when the widget
/// is focused. It's called with the identifier of the key being released and
/// the current keyboard modifiers.
///
/// * `key` - The identifier of the key being released.
/// * `modifiers` - The current keyboard modifiers.
///
pub type KeyUpFunction<Window, States> = fn ;
/// The character enter callback function.
///
/// This function is called whenever a character is generated, usually after a
/// sequence of keys are pressed. It's the underlying operating system that
/// computes its unicode scalar value according to the keyboard layout settings
/// of the user.
///
/// Note that it doesn't keep the key down/up counter-part callback functions
/// from being called. For instance, pressing the 'A' key on the keyboard will
/// likely generate a key down event with the key identifier 'A' **and** the 'A'
/// character... unless it's configured to generate a different character, like
/// for a Russian keyboard layout for example.
///
/// * `character` - The character entered as a unicode scalar value.
///
pub type CharacterEnterFunction<Window, States> = fn ;
/// The cursor enter callback function.
///
/// This function is called whenever the mouse cursor enters the widget area.
/// It's called with the position of the cursor relative to the widget top-left
/// corner.
///
/// * `position` - The cursor position (relative to the top-left corner).
///
pub type CursorEnterFunction<Window, States> = fn ;
/// The cursor leave callback function
///
/// This function is called whenever the mouse cursor leaves the widget area.
/// It's called with the position of the cursor relative to the widget top-left
/// corner.
///
/// * `position` - The cursor position (relative to the top-left corner).
///
pub type CursorLeaveFunction<Window, States> = fn ;
/// The cursor move callback function
///
/// This function is called whenever the mouse cursor moves while it is on the
/// widget area, or when the widget is grabbed. It's called with the position
/// of the cursor relative to the widget top-left corner and a vector
/// describing the cursor movement in pixels coordinate.
///
/// * `position` - The new cursor position (relative to the top-left corner).
/// * `movement` - The movement of the cursor in pixels coordinate.
///
pub type CursorMoveFunction<Window, States> = fn ;
/// The mouse button down callback function
///
/// This function is called whenever a mouse button is pressed when the cursor
/// is on the widget area; the widget is then marked as grabbed by this button.
/// It's called with the identifier of the button being pressed and the current
/// cursor position.
///
/// * `button` - The identifier of the button being pressed.
/// * `position` - The current cursor position.
///
pub type MouseDownFunction<Window, States> = fn ;
/// The mouse button up callback function
///
/// This function is called whenever a mouse button is released when the widget
/// was grabbed by this very same button. It's called with the identifier of the
/// button being released and the current cursor position relative to the
/// top-left corner of the widget.
///
/// * `button` - The identifier of the button being released.
/// * `position` - The current cursor position (relative to the top-left corner).
///
pub type MouseUpFunction<Window, States> = fn ;
/// The mouse wheel scroll callback function
///
/// This function is called whenever the wheel of the mouse is scrolled when the
/// cursor is on the widget area. It's called with the identifier of the wheel
/// which can be either horizontal or vertical and the movement of the wheel in
/// pixels.
///
/// Note that the movement value is not precised; work towards testing and
/// documenting, and possibly improving the interface and uniformizing the
/// values, will be done.
///
/// * `wheel` - The identifier of the wheel being scrolled.
/// * `movement` - The movement of the wheel expressed in pixels
///
pub type MouseScrollFunction<Window, States> = fn ;
/// Brief description
///
/// The **Widget trait** is not documented yet. Pull requests are welcome.
///