reflexion 0.6.0 → 0.7.0

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.
Files changed (275) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/reflex/application.cpp +37 -6
  3. data/.doc/ext/reflex/capture_event.cpp +1 -1
  4. data/.doc/ext/reflex/chase_constraint.cpp +1 -1
  5. data/.doc/ext/reflex/clipboard.cpp +1 -1
  6. data/.doc/ext/reflex/color_event.cpp +76 -0
  7. data/.doc/ext/reflex/color_picker.cpp +113 -0
  8. data/.doc/ext/reflex/constraint.cpp +1 -1
  9. data/.doc/ext/reflex/contact_event.cpp +1 -1
  10. data/.doc/ext/reflex/control_change_event.cpp +1 -1
  11. data/.doc/ext/reflex/device.cpp +1 -1
  12. data/.doc/ext/reflex/device_event.cpp +1 -1
  13. data/.doc/ext/reflex/draw_event.cpp +1 -1
  14. data/.doc/ext/reflex/ellipse_shape.cpp +1 -1
  15. data/.doc/ext/reflex/event.cpp +1 -1
  16. data/.doc/ext/reflex/file_dialog.cpp +181 -0
  17. data/.doc/ext/reflex/file_event.cpp +103 -0
  18. data/.doc/ext/reflex/filter.cpp +1 -1
  19. data/.doc/ext/reflex/focus_event.cpp +1 -1
  20. data/.doc/ext/reflex/frame_event.cpp +1 -1
  21. data/.doc/ext/reflex/gamepad.cpp +48 -0
  22. data/.doc/ext/reflex/image_view.cpp +1 -1
  23. data/.doc/ext/reflex/key_event.cpp +1 -274
  24. data/.doc/ext/reflex/line_shape.cpp +1 -1
  25. data/.doc/ext/reflex/link_constraint.cpp +1 -1
  26. data/.doc/ext/reflex/menu.cpp +6 -5
  27. data/.doc/ext/reflex/midi.cpp +9 -2
  28. data/.doc/ext/reflex/midi_event.cpp +1 -1
  29. data/.doc/ext/reflex/motion_event.cpp +1 -1
  30. data/.doc/ext/reflex/native.cpp +18 -6
  31. data/.doc/ext/reflex/note_event.cpp +1 -1
  32. data/.doc/ext/reflex/pin.cpp +1 -1
  33. data/.doc/ext/reflex/pointer.cpp +1 -1
  34. data/.doc/ext/reflex/pointer_event.cpp +2 -2
  35. data/.doc/ext/reflex/polygon_shape.cpp +1 -1
  36. data/.doc/ext/reflex/rect_shape.cpp +1 -1
  37. data/.doc/ext/reflex/reflex.cpp +566 -232
  38. data/.doc/ext/reflex/screen.cpp +27 -1
  39. data/.doc/ext/reflex/scroll_event.cpp +1 -1
  40. data/.doc/ext/reflex/selector.cpp +1 -1
  41. data/.doc/ext/reflex/shape.cpp +1 -1
  42. data/.doc/ext/reflex/snap_constraint.cpp +1 -1
  43. data/.doc/ext/reflex/style.cpp +1 -1
  44. data/.doc/ext/reflex/style_length.cpp +1 -1
  45. data/.doc/ext/reflex/text_event.cpp +104 -0
  46. data/.doc/ext/reflex/timer.cpp +1 -1
  47. data/.doc/ext/reflex/timer_event.cpp +1 -1
  48. data/.doc/ext/reflex/update_event.cpp +1 -1
  49. data/.doc/ext/reflex/view.cpp +110 -56
  50. data/.doc/ext/reflex/wheel_constraint.cpp +1 -1
  51. data/.doc/ext/reflex/wheel_event.cpp +1 -1
  52. data/.doc/ext/reflex/window.cpp +226 -17
  53. data/.github/workflows/release-gem.yml +2 -49
  54. data/.github/workflows/tag.yml +5 -28
  55. data/.github/workflows/test.yml +1 -37
  56. data/ChangeLog.md +54 -0
  57. data/Gemfile.lock +13 -8
  58. data/Rakefile +13 -2
  59. data/Reflex.podspec +2 -2
  60. data/VERSION +1 -1
  61. data/ext/reflex/application.cpp +41 -6
  62. data/ext/reflex/capture_event.cpp +1 -1
  63. data/ext/reflex/chase_constraint.cpp +1 -1
  64. data/ext/reflex/clipboard.cpp +1 -1
  65. data/ext/reflex/color_event.cpp +80 -0
  66. data/ext/reflex/color_picker.cpp +121 -0
  67. data/ext/reflex/constraint.cpp +1 -1
  68. data/ext/reflex/contact_event.cpp +1 -1
  69. data/ext/reflex/control_change_event.cpp +1 -1
  70. data/ext/reflex/device.cpp +1 -1
  71. data/ext/reflex/device_event.cpp +1 -1
  72. data/ext/reflex/draw_event.cpp +1 -1
  73. data/ext/reflex/ellipse_shape.cpp +1 -1
  74. data/ext/reflex/event.cpp +1 -1
  75. data/ext/reflex/extconf.rb +4 -2
  76. data/ext/reflex/file_dialog.cpp +194 -0
  77. data/ext/reflex/file_event.cpp +108 -0
  78. data/ext/reflex/filter.cpp +1 -1
  79. data/ext/reflex/focus_event.cpp +1 -1
  80. data/ext/reflex/frame_event.cpp +1 -1
  81. data/ext/reflex/gamepad.cpp +50 -0
  82. data/ext/reflex/image_view.cpp +1 -1
  83. data/ext/reflex/key_event.cpp +1 -275
  84. data/ext/reflex/line_shape.cpp +1 -1
  85. data/ext/reflex/link_constraint.cpp +1 -1
  86. data/ext/reflex/menu.cpp +8 -7
  87. data/ext/reflex/midi.cpp +11 -3
  88. data/ext/reflex/midi_event.cpp +1 -1
  89. data/ext/reflex/motion_event.cpp +1 -1
  90. data/ext/reflex/native.cpp +18 -6
  91. data/ext/reflex/note_event.cpp +1 -1
  92. data/ext/reflex/pin.cpp +1 -1
  93. data/ext/reflex/pointer.cpp +1 -1
  94. data/ext/reflex/pointer_event.cpp +2 -2
  95. data/ext/reflex/polygon_shape.cpp +1 -1
  96. data/ext/reflex/rect_shape.cpp +1 -1
  97. data/ext/reflex/reflex.cpp +568 -232
  98. data/ext/reflex/screen.cpp +31 -2
  99. data/ext/reflex/scroll_event.cpp +1 -1
  100. data/ext/reflex/selector.cpp +1 -1
  101. data/ext/reflex/selector.h +9 -9
  102. data/ext/reflex/shape.cpp +1 -1
  103. data/ext/reflex/snap_constraint.cpp +1 -1
  104. data/ext/reflex/style.cpp +1 -1
  105. data/ext/reflex/style_length.cpp +1 -1
  106. data/ext/reflex/text_event.cpp +111 -0
  107. data/ext/reflex/timer.cpp +1 -1
  108. data/ext/reflex/timer_event.cpp +1 -1
  109. data/ext/reflex/update_event.cpp +1 -1
  110. data/ext/reflex/view.cpp +121 -61
  111. data/ext/reflex/wheel_constraint.cpp +1 -1
  112. data/ext/reflex/wheel_event.cpp +1 -1
  113. data/ext/reflex/window.cpp +256 -25
  114. data/include/reflex/application.h +10 -0
  115. data/include/reflex/color_picker.h +65 -0
  116. data/include/reflex/event.h +178 -88
  117. data/include/reflex/file_dialog.h +73 -0
  118. data/include/reflex/gamepad.h +3 -0
  119. data/include/reflex/menu.h +3 -3
  120. data/include/reflex/midi.h +3 -0
  121. data/include/reflex/reflex.h +2 -0
  122. data/include/reflex/ruby/application.h +6 -1
  123. data/include/reflex/ruby/color_picker.h +89 -0
  124. data/include/reflex/ruby/event.h +62 -29
  125. data/include/reflex/ruby/file_dialog.h +89 -0
  126. data/include/reflex/ruby/gamepad.h +46 -0
  127. data/include/reflex/ruby/reflex.h +3 -0
  128. data/include/reflex/ruby/view.h +92 -44
  129. data/include/reflex/ruby/window.h +60 -1
  130. data/include/reflex/ruby.h +3 -0
  131. data/include/reflex/screen.h +11 -2
  132. data/include/reflex/view.h +28 -16
  133. data/include/reflex/window.h +40 -8
  134. data/include/reflex.h +3 -0
  135. data/lib/reflex/application.rb +5 -5
  136. data/lib/reflex/autoinit.rb +3 -1
  137. data/lib/reflex/button.rb +3 -3
  138. data/lib/reflex/color_event.rb +16 -0
  139. data/lib/reflex/color_picker.rb +45 -0
  140. data/lib/reflex/control_change_event.rb +17 -0
  141. data/lib/reflex/file_dialog.rb +70 -0
  142. data/lib/reflex/file_event.rb +37 -0
  143. data/lib/reflex/helper.rb +58 -7
  144. data/lib/reflex/key_event.rb +9 -4
  145. data/lib/reflex/menu.rb +17 -1
  146. data/lib/reflex/model.rb +19 -19
  147. data/lib/reflex/note_event.rb +1 -1
  148. data/lib/reflex/pointer.rb +14 -3
  149. data/lib/reflex/pointer_event.rb +12 -1
  150. data/lib/reflex/reflex.rb +5 -0
  151. data/lib/reflex/shape.rb +14 -14
  152. data/lib/reflex/style.rb +16 -16
  153. data/lib/reflex/text_event.rb +40 -0
  154. data/lib/reflex/timer.rb +3 -3
  155. data/lib/reflex/view.rb +29 -14
  156. data/lib/reflex/wheel_event.rb +12 -3
  157. data/lib/reflex/window.rb +25 -13
  158. data/lib/reflex.rb +8 -2
  159. data/reflex.gemspec +4 -4
  160. data/samples/ime.rb +100 -0
  161. data/samples/ios/hello/hello.xcodeproj/project.pbxproj +236 -224
  162. data/samples/menu.rb +4 -1
  163. data/samples/model.rb +3 -3
  164. data/samples/test/alert.rb +93 -0
  165. data/samples/test/always_on.rb +76 -0
  166. data/samples/test/app_background.rb +51 -0
  167. data/samples/test/boundary.rb +75 -0
  168. data/samples/test/callback_exception.rb +101 -0
  169. data/samples/test/cancel.rb +53 -0
  170. data/samples/test/color_picker.rb +63 -0
  171. data/samples/test/file_dialog.rb +102 -0
  172. data/samples/window_style.rb +156 -0
  173. data/src/application.cpp +159 -18
  174. data/src/application.h +92 -7
  175. data/src/color_picker.cpp +113 -0
  176. data/src/color_picker.h +36 -0
  177. data/src/event.cpp +410 -252
  178. data/src/event.h +12 -0
  179. data/src/file_dialog.cpp +163 -0
  180. data/src/file_dialog.h +52 -0
  181. data/src/gamepad.cpp +42 -5
  182. data/src/gamepad.h +4 -0
  183. data/src/ios/app_delegate.mm +5 -3
  184. data/src/ios/application.mm +24 -0
  185. data/src/ios/color_picker.mm +19 -0
  186. data/src/ios/file_dialog.mm +21 -0
  187. data/src/ios/gamepad.mm +4 -4
  188. data/src/ios/menu.mm +5 -0
  189. data/src/ios/reflex.mm +8 -0
  190. data/src/ios/screen.mm +26 -0
  191. data/src/ios/view_controller.mm +2 -30
  192. data/src/ios/window.mm +38 -9
  193. data/src/menu.cpp +66 -4
  194. data/src/menu.h +17 -1
  195. data/src/midi.cpp +61 -31
  196. data/src/osx/app_delegate.h +4 -0
  197. data/src/osx/app_delegate.mm +102 -22
  198. data/src/osx/application.mm +88 -6
  199. data/src/osx/color_picker.mm +112 -0
  200. data/src/osx/event.h +10 -0
  201. data/src/osx/event.mm +84 -30
  202. data/src/osx/file_dialog.mm +168 -0
  203. data/src/osx/gamepad.mm +2 -2
  204. data/src/osx/gamepad_hid.mm +1 -1
  205. data/src/osx/menu.mm +177 -33
  206. data/src/osx/native_window.h +16 -2
  207. data/src/osx/native_window.mm +114 -57
  208. data/src/osx/opengl_view.h +2 -1
  209. data/src/osx/opengl_view.mm +184 -43
  210. data/src/osx/reflex.mm +38 -0
  211. data/src/osx/screen.mm +36 -0
  212. data/src/osx/window.mm +106 -24
  213. data/src/pointer.cpp +13 -4
  214. data/src/pointer.h +4 -0
  215. data/src/rays.h +46 -0
  216. data/src/sdl/application.cpp +68 -8
  217. data/src/sdl/color_picker.cpp +18 -0
  218. data/src/sdl/event.cpp +24 -3
  219. data/src/sdl/event.h +12 -0
  220. data/src/sdl/file_dialog.cpp +20 -0
  221. data/src/sdl/gamepad.cpp +3 -7
  222. data/src/sdl/menu.cpp +5 -0
  223. data/src/sdl/reflex.cpp +20 -0
  224. data/src/sdl/screen.cpp +36 -0
  225. data/src/sdl/window.cpp +142 -29
  226. data/src/shape.cpp +15 -10
  227. data/src/view.cpp +287 -198
  228. data/src/view.h +4 -2
  229. data/src/vk.h +416 -0
  230. data/src/win32/application.cpp +162 -12
  231. data/src/win32/application.h +20 -0
  232. data/src/win32/color_picker.cpp +82 -0
  233. data/src/win32/event.cpp +114 -12
  234. data/src/win32/event.h +21 -4
  235. data/src/win32/file_dialog.cpp +226 -0
  236. data/src/win32/gamepad.cpp +9 -2
  237. data/src/win32/menu.cpp +191 -53
  238. data/src/win32/menu.h +9 -1
  239. data/src/win32/opengl.cpp +2 -9
  240. data/src/win32/reflex.cpp +44 -3
  241. data/src/win32/screen.cpp +164 -3
  242. data/src/win32/screen.h +8 -0
  243. data/src/win32/tray.cpp +191 -0
  244. data/src/win32/tray.h +22 -0
  245. data/src/win32/vk.cpp +11 -0
  246. data/src/win32/window.cpp +809 -148
  247. data/src/win32/window.h +6 -0
  248. data/src/window.cpp +718 -185
  249. data/src/window.h +66 -33
  250. data/src/world.cpp +9 -1
  251. data/test/helper.rb +17 -0
  252. data/test/test_application.rb +90 -1
  253. data/test/test_chase_constraint.rb +1 -3
  254. data/test/test_color_event.rb +36 -0
  255. data/test/test_color_picker.rb +62 -0
  256. data/test/test_constraint.rb +2 -4
  257. data/test/test_event.rb +1 -1
  258. data/test/test_file_dialog.rb +48 -0
  259. data/test/test_file_event.rb +43 -0
  260. data/test/test_has_text_preedit.rb +54 -0
  261. data/test/test_key_event.rb +20 -5
  262. data/test/test_link_constraint.rb +1 -3
  263. data/test/test_menu.rb +40 -10
  264. data/test/test_pointer.rb +33 -23
  265. data/test/test_pointer_event.rb +24 -9
  266. data/test/test_reflex.rb +36 -0
  267. data/test/test_screen.rb +24 -2
  268. data/test/test_snap_constraint.rb +1 -3
  269. data/test/test_text_event.rb +54 -0
  270. data/test/test_view.rb +41 -4
  271. data/test/test_wheel_constraint.rb +1 -3
  272. data/test/test_wheel_event.rb +13 -5
  273. data/test/test_window.rb +196 -44
  274. metadata +80 -10
  275. data/.github/workflows/utils.rb +0 -127
