wxruby3 1.7.0 → 1.8.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 (220) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +27 -2
  3. data/README.md +15 -15
  4. data/ext/wxruby3/include/wxRubyApp.h +145 -46
  5. data/ext/wxruby3/include/wxruby-ComboPopup.h +25 -8
  6. data/ext/wxruby3/include/wxruby-GCTracking.h +262 -0
  7. data/ext/wxruby3/include/wxruby-MBConv.h +190 -0
  8. data/ext/wxruby3/include/wxruby-SharedEventHandler.h +183 -0
  9. data/ext/wxruby3/include/wxruby-SharedPtr.h +104 -0
  10. data/ext/wxruby3/include/wxruby-runtime.h +29 -0
  11. data/ext/wxruby3/swig/custom/rubytracking.swg +8 -22
  12. data/ext/wxruby3/swig/custom/wx_ruby_shared_ptr.i +434 -0
  13. data/ext/wxruby3/swig/custom/wx_shared_ptr.i +431 -0
  14. data/ext/wxruby3/swig/mark_free_impl.i +7 -132
  15. data/ext/wxruby3/swig/memory_management.i +8 -44
  16. data/ext/wxruby3/swig/wx.i +46 -73
  17. data/lib/wx/core/const.rb +0 -1
  18. data/lib/wx/core/context_help.rb +17 -0
  19. data/lib/wx/core/cursor.rb +1 -0
  20. data/lib/wx/core/helpcontrollerhelpprovider.rb +10 -2
  21. data/lib/wx/core/mbconv.rb +11 -0
  22. data/lib/wx/core/media_ctrl.rb +31 -0
  23. data/lib/wx/core/top_level_window.rb +7 -0
  24. data/lib/wx/core.rb +6 -0
  25. data/lib/wx/doc/art_provider.rb +17 -0
  26. data/lib/wx/doc/context_help.rb +42 -0
  27. data/lib/wx/doc/core.rb +0 -5
  28. data/lib/wx/doc/functions.rb +10 -0
  29. data/lib/wx/doc/gen/affine_matrix2d.rb +2 -0
  30. data/lib/wx/doc/gen/art_provider.rb +12 -0
  31. data/lib/wx/doc/gen/aui/aui_notebook_event.rb +15 -15
  32. data/lib/wx/doc/gen/aui/aui_pane_info.rb +8 -8
  33. data/lib/wx/doc/gen/aui/aui_tool_bar_event.rb +5 -5
  34. data/lib/wx/doc/gen/book_ctrl_base.rb +2 -1
  35. data/lib/wx/doc/gen/calendar_event.rb +5 -5
  36. data/lib/wx/doc/gen/choicebook.rb +2 -2
  37. data/lib/wx/doc/gen/collapsible_pane.rb +1 -1
  38. data/lib/wx/doc/gen/colour_dialog.rb +1 -1
  39. data/lib/wx/doc/gen/colour_picker_event.rb +3 -3
  40. data/lib/wx/doc/gen/context_help_button.rb +0 -53
  41. data/lib/wx/doc/gen/core.rb +4 -4
  42. data/lib/wx/doc/gen/credential_entry_dialog.rb +2 -2
  43. data/lib/wx/doc/gen/date_event.rb +2 -2
  44. data/lib/wx/doc/gen/dial_up_event.rb +2 -2
  45. data/lib/wx/doc/gen/dir_filter_list_ctrl.rb +2 -2
  46. data/lib/wx/doc/gen/event.rb +58 -58
  47. data/lib/wx/doc/gen/ext_help_controller.rb +62 -16
  48. data/lib/wx/doc/gen/file_ctrl.rb +4 -4
  49. data/lib/wx/doc/gen/file_dir_picker_event.rb +2 -2
  50. data/lib/wx/doc/gen/file_system.rb +1 -1
  51. data/lib/wx/doc/gen/find_dialog_event.rb +5 -5
  52. data/lib/wx/doc/gen/font_picker_event.rb +1 -1
  53. data/lib/wx/doc/gen/grid/grid_ctrl.rb +67 -32
  54. data/lib/wx/doc/gen/header_ctrl_event.rb +13 -13
  55. data/lib/wx/doc/gen/help_controller.rb +45 -2
  56. data/lib/wx/doc/gen/html/html_help_controller.rb +74 -32
  57. data/lib/wx/doc/gen/html/html_help_window.rb +3 -3
  58. data/lib/wx/doc/gen/html/html_window.rb +4 -4
  59. data/lib/wx/doc/gen/hyperlink_ctrl.rb +1 -1
  60. data/lib/wx/doc/gen/list_ctrl.rb +22 -22
  61. data/lib/wx/doc/gen/listbook.rb +2 -2
  62. data/lib/wx/doc/gen/mb_conv.rb +10 -0
  63. data/lib/wx/doc/gen/media_event.rb +6 -6
  64. data/lib/wx/doc/gen/notebook.rb +2 -2
  65. data/lib/wx/doc/gen/pg/pg_validation_info.rb +14 -14
  66. data/lib/wx/doc/gen/pg/property_grid_interface.rb +2 -2
  67. data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +19 -9
  68. data/lib/wx/doc/gen/rbn/ribbon_button_bar.rb +2 -2
  69. data/lib/wx/doc/gen/rbn/ribbon_gallery.rb +3 -3
  70. data/lib/wx/doc/gen/rbn/ribbon_panel.rb +2 -2
  71. data/lib/wx/doc/gen/rbn/ribbon_tool_bar.rb +2 -2
  72. data/lib/wx/doc/gen/rt/event_list.rb +17 -0
  73. data/lib/wx/doc/gen/rt/shared_evt_handler.rb +14 -0
  74. data/lib/wx/doc/gen/rt/thread_event.rb +71 -0
  75. data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +19 -19
  76. data/lib/wx/doc/gen/sash_event.rb +2 -2
  77. data/lib/wx/doc/gen/sash_layout_window.rb +2 -2
  78. data/lib/wx/doc/gen/search_ctrl.rb +2 -2
  79. data/lib/wx/doc/gen/spin_ctrl.rb +2 -2
  80. data/lib/wx/doc/gen/splitter_window.rb +6 -6
  81. data/lib/wx/doc/gen/stc/styled_text_event.rb +34 -34
  82. data/lib/wx/doc/gen/task_bar_icon_event.rb +10 -10
  83. data/lib/wx/doc/gen/text_ctrl.rb +4 -4
  84. data/lib/wx/doc/gen/toggle_button.rb +1 -1
  85. data/lib/wx/doc/gen/toolbook.rb +2 -2
  86. data/lib/wx/doc/gen/top_level_window.rb +19 -0
  87. data/lib/wx/doc/gen/tree_ctrl.rb +21 -21
  88. data/lib/wx/doc/gen/treebook.rb +4 -4
  89. data/lib/wx/doc/gen/utils.rb +2 -2
  90. data/lib/wx/doc/gen/web/event_list.rb +95 -0
  91. data/lib/wx/doc/gen/web/web_view.rb +1136 -0
  92. data/lib/wx/doc/gen/web/web_view_event.rb +210 -0
  93. data/lib/wx/doc/gen/web/web_view_handler.rb +318 -0
  94. data/lib/wx/doc/gen/window.rb +1 -1
  95. data/lib/wx/doc/gen/wizard_event.rb +7 -7
  96. data/lib/wx/doc/html/html_help_controller.rb +23 -1
  97. data/lib/wx/doc/mbconv.rb +108 -0
  98. data/lib/wx/doc/rt/shared_event_handler.rb +49 -0
  99. data/lib/wx/doc/rt/thread_event.rb +28 -0
  100. data/lib/wx/doc/webview.rb +40 -0
  101. data/lib/wx/helpers.rb +1 -1
  102. data/lib/wx/html/htmlhelpcontroller.rb +10 -0
  103. data/lib/wx/keyword_defs.rb +11 -0
  104. data/lib/wx/rt/events/evt_list.rb +8 -0
  105. data/lib/wx/rt/require.rb +8 -0
  106. data/lib/wx/rt/thread_event.rb +14 -0
  107. data/lib/wx/rt.rb +16 -0
  108. data/lib/wx/version.rb +1 -1
  109. data/lib/wx/web/events/evt_list.rb +74 -0
  110. data/lib/wx/web/require.rb +8 -0
  111. data/lib/wx/web/webview.rb +106 -0
  112. data/lib/wx/web.rb +17 -0
  113. data/lib/wx/wxruby/cmd/setup.rb +15 -0
  114. data/lib/wx.rb +2 -0
  115. data/rakelib/configure.rb +24 -0
  116. data/rakelib/gem.rb +3 -2
  117. data/rakelib/install.rb +54 -27
  118. data/rakelib/lib/config/macosx.rb +7 -5
  119. data/rakelib/lib/config/mingw.rb +66 -5
  120. data/rakelib/lib/config/pkgman/mingw.rb +1 -1
  121. data/rakelib/lib/config/unixish.rb +4 -2
  122. data/rakelib/lib/config.rb +37 -3
  123. data/rakelib/lib/core/include/client_data.inc +38 -17
  124. data/rakelib/lib/core/include/funcall.inc +1 -1
  125. data/rakelib/lib/core/include/swigdirector.inc +3 -3
  126. data/rakelib/lib/core/include/swigrubyrun.inc +14 -26
  127. data/rakelib/lib/core/package.rb +0 -2
  128. data/rakelib/lib/director/app.rb +1 -8
  129. data/rakelib/lib/director/art_provider.rb +7 -3
  130. data/rakelib/lib/director/comboctrl.rb +0 -7
  131. data/rakelib/lib/director/context_help_button.rb +35 -2
  132. data/rakelib/lib/director/event_handler.rb +32 -28
  133. data/rakelib/lib/director/fs_file.rb +15 -10
  134. data/rakelib/lib/director/functions.rb +8 -0
  135. data/rakelib/lib/director/grid_cell_attr.rb +1 -3
  136. data/rakelib/lib/director/grid_cell_editor.rb +14 -12
  137. data/rakelib/lib/director/grid_cell_renderer.rb +11 -8
  138. data/rakelib/lib/director/grid_ctrl.rb +140 -121
  139. data/rakelib/lib/director/help_controller.rb +70 -2
  140. data/rakelib/lib/director/mb_conv.rb +30 -0
  141. data/rakelib/lib/director/menu.rb +92 -42
  142. data/rakelib/lib/director/menu_bar.rb +84 -45
  143. data/rakelib/lib/director/menu_item.rb +2 -2
  144. data/rakelib/lib/director/persistence_manager.rb +3 -2
  145. data/rakelib/lib/director/preview_frame.rb +2 -2
  146. data/rakelib/lib/director/richtext_buffer.rb +5 -2
  147. data/rakelib/lib/director/shared_evt_handler.rb +30 -0
  148. data/rakelib/lib/director/sizer.rb +8 -17
  149. data/rakelib/lib/director/sizer_item.rb +3 -4
  150. data/rakelib/lib/director/task_bar_icon.rb +7 -7
  151. data/rakelib/lib/director/thread_event.rb +33 -0
  152. data/rakelib/lib/director/validator.rb +3 -1
  153. data/rakelib/lib/director/variant.rb +16 -12
  154. data/rakelib/lib/director/webview.rb +166 -0
  155. data/rakelib/lib/director/webview_event.rb +37 -0
  156. data/rakelib/lib/director/webview_handler.rb +63 -0
  157. data/rakelib/lib/generate/doc/thread_event.yaml +20 -0
  158. data/rakelib/lib/generate/doc/web_view.yaml +135 -0
  159. data/rakelib/lib/generate/doc/web_view_event.yaml +38 -0
  160. data/rakelib/lib/generate/doc/web_view_handler.yaml +58 -0
  161. data/rakelib/lib/specs/interfaces.rb +12 -0
  162. data/rakelib/lib/typemap/common.rb +34 -1
  163. data/rakelib/lib/typemap/mb_conv.rb +58 -0
  164. data/rakelib/prepost.rake +23 -31
  165. data/rakelib/prepost.rb +20 -0
  166. data/samples/event/threaded.rb +295 -42
  167. data/samples/event/tn_threaded.png +0 -0
  168. data/samples/help/doc/back.gif +0 -0
  169. data/samples/help/doc/contents.gif +0 -0
  170. data/samples/help/doc/cshelp.txt +9 -0
  171. data/samples/help/doc/doc.chm +0 -0
  172. data/samples/help/doc/doc.cnt +8 -0
  173. data/samples/help/doc/doc.h +7 -0
  174. data/samples/help/doc/doc.hhc +40 -0
  175. data/samples/help/doc/doc.hhk +31 -0
  176. data/samples/help/doc/doc.hhp +33 -0
  177. data/samples/help/doc/doc.hpj +21 -0
  178. data/samples/help/doc/doc.htm +27 -0
  179. data/samples/help/doc/doc1.htm +24 -0
  180. data/samples/help/doc/doc2.htm +12 -0
  181. data/samples/help/doc/doc3.htm +12 -0
  182. data/samples/help/doc/doc4.htm +12 -0
  183. data/samples/help/doc/doc5.htm +14 -0
  184. data/samples/help/doc/forward.gif +0 -0
  185. data/samples/help/doc/up.gif +0 -0
  186. data/samples/help/doc.chm +0 -0
  187. data/samples/help/doc.chw +0 -0
  188. data/samples/help/doc.zip +0 -0
  189. data/samples/help/help.rb +352 -0
  190. data/samples/help/tn_help.png +0 -0
  191. data/samples/webview/handler_advanced.html +55 -0
  192. data/samples/webview/tn_webview.png +0 -0
  193. data/samples/webview/webview.rb +1264 -0
  194. data/tests/assets/handler_advanced.html +55 -0
  195. data/tests/assets/test.css +1 -0
  196. data/tests/assets/test.html +9 -0
  197. data/tests/assets/test.zip +0 -0
  198. data/tests/lib/text_entry_tests.rb +2 -2
  199. data/tests/lib/wxapp_runner.rb +40 -0
  200. data/tests/lib/wxframe_runner.rb +17 -2
  201. data/tests/test_art.rb +8 -8
  202. data/tests/test_clipboard.rb +4 -4
  203. data/tests/test_config.rb +6 -6
  204. data/tests/test_exceptions.rb +8 -6
  205. data/tests/test_ext_controls.rb +3 -3
  206. data/tests/test_file_dialog.rb +5 -5
  207. data/tests/test_font.rb +7 -7
  208. data/tests/test_grid_ctrl.rb +133 -0
  209. data/tests/test_help.rb +88 -0
  210. data/tests/test_intl.rb +1 -1
  211. data/tests/test_media_ctrl.rb +14 -6
  212. data/tests/test_menu.rb +94 -86
  213. data/tests/test_persistence.rb +1 -1
  214. data/tests/test_proof_check.rb +5 -5
  215. data/tests/test_propgrid.rb +1 -1
  216. data/tests/test_shared_event_handler.rb +141 -0
  217. data/tests/test_std_controls.rb +5 -5
  218. data/tests/test_webview.rb +492 -0
  219. data/tests/test_window.rb +3 -3
  220. metadata +78 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29b2e3949b365c4778d3b537d91f6b227361bcc3f978fa2c92bdea5e2c81390c
