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
@@ -13,7 +13,8 @@ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::Window)
13
13
 
14
14
  #define THIS to<Reflex::Window*>(self)
15
15
 
16
- #define CHECK RUCY_CHECK_OBJECT(Reflex::Window, self)
16
+ #define CHECK_PTR RUCY_CHECK_PTR(Reflex::Window, self)
17
+ #define CHECK RUCY_CHECK_OBJ(Reflex::Window, self)
17
18
 
18
19
  #define CALL(fun) RUCY_CALL_SUPER(THIS, fun)
19
20
 
@@ -41,7 +42,7 @@ VALUE hide(VALUE self)
41
42
  }
42
43
 
43
44
  static
44
- VALUE hidden(VALUE self)
45
+ VALUE is_hidden(VALUE self)
45
46
  {
46
47
  CHECK;
47
48
  return value(THIS->hidden());
@@ -50,8 +51,8 @@ VALUE hidden(VALUE self)
50
51
  static
51
52
  VALUE close(VALUE self)
52
53
  {
53
- CHECK;
54
- THIS->close();
54
+ CHECK_PTR;
55
+ if (*THIS) THIS->close();
55
56
  return self;
56
57
  }
57
58
 
@@ -189,6 +190,80 @@ VALUE is_resizable(VALUE self)
189
190
  return value(THIS->has_flag(Reflex::Window::FLAG_RESIZABLE));
190
191
  }
191
192
 
193
+ static const uint TITLEBAR_MASK =
194
+ Reflex::Window::FLAG_TITLEBAR_BUTTONS |
195
+ Reflex::Window::FLAG_TITLEBAR_BACKGROUND;
196
+
197
+ static
198
+ VALUE set_titlebar(VALUE self, VALUE titlebar)
199
+ {
200
+ CHECK;
201
+
202
+ uint flags = to<uint>(titlebar);
203
+ THIS->set_flags((flags & TITLEBAR_MASK) | (THIS->flags() & ~TITLEBAR_MASK));
204
+ }
205
+
206
+ static
207
+ VALUE get_titlebar(VALUE self)
208
+ {
209
+ CHECK;
210
+ return value(THIS->flags() & TITLEBAR_MASK);
211
+ }
212
+
213
+ static
214
+ VALUE set_unlisted(VALUE self, VALUE state)
215
+ {
216
+ CHECK;
217
+
218
+ if (state)
219
+ THIS-> add_flag(Reflex::Window::FLAG_UNLISTED);
220
+ else
221
+ THIS->remove_flag(Reflex::Window::FLAG_UNLISTED);
222
+ }
223
+
224
+ static
225
+ VALUE is_unlisted(VALUE self)
226
+ {
227
+ CHECK;
228
+ return value(THIS->has_flag(Reflex::Window::FLAG_UNLISTED));
229
+ }
230
+
231
+ static
232
+ VALUE set_shadow(VALUE self, VALUE state)
233
+ {
234
+ CHECK;
235
+
236
+ if (state)
237
+ THIS-> add_flag(Reflex::Window::FLAG_SHADOW);
238
+ else
239
+ THIS->remove_flag(Reflex::Window::FLAG_SHADOW);
240
+ }
241
+
242
+ static
243
+ VALUE has_shadow(VALUE self)
244
+ {
245
+ CHECK;
246
+ return value(THIS->has_flag(Reflex::Window::FLAG_SHADOW));
247
+ }
248
+
249
+ static
250
+ VALUE set_transparent(VALUE self, VALUE state)
251
+ {
252
+ CHECK;
253
+
254
+ if (state)
255
+ THIS-> add_flag(Reflex::Window::FLAG_TRANSPARENT);
256
+ else
257
+ THIS->remove_flag(Reflex::Window::FLAG_TRANSPARENT);
258
+ }
259
+
260
+ static
261
+ VALUE is_transparent(VALUE self)
262
+ {
263
+ CHECK;
264
+ return value(THIS->has_flag(Reflex::Window::FLAG_TRANSPARENT));
265
+ }
266
+
192
267
  static
193
268
  VALUE set_fullscreen(VALUE self, VALUE state)