@@ -293,6 +293,40 @@ namespace Reflex
293
293
  };// KeyEvent
294
294
 
295
295
 
296
+ class TextEvent : public Event
297
+ {
298
+
299
+ public:
300
+
301
+ enum Action {ACTION_NONE = 0, PREEDIT, COMMIT};
302
+
303
+ TextEvent ();
304
+
305
+ TextEvent (
306
+ Action action, const char* text,
307
+ int selection_offset = -1, int selection_size = 0);
308
+
309
+ TextEvent dup () const;
310
+
311
+ Action action () const;
312
+
313
+ const char* text () const;
314
+
315
+ int selection_offset () const;
316
+
317
+ int selection_size () const;
318
+
319
+ struct Data;
320
+
321
+ Xot::PSharedImpl<Data> self;
322
+
323
+ private:
324
+
325
+ TextEvent (const TextEvent* src);
326
+
327
+ };// TextEvent
328
+
329
+
296
330
  class PointerEvent : public Event
297
331
  {
298
332
 
@@ -334,6 +368,10 @@ namespace Reflex
334
368
  coord x, coord y, coord z, coord dx, coord dy, coord dz,
335
369
  uint modifiers = 0);
336
370
 
371
+ WheelEvent (
372
+ const Point& position, const Point& dposition,
373
+ uint modifiers = 0);
374
+
337
375
  WheelEvent dup () const;
