wxruby3 0.9.0.pre.rc.1 → 0.9.0.pre.rc.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +73 -22
  3. data/README.md +40 -8
  4. data/assets/hello_button-macos.png +0 -0
  5. data/assets/hello_button-msw.png +0 -0
  6. data/assets/hello_button_clicked-macos.png +0 -0
  7. data/assets/hello_button_clicked-msw.png +0 -0
  8. data/assets/hello_button_clicked_combi.png +0 -0
  9. data/assets/hello_world-macos.png +0 -0
  10. data/assets/hello_world-msw.png +0 -0
  11. data/assets/hello_world_combi.png +0 -0
  12. data/ext/wxruby3/swig/wx.i +2 -0
  13. data/lib/wx/core/brush.rb +6 -0
  14. data/lib/wx/core/event_loop.rb +7 -0
  15. data/lib/wx/core/evthandler.rb +12 -2
  16. data/lib/wx/core/font.rb +22 -14
  17. data/lib/wx/core/helpprovider.rb +2 -2
  18. data/lib/wx/core/image.rb +33 -0
  19. data/lib/wx/core/listctrl.rb +17 -13
  20. data/lib/wx/core/log.rb +90 -0
  21. data/lib/wx/core/menu.rb +5 -0
  22. data/lib/wx/core/pen.rb +6 -0
  23. data/lib/wx/core/window.rb +28 -1
  24. data/lib/wx/doc/app.rb +40 -0
  25. data/lib/wx/doc/bitmap.rb +11 -15
  26. data/lib/wx/doc/brush.rb +17 -0
  27. data/lib/wx/doc/event_loop.rb +7 -0
  28. data/lib/wx/doc/extra/00_starting.md +6 -6
  29. data/lib/wx/doc/extra/02_lifecycles.md +9 -8
  30. data/lib/wx/doc/extra/09_exceptions.md +1 -1
  31. data/lib/wx/doc/extra/11_drawing_and_dc.md +4 -4
  32. data/lib/wx/doc/font.rb +27 -0
  33. data/lib/wx/doc/functions.rb +51 -23
  34. data/lib/wx/doc/gc_dc.rb +1 -1
  35. data/lib/wx/doc/image.rb +42 -12
  36. data/lib/wx/doc/list_ctrl.rb +32 -0
  37. data/lib/wx/doc/log.rb +28 -0
  38. data/lib/wx/doc/pen.rb +17 -0
  39. data/lib/wx/doc/prt/printer_dc.rb +2 -2
  40. data/lib/wx/doc/radio_box.rb +20 -0
  41. data/lib/wx/doc/scaled_dc.rb +1 -1
  42. data/lib/wx/doc/text_validator.rb +12 -0
  43. data/lib/wx/doc/window.rb +27 -0
  44. data/lib/wx/keyword_defs.rb +77 -76
  45. data/lib/wx/prt/keyword_defs.rb +5 -1
  46. data/lib/wx/version.rb +1 -1
  47. data/rakelib/install.rb +17 -6
  48. data/rakelib/lib/config/linux.rb +4 -2
  49. data/rakelib/lib/config/macosx.rb +120 -1
  50. data/rakelib/lib/config/mingw.rb +6 -1
  51. data/rakelib/lib/config/unixish.rb +26 -11
  52. data/rakelib/lib/config.rb +15 -6
  53. data/rakelib/lib/core/mapping.rb +15 -10
  54. data/rakelib/lib/core/package.rb +4 -1
  55. data/rakelib/lib/core/spec.rb +23 -12
  56. data/rakelib/lib/core/spec_helper.rb +6 -0
  57. data/rakelib/lib/director/app.rb +30 -1
  58. data/rakelib/lib/director/aui_toolbar.rb +41 -0
  59. data/rakelib/lib/director/brush.rb +10 -1
  60. data/rakelib/lib/director/combobox.rb +1 -1
  61. data/rakelib/lib/director/context_help_button.rb +23 -0
  62. data/rakelib/lib/director/dialog.rb +33 -2
  63. data/rakelib/lib/director/event_loop.rb +26 -0
  64. data/rakelib/lib/director/font.rb +12 -3
  65. data/rakelib/lib/director/functions.rb +44 -48
  66. data/rakelib/lib/director/help_provider.rb +8 -10
  67. data/rakelib/lib/director/hyperlink_event.rb +22 -0
  68. data/rakelib/lib/director/image.rb +32 -0
  69. data/rakelib/lib/director/list_ctrl.rb +3 -2
  70. data/rakelib/lib/director/log.rb +64 -4
  71. data/rakelib/lib/director/menu.rb +0 -3
  72. data/rakelib/lib/director/menu_bar.rb +3 -0
  73. data/rakelib/lib/director/pen.rb +10 -1
  74. data/rakelib/lib/director/popup_window.rb +18 -0
  75. data/rakelib/lib/director/radio_box.rb +15 -4
  76. data/rakelib/lib/director/searchctrl.rb +2 -1
  77. data/rakelib/lib/director/static_box.rb +1 -1
  78. data/rakelib/lib/director/styled_text_ctrl.rb +1 -1
  79. data/rakelib/lib/director/text_entry.rb +30 -0
  80. data/rakelib/lib/director/text_validator.rb +8 -2
  81. data/rakelib/lib/director/textctrl.rb +1 -1
  82. data/rakelib/lib/director/variant.rb +17 -4
  83. data/rakelib/lib/director/window.rb +37 -1
  84. data/rakelib/lib/extractor/function.rb +7 -7
  85. data/rakelib/lib/extractor/variable.rb +6 -6
  86. data/rakelib/lib/generate/doc/aui_manager.yaml +21 -0
  87. data/rakelib/lib/generate/doc/context_help_button.yaml +16 -0
  88. data/rakelib/lib/generate/doc/event_blocker.yaml +27 -0
  89. data/rakelib/lib/generate/doc/event_filter.yaml +47 -0
  90. data/rakelib/lib/generate/doc/file_dialog.yaml +68 -0
  91. data/rakelib/lib/generate/doc/font.yaml +29 -0
  92. data/rakelib/lib/generate/doc/frame.yaml +23 -0
  93. data/rakelib/lib/generate/doc/fs_file.yaml +11 -0
  94. data/rakelib/lib/generate/doc/gdi_common.yaml +36 -0
  95. data/rakelib/lib/generate/doc/graphics_context.yaml +34 -0
  96. data/rakelib/lib/generate/doc/gui_event_loop.yaml +12 -0
  97. data/rakelib/lib/generate/doc/help_controller.yaml +24 -0
  98. data/rakelib/lib/generate/doc/icon.yaml +11 -0
  99. data/rakelib/lib/generate/doc/image.yaml +87 -0
  100. data/rakelib/lib/generate/doc/keyboard_state.yaml +19 -0
  101. data/rakelib/lib/generate/doc/list_ctrl.yaml +77 -0
  102. data/rakelib/lib/generate/doc/locale.yaml +12 -0
  103. data/rakelib/lib/generate/doc/log.yaml +86 -0
  104. data/rakelib/lib/generate/doc/mdi_frame.yaml +12 -0
  105. data/rakelib/lib/generate/doc/memory_dc.yaml +42 -0
  106. data/rakelib/lib/generate/doc/menu.yaml +17 -0
  107. data/rakelib/lib/generate/doc/menu_item.yaml +43 -0
  108. data/rakelib/lib/generate/doc/message_dialog.yaml +36 -0
  109. data/rakelib/lib/generate/doc/non_owned_window.yaml +14 -0
  110. data/rakelib/lib/generate/doc/notebook.yaml +18 -0
  111. data/rakelib/lib/generate/doc/pen.yaml +11 -0
  112. data/rakelib/lib/generate/doc/picker_base.yaml +19 -0
  113. data/rakelib/lib/generate/doc/platform_info.yaml +15 -0
  114. data/rakelib/lib/generate/doc/property_sheet_dialog.yaml +26 -0
  115. data/rakelib/lib/generate/doc/scroll_bar.yaml +11 -0
  116. data/rakelib/lib/generate/doc/scrolled_canvas.yaml +37 -0
  117. data/rakelib/lib/generate/doc/scrolled_control.yaml +37 -0
  118. data/rakelib/lib/generate/doc/scrolled_window.yaml +37 -0
  119. data/rakelib/lib/generate/doc/sizer.yaml +69 -0
  120. data/rakelib/lib/generate/doc/splash_screen.yaml +18 -0
  121. data/rakelib/lib/generate/doc/static_box.yaml +52 -0
  122. data/rakelib/lib/generate/doc/static_box_sizer.yaml +22 -0
  123. data/rakelib/lib/generate/doc/svg_file_dc.yaml +11 -0
  124. data/rakelib/lib/generate/doc/text_ctrl.yaml +19 -0
  125. data/rakelib/lib/generate/doc/text_entry.yaml +42 -0
  126. data/rakelib/lib/generate/doc/text_entry_dialog.yaml +17 -0
  127. data/rakelib/lib/generate/doc/timer_event.yaml +28 -0
  128. data/rakelib/lib/generate/doc/tool_bar.yaml +35 -0
  129. data/rakelib/lib/generate/doc/top_level_window.yaml +23 -0
  130. data/rakelib/lib/generate/doc/validator.yaml +12 -0
  131. data/rakelib/lib/generate/doc/variant.yaml +29 -0
  132. data/rakelib/lib/generate/doc/window.yaml +249 -0
  133. data/rakelib/lib/generate/doc/wizard_page_simple.yaml +14 -0
  134. data/rakelib/lib/generate/doc/xml_node.yaml +7 -0
  135. data/rakelib/lib/generate/doc/xml_resource.yaml +27 -0
  136. data/rakelib/lib/generate/doc.rb +36 -2
  137. data/rakelib/lib/generate/interface.rb +11 -10
  138. data/rakelib/lib/specs/interfaces.rb +5 -1
  139. data/rakelib/lib/swig_runner.rb +37 -0
  140. data/samples/aui/aui.rb +432 -363
  141. data/samples/propgrid/propgrid.rb +3 -0
  142. data/samples/sampler/editor.rb +33 -25
  143. data/samples/sampler/sample.rb +2 -2
  144. data/samples/sampler/stc_editor.rb +4 -2
  145. data/tests/lib/item_container_tests.rb +82 -0
  146. data/tests/lib/text_entry_tests.rb +80 -0
  147. data/tests/lib/wxapp_runner.rb +12 -0
  148. data/tests/lib/wxframe_runner.rb +89 -4
  149. data/tests/test_art.rb +9 -0
  150. data/tests/test_box_sizer.rb +161 -0
  151. data/tests/test_ext_controls.rb +28 -0
  152. data/tests/test_font.rb +239 -0
  153. data/tests/test_grid_sizer.rb +148 -0
  154. data/tests/test_intl.rb +5 -1
  155. data/tests/test_list_ctrl.rb +53 -0
  156. data/tests/test_log.rb +163 -0
  157. data/tests/test_std_controls.rb +321 -37
  158. data/tests/test_timer.rb +95 -0
  159. data/tests/test_window.rb +340 -0
  160. metadata +85 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a325622c35b3b6321d220fe21ef12c341dc640487529e05ae5cc3775b0685c50