194
269
  {
@@ -209,18 +284,90 @@ VALUE is_fullscreen(VALUE self)
209
284
  return value(THIS->has_flag(Reflex::Window::FLAG_FULLSCREEN));
210
285
  }
211
286
 
287
+ static
288
+ VALUE set_always_on_top(VALUE self, VALUE state)
289
+ {
290
+ CHECK;
291
+
292
+ if (state)
293
+ {
294
+ THIS->remove_flag(Reflex::Window::FLAG_ALWAYS_ON_BOTTOM);
295
+ THIS-> add_flag(Reflex::Window::FLAG_ALWAYS_ON_TOP);
296
+ }
297
+ else
298
+ THIS->remove_flag(Reflex::Window::FLAG_ALWAYS_ON_TOP);
299
+ }
300
+
301
+ static
302
+ VALUE is_always_on_top(VALUE self)
303
+ {
304
+ CHECK;
305
+ return value(THIS->has_flag(Reflex::Window::FLAG_ALWAYS_ON_TOP));
306
+ }
307
+
308
+ static
309
+ VALUE set_always_on_bottom(VALUE self, VALUE state)
310
+ {
311
+ CHECK;
312
+
313
+ if (state)
314
+ {
315
+ THIS->remove_flag(Reflex::Window::FLAG_ALWAYS_ON_TOP);
316
+ THIS-> add_flag(Reflex::Window::FLAG_ALWAYS_ON_BOTTOM);
317
+ }
318
+ else
319
+ THIS->remove_flag(Reflex::Window::FLAG_ALWAYS_ON_BOTTOM);
320
+ }
321
+
322
+ static
323
+ VALUE is_always_on_bottom(VALUE self)
324
+ {
325
+ CHECK;
326
+ return value(THIS->has_flag(Reflex::Window::FLAG_ALWAYS_ON_BOTTOM));
327
+ }
328
+
329
+ static
330
+ VALUE set_pointer_through(VALUE self, VALUE state)
331
+ {
332
+ CHECK;
333
+
334
+ if (state)
335
+ THIS-> add_flag(Reflex::Window::FLAG_POINTER_THROUGH);
336
+ else
337
+ THIS->remove_flag(Reflex::Window::FLAG_POINTER_THROUGH);
338
+ }
339
+
340
+ static
341
+ VALUE is_pointer_through(VALUE self)
342
+ {
343
+ CHECK;
344
+ return value(THIS->has_flag(Reflex::Window::FLAG_POINTER_THROUGH));
345
+ }
346
+
347
+ static
348
+ VALUE set_pointer_through_alpha(VALUE self, VALUE alpha)
349
+ {
350
+ CHECK;
351
+ THIS->set_pointer_through_alpha(to<float>(alpha));
352
+ }
353
+
354
+ static
355
+ VALUE get_pointer_through_alpha(VALUE self)
356
+ {
357
+ CHECK;
358
+ return value(THIS->pointer_through_alpha());
359
+ }
360
+
212
361
  static const uint ORIENTATION_MASK =
213
362
  Reflex::Window::FLAG_PORTRAIT | Reflex::Window::FLAG_LANDSCAPE;
214
363
 
215
364
  static
216
365
  VALUE set_orientations(VALUE self, VALUE orientations)
217
366
  {
218
- using namespace Reflex;
219
-
220
367
  CHECK;
221
368
 
222
369
  uint flags = to<uint>(orientations);
223
- THIS->set_flag(
370
+ THIS->set_flags(
224
371
  ( flags & ORIENTATION_MASK) |
225
372
  (THIS->flags() & ~ORIENTATION_MASK));
226
373
  }
@@ -228,8 +375,6 @@ VALUE set_orientations(VALUE self, VALUE orientations)
228
375
  static
229
376
  VALUE get_orientations(VALUE self)
230
377
  {
231
- using namespace Reflex;
232
-
233
378
  CHECK;
234
379
  return value(THIS->flags() & ORIENTATION_MASK);
235
380
  }
@@ -267,9 +412,6 @@ VALUE on_show(VALUE self, VALUE event)
267
412
  {
268
413
  CHECK;
269
414
 
270
- RUCY_SYM(call_show_block);
271
- self.call(call_show_block);
272
-
273
415
  CALL(on_show(to<Reflex::Event*>(event)));
274
416
  }
275
417
 
@@ -350,6 +492,27 @@ VALUE on_key_up(VALUE self, VALUE event)
350
492
  CALL(on_key_up(to<Reflex::KeyEvent*>(event)));
351
493
  }