338
376
 
339
377
  Point& position ();
@@ -357,51 +395,56 @@ namespace Reflex
357
395
  };// WheelEvent
358
396
 
359
397
 
360
- class MIDIEvent : public Event
398
+ class CaptureEvent : public Event
361
399
  {
362
400
 
363
401
  public:
364
402
 
365
- enum Action
366
- {
403
+ CaptureEvent ();
367
404
 
368
- ACTION_NONE = 0,
405
+ CaptureEvent (uint begin, uint end);
369
406
 
370
- NOTE_ON,
407
+ CaptureEvent dup () const;
371
408
 
372
- NOTE_OFF,
409
+ uint begin () const;
373
410
 
374
- CONTROL_CHANGE,
411
+ uint end () const;
375
412
 
376
- PROGRAM_CHANGE,
413
+ struct Data;
377
414
 
378
- CHANNEL_PRESSURE,
415
+ Xot::PSharedImpl<Data> self;
379
416
 
380
- KEY_PRESSURE,
417
+ private:
381
418
 
382
- PITCH_BEND_CHANGE,
419
+ CaptureEvent (const CaptureEvent* src);
383
420
 
384
- SYSTEM
421
+ };// CaptureEvent
385
422
 
386
- };// Action
387
423
 
388
- MIDIEvent ();
424
+ class TimerEvent : public Event
425
+ {
389
426
 
390
- MIDIEvent (MIDI* midi, const uchar* bytes, double time);
427
+ public:
391
428
 
392
- MIDIEvent dup () const;
429
+ TimerEvent ();
393
430
 
394
- MIDI* midi () const;
431
+ TimerEvent (Timer* timer);
395
432
 
396
- Action action () const;
433
+ TimerEvent dup () const;
397
434
 
398
- int channel () const;
435
+ Timer* timer ();
399
436
 
400
- uchar data1 () const;
437
+ const Timer* timer () const;
401
438
 
402
- uchar data2 () const;
439
+ View* owner () const;
403
440
 
404
- bool is_captured () const;
441
+ int id () const;
442
+
443
+ float interval () const;
444
+
445
+ int count () const;
446
+
447
+ bool is_finished () const;
405
448
 
406
449
  struct Data;
407
450
 
@@ -409,36 +452,33 @@ namespace Reflex
409
452
 
410
453
  private:
411
454
 
412
- MIDIEvent (const MIDIEvent* src);
455
+ TimerEvent (const TimerEvent* src);
413
456
 
414
- };// MIDIEvent
457
+ };// TimerEvent
415
458
 
