reflexion 0.1.23 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/capture_event.cpp +6 -5
- data/.doc/ext/reflex/contact_event.cpp +14 -12
- data/.doc/ext/reflex/draw_event.cpp +10 -8
- data/.doc/ext/reflex/event.cpp +2 -10
- data/.doc/ext/reflex/focus_event.cpp +14 -13
- data/.doc/ext/reflex/frame_event.cpp +17 -17
- data/.doc/ext/reflex/key_event.cpp +20 -19
- data/.doc/ext/reflex/pointer_event.cpp +1 -1
- data/.doc/ext/reflex/scroll_event.cpp +14 -17
- 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/wheel_event.cpp +39 -22
- data/VERSION +1 -1
- data/ext/reflex/capture_event.cpp +6 -5
- data/ext/reflex/contact_event.cpp +16 -14
- data/ext/reflex/draw_event.cpp +9 -7
- data/ext/reflex/event.cpp +2 -11
- data/ext/reflex/focus_event.cpp +14 -13
- data/ext/reflex/frame_event.cpp +16 -16
- data/ext/reflex/key_event.cpp +20 -19
- data/ext/reflex/pointer_event.cpp +1 -1
- data/ext/reflex/scroll_event.cpp +15 -18
- 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/wheel_event.cpp +40 -21
- data/include/reflex/event.h +224 -115
- data/include/reflex/shape.h +2 -2
- data/lib/reflex/contact_event.rb +7 -7
- data/lib/reflex/focus_event.rb +8 -8
- data/lib/reflex/key_event.rb +8 -8
- data/lib/reflex/pointer.rb +3 -3
- data/lib/reflex/timer_event.rb +2 -1
- data/lib/reflex/wheel_event.rb +1 -9
- data/lib/reflex/window.rb +1 -1
- data/reflex.gemspec +4 -4
- data/src/event.cpp +630 -76
- data/src/event.h +15 -0
- data/src/image_view.cpp +2 -2
- data/src/ios/view_controller.mm +1 -1
- data/src/osx/event.h +1 -1
- data/src/osx/event.mm +9 -9
- data/src/osx/native_window.mm +1 -1
- data/src/shape.cpp +11 -13
- data/src/shape.h +1 -1
- data/src/view.cpp +137 -89
- data/src/view.h +5 -6
- data/src/window.cpp +44 -38
- data/src/world.cpp +6 -4
- data/test/test_capture_event.rb +16 -0
- data/test/test_contact_event.rb +40 -0
- data/test/test_draw_event.rb +35 -0
- data/test/test_event.rb +20 -6
- data/test/test_focus_event.rb +34 -0
- data/test/test_frame_event.rb +38 -0
- data/test/test_key_event.rb +33 -0
- data/test/test_pointer.rb +14 -14
- data/test/test_pointer_event.rb +1 -1
- data/test/test_scroll_event.rb +39 -0
- data/test/test_timer_event.rb +38 -0
- data/test/test_update_event.rb +29 -0
- data/test/test_wheel_event.rb +40 -0
- metadata +29 -11
data/src/event.cpp
CHANGED
@@ -12,93 +12,360 @@ namespace Reflex
|
|
12
12
|
{
|
13
13
|
|
14
14
|
|
15
|
+
struct Event::Data
|
16
|
+
{
|
17
|
+
|
18
|
+
bool blocked;
|
19
|
+
|
20
|
+
double time;
|
21
|
+
|
22
|
+
Xot::PSharedImpl<Data> parent;
|
23
|
+
|
24
|
+
Data (bool blocked = false, double time = Xot::time())
|
25
|
+
: blocked(blocked), time(time), parent(NULL)
|
26
|
+
{
|
27
|
+
}
|
28
|
+
|
29
|
+
void block ()
|
30
|
+
{
|
31
|
+
blocked = true;
|
32
|
+
if (parent) parent->block();
|
33
|
+
}
|
34
|
+
|
35
|
+
};// Event::Data
|
36
|
+
|
37
|
+
|
15
38
|
Event::Event ()
|
16
|
-
|
39
|
+
{
|
40
|
+
}
|
41
|
+
|
42
|
+
Event::Event (const Event* src)
|
43
|
+
: self(new Data(*src->self))
|
44
|
+
{
|
45
|
+
self->parent = src->self;
|
46
|
+
}
|
47
|
+
|
48
|
+
Event::~Event ()
|
17
49
|
{
|
18
50
|
}
|
19
51
|
|
20
52
|
void
|
21
53
|
Event::block ()
|
22
54
|
{
|
23
|
-
|
55
|
+
self->block();
|
24
56
|
}
|
25
57
|
|
26
58
|
bool
|
27
59
|
Event::is_blocked () const
|
28
60
|
{
|
29
|
-
return blocked;
|
61
|
+
return self->blocked;
|
30
62
|
}
|
31
63
|
|
32
64
|
double
|
33
65
|
Event::time () const
|
34
66
|
{
|
35
|
-
return
|
67
|
+
return self->time;
|
36
68
|
}
|
37
69
|
|
38
70
|
|
71
|
+
struct UpdateEvent::Data
|
72
|
+
{
|
73
|
+
|
74
|
+
double now;
|
75
|
+
|
76
|
+
float dt;
|
77
|
+
|
78
|
+
Data (double now = 0, float dt = 0)
|
79
|
+
: now(now), dt(dt)
|
80
|
+
{
|
81
|
+
}
|
82
|
+
|
83
|
+
};// UpdateEvent::Data
|
84
|
+
|
85
|
+
|
86
|
+
UpdateEvent::UpdateEvent ()
|
87
|
+
{
|
88
|
+
}
|
89
|
+
|
39
90
|
UpdateEvent::UpdateEvent (double now, float dt)
|
40
|
-
:
|
91
|
+
: self(new Data(now, dt))
|
92
|
+
{
|
93
|
+
}
|
94
|
+
|
95
|
+
UpdateEvent::UpdateEvent (const UpdateEvent* src)
|
96
|
+
: Event(src), self(new Data(*src->self))
|
97
|
+
{
|
98
|
+
}
|
99
|
+
|
100
|
+
UpdateEvent
|
101
|
+
UpdateEvent::dup () const
|
102
|
+
{
|
103
|
+
return UpdateEvent(this);
|
104
|
+
}
|
105
|
+
|
106
|
+
double
|
107
|
+
UpdateEvent::now () const
|
108
|
+
{
|
109
|
+
return self->now;
|
110
|
+
}
|
111
|
+
|
112
|
+
float
|
113
|
+
UpdateEvent::dt () const
|
41
114
|
{
|
115
|
+
return self->dt;
|
42
116
|
}
|
43
117
|
|
44
118
|
|
119
|
+
struct DrawEvent::Data
|
120
|
+
{
|
121
|
+
|
122
|
+
View* view;
|
123
|
+
|
124
|
+
Painter* painter;
|
125
|
+
|
126
|
+
Bounds bounds;
|
127
|
+
|
128
|
+
float dt, fps;
|
129
|
+
|
130
|
+
Data (float dt = 0, float fps = 0)
|
131
|
+
: view(NULL), painter(NULL), dt(dt), fps(fps)
|
132
|
+
{
|
133
|
+
}
|
134
|
+
|
135
|
+
};// DrawEvent::Data
|
136
|
+
|
137
|
+
|
138
|
+
void
|
139
|
+
DrawEvent_set_view (DrawEvent* pthis, View* view)
|
140
|
+
{
|
141
|
+
if (!pthis)
|
142
|
+
argument_error(__FILE__, __LINE__);
|
143
|
+
|
144
|
+
pthis->self->view = view;
|
145
|
+
}
|
146
|
+
|
147
|
+
void
|
148
|
+
DrawEvent_set_painter (DrawEvent* pthis, Painter* painter)
|
149
|
+
{
|
150
|
+
if (!pthis)
|
151
|
+
argument_error(__FILE__, __LINE__);
|
152
|
+
|
153
|
+
pthis->self->painter = painter;
|
154
|
+
}
|
155
|
+
|
156
|
+
void
|
157
|
+
DrawEvent_set_bounds (DrawEvent* pthis, const Bounds& bounds)
|
158
|
+
{
|
159
|
+
if (!pthis)
|
160
|
+
argument_error(__FILE__, __LINE__);
|
161
|
+
|
162
|
+
pthis->self->bounds = bounds;
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
DrawEvent::DrawEvent ()
|
167
|
+
{
|
168
|
+
}
|
169
|
+
|
45
170
|
DrawEvent::DrawEvent (float dt, float fps)
|
46
|
-
:
|
171
|
+
: self(new Data(dt, fps))
|
172
|
+
{
|
173
|
+
}
|
174
|
+
|
175
|
+
DrawEvent::DrawEvent (const DrawEvent* src)
|
176
|
+
: Event(src), self(new Data(*src->self))
|
177
|
+
{
|
178
|
+
}
|
179
|
+
|
180
|
+
DrawEvent
|
181
|
+
DrawEvent::dup () const
|
182
|
+
{
|
183
|
+
return DrawEvent(this);
|
184
|
+
}
|
185
|
+
|
186
|
+
Painter*
|
187
|
+
DrawEvent::painter ()
|
188
|
+
{
|
189
|
+
return self->painter;
|
190
|
+
}
|
191
|
+
|
192
|
+
const Painter*
|
193
|
+
DrawEvent::painter () const
|
194
|
+
{
|
195
|
+
return const_cast<DrawEvent*>(this)->painter();
|
196
|
+
}
|
197
|
+
|
198
|
+
const Bounds&
|
199
|
+
DrawEvent::bounds () const
|
200
|
+
{
|
201
|
+
return self->bounds;
|
202
|
+
}
|
203
|
+
|
204
|
+
float
|
205
|
+
DrawEvent::dt () const
|
47
206
|
{
|
207
|
+
return self->dt;
|
48
208
|
}
|
49
209
|
|
210
|
+
float
|
211
|
+
DrawEvent::fps () const
|
212
|
+
{
|
213
|
+
return self->fps;
|
214
|
+
}
|
215
|
+
|
216
|
+
|
217
|
+
struct FrameEvent::Data
|
218
|
+
{
|
219
|
+
|
220
|
+
Bounds frame;
|
221
|
+
|
222
|
+
coord dx, dy, dw, dh;
|
223
|
+
|
224
|
+
float angle, dangle;
|
225
|
+
|
226
|
+
Data (
|
227
|
+
const Bounds& frame = 0,
|
228
|
+
coord dx = 0, coord dy = 0, coord dw = 0, coord dh = 0,
|
229
|
+
float angle = 0, float dangle = 0)
|
230
|
+
: frame(frame), dx(dx), dy(dy), dw(dw), dh(dh), angle(angle), dangle(dangle)
|
231
|
+
{
|
232
|
+
}
|
233
|
+
|
234
|
+
};// FrameEvent::Data
|
235
|
+
|
236
|
+
|
237
|
+
FrameEvent::FrameEvent ()
|
238
|
+
{
|
239
|
+
}
|
50
240
|
|
51
241
|
FrameEvent::FrameEvent (
|
52
242
|
const Bounds& frame, coord dx, coord dy, coord dwidth, coord dheight,
|
53
243
|
float angle, float dangle)
|
54
|
-
:
|
55
|
-
angle(angle), dangle(dangle)
|
244
|
+
: self(new Data(frame, dx, dy, dwidth, dheight, angle, dangle))
|
56
245
|
{
|
57
246
|
}
|
58
247
|
|
59
248
|
FrameEvent::FrameEvent (
|
60
249
|
const Bounds& frame, const Bounds& prev_frame,
|
61
250
|
float angle, float prev_angle)
|
62
|
-
:
|
63
|
-
|
64
|
-
|
65
|
-
|
251
|
+
: self(new Data(
|
252
|
+
frame,
|
253
|
+
frame.x - prev_frame.x, frame.y - prev_frame.y,
|
254
|
+
frame.w - prev_frame.w, frame.h - prev_frame.h,
|
255
|
+
angle, angle - prev_angle))
|
256
|
+
{
|
257
|
+
}
|
258
|
+
|
259
|
+
FrameEvent::FrameEvent (const FrameEvent* src)
|
260
|
+
: Event(src), self(new Data(*src->self))
|
261
|
+
{
|
262
|
+
}
|
263
|
+
|
264
|
+
FrameEvent
|
265
|
+
FrameEvent::dup () const
|
66
266
|
{
|
267
|
+
return FrameEvent(this);
|
268
|
+
}
|
269
|
+
|
270
|
+
const Bounds&
|
271
|
+
FrameEvent::frame () const
|
272
|
+
{
|
273
|
+
return self->frame;
|
274
|
+
}
|
275
|
+
|
276
|
+
coord
|
277
|
+
FrameEvent::dx () const
|
278
|
+
{
|
279
|
+
return self->dx;
|
280
|
+
}
|
281
|
+
|
282
|
+
coord
|
283
|
+
FrameEvent::dy () const
|
284
|
+
{
|
285
|
+
return self->dy;
|
286
|
+
}
|
287
|
+
|
288
|
+
coord
|
289
|
+
FrameEvent::dwidth () const
|
290
|
+
{
|
291
|
+
return self->dw;
|
292
|
+
}
|
293
|
+
|
294
|
+
coord
|
295
|
+
FrameEvent::dheight () const
|
296
|
+
{
|
297
|
+
return self->dh;
|
298
|
+
}
|
299
|
+
|
300
|
+
float
|
301
|
+
FrameEvent::angle () const
|
302
|
+
{
|
303
|
+
return self->angle;
|
304
|
+
}
|
305
|
+
|
306
|
+
float
|
307
|
+
FrameEvent::dangle () const
|
308
|
+
{
|
309
|
+
return self->dangle;
|
67
310
|
}
|
68
311
|
|
69
312
|
bool
|
70
313
|
FrameEvent::is_move () const
|
71
314
|
{
|
72
|
-
return dx != 0 || dy != 0;
|
315
|
+
return self->dx != 0 || self->dy != 0;
|
73
316
|
}
|
74
317
|
|
75
318
|
bool
|
76
319
|
FrameEvent::is_resize () const
|
77
320
|
{
|
78
|
-
return
|
321
|
+
return self->dw != 0 || self->dh != 0;
|
79
322
|
}
|
80
323
|
|
81
324
|
bool
|
82
325
|
FrameEvent::is_rotate () const
|
83
326
|
{
|
84
|
-
return dangle != 0;
|
327
|
+
return self->dangle != 0;
|
85
328
|
}
|
86
329
|
|
87
330
|
|
331
|
+
struct ScrollEvent::Data
|
332
|
+
{
|
333
|
+
|
334
|
+
Point scroll, dscroll;
|
335
|
+
|
336
|
+
Data (const Point& scroll, const Point& dscroll)
|
337
|
+
: scroll(scroll), dscroll(dscroll)
|
338
|
+
{
|
339
|
+
}
|
340
|
+
|
341
|
+
};// ScrollEvent::Data
|
342
|
+
|
343
|
+
|
88
344
|
ScrollEvent::ScrollEvent ()
|
89
|
-
:
|
345
|
+
: self(new Data(0, 0))
|
90
346
|
{
|
91
347
|
}
|
92
348
|
|
93
349
|
ScrollEvent::ScrollEvent (coord x, coord y, coord z, coord dx, coord dy, coord dz)
|
94
|
-
:
|
350
|
+
: self(new Data(Point(x, y, z), Point(dx, dy, dz)))
|
351
|
+
{
|
352
|
+
}
|
353
|
+
|
354
|
+
ScrollEvent::ScrollEvent (const ScrollEvent* src)
|
355
|
+
: Event(src), self(new Data(*src->self))
|
356
|
+
{
|
357
|
+
}
|
358
|
+
|
359
|
+
ScrollEvent
|
360
|
+
ScrollEvent::dup () const
|
95
361
|
{
|
362
|
+
return ScrollEvent(this);
|
96
363
|
}
|
97
364
|
|
98
365
|
Point&
|
99
366
|
ScrollEvent::scroll ()
|
100
367
|
{
|
101
|
-
return
|
368
|
+
return self->scroll;
|
102
369
|
}
|
103
370
|
|
104
371
|
const Point&
|
@@ -108,38 +375,163 @@ namespace Reflex
|
|
108
375
|
}
|
109
376
|
|
110
377
|
Point&
|
111
|
-
ScrollEvent::
|
378
|
+
ScrollEvent::dscroll ()
|
112
379
|
{
|
113
|
-
return
|
380
|
+
return self->dscroll;
|
114
381
|
}
|
115
382
|
|
116
383
|
const Point&
|
117
|
-
ScrollEvent::
|
384
|
+
ScrollEvent::dscroll () const
|
118
385
|
{
|
119
|
-
return const_cast<ScrollEvent*>(this)->
|
386
|
+
return const_cast<ScrollEvent*>(this)->dscroll();
|
120
387
|
}
|
121
388
|
|
122
389
|
|
390
|
+
struct FocusEvent::Data
|
391
|
+
{
|
392
|
+
|
393
|
+
Action action;
|
394
|
+
|
395
|
+
View *current, *last;
|
396
|
+
|
397
|
+
Data (Action action = ACTION_NONE, View* current = NULL, View* last = NULL)
|
398
|
+
: action(action), current(current), last(last)
|
399
|
+
{
|
400
|
+
}
|
401
|
+
|
402
|
+
};// FocusEvent::Data
|
403
|
+
|
404
|
+
|
123
405
|
FocusEvent::FocusEvent ()
|
124
406
|
{
|
125
407
|
}
|
126
408
|
|
127
|
-
FocusEvent::FocusEvent (
|
128
|
-
:
|
409
|
+
FocusEvent::FocusEvent (Action action, View* current, View* last)
|
410
|
+
: self(new Data(action, current, last))
|
129
411
|
{
|
130
412
|
}
|
131
413
|
|
414
|
+
FocusEvent::FocusEvent (const FocusEvent* src)
|
415
|
+
: Event(src), self(new Data(*src->self))
|
416
|
+
{
|
417
|
+
}
|
418
|
+
|
419
|
+
FocusEvent
|
420
|
+
FocusEvent::dup () const
|
421
|
+
{
|
422
|
+
return FocusEvent(this);
|
423
|
+
}
|
424
|
+
|
425
|
+
FocusEvent::Action
|
426
|
+
FocusEvent::action () const
|
427
|
+
{
|
428
|
+
return self->action;
|
429
|
+
}
|
430
|
+
|
431
|
+
View*
|
432
|
+
FocusEvent::current () const
|
433
|
+
{
|
434
|
+
return self->current;
|
435
|
+
}
|
436
|
+
|
437
|
+
View*
|
438
|
+
FocusEvent::last () const
|
439
|
+
{
|
440
|
+
return self->last;
|
441
|
+
}
|
442
|
+
|
443
|
+
|
444
|
+
struct KeyEvent::Data
|
445
|
+
{
|
446
|
+
|
447
|
+
Action action;
|
448
|
+
|
449
|
+
String chars;
|
450
|
+
|
451
|
+
int code;
|
452
|
+
|
453
|
+
uint modifiers;
|
454
|
+
|
455
|
+
int repeat;
|
456
|
+
|
457
|
+
bool captured;
|
458
|
+
|
459
|
+
Data (
|
460
|
+
Action action = ACTION_NONE, const char* chars = NULL, int code = KEY_NONE,
|
461
|
+
uint modifiers = MOD_NONE, int repeat = 0, bool captured = false)
|
462
|
+
: action(action), chars(chars ? chars : ""), code(code),
|
463
|
+
modifiers(modifiers), repeat(repeat), captured(captured)
|
464
|
+
{
|
465
|
+
}
|
466
|
+
|
467
|
+
};// KeyEvent::Data
|
468
|
+
|
469
|
+
|
470
|
+
void
|
471
|
+
KeyEvent_set_captured (KeyEvent* pthis, bool captured)
|
472
|
+
{
|
473
|
+
if (!pthis)
|
474
|
+
argument_error(__FILE__, __LINE__);
|
475
|
+
|
476
|
+
pthis->self->captured = captured;
|
477
|
+
}
|
478
|
+
|
132
479
|
|
133
480
|
KeyEvent::KeyEvent ()
|
134
|
-
: type(NONE), code(KEY_NONE), modifiers(MOD_NONE), repeat(0), captured(false)
|
135
481
|
{
|
136
482
|
}
|
137
483
|
|
138
484
|
KeyEvent::KeyEvent (
|
139
|
-
|
140
|
-
:
|
141
|
-
|
485
|
+
Action action, const char* chars, int code, uint modifiers, int repeat)
|
486
|
+
: self(new Data(action, chars, code, modifiers, repeat))
|
487
|
+
{
|
488
|
+
}
|
489
|
+
|
490
|
+
KeyEvent::KeyEvent (const KeyEvent* src)
|
491
|
+
: Event(src), self(new Data(*src->self))
|
492
|
+
{
|
493
|
+
}
|
494
|
+
|
495
|
+
KeyEvent
|
496
|
+
KeyEvent::dup () const
|
497
|
+
{
|
498
|
+
return KeyEvent(this);
|
499
|
+
}
|
500
|
+
|
501
|
+
KeyEvent::Action
|
502
|
+
KeyEvent::action () const
|
142
503
|
{
|
504
|
+
return self->action;
|
505
|
+
}
|
506
|
+
|
507
|
+
const char*
|
508
|
+
KeyEvent::chars () const
|
509
|
+
{
|
510
|
+
return self->chars;
|
511
|
+
}
|
512
|
+
|
513
|
+
int
|
514
|
+
KeyEvent::code () const
|
515
|
+
{
|
516
|
+
return self->code;
|
517
|
+
}
|
518
|
+
|
519
|
+
uint
|
520
|
+
KeyEvent::modifiers () const
|
521
|
+
{
|
522
|
+
return self->modifiers;
|
523
|
+
}
|
524
|
+
|
525
|
+
int
|
526
|
+
KeyEvent::repeat () const
|
527
|
+
{
|
528
|
+
return self->repeat;
|
529
|
+
}
|
530
|
+
|
531
|
+
bool
|
532
|
+
KeyEvent::is_captured () const
|
533
|
+
{
|
534
|
+
return self->captured;
|
143
535
|
}
|
144
536
|
|
145
537
|
|
@@ -210,6 +602,15 @@ namespace Reflex
|
|
210
602
|
fun(pointer);
|
211
603
|
}
|
212
604
|
|
605
|
+
void
|
606
|
+
PointerEvent_set_captured (PointerEvent* pthis, bool captured)
|
607
|
+
{
|
608
|
+
if (!pthis)
|
609
|
+
argument_error(__FILE__, __LINE__);
|
610
|
+
|
611
|
+
pthis->self->captured = captured;
|
612
|
+
}
|
613
|
+
|
213
614
|
static void
|
214
615
|
filter_and_offset_pointer_positions (PointerEvent* event, const Bounds& frame)
|
215
616
|
{
|
@@ -283,41 +684,25 @@ namespace Reflex
|
|
283
684
|
}
|
284
685
|
|
285
686
|
|
286
|
-
PointerEvent::PointerEvent (
|
287
|
-
: self(new Data(captured))
|
288
|
-
{
|
289
|
-
}
|
290
|
-
|
291
|
-
PointerEvent::PointerEvent (const Pointer& pointer, bool captured)
|
292
|
-
: self(new Data(captured))
|
687
|
+
PointerEvent::PointerEvent ()
|
293
688
|
{
|
294
|
-
self->pointers.emplace_back(pointer);
|
295
689
|
}
|
296
690
|
|
297
|
-
PointerEvent::PointerEvent (const Pointer* pointers, size_t size
|
298
|
-
: self(new Data(captured))
|
691
|
+
PointerEvent::PointerEvent (const Pointer* pointers, size_t size)
|
299
692
|
{
|
300
693
|
for (size_t i = 0; i < size; ++i)
|
301
694
|
self->pointers.emplace_back(pointers[i]);
|
302
695
|
}
|
303
696
|
|
304
|
-
PointerEvent::PointerEvent (const
|
305
|
-
: self(new Data(*
|
306
|
-
{
|
307
|
-
}
|
308
|
-
|
309
|
-
PointerEvent&
|
310
|
-
PointerEvent::operator = (const This& obj)
|
697
|
+
PointerEvent::PointerEvent (const PointerEvent* src)
|
698
|
+
: Event(src), self(new Data(*src->self))
|
311
699
|
{
|
312
|
-
if (&obj == this) return *this;
|
313
|
-
|
314
|
-
Event::operator=(obj);
|
315
|
-
*self = *obj.self;
|
316
|
-
return *this;
|
317
700
|
}
|
318
701
|
|
319
|
-
PointerEvent
|
702
|
+
PointerEvent
|
703
|
+
PointerEvent::dup () const
|
320
704
|
{
|
705
|
+
return PointerEvent(this);
|
321
706
|
}
|
322
707
|
|
323
708
|
size_t
|
@@ -348,21 +733,58 @@ namespace Reflex
|
|
348
733
|
}
|
349
734
|
|
350
735
|
|
736
|
+
struct WheelEvent::Data
|
737
|
+
{
|
738
|
+
|
739
|
+
Point position, dposition;
|
740
|
+
|
741
|
+
uint modifiers;
|
742
|
+
|
743
|
+
Data (
|
744
|
+
const Point& position = 0, const Point& dposition = 0,
|
745
|
+
uint modifiers = 0)
|
746
|
+
: position(position), dposition(dposition), modifiers(modifiers)
|
747
|
+
{
|
748
|
+
}
|
749
|
+
|
750
|
+
};// WheelEvent::Data
|
751
|
+
|
752
|
+
|
753
|
+
void
|
754
|
+
WheelEvent_set_position (WheelEvent* pthis, const Point& position)
|
755
|
+
{
|
756
|
+
if (!pthis)
|
757
|
+
argument_error(__FILE__, __LINE__);
|
758
|
+
|
759
|
+
pthis->self->position = position;
|
760
|
+
}
|
761
|
+
|
762
|
+
|
351
763
|
WheelEvent::WheelEvent ()
|
352
|
-
: dx(0), dy(0), dz(0), x(0), y(0), z(0), modifiers(0)
|
353
764
|
{
|
354
765
|
}
|
355
766
|
|
356
767
|
WheelEvent::WheelEvent (
|
357
|
-
coord
|
358
|
-
:
|
768
|
+
coord x, coord y, coord z, coord dx, coord dy, coord dz, uint modifiers)
|
769
|
+
: self(new Data(Point(x, y, z), Point(dx, dy, dz), modifiers))
|
359
770
|
{
|
360
771
|
}
|
361
772
|
|
773
|
+
WheelEvent::WheelEvent (const WheelEvent* src)
|
774
|
+
: Event(src), self(new Data(*src->self))
|
775
|
+
{
|
776
|
+
}
|
777
|
+
|
778
|
+
WheelEvent
|
779
|
+
WheelEvent::dup () const
|
780
|
+
{
|
781
|
+
return WheelEvent(this);
|
782
|
+
}
|
783
|
+
|
362
784
|
Point&
|
363
785
|
WheelEvent::position ()
|
364
786
|
{
|
365
|
-
return
|
787
|
+
return self->position;
|
366
788
|
}
|
367
789
|
|
368
790
|
const Point&
|
@@ -372,79 +794,211 @@ namespace Reflex
|
|
372
794
|
}
|
373
795
|
|
374
796
|
Point&
|
375
|
-
WheelEvent::
|
797
|
+
WheelEvent::dposition ()
|
376
798
|
{
|
377
|
-
return
|
799
|
+
return self->dposition;
|
378
800
|
}
|
379
801
|
|
380
802
|
const Point&
|
381
|
-
WheelEvent::
|
803
|
+
WheelEvent::dposition () const
|
382
804
|
{
|
383
|
-
return const_cast<WheelEvent*>(this)->
|
805
|
+
return const_cast<WheelEvent*>(this)->dposition();
|
384
806
|
}
|
385
807
|
|
808
|
+
uint
|
809
|
+
WheelEvent::modifiers () const
|
810
|
+
{
|
811
|
+
return self->modifiers;
|
812
|
+
}
|
813
|
+
|
814
|
+
|
815
|
+
struct CaptureEvent::Data
|
816
|
+
{
|
817
|
+
|
818
|
+
uint begin, end;
|
819
|
+
|
820
|
+
Data (uint begin = 0, uint end = 0)
|
821
|
+
: begin(begin), end(end)
|
822
|
+
{
|
823
|
+
}
|
824
|
+
|
825
|
+
};// CaptureEvent::Data
|
826
|
+
|
386
827
|
|
387
828
|
CaptureEvent::CaptureEvent ()
|
388
|
-
: begin(0), end(0)
|
389
829
|
{
|
390
830
|
}
|
391
831
|
|
392
832
|
CaptureEvent::CaptureEvent (uint begin, uint end)
|
393
|
-
:
|
833
|
+
: self(new Data(begin, end))
|
834
|
+
{
|
835
|
+
}
|
836
|
+
|
837
|
+
CaptureEvent::CaptureEvent (const CaptureEvent* src)
|
838
|
+
: Event(src), self(new Data(*src->self))
|
839
|
+
{
|
840
|
+
}
|
841
|
+
|
842
|
+
CaptureEvent
|
843
|
+
CaptureEvent::dup () const
|
844
|
+
{
|
845
|
+
return CaptureEvent(this);
|
846
|
+
}
|
847
|
+
|
848
|
+
uint
|
849
|
+
CaptureEvent::begin () const
|
394
850
|
{
|
851
|
+
return self->begin;
|
395
852
|
}
|
396
853
|
|
854
|
+
uint
|
855
|
+
CaptureEvent::end () const
|
856
|
+
{
|
857
|
+
return self->end;
|
858
|
+
}
|
859
|
+
|
860
|
+
|
861
|
+
struct TimerEvent::Data
|
862
|
+
{
|
863
|
+
|
864
|
+
Timer::Ref timer;
|
865
|
+
|
866
|
+
Data (Timer* timer = NULL)
|
867
|
+
: timer(timer)
|
868
|
+
{
|
869
|
+
}
|
870
|
+
|
871
|
+
};// TimerEvent::Data
|
872
|
+
|
873
|
+
|
874
|
+
TimerEvent::TimerEvent ()
|
875
|
+
{
|
876
|
+
}
|
397
877
|
|
398
878
|
TimerEvent::TimerEvent (Timer* timer)
|
399
|
-
:
|
879
|
+
: self(new Data(timer))
|
880
|
+
{
|
881
|
+
}
|
882
|
+
|
883
|
+
TimerEvent::TimerEvent (const TimerEvent* src)
|
884
|
+
: Event(src), self(new Data(*src->self))
|
885
|
+
{
|
886
|
+
}
|
887
|
+
|
888
|
+
TimerEvent
|
889
|
+
TimerEvent::dup () const
|
890
|
+
{
|
891
|
+
return TimerEvent(this);
|
892
|
+
}
|
893
|
+
|
894
|
+
Timer*
|
895
|
+
TimerEvent::timer ()
|
400
896
|
{
|
897
|
+
return self->timer;
|
898
|
+
}
|
899
|
+
|
900
|
+
const Timer*
|
901
|
+
TimerEvent::timer () const
|
902
|
+
{
|
903
|
+
return const_cast<TimerEvent*>(this)->timer();
|
401
904
|
}
|
402
905
|
|
403
906
|
View*
|
404
907
|
TimerEvent::owner () const
|
405
908
|
{
|
406
|
-
return timer ? timer->owner() : NULL;
|
909
|
+
return self->timer ? self->timer->owner() : NULL;
|
407
910
|
}
|
408
911
|
|
409
912
|
int
|
410
913
|
TimerEvent::id () const
|
411
914
|
{
|
412
|
-
return timer ? timer->id() : Timer::ID_INVALID;
|
915
|
+
return self->timer ? self->timer->id() : Timer::ID_INVALID;
|
413
916
|
}
|
414
917
|
|
415
918
|
float
|
416
919
|
TimerEvent::interval () const
|
417
920
|
{
|
418
|
-
return timer ? timer->interval() : -1;
|
419
|
-
}
|
420
|
-
|
421
|
-
void
|
422
|
-
TimerEvent::set_count (int count)
|
423
|
-
{
|
424
|
-
if (timer) timer->set_count(count);
|
921
|
+
return self->timer ? self->timer->interval() : -1;
|
425
922
|
}
|
426
923
|
|
427
924
|
int
|
428
925
|
TimerEvent::count () const
|
429
926
|
{
|
430
|
-
return timer ? timer->count() : 0;
|
927
|
+
return self->timer ? self->timer->count() : 0;
|
431
928
|
}
|
432
929
|
|
433
930
|
bool
|
434
931
|
TimerEvent::is_finished () const
|
435
932
|
{
|
436
|
-
return timer ? timer->is_finished() : true;
|
933
|
+
return self->timer ? self->timer->is_finished() : true;
|
437
934
|
}
|
438
935
|
|
439
936
|
|
937
|
+
struct ContactEvent::Data
|
938
|
+
{
|
939
|
+
|
940
|
+
Action action;
|
941
|
+
|
942
|
+
Shape* shape;
|
943
|
+
|
944
|
+
View* view;
|
945
|
+
|
946
|
+
Data (Action action = ACTION_NONE, Shape* shape = NULL, View* view = NULL)
|
947
|
+
: action(action), shape(shape), view(view)
|
948
|
+
{
|
949
|
+
}
|
950
|
+
|
951
|
+
};// ContactEvent::Data
|
952
|
+
|
953
|
+
|
440
954
|
ContactEvent::ContactEvent ()
|
441
|
-
: type(NONE), shape(NULL), view(NULL)
|
442
955
|
{
|
443
956
|
}
|
444
957
|
|
445
|
-
ContactEvent::ContactEvent (
|
446
|
-
:
|
958
|
+
ContactEvent::ContactEvent (Action action, Shape* shape)
|
959
|
+
: self(new Data(action, shape, shape ? shape->owner() : NULL))
|
960
|
+
{
|
961
|
+
}
|
962
|
+
|
963
|
+
ContactEvent::ContactEvent (const ContactEvent* src)
|
964
|
+
: Event(src), self(new Data(*src->self))
|
965
|
+
{
|
966
|
+
}
|
967
|
+
|
968
|
+
ContactEvent
|
969
|
+
ContactEvent::dup () const
|
970
|
+
{
|
971
|
+
return ContactEvent(this);
|
972
|
+
}
|
973
|
+
|
974
|
+
ContactEvent::Action
|
975
|
+
ContactEvent::action () const
|
976
|
+
{
|
977
|
+
return self->action;
|
978
|
+
}
|
979
|
+
|
980
|
+
Shape*
|
981
|
+
ContactEvent::shape ()
|
982
|
+
{
|
983
|
+
return self->shape;
|
984
|
+
}
|
985
|
+
|
986
|
+
const Shape*
|
987
|
+
ContactEvent::shape () const
|
988
|
+
{
|
989
|
+
return const_cast<ContactEvent*>(this)->shape();
|
990
|
+
}
|
991
|
+
|
992
|
+
View*
|
993
|
+
ContactEvent::view ()
|
994
|
+
{
|
995
|
+
return self->view;
|
996
|
+
}
|
997
|
+
|
998
|
+
const View*
|
999
|
+
ContactEvent::view () const
|
447
1000
|
{
|
1001
|
+
return const_cast<ContactEvent*>(this)->view();
|
448
1002
|
}
|
449
1003
|
|
450
1004
|
|