352
494
 
495
+ static
496
+ VALUE on_text(VALUE self, VALUE event)
497
+ {
498
+ CHECK;
499
+ CALL(on_text(to<Reflex::TextEvent*>(event)));
500
+ }
501
+
502
+ static
503
+ VALUE on_text_preedit(VALUE self, VALUE event)
504
+ {
505
+ CHECK;
506
+ CALL(on_text_preedit(to<Reflex::TextEvent*>(event)));
507
+ }
508
+
509
+ static
510
+ VALUE on_text_commit(VALUE self, VALUE event)
511
+ {
512
+ CHECK;
513
+ CALL(on_text_commit(to<Reflex::TextEvent*>(event)));
514
+ }
515
+
353
516
  static
354
517
  VALUE on_pointer(VALUE self, VALUE event)
355
518
  {
@@ -406,6 +569,27 @@ VALUE on_wheel(VALUE self, VALUE event)
406
569
  CALL(on_wheel(to<Reflex::WheelEvent*>(event)));
407
570
  }
408
571
 
572
+ static
573
+ VALUE on_file(VALUE self, VALUE event)
574
+ {
575
+ CHECK;
576
+ CALL(on_file(to<Reflex::FileEvent*>(event)));
577
+ }
578
+
579
+ static
580
+ VALUE on_file_open(VALUE self, VALUE event)
581
+ {
582
+ CHECK;
583
+ CALL(on_file_open(to<Reflex::FileEvent*>(event)));
584
+ }
585
+
586
+ static
587
+ VALUE on_file_save(VALUE self, VALUE event)
588
+ {
589
+ CHECK;
590
+ CALL(on_file_save(to<Reflex::FileEvent*>(event)));
591
+ }
592
+
409
593
  static
410
594
  VALUE on_midi(VALUE self, VALUE event)