416
459
 
417
- class NoteEvent : public Event
460
+ class ContactEvent : public Event
418
461
  {
419
462
 
420
463
  public:
421
464
 
422
- enum Action {ACTION_NONE = 0, ON, OFF};
465
+ enum Action {ACTION_NONE = 0, BEGIN, END};
423
466
 
424
- NoteEvent ();
467
+ ContactEvent ();
425
468
 
426
- NoteEvent (
427
- Action action, int channel, int note, float velocity, double time);
469
+ ContactEvent (Action action, Shape* shape);
428
470
 
429
- NoteEvent dup () const;
471
+ ContactEvent dup () const;
430
472
 
431
473
  Action action () const;
432
474
 
433
- int channel () const;
434
-
435
- int note () const;
475
+ Shape* shape ();
436
476
 
437
- float frequency () const;
477
+ const Shape* shape () const;
438
478
 
439
- float velocity () const;
479
+ View* view ();
440
480
 
441
- bool is_captured () const;
481
+ const View* view () const;
442
482
 
443
483
  struct Data;
444
484
 
@@ -446,30 +486,49 @@ namespace Reflex
446
486
 
447
487
  private:
448
488
 
449
- NoteEvent (const NoteEvent* src);
489
+ ContactEvent (const ContactEvent* src);
450
490
 
451
- };// NoteEvent
491
+ };// ContactEvent
452
492
 