4
- data.tar.gz: af2bfd3115f68d2ac2485dad07ede48f45cba4e64fbbfae19d3756dc3c6e9176
3
+ metadata.gz: 9adbc82ffc489a20f1f631d4db04012c1a750d4f71b5241dc5c8647ea024aca4
4
+ data.tar.gz: e6e637da8c206fd334809ab6592f1b89d08fbae59cd518c251f20567e981a314
5
5
  SHA512:
6
- metadata.gz: 8dcc66a0505ea81a55aa8f22b2692ac83c4c055252691ec1122dc8ee11b7119bad00a6bd79cdb8e4cbab7d03f33912818b3c1a6b77f6c7dcddec5b5bd99d62a1
7
- data.tar.gz: 9894a71c94deaef52479339f540cbdff8a02c301bc80c927bd96590c1366d893690eebd7d526ee09d90abe568dcec289233ffc717b4cad123c47e597f44c534b
6
+ metadata.gz: 5b46691fea333ff841c685e5aeabab7e51c0348467b13e95b32dc9ba7ddd3cacf3c19d6861fa0c9f351c17ef20da3175d287ef2ff802bf834a5acffbc41cfe93
7
+ data.tar.gz: 5ba1ebd28a837286b1e840b485d07f9c370f168b831fd11fad523eb095d5eebd93c8bab65911db7f303a5bbb25d6ab9da1556fdb359c2831aa41c21500693592
data/INSTALL.md CHANGED
@@ -4,32 +4,56 @@
4
4
 