411
595
  {
@@ -453,6 +637,7 @@ Init_reflex_window ()
453
637
  rb_define_alloc_func(cWindow, alloc);
454
638
  rb_define_method(cWindow, "show", RUBY_METHOD_FUNC(show), 0);
455
639
  rb_define_method(cWindow, "hide", RUBY_METHOD_FUNC(hide), 0);
640
+ cWindow.define_method("hidden?", is_hidden);
456
641
  rb_define_method(cWindow, "close", RUBY_METHOD_FUNC(close), 0);
457
642
  rb_define_method(cWindow, "redraw", RUBY_METHOD_FUNC(redraw), 0);
458
643
  rb_define_method(cWindow, "from_screen", RUBY_METHOD_FUNC(from_screen), 1);
@@ -465,16 +650,31 @@ Init_reflex_window ()
465
650
  rb_define_method(cWindow, "menu=", RUBY_METHOD_FUNC(set_menu), 1);
466
651
  rb_define_method(cWindow, "menu", RUBY_METHOD_FUNC(get_menu), 0);
467
652
  rb_define_method(cWindow, "closable=", RUBY_METHOD_FUNC(set_closable), 1);
468
- cWindow.define_method("closable?", is_closable);
653
+ cWindow.define_method("closable?", is_closable);
469
654
  rb_define_method(cWindow, "minimizable=", RUBY_METHOD_FUNC(set_minimizable), 1);
470
- cWindow.define_method("minimizable?", is_minimizable);
655
+ cWindow.define_method("minimizable?", is_minimizable);
471
656
  rb_define_method(cWindow, "resizable=", RUBY_METHOD_FUNC(set_resizable), 1);
472
- cWindow.define_method("resizable?", is_resizable);
657
+ cWindow.define_method("resizable?", is_resizable);
658
+ rb_define_method(cWindow, "titlebar=", RUBY_METHOD_FUNC(set_titlebar), 1);
659
+ rb_define_method(cWindow, "titlebar", RUBY_METHOD_FUNC(get_titlebar), 0);
660
+ rb_define_method(cWindow, "unlisted=", RUBY_METHOD_FUNC(set_unlisted), 1);
661
+ cWindow.define_method("unlisted?", is_unlisted);
662
+ rb_define_method(cWindow, "shadow=", RUBY_METHOD_FUNC(set_shadow), 1);
663
+ cWindow.define_method("shadow?", has_shadow);
664
+ rb_define_method(cWindow, "transparent=", RUBY_METHOD_FUNC(set_transparent), 1);
665
+ cWindow.define_method("transparent?", is_transparent);
473
666
  rb_define_method(cWindow, "fullscreen=", RUBY_METHOD_FUNC(set_fullscreen), 1);
474
- cWindow.define_method("fullscreen?", is_fullscreen);
667
+ cWindow.define_method("fullscreen?", is_fullscreen);
668
+ rb_define_method(cWindow, "always_on_top=", RUBY_METHOD_FUNC(set_always_on_top), 1);
669
+ cWindow.define_method("always_on_top?", is_always_on_top);
670
+ rb_define_method(cWindow, "always_on_bottom=", RUBY_METHOD_FUNC(set_always_on_bottom), 1);
671
+ cWindow.define_method("always_on_bottom?", is_always_on_bottom);
672
+ rb_define_method(cWindow, "pointer_through=", RUBY_METHOD_FUNC(set_pointer_through), 1);
673
+ cWindow.define_method("pointer_through?", is_pointer_through);
674
+ rb_define_method(cWindow, "pointer_through_alpha=", RUBY_METHOD_FUNC(set_pointer_through_alpha), 1);
675
+ rb_define_method(cWindow, "pointer_through_alpha", RUBY_METHOD_FUNC(get_pointer_through_alpha), 0);
475
676
  rb_define_method(cWindow, "orientations=", RUBY_METHOD_FUNC(set_orientations), 1);
476
677
  rb_define_method(cWindow, "orientations", RUBY_METHOD_FUNC(get_orientations), 0);
477
- rb_define_method(cWindow, "hidden", RUBY_METHOD_FUNC(hidden), 0);
478
678
  rb_define_method(cWindow, "screen", RUBY_METHOD_FUNC(get_screen), 0);
479
679
  rb_define_method(cWindow, "root", RUBY_METHOD_FUNC(get_root), 0);
480
680
  rb_define_method(cWindow, "focus", RUBY_METHOD_FUNC(get_focus), 0);
@@ -491,6 +691,9 @@ Init_reflex_window ()
491
691
  rb_define_method(cWindow, "on_key", RUBY_METHOD_FUNC(on_key), 1);
492
692
  rb_define_method(cWindow, "on_key_down", RUBY_METHOD_FUNC(on_key_down), 1);
493
693
  rb_define_method(cWindow, "on_key_up", RUBY_METHOD_FUNC(on_key_up), 1);
694
+ rb_define_method(cWindow, "on_text", RUBY_METHOD_FUNC(on_text), 1);
695
+ rb_define_method(cWindow, "on_text_preedit", RUBY_METHOD_FUNC(on_text_preedit), 1);
696
+ rb_define_method(cWindow, "on_text_commit", RUBY_METHOD_FUNC(on_text_commit), 1);
494
697
  rb_define_method(cWindow, "on_pointer", RUBY_METHOD_FUNC(on_pointer), 1);
495
698
  rb_define_method(cWindow, "on_pointer_down", RUBY_METHOD_FUNC(on_pointer_down), 1);
496
699
  rb_define_method(cWindow, "on_pointer_up", RUBY_METHOD_FUNC(on_pointer_up), 1);
@@ -499,12 +702,18 @@ Init_reflex_window ()
499
702
  rb_define_method(cWindow, "on_pointer_enter", RUBY_METHOD_FUNC(on_pointer_enter), 1);
500
703
  rb_define_method(cWindow, "on_pointer_leave", RUBY_METHOD_FUNC(on_pointer_leave), 1);
501
704
  rb_define_method(cWindow, "on_wheel", RUBY_METHOD_FUNC(on_wheel), 1);
705
+ rb_define_method(cWindow, "on_file", RUBY_METHOD_FUNC(on_file), 1);
706
+ rb_define_method(cWindow, "on_file_open", RUBY_METHOD_FUNC(on_file_open), 1);
707
+ rb_define_method(cWindow, "on_file_save", RUBY_METHOD_FUNC(on_file_save), 1);
502
708
  rb_define_method(cWindow, "on_midi", RUBY_METHOD_FUNC(on_midi), 1);
503
709
  rb_define_method(cWindow, "on_note", RUBY_METHOD_FUNC(on_note), 1);
504
710
  rb_define_method(cWindow, "on_note_on", RUBY_METHOD_FUNC(on_note_on), 1);
505
711
  rb_define_method(cWindow, "on_note_off", RUBY_METHOD_FUNC(on_note_off), 1);
506
712
  rb_define_method(cWindow, "on_control_change", RUBY_METHOD_FUNC(on_control_change), 1);
507
713
 
714
+ cWindow.define_const("TITLEBAR_BUTTONS", Reflex::Window::FLAG_TITLEBAR_BUTTONS);
715
+ cWindow.define_const("TITLEBAR_BACKGROUND", Reflex::Window::FLAG_TITLEBAR_BACKGROUND);
716
+
508
717
  cWindow.define_const("ORIENTATION_PORTRAIT", Reflex::Window::FLAG_PORTRAIT);
509
718
  cWindow.define_const("ORIENTATION_LANDSCAPE", Reflex::Window::FLAG_LANDSCAPE);
510
719
 
@@ -9,52 +9,5 @@ permissions:
9
9
 
10
10
  jobs:
11
11
  release:
12
- runs-on: macos-latest
13
-
14
- steps:
15
- - name: ruby 3.2
16
- uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: 3.2
19
-
20
- - name: checkout
21
- uses: actions/checkout@v4
22
-
23
- - name: setup gems
24
- run: bundle install
25
-
26
- - name: setup dependencies
27
- run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
28
-
29
- - name: packages
30
- run: bundle exec rake packages
31
-
32
- - name: setup zig
33
- if: github.event.repository.name == 'reflex-terminal'
34
- uses: mlugg/setup-zig@v2
35
- with:
36
- version: 0.16.0
37
-
38
- - name: test
39
- run: bundle exec rake test
40
-
41
- - name: create gem
42
- id: gem
43
- run: |
44
- bundle exec rake gem
45
- echo path=$(ruby -e 'print Dir.glob("*.gem").first') >> $GITHUB_OUTPUT
46
-
47
- - name: create github release
48
- env:
49
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50
- run: ruby -I.github/workflows -rutils -e 'release(*ARGV)' ./${{ steps.gem.outputs.path }}
51
-
52
- - name: upload to rubygems
53
- env:
54
- GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
55
- run: |
56
- mkdir -p $HOME/.gem
57
- touch $HOME/.gem/credentials
58
- chmod 0600 $HOME/.gem/credentials
59
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
60
- bundle exec rake upload
12
+ uses: xord/xot/.github/workflows/release-gem.yml@master
13
+ secrets: inherit
@@ -1,35 +1,12 @@
1
1
  name: Tag
2
2
 
3
3
  on:
4
- push:
4
+ workflow_run:
5
+ workflows: [Test]
6
+ types: [completed]
5
7
  branches: [master]
6
8
 
7
9
  jobs:
8
10
  tag:
9
- runs-on: ubuntu-latest
10
-
11
- steps:
12
- - name: ruby 3.2
13
- uses: ruby/setup-ruby@v1
14
- with:
15
- ruby-version: 3.2
16
-
17
- - name: checkout
18
- uses: actions/checkout@v4
19
- with:
20
- fetch-depth: 0
21
- token: ${{ secrets.PAT }}
22
-
23
- - name: setup dependencies
24
- run: "ruby -I.github/workflows -rutils -e 'setup_dependencies only: :xot'"
25
-
26
- - name: setup user name and email
27
- run: |
28
- git config --global user.email "xordog@gmail.com"
29
- git config --global user.name "xord"
30
-
31
- - name: tag versions
32
- run: "ruby -I.github/workflows -rutils -e 'tag_versions'"
33
-
34
- - name: push tags
35
- run: git push origin --tags
11
+ uses: xord/xot/.github/workflows/tag.yml@master
12
+ secrets: inherit
@@ -7,40 +7,4 @@ on:
7
7
 
8
8
  jobs:
9
9
  test:
10
- runs-on: macos-latest
11
-
12
- steps:
13
- - name: ruby 3.2
14
- uses: ruby/setup-ruby@v1
15
- with:
16
- ruby-version: 3.2
17
-
18
- - name: checkout
19
- uses: actions/checkout@v4
20
-
21
- - name: setup gems
22
- run: bundle install
23
-
24
- - name: setup dependencies
25
- run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
26
-
27
- - name: packages
28
- run: bundle exec rake verbose packages
29
-
30
- - name: setup zig
31
- if: github.event.repository.name == 'reflex-terminal'
32
- uses: mlugg/setup-zig@v2
33
- with:
34
- version: 0.16.0
35
-
36
- - name: vendor
37
- run: bundle exec rake vendor
38
-
39
- - name: lib
40
- run: bundle exec rake verbose lib
41
-
42
- - name: ext
43
- run: bundle exec rake verbose ext
44
-
45
- - name: test
46
- run: bundle exec rake verbose test
10
+ uses: xord/xot/.github/workflows/test.yml@master
data/ChangeLog.md CHANGED
@@ -1,6 +1,60 @@
1
1
  # reflex ChangeLog
2
2
 
3
3
 
4
+ ## [v0.7.0] - 2026-11-04
5
+
6
+ - [BREAKING] Rename View#cache to View#draw_cache
7
+ - [BREAKING] Rename Window#hidden to Window#hidden?
8
+ - [BREAKING] Make Menu#shortcut_key a key symbol, not a string
9
+ - [BREAKING] Return only the shortcut modifiers from #modifiers by default
10
+ - [BREAKING] Report wheel deltas in pixels, in the same direction, on every platform
11
+ - [BREAKING] Make the window frame the client rect on Windows, as it is the content rect on macOS
12
+ - [BREAKING] Open gamepads and MIDI only when Gamepad.enable / MIDI.enable is called
13
+ - [BREAKING] Return from Reflex.start on quit on macOS too, and raise the exception of a callback from it
14
+ - [BREAKING] Raise the deployment targets to macOS 11.0 and iOS 14.0
15
+ - Add TextEvent, on_text_preedit and on_text_commit to take text from an input method
16
+ - Add HasTextPreedit for views taking text input
17
+ - Add FileDialog to open the file dialog of the platform
18
+ - Add ColorPicker to open the color picker of the platform
19
+ - Add Reflex.alert to show a message and wait for it to be closed
20
+ - Add Application#background for an app with no dock icon, with its menu in the menu bar or the tray
21
+ - Add Window#transparent= and #shadow=
22
+ - Add the :buttons and :background flags to Window#titlebar to hide the parts of the titlebar
23
+ - Add Window#always_on_top and #always_on_bottom
24
+ - Add Window::FLAG_POINTER_THROUGH and Window#pointer_through_alpha to let pointers go through a window
25
+ - Add Window#unlisted= to keep a window out of Mission Control, the taskbar and alt-tab
26
+ - Add Screen.all, Screen#name and #pixel_density
27
+ - Add Reflex::KEYS and Reflex.get_key_symbol!
28
+ - Add ControlChangeEvent#inspect
29
+ - Handle non-ASCII text on Windows
30
+ - Support High DPI on Windows
31
+ - Deliver MIDI events to every window, also while the app is in the background
32
+ - End every pointer press with an up or a cancel, also when a menu pops up or the pointer leaves the window
33
+ - Decide the enter and leave of a window from where the pointer is
34
+ - Stop hover moves at the edge of a window on macOS, as on the other platforms
35
+ - Let handlers add and remove views while events are dispatched
36
+ - Name an application by the name the system has for it by default
37
+ - Give windows the icon of the executable on Windows
38
+ - Keep the caption on screen when placing a window on Windows
39
+ - Leave the time a popup menu is open on Windows out of the next dt
40
+ - Make Window#close do nothing on a window already closed
41
+ - Let Window#titlebar and #orientations be called as universal accessors
42
+
43
+ - Fix menu shortcuts never firing on macOS and Windows
44
+ - Fix closable, minimizable and resizable doing nothing on Windows
45
+ - Fix the window flags taking effect one change late on macOS
46
+ - Fix a block given to Window.new or Reflex.start being lost when on(:show) or on(:start) is hooked
47
+ - Fix views added to a window already shown never being drawn
48
+ - Fix a drag not working on Windows right after a popup menu
49
+ - Fix MIDI.all returning true for each device
50
+ - Fix the MIDI input thread corrupting the heap
51
+ - Fix a crash when removing two or more gamepads
52
+ - Fix RtMidi running the event loop of the app on macOS
53
+ - Fix the extension failing to load on Windows without the DirectX redistributable
54
+ - Fix linking the extension statically on macOS
55
+ - Fix the build for iOS
56
+
57
+
4
58
  ## [v0.6.0] - 2026-08-04
5
59
 
6
60
  - [BREAKING] Read modifiers as symbols from every event that carries them
data/Gemfile.lock CHANGED
@@ -1,21 +1,26 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- power_assert (3.0.1)
5
- rake (13.3.1)
6
- test-unit (3.7.7)
4
+ power_assert (3.1.0)
5
+ rake (13.4.2)
6
+ test-unit (3.7.8)
7
7
  power_assert
8
- yard (0.9.39)
8
+ yard (0.9.45)
9
9
 
10
10
  PLATFORMS
11
- arm64-darwin-21
12
- arm64-darwin-23
13
- arm64-darwin-24
11
+ ruby
14
12
 
15
13
  DEPENDENCIES
16
14
  rake
17
15
  test-unit
18
16
  yard
19
17
 
18
+ CHECKSUMS
19
+ bundler (4.0.20) sha256=7978a8ac648767f5e635bc522445b79e80a52b907a39a36c2d8085ed6bc762ae
20
+ power_assert (3.1.0) sha256=fefe98ed5d3140628138f3f9f9194d6ece01f1320e69700d3c928adca7518251
21
+ rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
22
+ test-unit (3.7.8) sha256=689d1ca53f4d46f678b4e5d68d8e4294f87fc5e8b9238cc4de7c5727e8d65943
23
+ yard (0.9.45) sha256=52e211493f7cb8a3ebf7e104a25a1e73937a3103092545d34cb88fafebb3dc51
24
+
20
25
  BUNDLED WITH
21
- 2.4.19
26
+ 4.0.20
data/Rakefile CHANGED
@@ -35,12 +35,23 @@ use_external_library 'https://github.com/thestk/rtmidi',
35
35
  when linux? then '__LINUX_ALSA__'
36
36
  end
37
37
  }.call,
