wxruby3 0.9.8 → 1.0.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.
- checksums.yaml +4 -4
- data/INSTALL.md +23 -1
- data/README.md +12 -26
- data/ext/mkrf_conf_ext.rb +11 -7
- data/lib/wx/core/app.rb +16 -0
- data/lib/wx/core/colour.rb +36 -28
- data/lib/wx/core/const.rb +19 -0
- data/lib/wx/core/enum.rb +17 -1
- data/lib/wx/core/geometry.rb +121 -0
- data/lib/wx/core/graphics_pen_info.rb +18 -0
- data/lib/wx/core/image.rb +49 -0
- data/lib/wx/core/menu_bar.rb +11 -0
- data/lib/wx/core/paintdc.rb +9 -3
- data/lib/wx/doc/app.rb +97 -41
- data/lib/wx/doc/bitmap.rb +4 -0
- data/lib/wx/doc/client_dc.rb +2 -2
- data/lib/wx/doc/clipboard.rb +1 -1
- data/lib/wx/doc/colour.rb +12 -0
- data/lib/wx/doc/const.rb +16 -0
- data/lib/wx/doc/cursor.rb +4 -0
- data/lib/wx/doc/dc_overlay.rb +34 -0
- data/lib/wx/doc/enum.rb +7 -1
- data/lib/wx/doc/event_blocker.rb +1 -1
- data/lib/wx/doc/evthandler.rb +25 -3
- data/lib/wx/doc/functions.rb +3 -6
- data/lib/wx/doc/gc_dc.rb +13 -4
- data/lib/wx/doc/geometry.rb +136 -0
- data/lib/wx/doc/graphics_context.rb +25 -7
- data/lib/wx/doc/icon.rb +4 -0
- data/lib/wx/doc/image.rb +56 -0
- data/lib/wx/doc/list_ctrl.rb +6 -6
- data/lib/wx/doc/memory_dc.rb +2 -11
- data/lib/wx/doc/mirror_dc.rb +1 -1
- data/lib/wx/doc/pen.rb +26 -0
- data/lib/wx/doc/persistence_manager.rb +1 -1
- data/lib/wx/doc/persistent_object.rb +1 -1
- data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
- data/lib/wx/doc/prt/printer_dc.rb +2 -2
- data/lib/wx/doc/region_iterator.rb +1 -1
- data/lib/wx/doc/scaled_dc.rb +1 -1
- data/lib/wx/doc/screen_dc.rb +1 -1
- data/lib/wx/doc/svg_file_dc.rb +1 -1
- data/lib/wx/doc/textctrl.rb +1 -1
- data/lib/wx/doc/tree_ctrl.rb +2 -2
- data/lib/wx/doc/validator.rb +6 -6
- data/lib/wx/doc/variant.rb +2 -2
- data/lib/wx/doc/window.rb +5 -4
- data/lib/wx/grid/keyword_defs.rb +1 -1
- data/lib/wx/html/keyword_defs.rb +3 -3
- data/lib/wx/keyword_defs.rb +76 -71
- data/lib/wx/pg/keyword_defs.rb +2 -2
- data/lib/wx/pg/pg_property.rb +12 -0
- data/lib/wx/rbn/keyword_defs.rb +1 -1
- data/lib/wx/rtc/keyword_defs.rb +1 -1
- data/lib/wx/stc/keyword_defs.rb +1 -1
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/cmd/setup.rb +3 -0
- data/rakelib/configure.rb +7 -0
- data/rakelib/gem.rake +2 -1
- data/rakelib/gem.rb +3 -2
- data/rakelib/lib/config/linux.rb +1 -1
- data/rakelib/lib/config/unixish.rb +6 -7
- data/rakelib/lib/config.rb +25 -4
- data/rakelib/lib/core/include/enum.inc +31 -1
- data/rakelib/lib/director/affine_matrix.rb +51 -0
- data/rakelib/lib/director/app.rb +29 -13
- data/rakelib/lib/director/art_provider.rb +4 -0
- data/rakelib/lib/director/cursor.rb +6 -2
- data/rakelib/lib/director/dc.rb +1 -6
- data/rakelib/lib/director/derived_dc.rb +88 -31
- data/rakelib/lib/director/dialog.rb +0 -8
- data/rakelib/lib/director/geometry.rb +142 -0
- data/rakelib/lib/director/graphics_context.rb +3 -2
- data/rakelib/lib/director/graphics_object.rb +18 -25
- data/rakelib/lib/director/image.rb +59 -0
- data/rakelib/lib/director/menu.rb +2 -3
- data/rakelib/lib/director/menu_bar.rb +0 -3
- data/rakelib/lib/director/pen.rb +1 -1
- data/rakelib/lib/director/richtext_ctrl.rb +1 -1
- data/rakelib/lib/director/system_settings.rb +1 -1
- data/rakelib/lib/director/window.rb +4 -3
- data/rakelib/lib/extractor/function.rb +1 -1
- data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
- data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
- data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
- data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
- data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
- data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
- data/rakelib/lib/generate/doc/icon.yaml +10 -0
- data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
- data/rakelib/lib/generate/doc/log.yaml +1 -1
- data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
- data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
- data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
- data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
- data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
- data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
- data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
- data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
- data/rakelib/lib/generate/doc/wizard.yaml +27 -0
- data/rakelib/lib/generate/doc.rb +4 -4
- data/rakelib/lib/generate/interface.rb +1 -1
- data/rakelib/lib/specs/interfaces.rb +3 -0
- data/rakelib/lib/swig_runner.rb +24 -3
- data/rakelib/lib/typemap/points_list.rb +8 -2
- data/rakelib/lib/typemap/richtext.rb +17 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
- data/samples/dialogs/wizard.rb +20 -19
- data/samples/drawing/art/drawing/image.bmp +0 -0
- data/samples/drawing/art/drawing/mask.bmp +0 -0
- data/samples/drawing/art/drawing/pat35.bmp +0 -0
- data/samples/drawing/art/drawing/pat36.bmp +0 -0
- data/samples/drawing/art/drawing/pat4.bmp +0 -0
- data/samples/drawing/art/drawing/smile.xpm +42 -0
- data/samples/drawing/drawing.rb +2276 -0
- data/samples/drawing/tn_drawing.png +0 -0
- data/samples/html/html.rb +1 -1
- data/samples/propgrid/propgrid.rb +1 -1
- data/samples/propgrid/propgrid_minimal.rb +1 -1
- data/samples/propgrid/sample_props.rb +1 -1
- data/samples/sampler/editor.rb +13 -11
- data/samples/sampler.rb +14 -10
- data/samples/text/richtext.rb +53 -0
- data/samples/text/scintilla.rb +1 -1
- data/samples/text/unicode.rb +4 -4
- data/tests/test_ext_controls.rb +12 -5
- data/tests/test_std_controls.rb +12 -12
- metadata +30 -30
- data/lib/wx/doc/extra/00_starting.md +0 -154
- data/lib/wx/doc/extra/01_packages.md +0 -180
- data/lib/wx/doc/extra/02_lifecycles.md +0 -166
- data/lib/wx/doc/extra/03_dialogs.md +0 -57
- data/lib/wx/doc/extra/04_enums.md +0 -143
- data/lib/wx/doc/extra/05_event-handling.md +0 -191
- data/lib/wx/doc/extra/06_geometry.md +0 -62
- data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
- data/lib/wx/doc/extra/08_extensions.md +0 -144
- data/lib/wx/doc/extra/09_exceptions.md +0 -54
- data/lib/wx/doc/extra/10_art.md +0 -111
- data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
- data/lib/wx/doc/extra/12_client_data.md +0 -89
- data/lib/wx/doc/extra/13_validators.md +0 -139
- data/lib/wx/doc/extra/14_config.md +0 -101
- data/lib/wx/doc/extra/15_persistence.md +0 -148
- data/samples/sampler/back.xpm +0 -21
- data/samples/sampler/copy.xpm +0 -44
- data/samples/sampler/cut.xpm +0 -46
- data/samples/sampler/filesave.xpm +0 -42
- data/samples/sampler/find.xpm +0 -62
- data/samples/sampler/findrepl.xpm +0 -63
- data/samples/sampler/forward.xpm +0 -21
- data/samples/sampler/paste.xpm +0 -46
- data/samples/sampler/redo.xpm +0 -58
- data/samples/sampler/undo.xpm +0 -58
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 22f63fb730a7c17f84eac51d892cad2f35ef33211d88fafde508fe7c222712e6
|
|
4
|
+
data.tar.gz: 2cf9e0b4026e8c00b24873e77af5f4d5676e5af3181e6459104b5c6fef0675d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48cce7a08e4f4bd15380178cab3ab38b53af6942d5054af617806d5b01bea0aabc26887ec26fc07a6bb6c2d9802ec512d59396a2361c88a12635ebf80b066d91
|
|
7
|
+
data.tar.gz: eba7856af27dcfe0e4eb50662bae9bb00af12f29258e0eb4b2d446c3351446651926e2e5c0eec017038fef2545671e8ac47faea0f75c1bb3efd54c751585ae08
|
data/INSTALL.md
CHANGED
|
@@ -334,6 +334,21 @@ wxruby setup --with-wxwin
|
|
|
334
334
|
|
|
335
335
|
This will force the setup procedure to build and install an embedded wxWidgets version for wxRuby3.
|
|
336
336
|
|
|
337
|
+
#### Force embedded wxWidgets head installation
|
|
338
|
+
|
|
339
|
+
To force the setup procedure to build and install an embedded wxWidgets head (master) version the setup procedure can
|
|
340
|
+
be started with the `--with-wxhead` option like this:
|
|
341
|
+
|
|
342
|
+
```shell
|
|
343
|
+
wxruby setup --with-wxhead
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
> **NOTE**<br>
|
|
347
|
+
> Although wxRuby3 endeavors to keep up to date with the wxWidgets master branch your mileage may vary depending on
|
|
348
|
+
> the development state of the wxWidgets master branch. You can check the latest results of the wxRuby3 CI master build
|
|
349
|
+
> workflows of the [wxRuby3 Github Actions](https://github.com/mcorino/wxRuby3/actions) to get a feel of the current
|
|
350
|
+
> integration state.
|
|
351
|
+
|
|
337
352
|
#### Setup with user installed wxWidgets
|
|
338
353
|
|
|
339
354
|
In case of a (custom) user installation of wxWidgets the `--wxwin` (and optionally `--wxxml`) option(s) can be used to
|
|
@@ -357,6 +372,13 @@ wxruby setup --wxwin=/my/custom/wxWidgets --wxxml=/my/alternate/wxWidgets/xml
|
|
|
357
372
|
> responsible for making sure the wxRuby3 extension library can find the wxWidgets libraries at runtime (normally this
|
|
358
373
|
> requires updating the standard shared library search path for the platform).
|
|
359
374
|
|
|
375
|
+
> **NOTE 2**<br>
|
|
376
|
+
> Please be aware that when building a user installation of wxWidgets on Windows this has to be done using the exact
|
|
377
|
+
> same compiler suite as used for building Ruby (and it's standard native extensions) itself.<br>
|
|
378
|
+
> Currently only RubyInstaller versions are supported which use the MingW64 compiler.
|
|
379
|
+
> Do **NOT** install a separate MSYS2/MingW64 release but rather use a RubyInstaller version with integrated DevKit
|
|
380
|
+
> installation (which includes MSYS2 and the right MingW64 compiler suite).
|
|
381
|
+
|
|
360
382
|
#### Setup with customized tool paths
|
|
361
383
|
|
|
362
384
|
If for whatever reason the required development tools `doxygen`, `swig` and/or `git` have been installed in a location
|
|
@@ -493,6 +515,6 @@ commands are executed using parallel task execution by default.
|
|
|
493
515
|
When the build has finished without errors the regression tests can be run by calling `rake test`.
|
|
494
516
|
|
|
495
517
|
After successfully building the wxRuby3 extension libraries (and possibly embedded wxWidgets libraries) a binary package
|
|
496
|
-
can be created by
|
|
518
|
+
can be created by calling `rake binpkg`.
|
|
497
519
|
|
|
498
520
|
For more details concerning the wxRuby3 development strategy and build options see [here](TODO).
|
data/README.md
CHANGED
|
@@ -41,7 +41,8 @@ end
|
|
|
41
41
|
|
|
42
42
|
Anyone who is familiar with wxWidgets should feel right at home since the API may be Ruby-fied, it is still easily
|
|
43
43
|
recognizable (but being Ruby-fied allowing for elegant and compact coding). And for those that do not have previous
|
|
44
|
-
experience, do not fear, wxRuby3 comes with
|
|
44
|
+
experience, do not fear, wxRuby3 comes with an extensive [User Guide](https://github.com/mcorino/wxRuby3/wiki/User-Guide-%3A-Introduction)
|
|
45
|
+
and detailed [reference documentation](https://mcorino.github.io/wxRuby3) and lots of examples and tests.
|
|
45
46
|
|
|
46
47
|
```ruby
|
|
47
48
|
require 'wx'
|
|
@@ -90,7 +91,9 @@ README and license files for details.
|
|
|
90
91
|
See [here](CREDITS.md) for more details on and acknowledgement of the developers
|
|
91
92
|
of these products.
|
|
92
93
|
|
|
93
|
-
##
|
|
94
|
+
## (Some of the) Most Frequently Asked Questions
|
|
95
|
+
|
|
96
|
+
(see the extended [FAQ](https://github.com/mcorino/wxRuby3/wiki/Frequently-Asked-Questions) in the [Wiki](https://github.com/mcorino/wxRuby3/wiki) for more information)
|
|
94
97
|
|
|
95
98
|
### What platforms and operating systems are supported in wxRuby3?
|
|
96
99
|
|
|
@@ -158,10 +161,10 @@ Use GitHUb Issues.
|
|
|
158
161
|
|
|
159
162
|
When asking a question, if something is not working as you expect,
|
|
160
163
|
please provide a *minimal*, *runnable* sample of code that demonstrates
|
|
161
|
-
the problem, and
|
|
164
|
+
the problem, and describe clearly what you expected to happen and what actually
|
|
162
165
|
happened. Please also provide basic details of your platform, Ruby,
|
|
163
166
|
wxRuby and wxWidgets version, and make a reasonable effort to find answers
|
|
164
|
-
in the archive and documentation before posting. People are mostly happy
|
|
167
|
+
in the archive, wiki and/or documentation before posting. People are mostly happy
|
|
165
168
|
to help, but it's too much to expect them to guess what you're trying to
|
|
166
169
|
do, or try and debug 1,000 lines of your application.
|
|
167
170
|
Very important also; do not use offensive language and be **polite**.
|
|
@@ -177,13 +180,17 @@ some use a more modern coding style than others. Use the bundled `wxruby`
|
|
|
177
180
|
CLI to access the samples (see the section **Bundled CLI** in
|
|
178
181
|
the [INSTALL](INSTALL.md) document for more details).
|
|
179
182
|
|
|
183
|
+
An extensive [User Guide](https://github.com/mcorino/wxRuby3/wiki/User-Guide-%3A-Introduction)
|
|
184
|
+
is available at the [wxRuby3 Wiki](https://github.com/mcorino/wxRuby3/wiki) providing detailed
|
|
185
|
+
information about how to build desktop applications with wxRuby3.
|
|
186
|
+
|
|
180
187
|
Complete (more or less) wxRuby API documentation should be part of any
|
|
181
188
|
complete wxRuby3 build. This tends to focus on providing a reference
|
|
182
189
|
of all available modules, classes and methods and how to use specific
|
|
183
190
|
classes and methods, rather than on how to construct an application
|
|
184
191
|
overall.
|
|
185
192
|
This documentation (for the latest release) is also available online
|
|
186
|
-
[here](https://mcorino.github.io/wxRuby3
|
|
193
|
+
[here](https://mcorino.github.io/wxRuby3).
|
|
187
194
|
|
|
188
195
|
One of the advantages of wxRuby3 is the much larger ecosystem of
|
|
189
196
|
wxWidgets and wxPython resources out there. There is a book for
|
|
@@ -199,18 +206,6 @@ example, if you wanted answers about the "Grid" class, try searching for
|
|
|
199
206
|
"wxGrid" as this will turn up results relating to wxWidgets and wxPython
|
|
200
207
|
which may be relevant.
|
|
201
208
|
|
|
202
|
-
### What wxWidgets features are supported by wxRuby3?
|
|
203
|
-
|
|
204
|
-
wxRuby supports almost all of the wxWidgets 3.2+ GUI API, providing over
|
|
205
|
-
600 classes in total. wxWidgets classes that provide general and/or non-GUI
|
|
206
|
-
programming support features, such as strings, networking, threading, database
|
|
207
|
-
access and such are not and will never be ported, as it's assumed that
|
|
208
|
-
in all these cases it's preferable to use pure Ruby features.
|
|
209
|
-
|
|
210
|
-
If you know of a feature in wxWidgets that you would like to see
|
|
211
|
-
supported in wxRuby3 you are free to ask but do not **EXPECT** unconditional
|
|
212
|
-
agreement or immediate response.
|
|
213
|
-
|
|
214
209
|
### How does wxRuby3 relate to the wxRuby 2.0 (and even older 0.6.0) release?
|
|
215
210
|
|
|
216
211
|
wxRuby 0.6.0 was the last in a series of releases developed using a
|
|
@@ -231,12 +226,3 @@ maintainable solution.
|
|
|
231
226
|
|
|
232
227
|
Please double-check the instructions above and in the [INSTALL](INSTALL.md) document and search issue archives. If
|
|
233
228
|
this doesn't help, please post your question using GitHub Issues.
|
|
234
|
-
|
|
235
|
-
### Is there another, more declarative way, for writing wxRuby3 desktop GUI applications?
|
|
236
|
-
|
|
237
|
-
Yes. [Glimmer DSL for WX](https://github.com/AndyObtiva/glimmer-dsl-wx) enables software engineers to build GUI
|
|
238
|
-
using wxruby3 following the Ruby way with the least amount of code possible. That is by offering a minimalistic
|
|
239
|
-
declarative high-level DSL that maps visually to the way software engineers think about the GUI hierarchy in addition
|
|
240
|
-
to adopting Rails' strategy of Convention over Configuration via smart defaults and automation of wxruby3 low-level
|
|
241
|
-
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
|
|
242
|
-
how to translate wxruby3 apps to [Glimmer DSL for WX](https://github.com/AndyObtiva/glimmer-dsl-wx) syntax.
|
data/ext/mkrf_conf_ext.rb
CHANGED
|
@@ -12,8 +12,8 @@ OPTIONS = {
|
|
|
12
12
|
until ARGV.empty?
|
|
13
13
|
switch = ARGV.shift
|
|
14
14
|
case switch
|
|
15
|
-
when /^prebuilt=(none|only)$/
|
|
16
|
-
OPTIONS[:prebuilt] = $1
|
|
15
|
+
when /^prebuilt=(none|only|head)$/
|
|
16
|
+
OPTIONS[:prebuilt] = $1.to_sym
|
|
17
17
|
when /^package=(.+)$/
|
|
18
18
|
OPTIONS[:package] = $1
|
|
19
19
|
when 'help'
|
|
@@ -41,14 +41,18 @@ until ARGV.empty?
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
task_args =
|
|
44
|
+
task_args = []
|
|
45
45
|
unless OPTIONS[:prebuilt].nil?
|
|
46
|
-
|
|
46
|
+
case OPTIONS[:prebuilt]
|
|
47
|
+
when :only
|
|
48
|
+
task_args << "'--prebuilt'"
|
|
49
|
+
when :none
|
|
50
|
+
task_args << "'--no-prebuilt'"
|
|
51
|
+
end
|
|
47
52
|
end
|
|
48
53
|
if OPTIONS[:package]
|
|
49
|
-
task_args << ', ' unless task_args.empty?
|
|
50
54
|
pkg = RUBY_PLATFORM =~ /mingw/ ? OPTIONS[:package].gsub('\\', '/') : OPTIONS[:package] # make sure the path is URI compatible
|
|
51
|
-
task_args << "'--package'
|
|
55
|
+
task_args << "'--package'" << "'#{pkg}'"
|
|
52
56
|
end
|
|
53
57
|
|
|
54
58
|
# generate new rakefile with appropriate default task (calls actual task in rakelib)
|
|
@@ -61,7 +65,7 @@ File.open('../Rakefile', 'w') do |f|
|
|
|
61
65
|
|
|
62
66
|
unless File.file?(File.join('lib', 'wx', 'wxruby_core.so'))
|
|
63
67
|
task :default do
|
|
64
|
-
Rake::Task['wxruby:gem:install'].invoke(#{task_args})
|
|
68
|
+
Rake::Task['wxruby:gem:install'].invoke(#{task_args.join(', ')})
|
|
65
69
|
end
|
|
66
70
|
end
|
|
67
71
|
EOF__
|
data/lib/wx/core/app.rb
CHANGED
|
@@ -14,6 +14,22 @@ require_relative './ext'
|
|
|
14
14
|
# Controller class which creates and manages all windows.
|
|
15
15
|
class Wx::App
|
|
16
16
|
|
|
17
|
+
if Wx::PLATFORM == 'WXOSX'
|
|
18
|
+
class << self
|
|
19
|
+
# provide aliases for macosx specials
|
|
20
|
+
alias :mac_about_menu_itemid= :set_mac_about_menu_itemid
|
|
21
|
+
alias :mac_about_menu_itemid :get_mac_about_menu_itemid
|
|
22
|
+
alias :mac_preferences_menu_itemid= :set_mac_preferences_menu_itemid
|
|
23
|
+
alias :mac_preferences_menu_itemid :get_mac_preferences_menu_itemid
|
|
24
|
+
alias :mac_exit_menu_itemid= :set_mac_exit_menu_itemid
|
|
25
|
+
alias :mac_exit_menu_itemid :get_mac_exit_menu_itemid
|
|
26
|
+
alias :mac_help_menu_title= :set_mac_help_menu_title
|
|
27
|
+
alias :mac_help_menu_title :get_mac_help_menu_title
|
|
28
|
+
alias :mac_window_menu_title= :set_mac_window_menu_title
|
|
29
|
+
alias :mac_window_menu_title :get_mac_window_menu_title
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
17
33
|
# convenience method to retrieve global Wx::App instance
|
|
18
34
|
def self.the_app
|
|
19
35
|
if Wx::const_defined?(:THE_APP) and Wx::THE_APP.is_running
|
data/lib/wx/core/colour.rb
CHANGED
|
@@ -6,37 +6,45 @@
|
|
|
6
6
|
# Copyright 2004-2007, wxRuby development team
|
|
7
7
|
# released under the MIT-like wxRuby2 license
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
require_relative 'ext'
|
|
10
|
+
|
|
11
|
+
module Wx
|
|
12
|
+
|
|
13
|
+
Wx.add_delayed_constant(self, :TRANSPARENT_COLOUR, 'Wx::Colour.new(0, 0, 0, Wx::ALPHA_TRANSPARENT)') { Wx::Colour.new(0, 0, 0, Wx::ALPHA_TRANSPARENT) }
|
|
14
|
+
|
|
15
|
+
class Colour
|
|
16
|
+
# Redefine the initialize method so it raises an exception if an
|
|
17
|
+
# invalid colour value is given. This might be an unknown colour
|
|
18
|
+
# string (eg 'dark blue') or out-of-bounds integer values (<0 or >255)
|
|
19
|
+
wx_init = self.instance_method(:initialize)
|
|
20
|
+
define_method(:initialize) do | *args |
|
|
21
|
+
begin
|
|
22
|
+
wx_init.bind(self).call(*args)
|
|
23
|
+
# Invalid integer values raise SWIG 'no matching func'
|
|
24
|
+
rescue ArgumentError, TypeError
|
|
25
|
+
Kernel.raise ArgumentError, "Invalid colour values #{args.inspect}"
|
|
26
|
+
end
|
|
20
27
|
end
|
|
21
|
-
end
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
# Missing Standard colour
|
|
30
|
+
Wx::MAGENTA = new(255, 0, 255)
|
|
31
|
+
|
|
32
|
+
# Colours are equal to one another if they have the same red, green
|
|
33
|
+
# and blue intensity, and the same alpha
|
|
34
|
+
def ==(other)
|
|
35
|
+
case other
|
|
36
|
+
when Wx::Colour
|
|
37
|
+
[ self.red, self.green, self.blue, self.alpha ] ==
|
|
38
|
+
[ other.red, other.green, other.blue, other.alpha ]
|
|
39
|
+
else
|
|
40
|
+
false
|
|
41
|
+
end
|
|
35
42
|
end
|
|
36
|
-
end
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
# More informative output for inspect etc
|
|
45
|
+
def to_s
|
|
46
|
+
"#<Wx::Colour: (#{red}, #{green}, #{blue} *#{alpha})>"
|
|
47
|
+
end
|
|
41
48
|
end
|
|
49
|
+
|
|
42
50
|
end
|
data/lib/wx/core/const.rb
CHANGED
|
@@ -68,8 +68,14 @@ module Wx
|
|
|
68
68
|
TREE_LIST_CTRL_NAME_STR = 'wxTreeListCtrl'
|
|
69
69
|
HTML_LIST_BOX_NAME_STR = 'htmlListBox'
|
|
70
70
|
SIMPLE_HTML_LIST_BOX_NAME_STR = 'simpleHtmlListBox'
|
|
71
|
+
HTML_WINDOW_NAME_STR = 'htmlWindow'
|
|
71
72
|
EDITABLE_LIST_BOX_NAME_STR = 'editableListBox'
|
|
72
73
|
V_LIST_BOX_NAME_STR = 'wxVListBox'
|
|
74
|
+
ACTIVITY_INDICATOR_NAME_STR = 'activityindicator'
|
|
75
|
+
TIME_PICKER_CTRL_NAME_STR = 'timectrl'
|
|
76
|
+
DATE_PICKER_CTRL_NAME_STR = 'datectrl'
|
|
77
|
+
CALENDAR_NAME_STR = 'CalendarCtrl'
|
|
78
|
+
SPIN_BUTTON_NAME_STR = 'wxSpinButton'
|
|
73
79
|
|
|
74
80
|
if Wx::PLATFORM == 'WXMSW'
|
|
75
81
|
# wxMSW only
|
|
@@ -80,4 +86,17 @@ module Wx
|
|
|
80
86
|
PROPERTY_GRID_NAME_STR = 'wxPropertyGrid'
|
|
81
87
|
STC_NAME_STR = 'stcwindow'
|
|
82
88
|
|
|
89
|
+
# custom wxRuby addition
|
|
90
|
+
MEDIA_CTRL_NAME_STR = 'mediaCtrl'
|
|
91
|
+
SPIN_CTRL_NAME_STR = 'wxSpinCtrl'
|
|
92
|
+
SPIN_CTRL_DOUBLE_NAME_STR = 'wxSpinCtrlDouble'
|
|
93
|
+
SPLITTER_WINDOW_NAME_STR = 'splitter'
|
|
94
|
+
CHOICEBOOK_NAME_STR = 'choicebook'
|
|
95
|
+
LISTBOOK_NAME_STR = 'listbook'
|
|
96
|
+
TOOLBOOK_NAME_STR = 'toolbook'
|
|
97
|
+
TREEBOOK_NAME_STR = 'treebook'
|
|
98
|
+
SASH_WINDOW_NAME_STR = 'sashWindow'
|
|
99
|
+
SASH_LAYOUT_WINDOW_NAME_STR = 'layoutWindow'
|
|
100
|
+
SCROLLED_NAME_STR = 'SCROLLED_WINDOW'
|
|
101
|
+
|
|
83
102
|
end
|
data/lib/wx/core/enum.rb
CHANGED
|
@@ -48,8 +48,24 @@ class Wx::Enum
|
|
|
48
48
|
@value.hash
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
def bitmask_to_s
|
|
52
|
+
return '' if to_i == 0
|
|
53
|
+
enums = []
|
|
54
|
+
mask = to_i
|
|
55
|
+
self.class.values.each_value do |enum|
|
|
56
|
+
if enum != 0 && mask.allbits?(enum)
|
|
57
|
+
enums << enum.to_s
|
|
58
|
+
mask &= ~enum
|
|
59
|
+
break if mask == 0
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
enums << mask.to_s if mask != 0
|
|
63
|
+
enums.join('|')
|
|
64
|
+
end
|
|
65
|
+
private :bitmask_to_s
|
|
66
|
+
|
|
51
67
|
def to_s
|
|
52
|
-
to_i.
|
|
68
|
+
self.class.values.has_key?(to_i) ? "#{self.class.name}::#{self.class.names_by_value[self]}" : bitmask_to_s
|
|
53
69
|
end
|
|
54
70
|
|
|
55
71
|
end
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
|
2
|
+
#
|
|
3
|
+
# This software is released under the MIT license.
|
|
4
|
+
|
|
5
|
+
module Wx
|
|
6
|
+
|
|
7
|
+
def self.deg_to_rad(deg)
|
|
8
|
+
(deg * Math::PI) / 180.0
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.rad_to_deg(rad)
|
|
12
|
+
(rad * 180.0) / Math::PI
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class Point2DInt
|
|
16
|
+
|
|
17
|
+
alias :x :get_x
|
|
18
|
+
alias :x= :set_x
|
|
19
|
+
alias :y :get_y
|
|
20
|
+
alias :y= :set_y
|
|
21
|
+
|
|
22
|
+
# make wrappers private
|
|
23
|
+
private :add, :sub, :mul, :div
|
|
24
|
+
|
|
25
|
+
wx_assign = instance_method :assign
|
|
26
|
+
define_method :assign do |pt|
|
|
27
|
+
wx_assign.bind(self).call(pt)
|
|
28
|
+
self
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def add!(pt)
|
|
32
|
+
add(pt)
|
|
33
|
+
self
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def sub!(pt)
|
|
37
|
+
sub(pt)
|
|
38
|
+
self
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def mul!(v)
|
|
42
|
+
mul(v)
|
|
43
|
+
self
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def div!(v)
|
|
47
|
+
div(v)
|
|
48
|
+
self
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def +(pt)
|
|
52
|
+
Point2DInt.new(self).add!(pt)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def -(pt)
|
|
56
|
+
Point2DInt.new(self).sub!(pt)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def *(v)
|
|
60
|
+
Point2DInt.new(self).mul!(v)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def /(v)
|
|
64
|
+
Point2DInt.new(self).div!(v)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
class Point2DDouble
|
|
69
|
+
|
|
70
|
+
alias :x :get_x
|
|
71
|
+
alias :x= :set_x
|
|
72
|
+
alias :y :get_y
|
|
73
|
+
alias :y= :set_y
|
|
74
|
+
|
|
75
|
+
# make wrappers private
|
|
76
|
+
private :add, :sub, :mul, :div
|
|
77
|
+
|
|
78
|
+
wx_assign = instance_method :assign
|
|
79
|
+
define_method :assign do |pt|
|
|
80
|
+
wx_assign.bind(self).call(pt)
|
|
81
|
+
self
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def add!(pt)
|
|
85
|
+
add(pt)
|
|
86
|
+
self
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def sub!(pt)
|
|
90
|
+
sub(pt)
|
|
91
|
+
self
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def mul!(v)
|
|
95
|
+
mul(v)
|
|
96
|
+
self
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def div!(v)
|
|
100
|
+
div(v)
|
|
101
|
+
self
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def +(pt)
|
|
105
|
+
Point2DDouble.new(self).add!(pt)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def -(pt)
|
|
109
|
+
Point2DDouble.new(self).sub!(pt)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def *(v)
|
|
113
|
+
Point2DDouble.new(self).mul!(v)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def /(v)
|
|
117
|
+
Point2DDouble.new(self).div!(v)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
end
|
|
121
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
|
2
|
+
#
|
|
3
|
+
# This software is released under the MIT license.
|
|
4
|
+
#
|
|
5
|
+
# Some parts are
|
|
6
|
+
# Copyright 2004-2007, wxRuby development team
|
|
7
|
+
# released under the MIT-like wxRuby2 license
|
|
8
|
+
|
|
9
|
+
class Wx::GraphicsPenInfo
|
|
10
|
+
|
|
11
|
+
# make Wx::GraphicsPenInfo#dashes return self
|
|
12
|
+
wx_dashes = instance_method :dashes
|
|
13
|
+
define_method :dashes do |*args|
|
|
14
|
+
wx_dashes.bind(self).call(*args)
|
|
15
|
+
self
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
data/lib/wx/core/image.rb
CHANGED
|
@@ -108,6 +108,55 @@ module Wx
|
|
|
108
108
|
hist_hash.extend Histogram
|
|
109
109
|
hist_hash
|
|
110
110
|
end
|
|
111
|
+
|
|
112
|
+
# import flattened nested classes
|
|
113
|
+
HSVValue = Wx::HSVValue
|
|
114
|
+
RGBValue = Wx::RGBValue
|
|
115
|
+
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
class HSVValue
|
|
119
|
+
|
|
120
|
+
# More informative output when converted to string
|
|
121
|
+
def to_s
|
|
122
|
+
"#<Wx::Image::HSVValue: (#{self.hue}, #{self.saturation}, #{self.value})>"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def inspect
|
|
126
|
+
to_s
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# make HSVValue usable for parallel assignments like `x, y = pt`
|
|
130
|
+
def to_ary
|
|
131
|
+
[self.hue, self.saturation, self.value]
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def to_rgb
|
|
135
|
+
Image::hsv_to_rgb(self)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
class RGBValue
|
|
141
|
+
|
|
142
|
+
# More informative output when converted to string
|
|
143
|
+
def to_s
|
|
144
|
+
"#<Wx::Image::RGBValue: (#{self.red}, #{self.green}, #{self.blue})>"
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def inspect
|
|
148
|
+
to_s
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# make RGBValue usable for parallel assignments like `x, y = pt`
|
|
152
|
+
def to_ary
|
|
153
|
+
[self.red, self.green, self.blue]
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def to_hsv
|
|
157
|
+
Image::rgb_to_hsv(self)
|
|
158
|
+
end
|
|
159
|
+
|
|
111
160
|
end
|
|
112
161
|
|
|
113
162
|
def self.Image(name, bmp_type = nil, *rest, art_path: nil, art_section: nil)
|
data/lib/wx/core/menu_bar.rb
CHANGED
|
@@ -12,6 +12,17 @@ class Wx::MenuBar
|
|
|
12
12
|
|
|
13
13
|
def initialize(*args, &block)
|
|
14
14
|
wx_initialize(*args)
|
|
15
|
+
if Wx::PLATFORM == 'WXOSX'
|
|
16
|
+
# OSX's standard Apple/Application menu gets titled with the executables name by default
|
|
17
|
+
# which is 'ruby' for wxRuby and this title is near impossible to reliably change.
|
|
18
|
+
# Therefor we implemented (a little stunted) workaround here to deal with Apple's crap.
|
|
19
|
+
# We insert a disabled item at the start of this menu with the AppDisplayName and follow
|
|
20
|
+
# it up with a nice separator. This way at least we will always be able to see which wxRuby
|
|
21
|
+
# app the visible menu belongs to.
|
|
22
|
+
apple_menu = osx_get_apple_menu
|
|
23
|
+
apple_menu.insert(0, Wx::ID_NONE, Wx.get_app.get_app_display_name).enable(false)
|
|
24
|
+
apple_menu.insert_separator(1)
|
|
25
|
+
end
|
|
15
26
|
if block
|
|
16
27
|
if block.arity == -1 or block.arity == 0
|
|
17
28
|
self.instance_eval(&block)
|
data/lib/wx/core/paintdc.rb
CHANGED
|
@@ -6,10 +6,16 @@
|
|
|
6
6
|
# Copyright 2004-2007, wxRuby development team
|
|
7
7
|
# released under the MIT-like wxRuby2 license
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
module Wx
|
|
10
|
+
|
|
11
|
+
class PaintDC
|
|
12
|
+
|
|
13
|
+
def self.draw_on(win, &block)
|
|
14
|
+
win.paint(&block) if block
|
|
15
|
+
end
|
|
10
16
|
|
|
11
|
-
def self.draw_on(win, &block)
|
|
12
|
-
win.paint(&block) if block
|
|
13
17
|
end
|
|
14
18
|
|
|
19
|
+
AutoBufferedPaintDC = PaintDC.has_native_double_buffer ? Wx::PaintDC : Wx::BufferedPaintDC
|
|
20
|
+
|
|
15
21
|
end
|