5
5
  # Installation of wxRuby3
6
6
 
7
+ Below are installation instructions for Linux, Windows, and Mac (both AMD64 and ARM64).
8
+
9
+ ## Minimal requirements for installing wxRuby3
10
+
11
+ The minimal requirements for installing any source based setup (gem, source package or Github clone) of wxRuby3 are:
12
+
13
+ | Sofware | Notes |
14
+ |-----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15
+ | Ruby | A supported version of the Ruby interpreter needs to be installed. |
16
+ | C++ compiler<br>(incl. dev tools like `make`) | On linux a recent version of the GNU C++ compiler (with c++-14 support) needs to be installed<br>On Windows the RubyInstaller MSYS2-Devkit needs to be installed<br>On MacOS XCode with commandline tools needs to be installed via `sudo xcode-select --install` |
17
+ | Git version control toolkit | |
18
+ | SWIG >= 3.0.12 | On MacOS install [Homebrew](https://brew.sh/) and than `brew install swig` |
19
+ | Doxygen (>= 1.9.1, <= 1.9.6) | Doxygen > 1.9.6 has changes that cause problems with the wxWidgets doxygen files.<br>On MacOS: `brew tap mcorino/wxruby3` and than `brew install doxygen@1.9.6` (default brew recipe installs 1.9.7) |
20
+ | wxWidgets (>= 3.2) | See [wxWidgets installation](#wxwidgets-installation) |
21
+
22
+ The wxRuby3 build process requires `git` to clone a copy of the wxWidgets Github repository to extract the interface
23
+ specifications from.<br>
24
+ The wxRuby3 build process needs doxygen to generated XML files containing wxWidgets interface specs which are used to
25
+ generate SWIG interface definitions from which SWIG to generates C++ source code for the wrapper interfaces from
26
+ which the native extension is compiled.
27
+
7
28
  ## Installation of a wxRuby3 Gem
8
29
 
9
30
  The wxRuby3 project provides gems on [RubyGems](https://rubygems.org) which can be installed with the
10
31
  standard `gem install` command line this:
11
32
 
12
- ```sh
33
+ ```shell
13
34
  gem install wxruby3
14
35
  ```
15
36
 
16
37
  On Linux systems this will install the source based gem which will automatically build the native wxruby3 extension
17
38
  for the platform on which wxRuby3 is being installed.
18
39
  On Windows systems a prebuilt binary gem is available for the latest stable release(s) of [RubyInstaller](https://rubyinstaller.org)
19
- installed rubies that will be installed by default if installing for that platform. Alternatively the source gem can be
20
- installed on Windows by installing with explicit platform specification like this:
40
+ installed rubies that will be installed by default if installing for that platform (including an embedded, latest
41
+ stable version, wxWidgets installation).<br>
42
+ Alternatively the source gem can be installed on Windows by installing with explicit platform specification like this:
21
43
 
22
- ```sh
44
+ ```shell
23
45
  gem install wxruby3 --platform=ruby
24
46
  ```
25
47
 
26
- When installing the source gem the following basic requirements apply:
48
+ When installing the source gem the minimal requirements listed above apply.
27
49
 
28
- - Git version control toolkit
29
- - Ruby 2.5 or later (including development package)
30
- - GNU g++ 4.8 or later on Linux, RubyInstaller+DevKit on Windows
31
- - [SWIG](https://www.swig.org) 3.0.12 or later
32
- - [Doxygen](https://www.doxygen.nl/)
50
+ On MacOS, if wxWidgets was not available, you can pull in the latest wxWidgets and build it by adding the `WITH_WXWIN=1` option:
51
+
52
+ ```shell
53
+ gem install wxruby3 -- WITH_WXWIN=1
54
+ ```
55
+
56
+ ### wxWidgets installation
33
57
 
34
58
  Also a wxWidgets installation (version 3.2 or later) is required for which there are multiple options.
35
59
 
@@ -39,38 +63,65 @@ Also a wxWidgets installation (version 3.2 or later) is required for which there
39
63
  The wxRuby build procedure will determine the availability and version of wxWidgets by locating and calling
40
64
  the `wx-config` utility script. In case no (compatible) wxWidgets version is found installation ends with an error.<br>
41
65
  Please note that even with this method a copy of the wxWidgets project will be checked out from GitHUb as the wxRuby3
42
- build procedure requires access to the wxWidgets interface specification sources (see [here](TODO) for more details).
66
+ build procedure requires access to the wxWidgets interface specification sources which are not normally part of any of
67
+ the standard distribution packages.
43
68
 
69
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;On MacOS, you can install wxWidgets via [Homebrew](https://brew.sh/):
70
+
71
+ ```shell
72
+ brew install wxwidgets
73
+ ```
74
+
75
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Afterwards, you can install the Ruby gem and it will detect wxWidgets in the system automatically:
76
+
77
+ ```shell
78
+ gem install wxruby3
79
+ ```
44
80
 
45
81
  2. User installed wxWidgets version<br>
46
82
  <br>
47
- In case the being system installed on does not provide (a compatible) wxWidgets version or a specific (possibly updated)
83
+ In case the system being installed on does not provide (a compatible) wxWidgets version or a specific (possibly updated)
48
84
  wxWidgets version is required the source gem can be installed using a user installed version like this (where the
49
85
  `WXWIN` path should provide the location where the wxWidgets binaries are installed under `<wxwin path>/bin`):<br>
50
86
 
51
- ```sh
87
+ ```shell
52
88
  gem install wxruby3 -- WXWIN=/path/to/wx/install
53
89
  ```
54
-
55
- 3. Automatic installed wxWidgets version<br>
90
+
91
+ 3. Automatic installed, embedded, wxWidgets version<br>
56
92
  <br>
57
- This is the easiest method when the being system installed on does not provide (a compatible) wxWidgets version (and
93
+ This is the easiest method when the system being installed on does not provide (a compatible) wxWidgets version (and
58
94
  no specific user defined version is required) and can be used by installing the source gem like this (which will
59
- cause automatic checkout and building of the latest wxWidgets release (>= 3.2) from GitHub:
60
-
95
+ cause automatic checkout and building of the latest stable wxWidgets release (>= 3.2) from GitHub:
61
96
 
62
- ```sh
97
+ ```shell
63
98
  gem install wxruby3 -- WITH_WXWIN=1
64
99
  ```
65
100
 
101
+ In case of option **2** it is also possible to do the doxygen XML generation as part of the wxWidgets user installation
102
+ and use that for the gem installation. In that case the user is required to generate the XML interface specs using the
103
+ `regen` script found in the `docs/doxygen` folder of the wxWidgets installation after which the XML output folder can be
104
+ provided to the gem installation as follows:
105
+
106
+ ```shell
107
+ gem install wxruby3 -- WXWIN=/path/to/wx/install WXXML=/path/to/wx/doxygen/xml
108
+ ```
109
+
110
+ Please also not that in case of option two the user is responsible to make sure the wxWidgets shared libraries can be
111
+ found by the system's dynamic loader at runtime.
112
+
66
113
  > **NOTE:** Be patient when installing the source gem. Building wxRuby3 takes a while and when wxWidgets is included event more.
67
114
 
115
+ > **NOTE:** Be aware that for prerelease versions of the gem you should add the `--pre` argument to the `gem install` command.
116
+
68
117
  ## Building from source
69
118
 
70
- Checkout the wxRuby3 sources from [GitHub](https://github.com/mcorino/wxRuby3).
119
+ Checkout the wxRuby3 sources from [GitHub](https://github.com/mcorino/wxRuby3) or download and unpack a release package.
71
120
 
72
- Basic requirements are the same as for installing the source gem. Gem dependencies are listed in the Gemfile in the root
73
- of the wxRuby3 tree.
121
+ Requirements are the same as for installing the source gem. Gem dependencies are listed in the Gemfile in the root
122
+ of the wxRuby3 tree and should be installed by executing `bundle install`.<br>
123
+ To be able to generate HTML documentation the optional `:documentation` group should be included.<br>
124
+ To be able to run the Rake memory check task the option `:develop` group should be included.
74
125
 
75
126
  The wxRuby3 project provides a Rake based build system. Call `rake help` to get an overview of the available commands.
76
127
  As mentioned there the `rake configure` command is required as the very first command. Call `rake configure[--help]` to
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  [![Linux wxGTK](https://github.com/mcorino/wxRuby3/actions/workflows/linux.yml/badge.svg)](https://github.com/mcorino/wxRuby3/actions/workflows/linux.yml)
2
2
  [![Windows wxMSW](https://github.com/mcorino/wxRuby3/actions/workflows/msw.yml/badge.svg)](https://github.com/mcorino/wxRuby3/actions/workflows/msw.yml)
3
+ [![Mac wxOSX](https://github.com/mcorino/wxRuby3/actions/workflows/mac.yml/badge.svg)](https://github.com/mcorino/wxRuby3/actions/workflows/mac.yml)
4
+
3
5
  [![License](https://img.shields.io/badge/license-MIT-yellowgreen.svg)](LICENSE)
4
6
  [![Gem Version](https://badge.fury.io/rb/wxruby3.svg)](https://badge.fury.io/rb/wxruby3)
5
-
6
7
  [![Documentation](https://img.shields.io/badge/docs-pages-blue.svg)](https://mcorino.github.io/wxRuby3)
8
+ [![Chat](https://img.shields.io/gitter/room/mcorino/wxruby)](https://gitter.im/mcorino/wxruby3)
7
9
 
8
10
  # README for wxRuby3
9
11
 
@@ -33,13 +35,13 @@ Wx::App.run do
33
35
  end
34
36
  ```
35
37
 
36
- ![Hello_World](assets/hello_world.png "Hello World sample")
38
+ ![Hello_World](assets/hello_world_combi.png "Hello World sample")
37
39
 
38
40
  ### Hello Button
39
41
 
40
42
  Anyone who is familiar with wxWidgets should feel right at home since the API may be Ruby-fied, it is still easily
41
43
  recognizable (but being Ruby-fied allowing for elegant and compact coding). And for those that do not have previous
42
- experience do not fear, wxRuby3 comes with detailed [documentation](https://mcorino.github.io/wxRuby3/file.00_starting.html) and lots of examples and test.
44
+ experience, do not fear, wxRuby3 comes with detailed [documentation](https://mcorino.github.io/wxRuby3/file.00_starting.html) and lots of examples and tests.
43
45
 
44
46
  ```ruby
45
47
  require 'wx'
@@ -56,8 +58,7 @@ end
56
58
  Wx::App.run { TheFrame.new('Hello world!').show }
57
59
  ```
58
60
 
59
- ![Hello_Button](assets/hello_button.png "Hello Button sample")
60
- ![Hello_Button_Clicked](assets/hello_button_clicked.png "Hello Button sample clicked")
61
+ ![Hello_Button_Clicked](assets/hello_button_clicked_combi.png "Hello Button sample clicked")
61
62
 
62
63
 
63
64
  ## wxRuby3 licence
@@ -99,12 +100,39 @@ Currently the following are fully supported:
99
100
  |----------------------------------------------------------------------------|-----------------| --- |
100
101
  | Windows 10 (tested)<br>(most likely also Windows 11) | Ruby >= 2.5<br>(RubyInstaller MSYS2-DevKit) | wxWidgets >= 3.2 |
101
102
  | Linux (tested; any AMD-64 distribution)<br>(most likely also i686 and ARM) | Ruby >= 2.5 | wxWidgets >= 3.2 |
103
+ | MacOS >= 10.10 using Cocoa (tested on AMD-64 and ARM64 M2 Chip) | Ruby >= 2.5 | wxWidgets >= 3.2 |
102
104
 
103
105
  Support for other platforms is not being actively developed at present,
104
106
  but patches are welcome. It is likely to be much simpler to get wxRuby
105
107
  working on similar modern systems (eg FreeBSD or Solaris with GTK) than
106
108
  on legacy systems (eg Windows 98, Mac OS 9).
107
109
 
110
+ ### How can I install wxRuby3?
111
+
112
+ wxRuby3 is distributed as a Ruby gem on [RubyGems](https://rubygems.org).<br>
113
+ Apart from a regular source-only version of the gem there is also a binary gem version for Windows 10 provided (for the
114
+ latest stable Ruby version at the time of publishing) which includes an embedded wxWidgets installation (also latest
115
+ stable version).
116
+
117
+ Installing the binary gem version on Windows requires no additional software to be installed except for a supported
118
+ version of the Ruby interpreter.<br>
119
+ To install the source-only gem the following software is required:
120
+
121
+ | Sofware | Notes |
122
+ |-----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
123
+ | Ruby | A supported version of the Ruby interpreter needs to be installed. |
124
+ | C++ compiler<br>(incl. dev tools like `make`) | On linux a recent version of the GNU C++ compiler (with c++-14 support) needs to be installed<br>On Windows the RubyInstaller MSYS2-Devkit needs to be installed<br>On MacOS XCode with commandline tools needs to be installed |
125
+ | Git version control toolkit | |
126
+ | SWIG >= 3.0.12 | On MacOS install [Homebrew](https://brew.sh/) and than `brew install swig` |
127
+ | Doxygen (>= 1.9.1, <= 1.9.6) | Doxygen > 1.9.6 has changes that cause problems with the wxWidgets doxygen files.<br>On MacOS: `brew tap mcorino/wxruby3` and than `brew install doxygen@1.9.6` (default brew recipe installs 1.9.7) |
128
+ | wxWidgets >= 3.2 (*OPTIONAL*) | On Linux most distributions provide system installable (development) packages for wxWidgets providing a supported version. Alternatively you can fairly easily install your own preferred version manually (see the [wxWidgets](https://wxwidgets.org) project for details).<br>On Windows and MacOS the process is less straightforward (also here see the [wxWidgets](https://wxwidgets.org) project for details).<br>The wxRuby3 source-only gem can also be installed using a private local wxWidgets installation or an embedded installation (most likely preferred on Windows and MacOS). See [INSTALL](INSTALL.md) for more details. |
129
+
130
+ In case the prerequisites above are met the (source-only or binary) gem can be installed executing the following command:
131
+
132
+ ```shell
133
+ gem install wxruby3
134
+ ```
135
+
108
136
  ### Where can I ask a question, or report a bug?
109
137
 
110
138
  Use GitHUb Issues.
@@ -130,7 +158,7 @@ some use a more modern coding style than others.
130
158
 
131
159
  Complete (more or less) wxRuby API documentation should be part of any
132
160
  complete wxRuby3 build. This tends to focus on providing a reference
133
- of all available modules, classes ad methods and how to use specific
161
+ of all available modules, classes and methods and how to use specific
134
162
  classes and methods, rather than on how to construct an application
135
163
  overall.
136
164
  This documentation (for the latest release) is also available online
@@ -162,7 +190,7 @@ If you know of a feature in wxWidgets that you would like to see
162
190
  supported in wxRuby3 you are free to ask but do not **EXPECT** unconditional
163
191
  agreement or immediate response.
164
192
 
165
- ### How does wxRuby3 relate to the wxRuby 2.0 (and even older 0.6.0 release)?
193
+ ### How does wxRuby3 relate to the wxRuby 2.0 (and even older 0.6.0) release?
166
194
 
167
195
  wxRuby 0.6.0 was the last in a series of releases developed using a
168
196
  different approach in the early days of wxRuby. Work on this series
@@ -180,5 +208,9 @@ maintainable solution.
180
208
 
181
209
  ### I am getting an error trying to install or compile wxRuby3
182
210
 
183
- Please double-check the [INSTALL](INSTALL.md) documents, and search issue archives. If
211
+ Please double-check the instructions above and in the [INSTALL](INSTALL.md) document and search issue archives. If
184
212
  this doesn't help, please post your question using GitHub Issues.
213
+
214
+ ### Is there another, more declarative way, for writing wxRuby3 desktop GUI applications?
215
+
216
+ Yes. [Glimmer DSL for WX](https://github.com/AndyObtiva/glimmer-dsl-wx) enables software engineers to build GUI using wxruby3 following the Ruby way with the least amount of code possible. That is by offering a minimalistic declarative high-level DSL that maps visually to the way software engineers think about the GUI hierarchy in addition to adopting Rails' strategy of Convention over Configuration via smart defaults and automation of wxruby3 low-level details. You can check out the [Glimmer DSL for WX README "Coming From wxruby3" section](https://github.com/AndyObtiva/glimmer-dsl-wx#coming-from-wxruby3) for more information on how to translate wxruby3 apps to [Glimmer DSL for WX](https://github.com/AndyObtiva/glimmer-dsl-wx) syntax.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -270,6 +270,8 @@ const int wxrb_trace_level = 0;
270
270
  #endif
271
271
  %}
272
272
 
273
+ %constant int wxWXWIDGETS_DEBUG_LEVEL = wxDEBUG_LEVEL;
274
+
273
275
  %{
274
276
  #ifdef __WXRB_DEBUG__
275
277
  WXRUBY_EXPORT int wxRuby_TraceLevel()
@@ -0,0 +1,6 @@
1
+
2
+ module Wx
3
+
4
+ TheBrushList = Wx::Brush
5
+
6
+ end
@@ -0,0 +1,7 @@
1
+
2
+ module Wx
3
+
4
+ # simply an alias
5
+ EventLoop = GUIEventLoop
6
+
7
+ end
@@ -22,9 +22,17 @@ class Wx::EvtHandler
22
22
  # methods; used internally by disconnect (see EvtHandler.i)
23
23
  EVENT_NAME_TYPE_MAP = {}
24
24
  private_constant :EVENT_NAME_TYPE_MAP
25
+ # Hash to look up event handler arity from symbol names of evt handler
26
+ # methods; internal use
27
+ EVENT_NAME_EVENT_ARITY_MAP = {}
28
+ private_constant :EVENT_NAME_EVENT_ARITY_MAP
25
29
 
26
30
  class << self
27
31
 
32
+ def event_type_arity(name)
33
+ EVENT_NAME_EVENT_ARITY_MAP[name.to_sym] || 0
34
+ end
35
+
28
36
  def get_event_type_class_map
29
37
  EVENT_TYPE_CLASS_MAP
30
38
  end
@@ -79,8 +87,8 @@ class Wx::EvtHandler
79
87
 
80
88
  # Given the Integer constant Wx::EVT_XXX, returns the convenience
81
89
  # handler method name associated with that type of event.
82
- def self.event_name_for_type(name)
83
- EVENT_NAME_TYPE_MAP.key(name)
90
+ def self.event_name_for_type(evt_id)
91
+ EVENT_NAME_TYPE_MAP.key(evt_id)
84
92
  end
85
93
 
86
94
  # Given an integer value +int_val+, returns the name of the EVT_xxx
@@ -121,6 +129,8 @@ class Wx::EvtHandler
121
129
  return
122
130
  end
123
131
 
132
+ EVENT_NAME_EVENT_ARITY_MAP[ev_type.name.to_sym] = ev_type.arity
133
+
124
134
  # set up the evt_xxx method
125
135
  case ev_type.arity
126
136
  when 0 # events without an id
data/lib/wx/core/font.rb CHANGED
@@ -1,22 +1,30 @@
1
1
 
2
2
  require_relative './font/encoding'
3
3
 
4
- class Wx::Font
5
- class << self
6
- # Returns the name of the platform's default font encoding
7
- def get_default_encoding_name
8
- ENCODING_NAMES[ get_default_encoding ]
9
- end
4
+ module Wx
5
+
6
+ class Font
7
+ class << self
8
+ # Returns the name of the platform's default font encoding
9
+ def get_default_encoding_name
10
+ ENCODING_NAMES[ get_default_encoding ]
11
+ end
10
12
 
11
- # Sets the default encoding to be +enc+, which may be the string
12
- # name of an encoding (eg 'UTF8') or an internal WxWidgets flag
13
- # (eg Wx::FONTENCODING_UTF8).
14
- def set_default_encoding_name(enc)
15
- if flag_int = ENCODING_NAMES.index(enc.upcase)
16
- set_default_encoding(Wx::FontEncoding.new(flag_int))
17
- else
18
- raise ArgumentError, "Unknown font encoding name '#{enc}'"
13
+ # Sets the default encoding to be +enc+, which may be the string
14
+ # name of an encoding (eg 'UTF8') or an internal WxWidgets flag
15
+ # (eg Wx::FONTENCODING_UTF8).
16
+ def set_default_encoding_name(enc)
17
+ if flag_int = ENCODING_NAMES.index(enc.upcase)
18
+ set_default_encoding(Wx::FontEncoding.new(flag_int))
19
+ else
20
+ raise ArgumentError, "Unknown font encoding name '#{enc}'"
21
+ end
19
22
  end
20
23
  end
21
24
  end
25
+
26
+ # make this simply an alias for the Font class so the #find_or_create_font methods
27
+ # can be accessed through that name too.
28
+ TheFontList = Font
29
+
22
30
  end
@@ -6,9 +6,9 @@ class Wx::HelpProvider
6
6
  # SWIG Director; it can't be reaped and re-wrapped later. The
7
7
  # easiest way is to make the currently set one an instance variable
8
8
  # of this class
9
- alias :__wx_set :set
9
+ wx_set = instance_method :set
10
10
  define_method(:set) do | help_provider |
11
- __wx_set(help_provider)
11
+ wx_set.bind(self).call(help_provider)
12
12
  @__hp__ = help_provider
13
13
  end
14
14
  end
data/lib/wx/core/image.rb CHANGED
@@ -66,6 +66,39 @@ module Wx
66
66
  def convert_to_bitmap
67
67
  Wx::Bitmap.from_image(self)
68
68
  end
69
+
70
+ module Histogram
71
+
72
+ def make_key(r, g, b)
73
+ (r << 16) | (g << 8) | b
74
+ end
75
+
76
+ def find_first_unused_colour(r=1, g=0, b=0)
77
+ while self.has_key?(make_key(r,g,b))
78
+ if r >= 254
79
+ r = 0
80
+ if g >= 254
81
+ return nil if b >= 254
82
+ g = 0
83
+ b += 1
84
+ else
85
+ g += 1
86
+ end
87
+ else
88
+ r += 1
89
+ end
90
+ end
91
+ [r, g, b]
92
+ end
93
+
94
+ end
95
+
96
+ wx_compute_histogram = instance_method :compute_histogram
97
+ define_method :compute_histogram do
98
+ hist_hash = wx_compute_histogram.bind(self).call
99
+ hist_hash.extend Histogram
100
+ hist_hash
101
+ end
69
102
  end
70
103
 
71
104
  def self.Image(name, bmp_type = nil, *rest)
@@ -3,8 +3,23 @@ class Wx::ListCtrl
3
3
  # Make these ruby enumerables so find, find_all, map are available
4
4
  include Enumerable
5
5
  # Passes each valid item index into the passed block
6
- def each
7
- 0.upto(item_count - 1) { | i | yield i }
6
+ def each(&block)
7
+ if block_given?
8
+ 0.upto(item_count - 1) { | i | block.call(i) }
9
+ else
10
+ ::Enumerator.new { |y| each { | i | y << i } }
11
+ end
12
+ end
13
+
14
+ def each_selected(&block)
15
+ if block_given?
16
+ item = -1
17
+ while (item = get_next_item(item, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED)) >= 0
18
+ block.call(item)
19
+ end
20
+ else
21
+ ::Enumerator.new { |y| each_selected { | i | y << i } }
22
+ end
8
23
  end
9
24
 
10
25
  # Returns an Array containing the indexes of the currently selected
@@ -19,15 +34,4 @@ class Wx::ListCtrl
19
34
  selections
20
35
  end
21
36
 
22
- # # Stub version for LC_VIRTUAL controls that does nothing; may be
23
- # # overridden in subclasses.
24
- # def on_get_item_attr(i)
25
- # nil
26
- # end
27
- #
28
- # # Stub version for LC_VIRTUAL|LC_REPORT controls that does nothing;
29
- # # may be overridden in subclasses.
30
- # def on_get_item_column_image(i, col)
31
- # -1
32
- # end
33
37
  end
data/lib/wx/core/log.rb CHANGED
@@ -14,7 +14,97 @@ module Wx
14
14
  alias :timestamp= :set_timestamp
15
15
  alias :verbose :get_verbose
16
16
  alias :verbose= :set_verbose
17
+
18
+ def set_component(comp)
19
+ @component = comp ? comp.to_s : comp
20
+ end
21
+ private :set_component
22
+
23
+ def component
24
+ @component
25
+ end
26
+
27
+ def for_component(comp, &block)
28
+ old_comp = component
29
+ set_component(comp)
30
+ begin
31
+ block.call if block_given?
32
+ ensure
33
+ set_component(old_comp)
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ end
40
+
41
+ class << self
42
+
43
+ def setup_log_info(fmt, args, filename, line, func, component)
44
+ # as wxRuby apps will ever only log from the main thread the only reason why
45
+ # log info data may be retained beyond the execution scope of the current
46
+ # log action is because of log repetition counting which will retain the
47
+ # first log info instance of a repeating message sequence
48
+
49
+ # format message
50
+ msg = fmt % args
51
+ log_info = {
52
+ filename: if filename
53
+ filename.to_s
54
+ else
55
+ filename
56
+ end,
57
+ line: line,
58
+ func: if func
59
+ func.to_s
60
+ else
61
+ func
62
+ end,
63
+ component: if component
64
+ component.to_s
65
+ else
66
+ Log.component
67
+ end
68
+ }
69
+ if Wx::Log.get_repetition_counting && @last_msg != msg
70
+ # refresh cache
71
+ @last_msg = msg
72
+ @last_info = log_info
73
+ end
74
+ [msg, log_info]
75
+ end
76
+ private :setup_log_info
77
+
78
+ wx_log_generic = self.instance_method :log_generic
79
+ define_method :log_generic do |lvl, fmt, *args, filename: nil, line: 0, func: nil, component: nil|
80
+ wx_log_generic.bind(self).call(lvl, *setup_log_info(fmt, args, filename, line, func, component))
17
81
  end
82
+
83
+ wx_log_info = self.instance_method :log_info
84
+ define_method :log_info do |fmt, *args, filename: nil, line: 0, func: nil, component: nil|
85
+ wx_log_info.bind(self).call(*setup_log_info(fmt, args, filename, line, func, component))
86
+ end
87
+
88
+ wx_log_verbose = self.instance_method :log_verbose
89
+ define_method :log_verbose do |fmt, *args, filename: nil, line: 0, func: nil, component: nil|
90
+ wx_log_verbose.bind(self).call(*setup_log_info(fmt, args, filename, line, func, component))
91
+ end
92
+
93
+ wx_log_message = self.instance_method :log_message
94
+ define_method :log_message do |fmt, *args, filename: nil, line: 0, func: nil, component: nil|
95
+ wx_log_message.bind(self).call(*setup_log_info(fmt, args, filename, line, func, component))
96
+ end
97
+
98
+ wx_log_warning = self.instance_method :log_warning
99
+ define_method :log_warning do |fmt, *args, filename: nil, line: 0, func: nil, component: nil|
100
+ wx_log_warning.bind(self).call(*setup_log_info(fmt, args, filename, line, func, component))
101
+ end
102
+
103
+ wx_log_error = self.instance_method :log_error
104
+ define_method :log_error do |fmt, *args, filename: nil, line: 0, func: nil, component: nil|
105
+ wx_log_error.bind(self).call(*setup_log_info(fmt, args, filename, line, func, component))
106
+ end
107
+
18
108
  end
19
109
 
20
110
  end
data/lib/wx/core/menu.rb CHANGED
@@ -75,4 +75,9 @@ class Wx::Menu
75
75
  methods_with_optional_ids_and_pos :insert,
76
76
  :insert_check_item,
77
77
  :insert_radio_item
78
+
79
+ # wxRuby2 backward compatibility version; no alias as #append has been altered above
80
+ def append_item(*args)
81
+ append(*args)
82
+ end
78
83
  end
@@ -0,0 +1,6 @@
1
+
2
+ module Wx
3
+
4
+ ThePenList = Wx::Pen
5
+
6
+ end
@@ -1,5 +1,6 @@
1
1
  # Copyright 2004-2007 by Kevin Smith
2
- # released under the MIT-style wxruby2 license
2
+ # Copyright 2022 by Martin Corino
3
+ # released under the MIT(-style) wxruby2/3 license
3
4
 
4
5
  # The base class for all things displayed on screen
5
6
  class Wx::Window
@@ -69,4 +70,30 @@ class Wx::Window
69
70
  self.paint(&block)
70
71
  end
71
72
  end
73
+
74
+ # implement non-static variants of these
75
+
76
+ def from_dip(*args)
77
+ Wx::Window.from_dip(*args, self)
78
+ end
79
+ def to_dip(*args)
80
+ Wx::Window.to_dip(*args, self)
81
+ end
82
+
83
+ def from_phys(*args)
84
+ Wx::Window.from_phys(*args, self)
85
+ end
86
+ def to_phys(*args)
87
+ Wx::Window.to_phys(*args, self)
88
+ end
89
+
90
+ # implement Window update locker
91
+ def locked(&block)
92
+ self.freeze
93
+ begin
94
+ block.call if block_given?
95
+ ensure
96
+ self.thaw
97
+ end
98
+ end
72
99
  end