4
- data.tar.gz: 58e28a379655680b2c7b5ac147436f154102bc551d356b8bd2d4f7a57249fa2f
3
+ metadata.gz: 36b9eb0db175364b374a899f3458497f09dddbfbc981c08b36f0c43c83d225b7
4
+ data.tar.gz: ac07b0f69b8878db1ee966d4ec2b79f4ee0122ee173a70a5ef7a4a274c634c6e
5
5
  SHA512:
6
- metadata.gz: fa954320cb8c4a44872a78fe5c5da098d5b15667b93b3d9b6f24839fb17a04e42b2d4ccd8eed502407a0eed348cba08da19abdeaab99d8121c5e49674b931227
7
- data.tar.gz: 7dd47c4496313f52a56ac7387ac195ad4a54ce5758b9015bb92eb5a6a7d8a98b27d8d9b96f06aa12850d613e74e51147fe82a7bdfe5541466c179f73dd7c964d
6
+ metadata.gz: b369e2270784db0220735194f98d047a97f0a277c7bba518627800e3c7ed70245a428a650aa531877314acae6c003ffad899295dcbdb36c9e1dcfb1714b46926
7
+ data.tar.gz: 0f86862841afe346ee8ee0218ef5a4259c9c22aa6109659e41e2e499575402aad3519a9bae99ea32150785fe8d278a5513e5a66d4ad21599ab4e9ad8c67c2f50
data/INSTALL.md CHANGED
@@ -82,6 +82,11 @@ The following tables lists the packages provided by the current wxRuby3 release
82
82
  | OSX | MacOS 15 | x86_64 <b>and</b> ARM64 | Latest stable Ruby |
