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