reflexion 0.1.21 → 0.1.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/capture_event.cpp +6 -5
- data/.doc/ext/reflex/contact_event.cpp +18 -16
- data/.doc/ext/reflex/draw_event.cpp +10 -8
- data/.doc/ext/reflex/event.cpp +10 -10
- data/.doc/ext/reflex/focus_event.cpp +18 -17
- data/.doc/ext/reflex/frame_event.cpp +17 -17
- data/.doc/ext/reflex/key_event.cpp +227 -28
- data/.doc/ext/reflex/native.cpp +2 -0
- data/.doc/ext/reflex/pointer.cpp +158 -0
- data/.doc/ext/reflex/pointer_event.cpp +32 -91
- data/.doc/ext/reflex/scroll_event.cpp +14 -17
- data/.doc/ext/reflex/selector.cpp +8 -0
- data/.doc/ext/reflex/timer.cpp +9 -1
- data/.doc/ext/reflex/timer_event.cpp +4 -13
- data/.doc/ext/reflex/update_event.cpp +6 -5
- data/.doc/ext/reflex/view.cpp +57 -0
- data/.doc/ext/reflex/wheel_event.cpp +39 -22
- data/.doc/ext/reflex/window.cpp +24 -0
- data/VERSION +1 -1
- data/ext/reflex/capture_event.cpp +6 -5
- data/ext/reflex/contact_event.cpp +18 -16
- data/ext/reflex/draw_event.cpp +9 -7
- data/ext/reflex/event.cpp +11 -11
- data/ext/reflex/focus_event.cpp +18 -17
- data/ext/reflex/frame_event.cpp +16 -16
- data/ext/reflex/key_event.cpp +228 -28
- data/ext/reflex/native.cpp +2 -0
- data/ext/reflex/pointer.cpp +170 -0
- data/ext/reflex/pointer_event.cpp +31 -96
- data/ext/reflex/scroll_event.cpp +15 -18
- data/ext/reflex/selector.cpp +9 -0
- data/ext/reflex/timer.cpp +15 -6
- data/ext/reflex/timer_event.cpp +9 -19
- data/ext/reflex/update_event.cpp +6 -5
- data/ext/reflex/view.cpp +67 -3
- data/ext/reflex/wheel_event.cpp +40 -21
- data/ext/reflex/window.cpp +30 -3
- data/include/reflex/defs.h +140 -106
- data/include/reflex/event.h +232 -124
- data/include/reflex/pointer.h +107 -0
- data/include/reflex/ruby/pointer.h +41 -0
- data/include/reflex/ruby/view.h +9 -0
- data/include/reflex/ruby/window.h +9 -0
- data/include/reflex/selector.h +1 -1
- data/include/reflex/shape.h +2 -2
- data/include/reflex/view.h +6 -4
- data/include/reflex/window.h +10 -8
- data/lib/reflex/application.rb +3 -3
- data/lib/reflex/autoinit.rb +1 -1
- data/lib/reflex/button.rb +7 -7
- data/lib/reflex/capture_event.rb +7 -7
- data/lib/reflex/contact_event.rb +10 -10
- data/lib/reflex/draw_event.rb +2 -2
- data/lib/reflex/ellipse_shape.rb +2 -2
- data/lib/reflex/focus_event.rb +11 -11
- data/lib/reflex/frame_event.rb +5 -5
- data/lib/reflex/helper.rb +20 -20
- data/lib/reflex/image_view.rb +2 -2
- data/lib/reflex/key_event.rb +12 -12
- data/lib/reflex/model.rb +22 -22
- data/lib/reflex/model_owner.rb +7 -7
- data/lib/reflex/model_view.rb +1 -1
- data/lib/reflex/module.rb +5 -5
- data/lib/reflex/pointer.rb +107 -0
- data/lib/reflex/pointer_event.rb +16 -54
- data/lib/reflex/polygon_shape.rb +2 -2
- data/lib/reflex/reflex.rb +3 -3
- data/lib/reflex/scroll_event.rb +1 -1
- data/lib/reflex/selector.rb +4 -4
- data/lib/reflex/shape.rb +13 -13
- data/lib/reflex/style.rb +11 -11
- data/lib/reflex/style_length.rb +1 -1
- data/lib/reflex/text_view.rb +2 -2
- data/lib/reflex/timer.rb +2 -2
- data/lib/reflex/timer_event.rb +3 -2
- data/lib/reflex/update_event.rb +1 -1
- data/lib/reflex/view.rb +32 -32
- data/lib/reflex/wheel_event.rb +2 -10
- data/lib/reflex/window.rb +6 -6
- data/lib/reflex.rb +1 -0
- data/lib/reflexion.rb +17 -17
- data/reflex.gemspec +5 -5
- data/samples/reflexion/noise.rb +1 -1
- data/samples/tree.rb +1 -1
- data/src/event.cpp +792 -86
- data/src/event.h +47 -0
- data/src/image_view.cpp +2 -2
- data/src/ios/event.h +15 -3
- data/src/ios/event.mm +126 -11
- data/src/ios/view_controller.mm +50 -22
- data/src/ios/window.mm +1 -1
- data/src/osx/event.h +15 -4
- data/src/osx/event.mm +214 -24
- data/src/osx/native_window.mm +84 -17
- data/src/pointer.cpp +203 -0
- data/src/pointer.h +26 -0
- data/src/selector.cpp +1 -1
- data/src/shape.cpp +11 -13
- data/src/shape.h +1 -1
- data/src/view.cpp +205 -118
- data/src/view.h +5 -10
- data/src/window.cpp +334 -104
- data/src/window.h +22 -3
- data/src/world.cpp +6 -4
- data/test/helper.rb +3 -3
- data/test/test_application.rb +1 -1
- data/test/test_capture_event.rb +22 -6
- data/test/test_contact_event.rb +40 -0
- data/test/test_draw_event.rb +35 -0
- data/test/test_event.rb +33 -5
- data/test/test_focus_event.rb +34 -0
- data/test/test_frame_event.rb +38 -0
- data/test/test_has_frame.rb +11 -11
- data/test/test_key_event.rb +33 -0
- data/test/test_pointer.rb +149 -0
- data/test/test_pointer_event.rb +70 -104
- data/test/test_reflex.rb +1 -1
- data/test/test_scroll_event.rb +39 -0
- data/test/test_selector.rb +15 -8
- data/test/test_shape.rb +8 -8
- data/test/test_style.rb +13 -13
- data/test/test_style_length.rb +5 -5
- data/test/test_timer_event.rb +38 -0
- data/test/test_update_event.rb +29 -0
- data/test/test_view.rb +57 -30
- data/test/test_wheel_event.rb +40 -0
- data/test/test_window.rb +29 -27
- metadata +64 -35
data/include/reflex/event.h
CHANGED
@@ -4,10 +4,12 @@
|
|
4
4
|
#define __REFLEX_EVENT_H__
|
5
5
|
|
6
6
|
|
7
|
+
#include <xot/pimpl.h>
|
7
8
|
#include <rays/point.h>
|
8
9
|
#include <rays/bounds.h>
|
9
10
|
#include <rays/painter.h>
|
10
11
|
#include <reflex/defs.h>
|
12
|
+
#include <reflex/pointer.h>
|
11
13
|
#include <reflex/timer.h>
|
12
14
|
|
13
15
|
|
@@ -26,74 +28,129 @@ namespace Reflex
|
|
26
28
|
|
27
29
|
Event ();
|
28
30
|
|
31
|
+
~Event ();
|
32
|
+
|
29
33
|
void block ();
|
30
34
|
|
31
35
|
bool is_blocked () const;
|
32
36
|
|
33
|
-
|
37
|
+
double time () const;
|
38
|
+
|
39
|
+
struct Data;
|
34
40
|
|
35
|
-
|
41
|
+
Xot::PSharedImpl<Data> self;
|
42
|
+
|
43
|
+
protected:
|
44
|
+
|
45
|
+
Event (const Event* src);
|
36
46
|
|
37
47
|
};// Event
|
38
48
|
|
39
49
|
|
40
|
-
|
50
|
+
class UpdateEvent : public Event
|
41
51
|
{
|
42
52
|
|
43
|
-
|
53
|
+
public:
|
54
|
+
|
55
|
+
UpdateEvent ();
|
56
|
+
|
57
|
+
UpdateEvent (double now, float dt);
|
58
|
+
|
59
|
+
UpdateEvent dup () const;
|
44
60
|
|
45
|
-
|
61
|
+
double now () const;
|
46
62
|
|
47
|
-
|
63
|
+
float dt () const;
|
64
|
+
|
65
|
+
struct Data;
|
66
|
+
|
67
|
+
Xot::PSharedImpl<Data> self;
|
68
|
+
|
69
|
+
private:
|
70
|
+
|
71
|
+
UpdateEvent (const UpdateEvent* src);
|
48
72
|
|
49
73
|
};// UpdateEvent
|
50
74
|
|
51
75
|
|
52
|
-
|
76
|
+
class DrawEvent : public Event
|
53
77
|
{
|
54
78
|
|
55
|
-
|
79
|
+
public:
|
80
|
+
|
81
|
+
DrawEvent ();
|
82
|
+
|
83
|
+
DrawEvent (float dt, float fps);
|
84
|
+
|
85
|
+
DrawEvent dup () const;
|
56
86
|
|
57
|
-
|
87
|
+
Painter* painter ();
|
58
88
|
|
59
|
-
|
89
|
+
const Painter* painter () const;
|
60
90
|
|
61
|
-
|
91
|
+
const Bounds& bounds () const;
|
62
92
|
|
63
|
-
|
93
|
+
float dt () const;
|
94
|
+
|
95
|
+
float fps () const;
|
96
|
+
|
97
|
+
struct Data;
|
98
|
+
|
99
|
+
Xot::PSharedImpl<Data> self;
|
100
|
+
|
101
|
+
private:
|
102
|
+
|
103
|
+
DrawEvent (const DrawEvent* src);
|
64
104
|
|
65
105
|
};// DrawEvent
|
66
106
|
|
67
107
|
|
68
|
-
|
108
|
+
class FrameEvent : public Event
|
69
109
|
{
|
70
110
|
|
71
|
-
|
111
|
+
public:
|
112
|
+
|
113
|
+
FrameEvent ();
|
114
|
+
|
115
|
+
FrameEvent (
|
116
|
+
const Bounds& frame,
|
117
|
+
coord dx, coord dy,
|
118
|
+
coord dwidth, coord dheight,
|
119
|
+
float angle, float dangle);
|
120
|
+
|
121
|
+
FrameEvent (
|
122
|
+
const Bounds& frame, const Bounds& prev_frame,
|
123
|
+
float angle, float prev_angle);
|
124
|
+
|
125
|
+
FrameEvent dup () const;
|
126
|
+
|
127
|
+
const Bounds& frame () const;
|
128
|
+
|
129
|
+
coord dx () const;
|
130
|
+
|
131
|
+
coord dy () const;
|
132
|
+
|
133
|
+
coord dwidth () const;
|
134
|
+
|
135
|
+
coord dheight () const;
|
72
136
|
|
73
|
-
|
137
|
+
float angle () const;
|
74
138
|
|
75
|
-
|
76
|
-
{
|
77
|
-
struct {coord dwidth, dheight;};
|
139
|
+
float dangle () const;
|
78
140
|
|
79
|
-
|
80
|
-
};
|
141
|
+
bool is_move () const;
|
81
142
|
|
82
|
-
|
143
|
+
bool is_resize () const;
|
83
144
|
|
84
|
-
|
85
|
-
const Bounds& frame = 0, coord dx = 0, coord dy = 0, coord dwidth = 0, coord dheight = 0,
|
86
|
-
float angle = 0, float dangle = 0);
|
145
|
+
bool is_rotate () const;
|
87
146
|
|
88
|
-
|
89
|
-
const Bounds& frame, const Bounds& prev_frame,
|
90
|
-
float angle = 0, float prev_angle = 0);
|
147
|
+
struct Data;
|
91
148
|
|
92
|
-
|
149
|
+
Xot::PSharedImpl<Data> self;
|
93
150
|
|
94
|
-
|
151
|
+
private:
|
95
152
|
|
96
|
-
|
153
|
+
FrameEvent (const FrameEvent* src);
|
97
154
|
|
98
155
|
};// FrameEvent
|
99
156
|
|
@@ -101,31 +158,29 @@ namespace Reflex
|
|
101
158
|
struct ScrollEvent : public Event
|
102
159
|
{
|
103
160
|
|
104
|
-
|
105
|
-
|
106
|
-
|
161
|
+
public:
|
162
|
+
|
163
|
+
ScrollEvent ();
|
107
164
|
|
108
|
-
|
109
|
-
};
|
165
|
+
ScrollEvent (coord x, coord y, coord z, coord dx, coord dy, coord dz);
|
110
166
|
|
111
|
-
|
112
|
-
{
|
113
|
-
struct {coord dx, dy, dz;};
|
167
|
+
ScrollEvent dup () const;
|
114
168
|
|
115
|
-
|
116
|
-
};
|
169
|
+
Point& scroll ();
|
117
170
|
|
118
|
-
|
171
|
+
const Point& scroll () const;
|
119
172
|
|
120
|
-
|
173
|
+
Point& dscroll ();
|
121
174
|
|
122
|
-
|
175
|
+
const Point& dscroll () const;
|
123
176
|
|
124
|
-
|
177
|
+
struct Data;
|
125
178
|
|
126
|
-
|
179
|
+
Xot::PSharedImpl<Data> self;
|
127
180
|
|
128
|
-
|
181
|
+
private:
|
182
|
+
|
183
|
+
ScrollEvent (const ScrollEvent* src);
|
129
184
|
|
130
185
|
};// ScrollEvent
|
131
186
|
|
@@ -133,15 +188,29 @@ namespace Reflex
|
|
133
188
|
struct FocusEvent : public Event
|
134
189
|
{
|
135
190
|
|
136
|
-
|
191
|
+
public:
|
192
|
+
|
193
|
+
enum Action {ACTION_NONE = 0, FOCUS, BLUR};
|
194
|
+
|
195
|
+
FocusEvent ();
|
196
|
+
|
197
|
+
FocusEvent (Action action, View* current, View* last);
|
198
|
+
|
199
|
+
FocusEvent dup () const;
|
200
|
+
|
201
|
+
Action action () const;
|
137
202
|
|
138
|
-
|
203
|
+
View* current () const;
|
139
204
|
|
140
|
-
|
205
|
+
View* last () const;
|
141
206
|
|
142
|
-
|
207
|
+
struct Data;
|
143
208
|
|
144
|
-
|
209
|
+
Xot::PSharedImpl<Data> self;
|
210
|
+
|
211
|
+
private:
|
212
|
+
|
213
|
+
FocusEvent (const FocusEvent* src);
|
145
214
|
|
146
215
|
};// FocusEvent
|
147
216
|
|
@@ -149,70 +218,67 @@ namespace Reflex
|
|
149
218
|
struct KeyEvent : public Event
|
150
219
|
{
|
151
220
|
|
152
|
-
|
221
|
+
public:
|
153
222
|
|
154
|
-
|
223
|
+
enum Action {ACTION_NONE = 0, DOWN, UP};
|
155
224
|
|
156
|
-
|
225
|
+
KeyEvent ();
|
157
226
|
|
158
|
-
|
227
|
+
KeyEvent (
|
228
|
+
Action action, const char* chars, int code,
|
229
|
+
uint modifiers = 0, int repeat = 0);
|
159
230
|
|
160
|
-
|
231
|
+
KeyEvent dup () const;
|
161
232
|
|
162
|
-
|
233
|
+
Action action () const;
|
163
234
|
|
164
|
-
|
235
|
+
const char* chars () const;
|
165
236
|
|
166
|
-
|
237
|
+
int code () const;
|
167
238
|
|
168
|
-
|
169
|
-
Type type, const char* chars, int code,
|
170
|
-
uint modifiers = 0, int repeat = 0);
|
239
|
+
uint modifiers () const;
|
171
240
|
|
172
|
-
|
241
|
+
int repeat () const;
|
173
242
|
|
243
|
+
bool is_captured () const;
|
174
244
|
|
175
|
-
|
176
|
-
{
|
245
|
+
struct Data;
|
177
246
|
|
178
|
-
|
247
|
+
Xot::PSharedImpl<Data> self;
|
179
248
|
|
180
|
-
|
249
|
+
private:
|
250
|
+
|
251
|
+
KeyEvent (const KeyEvent* src);
|
181
252
|
|
182
|
-
|
253
|
+
};// KeyEvent
|
183
254
|
|
184
|
-
uint pointer_type;
|
185
255
|
|
186
|
-
|
256
|
+
class PointerEvent : public Event
|
257
|
+
{
|
187
258
|
|
188
|
-
|
259
|
+
public:
|
189
260
|
|
190
|
-
|
261
|
+
PointerEvent ();
|
191
262
|
|
192
|
-
|
193
|
-
{
|
194
|
-
struct {coord x, y, z;};
|
263
|
+
PointerEvent (const Pointer* pointers, size_t size);
|
195
264
|
|
196
|
-
|
197
|
-
};
|
265
|
+
PointerEvent dup () const;
|
198
266
|
|
199
|
-
|
267
|
+
size_t size () const;
|
200
268
|
|
201
|
-
|
202
|
-
Type type, uint pointer_type, coord x, coord y,
|
203
|
-
uint modifiers = 0, uint count = 1, bool drag = false);
|
269
|
+
bool empty () const;
|
204
270
|
|
205
|
-
|
206
|
-
Type type, uint pointer_type, const Point* positions, size_t size,
|
207
|
-
uint modifiers = 0, uint count = 1, bool drag = false);
|
271
|
+
bool is_captured () const;
|
208
272
|
|
209
|
-
|
273
|
+
const Pointer& operator [] (size_t index) const;
|
210
274
|
|
211
|
-
|
275
|
+
struct Data;
|
212
276
|
|
213
|
-
|
277
|
+
Xot::PSharedImpl<Data> self;
|
214
278
|
|
215
|
-
|
279
|
+
private:
|
280
|
+
|
281
|
+
PointerEvent (const PointerEvent* src);
|
216
282
|
|
217
283
|
};// PointerEvent
|
218
284
|
|
@@ -220,35 +286,33 @@ namespace Reflex
|
|
220
286
|
struct WheelEvent : public Event
|
221
287
|
{
|
222
288
|
|
223
|
-
|
224
|
-
|
225
|
-
|
289
|
+
public:
|
290
|
+
|
291
|
+
WheelEvent ();
|
226
292
|
|
227
|
-
|
228
|
-
|
293
|
+
WheelEvent (
|
294
|
+
coord x, coord y, coord z, coord dx, coord dy, coord dz,
|
295
|
+
uint modifiers = 0);
|
229
296
|
|
230
|
-
|
231
|
-
{
|
232
|
-
struct {coord x, y, z;};
|
297
|
+
WheelEvent dup () const;
|
233
298
|
|
234
|
-
|
235
|
-
};
|
299
|
+
Point& position ();
|
236
300
|
|
237
|
-
|
301
|
+
const Point& position () const;
|
238
302
|
|
239
|
-
|
303
|
+
Point& dposition ();
|
240
304
|
|
241
|
-
|
242
|
-
coord dx, coord dy, coord dz, coord x = 0, coord y = 0, coord z = 0,
|
243
|
-
uint modifiers = 0);
|
305
|
+
const Point& dposition () const;
|
244
306
|
|
245
|
-
|
307
|
+
uint modifiers () const;
|
246
308
|
|
247
|
-
|
309
|
+
struct Data;
|
248
310
|
|
249
|
-
|
311
|
+
Xot::PSharedImpl<Data> self;
|
250
312
|
|
251
|
-
|
313
|
+
private:
|
314
|
+
|
315
|
+
WheelEvent (const WheelEvent* src);
|
252
316
|
|
253
317
|
};// WheelEvent
|
254
318
|
|
@@ -256,11 +320,25 @@ namespace Reflex
|
|
256
320
|
struct CaptureEvent : public Event
|
257
321
|
{
|
258
322
|
|
259
|
-
|
323
|
+
public:
|
324
|
+
|
325
|
+
CaptureEvent ();
|
326
|
+
|
327
|
+
CaptureEvent (uint begin, uint end);
|
328
|
+
|
329
|
+
CaptureEvent dup () const;
|
330
|
+
|
331
|
+
uint begin () const;
|
332
|
+
|
333
|
+
uint end () const;
|
260
334
|
|
261
|
-
|
335
|
+
struct Data;
|
262
336
|
|
263
|
-
|
337
|
+
Xot::PSharedImpl<Data> self;
|
338
|
+
|
339
|
+
private:
|
340
|
+
|
341
|
+
CaptureEvent (const CaptureEvent* src);
|
264
342
|
|
265
343
|
};// CaptureEvent
|
266
344
|
|
@@ -268,21 +346,35 @@ namespace Reflex
|
|
268
346
|
struct TimerEvent : public Event
|
269
347
|
{
|
270
348
|
|
271
|
-
|
349
|
+
public:
|
350
|
+
|
351
|
+
TimerEvent ();
|
352
|
+
|
353
|
+
TimerEvent (Timer* timer);
|
354
|
+
|
355
|
+
TimerEvent dup () const;
|
356
|
+
|
357
|
+
Timer* timer ();
|
358
|
+
|
359
|
+
const Timer* timer () const;
|
360
|
+
|
361
|
+
View* owner () const;
|
362
|
+
|
363
|
+
int id () const;
|
272
364
|
|
273
|
-
|
365
|
+
float interval () const;
|
274
366
|
|
275
|
-
|
367
|
+
int count () const;
|
276
368
|
|
277
|
-
|
369
|
+
bool is_finished () const;
|
278
370
|
|
279
|
-
|
371
|
+
struct Data;
|
280
372
|
|
281
|
-
|
373
|
+
Xot::PSharedImpl<Data> self;
|
282
374
|
|
283
|
-
|
375
|
+
private:
|
284
376
|
|
285
|
-
|
377
|
+
TimerEvent (const TimerEvent* src);
|
286
378
|
|
287
379
|
};// TimerEvent
|
288
380
|
|
@@ -290,17 +382,33 @@ namespace Reflex
|
|
290
382
|
struct ContactEvent : public Event
|
291
383
|
{
|
292
384
|
|
293
|
-
|
385
|
+
public:
|
386
|
+
|
387
|
+
enum Action {ACTION_NONE = 0, BEGIN, END};
|
388
|
+
|
389
|
+
ContactEvent ();
|
390
|
+
|
391
|
+
ContactEvent (Action action, Shape* shape);
|
392
|
+
|
393
|
+
ContactEvent dup () const;
|
294
394
|
|
295
|
-
|
395
|
+
Action action () const;
|
296
396
|
|
297
|
-
|
397
|
+
Shape* shape ();
|
298
398
|
|
299
|
-
|
399
|
+
const Shape* shape () const;
|
300
400
|
|
301
|
-
|
401
|
+
View* view ();
|
402
|
+
|
403
|
+
const View* view () const;
|
404
|
+
|
405
|
+
struct Data;
|
406
|
+
|
407
|
+
Xot::PSharedImpl<Data> self;
|
408
|
+
|
409
|
+
private:
|
302
410
|
|
303
|
-
|
411
|
+
ContactEvent (const ContactEvent* src);
|
304
412
|
|
305
413
|
};// ContactEvent
|
306
414
|
|
@@ -0,0 +1,107 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_POINTER_H__
|
4
|
+
#define __REFLEX_POINTER_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <xot/pimpl.h>
|
8
|
+
#include <xot/util.h>
|
9
|
+
#include <rays/point.h>
|
10
|
+
#include <reflex/defs.h>
|
11
|
+
|
12
|
+
|
13
|
+
namespace Reflex
|
14
|
+
{
|
15
|
+
|
16
|
+
|
17
|
+
class Pointer
|
18
|
+
{
|
19
|
+
|
20
|
+
typedef Pointer This;
|
21
|
+
|
22
|
+
public:
|
23
|
+
|
24
|
+
typedef int ID;
|
25
|
+
|
26
|
+
enum Type
|
27
|
+
{
|
28
|
+
|
29
|
+
TYPE_NONE = 0,
|
30
|
+
|
31
|
+
MOUSE = Xot::bit(0),
|
32
|
+
|
33
|
+
MOUSE_LEFT = Xot::bit(1),
|
34
|
+
|
35
|
+
MOUSE_RIGHT = Xot::bit(2),
|
36
|
+
|
37
|
+
MOUSE_MIDDLE = Xot::bit(3),
|
38
|
+
|
39
|
+
TOUCH = Xot::bit(4),
|
40
|
+
|
41
|
+
PEN = Xot::bit(5),
|
42
|
+
|
43
|
+
};// Type
|
44
|
+
|
45
|
+
enum Action
|
46
|
+
{
|
47
|
+
|
48
|
+
ACTION_NONE = 0,
|
49
|
+
|
50
|
+
DOWN,
|
51
|
+
|
52
|
+
UP,
|
53
|
+
|
54
|
+
MOVE,
|
55
|
+
|
56
|
+
CANCEL,
|
57
|
+
|
58
|
+
STAY
|
59
|
+
|
60
|
+
};// Action
|
61
|
+
|
62
|
+
Pointer ();
|
63
|
+
|
64
|
+
Pointer (
|
65
|
+
ID id, uint type, Action action,
|
66
|
+
const Point& position, uint modifiers, uint click_count, bool drag,
|
67
|
+
double time);
|
68
|
+
|
69
|
+
Pointer (const This& obj);
|
70
|
+
|
71
|
+
Pointer& operator = (const This& obj);
|
72
|
+
|
73
|
+
~Pointer ();
|
74
|
+
|
75
|
+
ID id () const;
|
76
|
+
|
77
|
+
uint type () const;
|
78
|
+
|
79
|
+
Action action () const;
|
80
|
+
|
81
|
+
const Point& position () const;
|
82
|
+
|
83
|
+
uint modifiers () const;
|
84
|
+
|
85
|
+
uint click_count () const;
|
86
|
+
|
87
|
+
bool is_drag () const;
|
88
|
+
|
89
|
+
double time () const;
|
90
|
+
|
91
|
+
const Pointer* prev () const;
|
92
|
+
|
93
|
+
operator bool () const;
|
94
|
+
|
95
|
+
bool operator ! () const;
|
96
|
+
|
97
|
+
struct Data;
|
98
|
+
|
99
|
+
Xot::PImpl<Data> self;
|
100
|
+
|
101
|
+
};// Pointer
|
102
|
+
|
103
|
+
|
104
|
+
}// Reflex
|
105
|
+
|
106
|
+
|
107
|
+
#endif//EOH
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_RUBY_POINTER_H__
|
4
|
+
#define __REFLEX_RUBY_POINTER_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <rucy/rucy.h>
|
8
|
+
#include <rucy/class.h>
|
9
|
+
#include <rucy/extension.h>
|
10
|
+
#include <reflex/pointer.h>
|
11
|
+
|
12
|
+
|
13
|
+
namespace Reflex
|
14
|
+
{
|
15
|
+
|
16
|
+
|
17
|
+
Rucy::Class pointer_class ();
|
18
|
+
// class Reflex::Pointer
|
19
|
+
|
20
|
+
|
21
|
+
}// Reflex
|
22
|
+
|
23
|
+
|
24
|
+
RUCY_DECLARE_VALUE_FROM_TO(Reflex::Pointer)
|
25
|
+
|
26
|
+
|
27
|
+
namespace Rucy
|
28
|
+
{
|
29
|
+
|
30
|
+
|
31
|
+
template <> inline Class
|
32
|
+
get_ruby_class<Reflex::Pointer> ()
|
33
|
+
{
|
34
|
+
return Reflex::pointer_class();
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
}// Rucy
|
39
|
+
|
40
|
+
|
41
|
+
#endif//EOH
|
data/include/reflex/ruby/view.h
CHANGED
@@ -201,6 +201,15 @@ namespace Reflex
|
|
201
201
|
Super::on_pointer_move(e);
|
202
202
|
}
|
203
203
|
|
204
|
+
virtual void on_pointer_cancel (PointerEvent* e)
|
205
|
+
{
|
206
|
+
RUCY_SYM(on_pointer_cancel);
|
207
|
+
if (this->is_overridable())
|
208
|
+
this->value.call(on_pointer_cancel, Rucy::value(e));
|
209
|
+
else
|
210
|
+
Super::on_pointer_cancel(e);
|
211
|
+
}
|
212
|
+
|
204
213
|
virtual void on_wheel (WheelEvent* e)
|
205
214
|
{
|
206
215
|
RUCY_SYM(on_wheel);
|
@@ -153,6 +153,15 @@ namespace Reflex
|
|
153
153
|
Super::on_pointer_move(e);
|
154
154
|
}
|
155
155
|
|
156
|
+
virtual void on_pointer_cancel (PointerEvent* e)
|
157
|
+
{
|
158
|
+
RUCY_SYM(on_pointer_cancel);
|
159
|
+
if (this->is_overridable())
|
160
|
+
this->value.call(on_pointer_cancel, Rucy::value(e));
|
161
|
+
else
|
162
|
+
Super::on_pointer_cancel(e);
|
163
|
+
}
|
164
|
+
|
156
165
|
virtual void on_wheel (WheelEvent* e)
|
157
166
|
{
|
158
167
|
RUCY_SYM(on_wheel);
|