453
493
 
454
- class ControlChangeEvent : public Event
494
+ class MotionEvent : public Event
455
495
  {
456
496
 
457
497
  public:
458
498
 
459
- ControlChangeEvent ();
499
+ MotionEvent (const Point& gravity = Point(0, 9.8));
460
500
 
461
- ControlChangeEvent (
462
- int channel, int controller, float value, double time);
501
+ MotionEvent dup () const;
463
502
 
464
- ControlChangeEvent dup () const;
503
+ const Point& gravity () const;
465
504
 
466
- int channel () const;
505
+ struct Data;
467
506
 
468
- int controller () const;
507
+ Xot::PSharedImpl<Data> self;
469
508
 
470
- float value () const;
509
+ private:
471
510
 
472
- bool is_captured () const;
511
+ MotionEvent (const MotionEvent* src);
512
+
513
+ };// MotionEvent
514
+
515
+
516
+ class FileEvent : public Event
517
+ {
518
+
519
+ public:
520
+
521
+ enum Action {ACTION_NONE = 0, OPEN, SAVE};
522
+
523
+ FileEvent ();
524
+
525
+ FileEvent (Action action, const StringList& paths);
526
+
527
+ FileEvent dup () const;
528
+
529
+ Action action () const;
530
+
531
+ const StringList& paths () const;
473
532
 
474
533
  struct Data;
475
534
 
@@ -477,25 +536,23 @@ namespace Reflex
477
536
 
478
537
  private:
479
538
 
480
- ControlChangeEvent (const ControlChangeEvent* src);
539
+ FileEvent (const FileEvent* src);
481
540
 
482
- };// ControlChangeEvent
541
+ };// FileEvent
483
542
 