38
- &proc {sh %( mkdir rtmidi && cp RtMidi.* rtmidi )}
38
+ &proc {
39
+ sh %( mkdir rtmidi && cp RtMidi.* rtmidi )
40
+
41
+ # the event loop of the app already takes in the port changes, and running
42
+ # it from inside RtMidi calls the timers and events of the app too early
43
+ spin = /^[ \t]*CFRunLoopRunInMode\([^)]*\);\n/
44
+ filter_file 'rtmidi/RtMidi.cpp' do |src|
45
+ count = src.scan(spin).size
46
+ raise "expected 6 run loop calls in RtMidi.cpp, found #{count}" if count != 6
47
+ src.gsub spin, ''
48
+ end
49
+ }
39
50
 
40
51
  default_tasks :ext
41
52
  use_bundler
42
53
  build_native_library
43
54
  build_ruby_extension
44
- test_ruby_extension unless github_actions? && win32?
55
+ test_ruby_extension
45
56
  generate_documents
46
57
  build_ruby_gem
data/Reflex.podspec CHANGED
@@ -11,8 +11,8 @@ Pod::Spec.new do |s|
11
11
  s.author = {"xordog" => "xordog@gmail.com"}
12
12
  s.homepage = "https://github.com/xord/reflex"
13
13
 
14
- s.osx.deployment_target = "10.10"
15
- s.ios.deployment_target = "12.0"
14
+ s.osx.deployment_target = "11.0"
15
+ s.ios.deployment_target = "14.0"
16
16
 
17
17
  root = "${PODS_ROOT}/#{s.name}"
18
18
  exts = File.read(File.expand_path 'Rakefile', __dir__)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.7.0