83
83
  | OSX | MacOS 26 | x86_64 <b>and</b> ARM64 | Latest stable Ruby |
84
84
 
85
+ ### Additional packages
86
+
87
+ Some additional packages built from local resources may be added to the standard release artifacts (like for example for
88
+ LinuxMint x86_64) but this will also depend on available time and resources.
89
+
85
90
  ### User created packages
86
91
 
87
92
  Users can create their own wxRuby3 binary packages by building from source ([see here](#building-from-source)) and after
@@ -102,7 +107,7 @@ The software requirements for setting up a wxRuby3 runtime environment are:
102
107
 
103
108
  | Sofware | Notes |
104
109
  |-----------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
105
- | Ruby >= 2.7 | A supported version of the Ruby interpreter needs to be installed. This is an absolute requirement for any installation as one cannot install gems without Ruby and building from source requires Ruby to drive the build process. |
110
+ | Ruby >= 3.0 | A supported version of the Ruby interpreter needs to be installed. This is an absolute requirement for any installation as one cannot install gems without Ruby and building from source requires Ruby to drive the build process. |
106
111
  | C++ compiler<br>(incl. dev tools like `make`) | Required for a source based installation to build wxWidgets (optionally) and the wxRuby extension libraries.<br/>On linux a recent version of the GNU C++ compiler (with c++-14 support) is required.<br>On Windows the RubyInstaller MSYS2-Devkit would be required.<br>On MacOS XCode with commandline tools would be required. |
107
112
  | Git version control toolkit | Required for a source based installation in to (possibly) clone a copy of the wxWidgets Github repository or to clone the Github repository of wxRuby3 itself for a fully source based installation. |
108
113
  | Doxygen (>= 1.9.1) | Required for building the wxRuby3 extension libraries for a source based installation. [**1**] |
@@ -116,7 +121,7 @@ But of course any of these requirements can also be fulfilled explicitly with se
116
121
  wxRuby3 installation procedure. See the platform specific sections of [Installing software requirements](INSTALL.md#installing-software-requirements) for details on
117
122
  how to go about that.
118
123
 
119
- [**1**] The wxRuby3 build process needs doxygen to generated XML files containing wxWidgets interface specs which are used to
124
+ [**1**] The wxRuby3 build process needs doxygen to generate XML files containing wxWidgets interface specs which are used to
120
125
  generate interface definitions for SWIG
121
126
 
122
127
  [**2**] The wxRuby3 build process uses SWIG to generate C++ source code for the wrapper interfaces from
@@ -368,6 +373,26 @@ Note that in this case `--with-wxwin` is implied.
368
373
  > workflows of the [wxRuby3 Github Actions](https://github.com/mcorino/wxRuby3/actions) to get a feel of the current
369
374
  > integration state.
370
375
 
376
+ #### Controlling included modules for embedded wxWidgets
377
+
378
+ When building wxRuby3 with embedded wxWidgets (implicit or explicit) there are some setup arguments to control the
379
+ modules included in the wxRuby3 installation.
380
+ If none of these options are specified __all__ modules will be included by default.
381
+
382
+ Note that these option only have effect if building with embedded wxWidgets. When building for wxWidgets system or user
383
+ installation, module support will be determined by the build options supplied when building that wxWidgets installation.
384
+
385
+ ##### WebView module
386
+
387
+ To explicitly include the wxWidgets WebView library for the Wx::WEB::WebView module (the default) add the
388
+ `--with-webview` option. To explicitly specify which WebView backends should be supported it is possible to use the
389
+ option like `--with-webview=<backend>[,<backend>`.
390
+ On Windows __<backend\>__ can be `edge` and/or `ie`. By default, if no backend is specified, only the `edge` backend
391
+ will be supported on Windows.
392
+ On Linux and MacOS currently only the `webkit` backend is supported.
393
+
394
+ To explicitly exclude WebView support add the `--without-webview` option.
395
+
371
396
  #### Setup with user installed wxWidgets
372
397
 
373
398
  In case of a (custom) user installation of wxWidgets the `--wxwin` (and optionally `--wxxml`) option(s) can be used to
data/README.md CHANGED
@@ -65,7 +65,7 @@ Wx::App.run { TheFrame.new('Hello world!').show }
65
65
  ## wxRuby3 licence
66
66
 
67
67
  wxRuby3 is free and open-source. It is distributed under the liberal
68
- MIT licence which is compatible with both free and commercial development.
68
+ MIT license which is compatible with both free and commercial development.
69
69
  See [LICENSE](LICENSE) for more details.
70
70
 
71
71
  ### wxRuby3 and wxWidgets
@@ -76,7 +76,7 @@ those requirements do not impose any serious restrictions.
76
76
 
77
77
  ### wxWidgets License Summary (from wxWidgets)
78
78
 
79
- In summary, the licence is LGPL plus a clause allowing unrestricted
79
+ In summary, the license is LGPL plus a clause allowing unrestricted
80
80
  distribution of application binaries. To answer a FAQ, you don't have to
81
81
  distribute any source if you wish to write commercial applications using
82
82
  wxWidgets.
@@ -97,23 +97,23 @@ of these products.
97
97
 
98
98
  ### What platforms and operating systems are supported in wxRuby3?
99
99
 
100
- Currently the following are fully supported:
100
+ Currently, the following are fully supported:
101
101
 
102
102
  | Platform | Ruby version(s) | wxWidgets version(s) |
103
103
  |--------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|----------------------|
104
- | Windows >= 10 | Ruby >= 2.7<br>(RubyInstaller MSYS2-DevKit) | wxWidgets >= 3.2 |
105
- | Linux (tested; all major AMD64 and ARM64 distributions: Ubuntu, Debian, Fedora, OpenSuSE, LinuxMint, Manjaro and ArchLinux)<br>(most likely also i686) | Ruby >= 2.7 | wxWidgets >= 3.2 |
106
- | MacOS >= 14 (MacOS 13 most likely also works) using Cocoa (tested on AMD64 and ARM64 M1/M2 Chip) | Ruby >= 2.7 (MacPorts, Homebrew, ruby-install, RVM, Rbenv) | wxWidgets >= 3.2 |
104
+ | Windows >= 10 | Ruby >= 3.0<br>(RubyInstaller MSYS2-DevKit) | wxWidgets >= 3.2 |
105
+ | Linux (tested; all major AMD64 and ARM64 distributions: Ubuntu, Debian, Fedora, OpenSuSE, LinuxMint, Manjaro and ArchLinux)<br>(most likely also i686) | Ruby >= 3.0 | wxWidgets >= 3.2 |
106
+ | MacOS >= 14 (MacOS 13 most likely also works) using Cocoa (tested on AMD64 and ARM64 M1/M2 Chip) | Ruby >= 3.0 (MacPorts, Homebrew, ruby-install, RVM, Rbenv) | wxWidgets >= 3.2 |
107
107
 
108
108
  Support for other platforms is not being actively developed at present,
109
109
  but patches are welcome. It is likely to be much simpler to get wxRuby
110
- working on similar modern systems (eg FreeBSD or Solaris with GTK) than
111
- on legacy systems (eg Windows 98, Mac OS 9).
110
+ working on similar modern systems (e.g. FreeBSD or Solaris with GTK) than
111
+ on legacy systems (e.g. Windows 98, macOS 9).
112
112
 
113
113
  ### How can I install wxRuby3?
114
114
 
115
115
  wxRuby3 is distributed as a Ruby gem on [RubyGems](https://rubygems.org). This gem can also be downloaded from the release
116
- assets on [Github](https://github.com/mcorino/wxRuby3/releases).
116
+ assets on [GitHub](https://github.com/mcorino/wxRuby3/releases).
117
117
 
118
118
  The wxRuby3 gem provides a **worry-free** installation procedure for all supported platforms.
119
119
 
@@ -124,7 +124,7 @@ supported version of the Ruby interpreter. So the following command is all it ta
124
124
  gem install wxruby3
125
125
  ```
126
126
 
127
- The wxRuby3 installation procedure will check the availability of a, prebuilt, binary package matching the platform
127
+ The wxRuby3 installation procedure will check the availability of a prebuilt, binary package matching the platform
128
128
  being installed on and if found will download and install that package resulting in a ready-to-run wxRuby3 installation.<br>
129
129
  If no matching package is found the installation reverts to a source installation which will require an additional setup
130
130
  step to finalize the wxRuby3 installation by executing the following command:
@@ -135,7 +135,7 @@ wxruby setup
135
135
 
136
136
  This last command is a fully automated setup procedure provided by the wxRuby3 **CLI** installed with the gem. This
137
137
  procedure (by default) will analyze your system and install (after asking your consent) any missing software
138
- requirements and build the wxRuby3 extension libraries (including a embedded copy of wxWidgets if necessary). It may
138
+ requirements and build the wxRuby3 extension libraries (including an embedded copy of wxWidgets if necessary). It may
139
139
  take quite a while depending on your system (around 10-15 minutes on a modern PC but could be significantly longer
140
140
  on 'older' PC's) but you can mostly sit back and relax.
141
141
 
@@ -146,11 +146,11 @@ on 'older' PC's) but you can mostly sit back and relax.
146
146
  > on like the nokogiri gem).
147
147
 
148
148
  The wxRuby3 CLI also provides a 'check' command with which the runtime status of the wxRuby3 installation can be checked
149
- at any time. By default running `wxruby check` will display a message reporting the runtime and suggestions on finalizing
149
+ at any time. By default, running `wxruby check` will display a message reporting the runtime and suggestions on finalizing
150
150
  the installation if not finalized yet. No message is displayed if wxRuby3 is ready to run. Run `wxruby check -h` for
151
151
  details concerning this command.
152
152
 
153
- A selection of (prebuilt) binary packages is provided as release assets on [Github](https://github.com/mcorino/wxRuby3/releases).
153
+ A selection of (prebuilt) binary packages is provided as release assets on [GitHub](https://github.com/mcorino/wxRuby3/releases).
154
154
  See the [INSTALL](INSTALL.md#binary-packages) document for more details.
155
155
 
156
156
  This install procedure can of course be tweaked and customized with commandline arguments.
@@ -158,7 +158,7 @@ See the [INSTALL](INSTALL.md) document for more details.
158
158
 
159
159
  ### Where can I ask a question, or report a bug?
160
160
 
161
- Use GitHUb Issues.
161
+ Use GitHub Issues.
162
162
 
163
163
  When asking a question, if something is not working as you expect,
164
164
  please provide a *minimal*, *runnable* sample of code that demonstrates
@@ -215,7 +215,7 @@ stopped in early 2005, in favour of what became wxRuby 2.0. This project
215
215
  in turn stopped being supported in 2013.
216
216
  Several years of development have passed for wxWidgets and Ruby respectively,
217
217
  improving code quality, adding new classes and new language features.
218
- In 2022 I finally found the time and the inspiration to pick up this project
218
+ In 2022, I finally found the time and the inspiration to pick up this project
219
219
  with the idea of reviving it to build some applications I had in mind.
220
220
  wxRuby 3 intends to provide Ruby interfaces for all relevant (!) wxWidget
221
221
  classes of the latest version 3.2 and beyond.
@@ -8,6 +8,14 @@ WXRUBY_TRACE_GUARD(WxRubyTraceAppRun, "APP_RUN")
8
8
 
9
9
  #include <memory>
10
10
 
11
+ #include <ruby/ractor.h>
12
+
13
+ #include <wx/scopedptr.h>
14
+ #include <wx/evtloop.h>
15
+
16
+ // this defines wxEventLoopPtr
17
+ wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoopBase)
18
+
11
19
  /*
12
20
  * WxRuby3 App class
13
21
  */
@@ -17,14 +25,133 @@ class wxRubyApp : public wxApp
17
25
  private:
18
26
  bool is_running_ = false;
19
27
  VALUE self_ = Qnil;
28
+
29
+ void _store_ruby_exception(VALUE ex)
30
+ {
31
+ rb_iv_set(this->self_, "@exception", ex);
32
+ }
33
+
34
+ class EventLoop : public wxGUIEventLoop
35
+ {
36
+ public:
37
+ int GetExitCode() { return this->exit_code_; }
38
+
39
+ protected:
40
+ virtual int DoRun() override
41
+ {
42
+ static WxRuby_ID count_id("count");
43
+ static WxRuby_ID list_id("list");
44
+ static WxRuby_ID pass_id("pass");
45
+
46
+ // run our own event loop
47
+ bool needs_idle_evt = true;
48
+ for (;;)
49
+ {
50
+ while ( !m_shouldExit
51
+ && !Pending()
52
+ && !(wxTheApp && wxTheApp->HasPendingEvents()) )
53
+ {
54
+ // check Ruby Ractors and/or Threads
55
+ bool needs_pass = false;
56
+ VALUE result = rb_funcall(rb_cRactor, count_id(), 0);
57
+ needs_pass = !RB_NIL_P(result) && NUM2INT(result) > 1;
58
+ if (!needs_pass)
59
+ {
60
+ result = rb_funcall(rb_cThread, list_id(), 0);
61
+ needs_pass = !RB_NIL_P(result) && TYPE(result) == T_ARRAY && RARRAY_LEN(result) > 1;
62
+ }
63
+ if (needs_pass)
64
+ {
65
+ // call Thread.pass
66
+ bool ex_caught = false;
67
+ result = wxRuby_Funcall(ex_caught, rb_cThread, pass_id(), 0, 0);
68
+ if (ex_caught)
69
+ {
70
+ #ifdef __WXRB_DEBUG__
71
+ wxRuby_PrintException(result);
72
+ #endif
73
+ wxRubyApp::GetInstance()->_store_ruby_exception(result);
74
+ this->exit_code_ = 1;
75
+ m_shouldExit = true;
76
+ }
77
+ }
78
+
79
+ if (!m_shouldExit && needs_idle_evt)
80
+ {
81
+ needs_idle_evt = ProcessIdle();
82
+ if (needs_idle_evt)
83
+ break;
84
+ }
85
+ }
86
+
87
+ // if Exit() was called, don't dispatch any more events here
88
+ if (m_shouldExit)
89
+ break;
90
+
91
+ // process pending wx events first as they correspond to low-level events
92
+ // which happened before, i.e. typically pending events were queued by a
93
+ // previous call to Dispatch() and if we didn't process them now the next
94
+ // call to it might enqueue them again (as happens with e.g. socket events
95
+ // which would be generated as long as there is input available on socket
96
+ // and this input is only removed from it when pending event handlers are
97
+ // executed)
98
+ if ( wxTheApp && wxTheApp->HasPendingEvents() )
99
+ {
100
+ wxTheApp->ProcessPendingEvents();
101
+
102
+ // One of the pending event handlers could have decided to exit the
103
+ // loop so check for the flag before trying to dispatch more events
104
+ // (which could block indefinitely if no more are coming).
105
+ if ( m_shouldExit )
106
+ break;
107
+ }
108
+
109
+ // nothing doing, so just wait max 1 msec for an event
110
+ if (this->DispatchTimeout(1) == 0 && m_shouldExit)
111
+ break; // stop event loop
112
+
113
+ needs_idle_evt = true;
114
+ }
115
+
116
+ return this->exit_code_;
117
+ }
118
+
119
+ #if (wxMAJOR_VERSION > 3) || (wxMINOR_VERSION > 2)
120
+ virtual void DoStop(int rc) override
121
+ {
122
+ this->exit_code_ = rc;
123
+ #if !defined(__WXGTK__)
124
+ wxGUIEventLoop::DoStop(rc);
125
+ #endif
126
+ }
127
+ #else
128
+ virtual void ScheduleExit(int rc) override
129
+ {
130
+ this->exit_code_ = rc;
131
+ #if defined(__WXGTK__)
132
+ m_shouldExit = true;
133
+ #else
134
+ wxGUIEventLoop::ScheduleExit(rc);
135
+ #endif
136
+ }
137
+ #endif
138
+
139
+ private:
140
+ int exit_code_ {};
141
+ };
142
+
20
143
  public:
21
144
  static wxRubyApp* GetInstance () { return dynamic_cast<wxRubyApp*> (wxApp::GetInstance()); }
22
145
 
23
146
  virtual ~wxRubyApp()
24
147
  {
25
- #ifdef __WXTRACE__
26
- std::wcout << "~wxRubyApp" << std::endl;
27
- #endif
148
+ WXRUBY_TRACE_IF(WxRubyTraceAppRun, 1)
149
+ WXRUBY_TRACE("> ~wxRubyApp this=" << this)
150
+ WXRUBY_TRACE_END
151
+
152
+ // app is also event handler, so cleanup
153
+ wxRuby_ReleaseEvtHandlerProcs(this);
154
+
28
155
  // unlink
29
156
  if (this->self_ != Qnil)
30
157
  {
@@ -54,39 +181,9 @@ public:
54
181
 
55
182
  bool IsRunning() const { return this->is_running_; }
56
183
 
57
- // When ruby's garbage collection runs, if the app is still active, it
58
- // cycles through all currently known SWIG objects and calls this
59
- // function on each to preserve still active Wx::Windows, and also
60
- // pending Wx::Events which have been queued from the Ruby side (the
61
- // only sort of events that will be in the tracking hash.
62
- static void markIterate(void* ptr, VALUE rb_obj)
63
- {
64
- // Check if it's a valid object (sometimes SWIG doesn't return what we're
65
- // expecting), a descendant of Wx::Window (but not a Dialog), and if it has not yet been
66
- // deleted by WxWidgets; if so, mark it.
67
- if ( TYPE(rb_obj) == T_DATA )
68
- {
69
- if ( rb_obj_is_kind_of(rb_obj, wxRuby_GetWindowClass()) )
70
- {
71
- rb_gc_mark(rb_obj);
72
- }
73
- else if (rb_obj_is_kind_of(rb_obj, wxRuby_GetDefaultEventClass()) )
74
- rb_gc_mark(rb_obj);
75
- }
76
- // else if (TYPE(rb_obj) == T_ARRAY )
77
- // {
78
- // VALUE proc = rb_ary_entry(rb_obj, 0);
79
- // if (rb_obj_is_kind_of(proc, rb_cProc) || rb_obj_is_kind_of(proc, rb_cMethod))
80
- // {
81
- // // keep the async call alive
82
- // rb_gc_mark(rb_obj);
83
- // }
84
- // }
85
- }
86
-
87
184
  // Implements GC protection across wxRuby. Always called because
88
185
  // Wx::THE_APP is a constant so always checked in GC mark phase.
89
- static void mark_wxRubyApp(void *ptr)
186
+ static void GC_mark_wxRubyApp(void *ptr)
90
187
  {
91
188
  WXRUBY_TRACE_IF(WxRubyTraceMarkApp, 1)
92
189
  WXRUBY_TRACE(">=== Starting App GC mark phase")
@@ -116,16 +213,8 @@ public:
116
213
  // classes/EvtHandler.i
117
214
  wxRuby_MarkProtectedEvtHandlerProcs();
118
215
 
119
- // run registered markers
120
- for (wxVector<WXRBMarkFunction>::iterator it = WXRuby_Mark_List.begin();
121
- it != WXRuby_Mark_List.end() ;++it)
122
- {
123
- (*it) ();
124
- }
125
-
126
- // To do the main marking, primarily of Windows, iterate over SWIG's
127
- // list of tracked objects
128
- wxRuby_IterateTracking(&wxRubyApp::markIterate);
216
+ // Mark all tracked objects (as applicable)
217
+ wxRuby_MarkTracked();
129
218
 
130
219
  WXRUBY_TRACE_IF(WxRubyTraceMarkApp, 1)
131
220
  WXRUBY_TRACE("<=== App GC mark phase completed")
@@ -207,6 +296,16 @@ public:
207
296
  return rc;
208
297
  }
209
298
 
299
+ virtual int MainLoop() override
300
+ {
301
+ wxEventLoopBaseTiedPtr main_loop(&m_mainLoop, new wxRubyApp::EventLoop);
302
+
303
+ if (wxTheApp)
304
+ wxTheApp->OnLaunched();
305
+
306
+ return m_mainLoop ? m_mainLoop->Run() : -1;
307
+ }
308
+
210
309
  // This method initializes the stock objects (Pens, Brushes, Fonts)
211
310
  // before yielding to ruby by calling the App's on_init method.
212
311
  // Note that as of wxWidget 2.8, the stock fonts in particular cannot
@@ -234,7 +333,7 @@ public:
234
333
  #ifdef __WXRB_DEBUG__
235
334
  wxRuby_PrintException(result);
236
335
  #endif
237
- rb_iv_set(this->self_, "@exception", result);
336
+ _store_ruby_exception(result);
238
337
  result = Qfalse; // exit app
239
338
  }
240
339
 
@@ -274,7 +373,7 @@ public:
274
373
  #ifdef __WXRB_DEBUG__
275
374
  wxRuby_PrintException(rc);
276
375
  #endif
277
- rb_iv_set(this->self_, "@exception", rc);
376
+ _store_ruby_exception(rc);
278
377
  }
279
378
  }
280
379
 
@@ -12,6 +12,9 @@
12
12
  #include <wx/combo.h>
13
13
  #include <map>
14
14
 
15
+
16
+ static void wxRuby_markComboPopups(const TGCTrackingValueMap& values);
17
+
15
18
  class WxRubyComboPopup : public wxComboPopup
16
19
  {
17
20
  private:
@@ -31,7 +34,7 @@ private:
31
34
  static WxRuby_ID on_popup_ID;
32
35
  static WxRuby_ID paint_combo_control_ID;
33
36
 
34
- static std::map<WxRubyComboPopup*, VALUE> combo_popup_map;
37
+ static const std::string WXRUBY_COMBO_POPUP;
35
38
 
36
39
  VALUE rb_combo_popup_;
37
40
 
@@ -44,11 +47,11 @@ private:
44
47
  };
45
48
 
46
49
  public:
47
- static void GC_mark_combo_popups()
50
+ static void GC_mark_combo_popups(const TGCTrackingValueMap& values)
48
51
  {
49
- for (auto pair : combo_popup_map)
52
+ for (const auto& ti : values)
50
53
  {
51
- rb_gc_mark(pair.second);
54
+ rb_gc_mark(ti.second);
52
55
  }
53
56
  }
54
57
 
@@ -56,14 +59,23 @@ public:
56
59
  : wxComboPopup()
57
60
  , rb_combo_popup_(rb_cp)
58
61
  {
59
- combo_popup_map[this] = rb_cp; // register
62
+ static bool is_marker_registered = false;
63
+
64
+ if (!is_marker_registered)
65
+ {
66
+ wxRuby_RegisterTrackingCategory(WXRUBY_COMBO_POPUP, wxRuby_markComboPopups, true);
67
+ is_marker_registered = true;
68
+ }
69
+ // register for tracking
70
+ wxRuby_RegisterCategoryValue(WXRUBY_COMBO_POPUP, this, rb_cp);
60
71
  }
61
72
 
62
73
  virtual ~WxRubyComboPopup()
63
74
  {
64
75
  if (!NIL_P(rb_combo_popup_))
65
76
  {
66
- combo_popup_map.erase(this); //deregister
77
+ // unregister from tracking
78
+ wxRuby_UnregisterCategoryValue(WXRUBY_COMBO_POPUP, this);
67
79
  // unlink
68
80
  rb_iv_set(rb_combo_popup_, "@_wx_combo_popup_proxy", Qnil);
69
81
  rb_combo_popup_ = Qnil;
@@ -197,6 +209,13 @@ public:
197
209
 
198
210
  };
199
211
 
212
+ const std::string WxRubyComboPopup::WXRUBY_COMBO_POPUP = {"WXRUBY_COMBO_POPUP"};
213
+
214
+ static void wxRuby_markComboPopups(const TGCTrackingValueMap& values)
215
+ {
216
+ WxRubyComboPopup::GC_mark_combo_popups(values);
217
+ }
218
+
200
219
  WxRuby_ID WxRubyComboPopup::init_ID("init");
201
220
  WxRuby_ID WxRubyComboPopup::lazy_create_ID("lazy_create");
202
221
  WxRuby_ID WxRubyComboPopup::create_ID("create");
@@ -213,8 +232,6 @@ WxRuby_ID WxRubyComboPopup::on_dismiss_ID("on_dismiss");
213
232
  WxRuby_ID WxRubyComboPopup::on_popup_ID("on_popup");
214
233
  WxRuby_ID WxRubyComboPopup::paint_combo_control_ID("paint_combo_control");
215
234
 
216
- std::map<WxRubyComboPopup*, VALUE> WxRubyComboPopup::combo_popup_map;
217
-
218
235
  // Wrapper methods for module Wx::ComboPopup
219
236
 
220
237
  static VALUE wx_combo_popup_get_combo_ctrl(int argc, VALUE *argv, VALUE self)