484
543
 
485
- class CaptureEvent : public Event
544
+ class ColorEvent : public Event
486
545
  {
487
546
 
488
547
  public:
489
548
 
490
- CaptureEvent ();
549
+ ColorEvent ();
491
550
 
492
- CaptureEvent (uint begin, uint end);
551
+ ColorEvent (const Color& color);
493
552
 
494
- CaptureEvent dup () const;
553
+ ColorEvent dup () const;
495
554
 
496
- uint begin () const;
497
-
498
- uint end () const;
555
+ const Color& color () const;
499
556
 
500
557
  struct Data;
501
558
 
@@ -503,35 +560,56 @@ namespace Reflex
503
560
 
504
561
  private:
505
562
 
506
- CaptureEvent (const CaptureEvent* src);
563
+ ColorEvent (const ColorEvent* src);
507
564
 
508
- };// CaptureEvent
565
+ };// ColorEvent
509
566
 
510
567
 
511
- class TimerEvent : public Event
568
+ class MIDIEvent : public Event
512
569
  {
513
570
 
514
571
  public:
515
572
 
516
- TimerEvent ();
573
+ enum Action
574
+ {
517
575
 
518
- TimerEvent (Timer* timer);
576
+ ACTION_NONE = 0,
519
577
 
520
- TimerEvent dup () const;
578
+ NOTE_ON,
521
579
 
522
- Timer* timer ();
580
+ NOTE_OFF,
523
581
 
524
- const Timer* timer () const;
582
+ CONTROL_CHANGE,
525
583
 
526
- View* owner () const;
584
+ PROGRAM_CHANGE,
527
585
 
528
- int id () const;
586
+ CHANNEL_PRESSURE,
529
587
 
530
- float interval () const;
588
+ KEY_PRESSURE,
531
589
 
532
- int count () const;
590
+ PITCH_BEND_CHANGE,
533
591
 
534
- bool is_finished () const;
592
+ SYSTEM
593
+
594
+ };// Action
595
+
596
+ MIDIEvent ();
597
+
598
+ MIDIEvent (MIDI* midi, const uchar* bytes, double time);
599
+
600
+ MIDIEvent dup () const;
601
+
602
+ MIDI* midi () const;
603
+
604
+ Action action () const;
605
+
606
+ int channel () const;
607
+
608
+ uchar data1 () const;
609
+
610
+ uchar data2 () const;
611
+
612
+ bool is_captured () const;
535
613
 
536
614
  struct Data;
537
615
 
@@ -539,33 +617,36 @@ namespace Reflex
539
617
 
540
618
  private:
541
619
 
542
- TimerEvent (const TimerEvent* src);
620
+ MIDIEvent (const MIDIEvent* src);
543
621
 
544
- };// TimerEvent
622
+ };// MIDIEvent
545
623
 
546
624
 
547
- class ContactEvent : public Event
625
+ class NoteEvent : public Event
548
626
  {
549
627
 
550
628
  public:
551
629
 
552
- enum Action {ACTION_NONE = 0, BEGIN, END};
630
+ enum Action {ACTION_NONE = 0, ON, OFF};
553
631
 
554
- ContactEvent ();
632
+ NoteEvent ();
555
633
 
556
- ContactEvent (Action action, Shape* shape);
634
+ NoteEvent (
635
+ Action action, int channel, int note, float velocity, double time);
557
636
 
558
- ContactEvent dup () const;
637
+ NoteEvent dup () const;
559
638
 
560
639
  Action action () const;
561
640
 
562
- Shape* shape ();
641
+ int channel () const;
563
642
 
564
- const Shape* shape () const;
643
+ int note () const;
565
644
 
566
- View* view ();
645
+ float frequency () const;
567
646
 
568
- const View* view () const;
647
+ float velocity () const;
648
+
649
+ bool is_captured () const;
569
650
 
570
651
  struct Data;
571
652
 
@@ -573,21 +654,30 @@ namespace Reflex
573
654
 
574
655
  private:
575
656
 
576
- ContactEvent (const ContactEvent* src);
657
+ NoteEvent (const NoteEvent* src);
577
658
 
578
- };// ContactEvent
659
+ };// NoteEvent
579
660
 
580
661
 
581
- class MotionEvent : public Event
662
+ class ControlChangeEvent : public Event
582
663
  {
583
664
 
584
665
  public:
585
666
 
586
- MotionEvent (const Point& gravity = Point(0, 9.8));
667
+ ControlChangeEvent ();
587
668
 
588
- MotionEvent dup () const;
669
+ ControlChangeEvent (
670
+ int channel, int controller, float value, double time);
589
671
 
590
- const Point& gravity () const;
672
+ ControlChangeEvent dup () const;
673
+
674
+ int channel () const;
675
+
676
+ int controller () const;
677
+
678
+ float value () const;
679
+
680
+ bool is_captured () const;
591
681
 
592
682
  struct Data;
593
683
 
@@ -595,9 +685,9 @@ namespace Reflex
595
685
 
596
686
  private:
597
687
 
598
- MotionEvent (const MotionEvent* src);
688
+ ControlChangeEvent (const ControlChangeEvent* src);
599
689
 
600
- };// MotionEvent
690
+ };// ControlChangeEvent
601
691
 
602
692
 
603
693
  }// Reflex
@@ -0,0 +1,73 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __REFLEX_FILE_DIALOG_H__
4
+ #define __REFLEX_FILE_DIALOG_H__
5
+
6
+
7
+ #include <xot/ref.h>
8
+ #include <xot/pimpl.h>
9
+ #include <reflex/defs.h>
10
+ #include <reflex/event.h>
11
+
12
+
13
+ namespace Reflex
14
+ {
15
+
16
+
17
+ class Window;
18
+
19
+
20
+ class FileDialog : public Xot::RefCountable<>
21
+ {
22
+
23
+ typedef FileDialog This;
24
+
25
+ public:
26
+
27
+ typedef Xot::Ref<This> Ref;
28
+
29
+ FileDialog ();
30
+
31
+ virtual ~FileDialog ();
32
+
33
+ virtual void open_file (const char* dir = NULL);
34
+
35
+ virtual void open_files (const char* dir = NULL);
36
+
37
+ virtual void open_directory (const char* dir = NULL);
38
+
39
+ virtual void save_file (const char* dir = NULL, const char* name = NULL);
40
+
41
+ virtual void set_owner (Window* window);
42
+
43
+ virtual Window* owner ();
44
+
45
+ virtual const Window* owner () const;
46
+
47
+ virtual void set_title (const char* title);
48
+
49
+ virtual const char* title () const;
50
+
51
+ virtual void set_extensions (const StringList& extensions);
52
+
53
+ virtual const StringList& extensions () const;
54
+
55
+ virtual void on_file (FileEvent* e);
56
+
57
+ virtual void on_cancel (Event* e);
58
+
59
+ virtual operator bool () const;
60
+
61
+ virtual bool operator ! () const;
62
+
63
+ struct Data;
64
+
65
+ Xot::PSharedImpl<Data> self;
66
+
67
+ };// FileDialog
68
+
69
+
70
+ }// Reflex
71
+
72
+
73
+ #endif//EOH
@@ -169,6 +169,9 @@ namespace Reflex
169
169
  };// Gamepad
170
170
 
171
171
 
172
+ void enable_gamepad ();
173
+
174
+
172
175
  }// Reflex
173
176
 
174
177
 
@@ -65,11 +65,11 @@ namespace Reflex
65
65
 
66
66
  virtual bool is_checked () const;
67
67
 
68
- virtual void set_shortcut (const char* key, uint modifiers = MOD_NONE);
68
+ virtual void set_shortcut (KeyCode key, uint modifiers = MOD_NONE);
69
69
 
70
- virtual const char* shortcut_key () const;
70
+ virtual KeyCode shortcut_key () const;
71
71
 
72
- virtual uint shortcut_modifiers () const;
72
+ virtual uint shortcut_modifiers () const;
73
73
 
74
74
  virtual void set_image (const Image& image);
75
75
 
@@ -51,6 +51,9 @@ namespace Reflex
51
51
  };// MIDI
52
52
 
53
53
 
54
+ void enable_midi ();
55
+
56
+
54
57
  }// Reflex
55
58
 
56
59
 
@@ -18,6 +18,8 @@ namespace Reflex
18
18
 
19
19
  void process_events ();
20
20
 
21
+ void alert (const char* message, const char* title = NULL);
22
+
21
23
 
22
24
  }// Reflex
23
25
 
@@ -49,9 +49,14 @@ namespace Reflex
49
49
 
50
50
  virtual void on_start (Event* e)
51
51
  {
52
- RUCY_SYM(on_start);
53
52
  if (this->is_overridable())
53
+ {
54
+ RUCY_SYM(call_start_block);
55
+ this->value.call(call_start_block);
56
+
57
+ RUCY_SYM(on_start);
54
58
  this->value.call(on_start, Rucy::value(e));
59
+ }
55
60
  else
56
61
  return Super::on_start(e);
57
62
  }
@@ -0,0 +1,89 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __REFLEX_RUBY_COLOR_PICKER_H__
4
+ #define __REFLEX_RUBY_COLOR_PICKER_H__
5
+
6
+
7
+ #include <rucy/class.h>
8
+ #include <rucy/extension.h>
9
+ #include <reflex/color_picker.h>
10
+ #include <reflex/ruby/event.h>
11
+
12
+
13
+ RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::ColorPicker)
14
+
15
+
16
+ namespace Reflex
17
+ {
18
+
19
+
20
+ REFLEX_EXPORT Rucy::Class color_picker_class ();
21
+ // class Reflex::ColorPicker
22
+
23
+
24
+ template <typename T>
25
+ class RubyColorPicker : public Rucy::ClassWrapper<T>
26
+ {
27
+
28
+ typedef Rucy::ClassWrapper<T> Super;
29
+
30
+ public:
31
+
32
+ virtual void on_color (ColorEvent* e)
33
+ {
34
+ if (this->is_overridable())
35
+ {
36
+ RUCY_SYM(call_color_block);
37
+ this->value.call(call_color_block, Rucy::value(e));
38
+
39
+ if (!e->is_blocked())
40
+ {
41
+ RUCY_SYM(on_color);
42
+ this->value.call(on_color, Rucy::value(e));
43
+ }
44
+ }
45
+ else
46
+ Super::on_color(e);
47
+ }
48
+
49
+ virtual void on_close (Event* e)
50
+ {
51
+ if (this->is_overridable())
52
+ {
53
+ RUCY_SYM(clear_color_block);
54
+ this->value.call(clear_color_block);
55
+
56
+ RUCY_SYM(on_close);
57
+ this->value.call(on_close, Rucy::value(e));
58
+ }
59
+ else
60
+ Super::on_close(e);
61
+ }
62
+
63
+ };// RubyColorPicker
64
+
65
+
66
+ }// Reflex
67
+
68
+
69
+ namespace Rucy
70
+ {
71
+
72
+
73
+ template <> inline Class
74
+ get_ruby_class<Reflex::ColorPicker> ()
75
+ {
76
+ return Reflex::color_picker_class();
77
+ }
78
+
79
+ inline Value
80
+ value (Reflex::ColorPicker::Ref& ref, Value klass = Reflex::color_picker_class())
81
+ {
82
+ return value(ref.get(), klass);
83
+ }
84
+
85
+
86
+ }// Rucy
87
+
88
+
89
+ #endif//EOH