wxruby3 0.9.0.pre.rc.2 → 0.9.0.pre.rc.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +30 -8
- data/README.md +3 -3
- data/ext/wxruby3/swig/wx.i +2 -0
- data/lib/wx/core/event_loop.rb +7 -0
- data/lib/wx/core/image.rb +33 -0
- data/lib/wx/core/listctrl.rb +17 -13
- data/lib/wx/core/log.rb +90 -0
- data/lib/wx/doc/bitmap.rb +11 -15
- data/lib/wx/doc/event_loop.rb +7 -0
- data/lib/wx/doc/extra/00_starting.md +6 -6
- data/lib/wx/doc/extra/02_lifecycles.md +9 -8
- data/lib/wx/doc/extra/09_exceptions.md +1 -1
- data/lib/wx/doc/extra/11_drawing_and_dc.md +4 -4
- data/lib/wx/doc/font.rb +1 -1
- data/lib/wx/doc/functions.rb +51 -23
- data/lib/wx/doc/gc_dc.rb +1 -1
- data/lib/wx/doc/image.rb +42 -12
- data/lib/wx/doc/list_ctrl.rb +32 -0
- data/lib/wx/doc/log.rb +28 -0
- data/lib/wx/doc/prt/printer_dc.rb +2 -2
- data/lib/wx/doc/scaled_dc.rb +1 -1
- data/lib/wx/doc/text_validator.rb +12 -0
- data/lib/wx/version.rb +1 -1
- data/rakelib/lib/core/mapping.rb +15 -10
- data/rakelib/lib/core/package.rb +3 -0
- data/rakelib/lib/core/spec.rb +21 -10
- data/rakelib/lib/core/spec_helper.rb +6 -0
- data/rakelib/lib/director/dialog.rb +25 -0
- data/rakelib/lib/director/event_loop.rb +26 -0
- data/rakelib/lib/director/functions.rb +44 -48
- data/rakelib/lib/director/image.rb +32 -0
- data/rakelib/lib/director/list_ctrl.rb +3 -2
- data/rakelib/lib/director/log.rb +64 -4
- data/rakelib/lib/director/text_entry.rb +25 -0
- data/rakelib/lib/director/text_validator.rb +8 -2
- data/rakelib/lib/director/variant.rb +17 -4
- data/rakelib/lib/extractor/function.rb +7 -7
- data/rakelib/lib/extractor/variable.rb +6 -6
- data/rakelib/lib/generate/doc/aui_manager.yaml +21 -0
- data/rakelib/lib/generate/doc/font.yaml +29 -0
- data/rakelib/lib/generate/doc/frame.yaml +23 -0
- data/rakelib/lib/generate/doc/fs_file.yaml +11 -0
- data/rakelib/lib/generate/doc/gdi_common.yaml +36 -0
- data/rakelib/lib/generate/doc/graphics_context.yaml +34 -0
- data/rakelib/lib/generate/doc/gui_event_loop.yaml +12 -0
- data/rakelib/lib/generate/doc/help_controller.yaml +24 -0
- data/rakelib/lib/generate/doc/icon.yaml +11 -0
- data/rakelib/lib/generate/doc/image.yaml +87 -0
- data/rakelib/lib/generate/doc/keyboard_state.yaml +19 -0
- data/rakelib/lib/generate/doc/list_ctrl.yaml +77 -0
- data/rakelib/lib/generate/doc/locale.yaml +12 -0
- data/rakelib/lib/generate/doc/log.yaml +86 -0
- data/rakelib/lib/generate/doc/mdi_frame.yaml +12 -0
- data/rakelib/lib/generate/doc/memory_dc.yaml +42 -0
- data/rakelib/lib/generate/doc/menu.yaml +17 -0
- data/rakelib/lib/generate/doc/menu_item.yaml +43 -0
- data/rakelib/lib/generate/doc/message_dialog.yaml +36 -0
- data/rakelib/lib/generate/doc/non_owned_window.yaml +14 -0
- data/rakelib/lib/generate/doc/notebook.yaml +18 -0
- data/rakelib/lib/generate/doc/pen.yaml +11 -0
- data/rakelib/lib/generate/doc/picker_base.yaml +19 -0
- data/rakelib/lib/generate/doc/platform_info.yaml +15 -0
- data/rakelib/lib/generate/doc/property_sheet_dialog.yaml +26 -0
- data/rakelib/lib/generate/doc/scroll_bar.yaml +11 -0
- data/rakelib/lib/generate/doc/scrolled_canvas.yaml +37 -0
- data/rakelib/lib/generate/doc/scrolled_control.yaml +37 -0
- data/rakelib/lib/generate/doc/scrolled_window.yaml +37 -0
- data/rakelib/lib/generate/doc/sizer.yaml +69 -0
- data/rakelib/lib/generate/doc/splash_screen.yaml +18 -0
- data/rakelib/lib/generate/doc/static_box.yaml +52 -0
- data/rakelib/lib/generate/doc/static_box_sizer.yaml +22 -0
- data/rakelib/lib/generate/doc/svg_file_dc.yaml +11 -0
- data/rakelib/lib/generate/doc/text_ctrl.yaml +19 -0
- data/rakelib/lib/generate/doc/text_entry.yaml +42 -0
- data/rakelib/lib/generate/doc/text_entry_dialog.yaml +17 -0
- data/rakelib/lib/generate/doc/timer_event.yaml +28 -0
- data/rakelib/lib/generate/doc/tool_bar.yaml +35 -0
- data/rakelib/lib/generate/doc/top_level_window.yaml +23 -0
- data/rakelib/lib/generate/doc/validator.yaml +12 -0
- data/rakelib/lib/generate/doc/variant.yaml +29 -0
- data/rakelib/lib/generate/doc/window.yaml +249 -0
- data/rakelib/lib/generate/doc/wizard_page_simple.yaml +14 -0
- data/rakelib/lib/generate/doc/xml_node.yaml +7 -0
- data/rakelib/lib/generate/doc/xml_resource.yaml +27 -0
- data/rakelib/lib/generate/doc.rb +35 -1
- data/rakelib/lib/specs/interfaces.rb +1 -0
- data/rakelib/lib/swig_runner.rb +37 -0
- data/tests/test_art.rb +9 -0
- data/tests/test_box_sizer.rb +161 -0
- data/tests/test_grid_sizer.rb +148 -0
- data/tests/test_list_ctrl.rb +53 -0
- data/tests/test_log.rb +163 -0
- data/tests/test_std_controls.rb +58 -0
- data/tests/test_timer.rb +95 -0
- metadata +59 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9adbc82ffc489a20f1f631d4db04012c1a750d4f71b5241dc5c8647ea024aca4
|
4
|
+
data.tar.gz: e6e637da8c206fd334809ab6592f1b89d08fbae59cd518c251f20567e981a314
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b46691fea333ff841c685e5aeabab7e51c0348467b13e95b32dc9ba7ddd3cacf3c19d6861fa0c9f351c17ef20da3175d287ef2ff802bf834a5acffbc41cfe93
|
7
|
+
data.tar.gz: 5ba1ebd28a837286b1e840b485d07f9c370f168b831fd11fad523eb095d5eebd93c8bab65911db7f303a5bbb25d6ab9da1556fdb359c2831aa41c21500693592
|
data/INSTALL.md
CHANGED
@@ -4,17 +4,20 @@
|
|
4
4
|
|
5
5
|
# Installation of wxRuby3
|
6
6
|
|
7
|
+
Below are installation instructions for Linux, Windows, and Mac (both AMD64 and ARM64).
|
8
|
+
|
7
9
|
## Minimal requirements for installing wxRuby3
|
8
10
|
|
9
11
|
The minimal requirements for installing any source based setup (gem, source package or Github clone) of wxRuby3 are:
|
10
12
|
|
11
|
-
| Sofware | Notes
|
12
|
-
|
13
|
-
| Ruby | A supported version of the Ruby interpreter needs to be installed.
|
14
|
-
| 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 |
|
15
|
-
| Git version control toolkit |
|
16
|
-
| SWIG >= 3.0.12 | On MacOS install [Homebrew](https://brew.sh/) and than `brew install swig`
|
17
|
-
| 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)
|
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) |
|
18
21
|
|
19
22
|
The wxRuby3 build process requires `git` to clone a copy of the wxWidgets Github repository to extract the interface
|
20
23
|
specifications from.<br>
|
@@ -44,6 +47,14 @@ gem install wxruby3 --platform=ruby
|
|
44
47
|
|
45
48
|
When installing the source gem the minimal requirements listed above apply.
|
46
49
|
|
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
|
57
|
+
|
47
58
|
Also a wxWidgets installation (version 3.2 or later) is required for which there are multiple options.
|
48
59
|
|
49
60
|
1. System installed wxWidgets version (including development package)<br>
|
@@ -55,6 +66,17 @@ Also a wxWidgets installation (version 3.2 or later) is required for which there
|
|
55
66
|
build procedure requires access to the wxWidgets interface specification sources which are not normally part of any of
|
56
67
|
the standard distribution packages.
|
57
68
|
|
69
|
+
On MacOS, you can install wxWidgets via [Homebrew](https://brew.sh/):
|
70
|
+
|
71
|
+
```shell
|
72
|
+
brew install wxwidgets
|
73
|
+
```
|
74
|
+
|
75
|
+
Afterwards, you can install the Ruby gem and it will detect wxWidgets in the system automatically:
|
76
|
+
|
77
|
+
```shell
|
78
|
+
gem install wxruby3
|
79
|
+
```
|
58
80
|
|
59
81
|
2. User installed wxWidgets version<br>
|
60
82
|
<br>
|
@@ -65,7 +87,7 @@ Also a wxWidgets installation (version 3.2 or later) is required for which there
|
|
65
87
|
```shell
|
66
88
|
gem install wxruby3 -- WXWIN=/path/to/wx/install
|
67
89
|
```
|
68
|
-
|
90
|
+
|
69
91
|
3. Automatic installed, embedded, wxWidgets version<br>
|
70
92
|
<br>
|
71
93
|
This is the easiest method when the system being installed on does not provide (a compatible) wxWidgets version (and
|
data/README.md
CHANGED
@@ -100,7 +100,7 @@ Currently the following are fully supported:
|
|
100
100
|
|----------------------------------------------------------------------------|-----------------| --- |
|
101
101
|
| Windows 10 (tested)<br>(most likely also Windows 11) | Ruby >= 2.5<br>(RubyInstaller MSYS2-DevKit) | wxWidgets >= 3.2 |
|
102
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)
|
103
|
+
| MacOS >= 10.10 using Cocoa (tested on AMD-64 and ARM64 M2 Chip) | Ruby >= 2.5 | wxWidgets >= 3.2 |
|
104
104
|
|
105
105
|
Support for other platforms is not being actively developed at present,
|
106
106
|
but patches are welcome. It is likely to be much simpler to get wxRuby
|
@@ -158,7 +158,7 @@ some use a more modern coding style than others.
|
|
158
158
|
|
159
159
|
Complete (more or less) wxRuby API documentation should be part of any
|
160
160
|
complete wxRuby3 build. This tends to focus on providing a reference
|
161
|
-
of all available modules, classes
|
161
|
+
of all available modules, classes and methods and how to use specific
|
162
162
|
classes and methods, rather than on how to construct an application
|
163
163
|
overall.
|
164
164
|
This documentation (for the latest release) is also available online
|
@@ -190,7 +190,7 @@ If you know of a feature in wxWidgets that you would like to see
|
|
190
190
|
supported in wxRuby3 you are free to ask but do not **EXPECT** unconditional
|
191
191
|
agreement or immediate response.
|
192
192
|
|
193
|
-
### 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?
|
194
194
|
|
195
195
|
wxRuby 0.6.0 was the last in a series of releases developed using a
|
196
196
|
different approach in the early days of wxRuby. Work on this series
|
data/ext/wxruby3/swig/wx.i
CHANGED
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)
|
data/lib/wx/core/listctrl.rb
CHANGED
@@ -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
|
-
|
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/doc/bitmap.rb
CHANGED
@@ -8,20 +8,16 @@ module Wx
|
|
8
8
|
# Default BitmapType for current platform. Actual value is platform dependent.
|
9
9
|
CURSOR_DEFAULT_TYPE = Wx::BitmapType::BITMAP_TYPE_ANY
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
# @see Wx::ArtLocator::find_art
|
23
|
-
def self.Bitmap(name, bmp_type = nil); end
|
24
|
-
|
25
|
-
end
|
11
|
+
# Searches for an art file with basename 'name' and creates a Bitmap if found.
|
12
|
+
# Raises an ArgumentError if not found.
|
13
|
+
# Wx::ArtLocator::find_art is used to look up the art file using ::Kernel#caller_locations to
|
14
|
+
# determine the values for the 'art_path' and 'art_owner' arguments ('art_path' is set to the
|
15
|
+
# absolute path to the folder holding the caller's code and 'art_owner' to the basename of the
|
16
|
+
# caller's source file). The 'art_type' argument is set to <code>:icon</code>.
|
17
|
+
# @param [String,Symbol] name base name of art file
|
18
|
+
# @param [Wx::BitmapType,nil] bmp_type bitmap type for art file (nil means any supported type)
|
19
|
+
# @return [Wx::Bitmap]
|
20
|
+
# @see Wx::ArtLocator::find_art
|
21
|
+
def self.Bitmap(name, bmp_type = nil); end
|
26
22
|
|
27
23
|
end
|
@@ -18,9 +18,9 @@ is available for anyone to look at and use in any way they like. Also, anyone ca
|
|
18
18
|
and enhancements to the project.
|
19
19
|
|
20
20
|
Like wxWidgets wxRuby is a cross platform toolkit. This means that the same program will run on multiple platforms
|
21
|
-
without modification. Currently Supported platforms are Microsoft Windows and Linux or other
|
22
|
-
unix-like systems with GTK2 or GTK3 libraries.
|
23
|
-
|
21
|
+
without modification. Currently Supported platforms are Microsoft Windows, MacOSX and Linux or other
|
22
|
+
unix-like systems with GTK2 or GTK3 libraries. Contributions to achieve support for other wxWidgets supported platforms
|
23
|
+
are appreciated.
|
24
24
|
|
25
25
|
Since the programming language is Ruby, wxRuby programs are simple and easy to write and understand. To accomplish the
|
26
26
|
full Ruby experience wxRuby has not ported the wxWidgets API 1 on 1 to Ruby but has made an effort to make the wxRuby
|
@@ -75,7 +75,7 @@ require 'wx'
|
|
75
75
|
Wx::App.run { puts 'Hello world!' }
|
76
76
|
```
|
77
77
|
|
78
|
-
As you can there is no obligation to create an instance of the Wx::App class in wxRuby for
|
78
|
+
As you can see there is no obligation to create an instance of the Wx::App class in wxRuby for
|
79
79
|
(admittedly extremely) simple applications. Calling the #run class method with a block will suffice.<br>
|
80
80
|
The class method will create an instance of the generic Wx::App class under the hood and use the
|
81
81
|
provided block as the #on_init callback. As the code inside the block returns a false-type value (#puts
|
@@ -127,8 +127,8 @@ When creating #on_init/#on_exit methods it is important to understand that those
|
|
127
127
|
with wxWidgets itself). The base Wx::App class actually does not define these methods so it's also not needed (even not possible)
|
128
128
|
to call `super` in the implementation. The wxRuby application class implementation will call the wxWidget OnInit base implementation
|
129
129
|
itself and after successful completion check for the existence of an #on_init method (which could also be 'automagicallly'
|
130
|
-
created from a block passed to #run) and call that if available or terminate the application if not.
|
131
|
-
exit sequence
|
130
|
+
created from a block passed to #run) and call that if available or terminate the application if not. The
|
131
|
+
exit sequence of executions are similar but reversed (first a possible #on_exit method and than the wxWidgets base OnExit).
|
132
132
|
|
133
133
|
What remains though is that for a derived application class it is still not necessary to explicitly create a class instance.
|
134
134
|
Simply calling the #run class method will suffice.
|
@@ -76,7 +76,7 @@ As mentioned above the wxWidgets GUI framework resources will only be fully init
|
|
76
76
|
starts. Likewise the framework resources will be de-initialized (deleted) after `#on_exit` method ends which means that
|
77
77
|
your application should not attempt to access any of these resources (windows, fonts, colours etc.) after that moment.
|
78
78
|
|
79
|
-
Also, largely because of the way the wxWidgets framework is designed but also because of
|
79
|
+
Also, largely because of the way the wxWidgets framework is designed but also because of the way this meshes with Ruby
|
80
80
|
GC, there is no safe way to re-initialize the framework after an application instance ends it run. This means you
|
81
81
|
**cannot** safely attempt to start another application instance after a previous (first) one has ended.
|
82
82
|
|
@@ -120,7 +120,7 @@ therefor provides special support to ease handling the destruction of these. See
|
|
120
120
|
One of the trickier things to handle correctly in the kind of native extensions like wxRuby is maintaining object
|
121
121
|
identities i.e. keeping native instances synced with their Ruby wrapper counter parts.
|
122
122
|
|
123
|
-
Whenever a native extension is allowed to call back into Ruby space we encounter the problem
|
123
|
+
Whenever a native extension is allowed to call back into Ruby space we encounter the problem that we need to map any
|
124
124
|
native object data provided for the call to the right Ruby types and when necessary to the right Ruby instance (object
|
125
125
|
identity).
|
126
126
|
|
@@ -131,8 +131,8 @@ passing them on to Ruby space.
|
|
131
131
|
For a lot of other objects though it is essential to not only map to the right **most derived** class type but also to
|
132
132
|
the exact Ruby instance which was originally instantiated as wrapper for the native object if any exists (in case no
|
133
133
|
Ruby instance existed yet a new instance of the correct **most derived** class should be instantiated at that point).
|
134
|
-
The reason this is important is 1
|
135
|
-
reference other data and/or functionality related to that specific Ruby/native pair and 2
|
134
|
+
The reason this is important is **1.** because the Ruby instance may have been used to identify, link to or otherwise
|
135
|
+
reference other data and/or functionality related to that specific Ruby/native pair and **2.** the Ruby instance could
|
136
136
|
contain data elements (instance variables) related to that specific Ruby/native pair.<br>
|
137
137
|
In the case of wxRuby Window instance for example it is common to derive custom Window classes with custom behaviour and
|
138
138
|
corresponding instance variables that drive that behaviour. When an event handler or an overloaded native method is passed
|
@@ -155,11 +155,12 @@ There are however quite a lot of wrapped native objects in wxRuby for which *obj
|
|
155
155
|
object tracking has been disabled for their classes. This means these kind of classes/object should **not** be derived from
|
156
156
|
(if even possible and/or useful) to add functionality/information or their identity used as key to link other information.<br>
|
157
157
|
These classes include:
|
158
|
-
|
158
|
+
* classes considered POD types like Wx::Size, Wx::Point, Wx::RealPoint, Wx::Rect, Wx::GBSpan, Wx::GBPosition, Wx::BusyInfoFlags,
|
159
159
|
Wx::AboutDialogInfo
|
160
|
-
|
160
|
+
* final non-instantiatable classes like the Wx::DC (Device Context) class family, Wx::GraphicsContext, Wx::WindowsDisabler,
|
161
161
|
Wx::EventBlocker, Wx::BusyInfo
|
162
|
-
|
163
|
-
|
162
|
+
* classes with native singleton objects like Wx::Clipboard
|
163
|
+
* the reference counted GDI objects like Wx::Pen, Wx::Brush, Wx::Colour, Wx::Cursor, Wx::Bitmap, Wx::Icon and similar
|
164
|
+
reference counted objects like Wx::Font
|
164
165
|
|
165
166
|
The reference documentation will note untracked object classes.
|
@@ -15,7 +15,7 @@ your own Ruby application code.
|
|
15
15
|
|
16
16
|
Any exceptions raised from wxRuby wrapper code signal coding errors that need to be rectified.
|
17
17
|
|
18
|
-
As far as handling application code exceptions is concerned the same advice applies as for wxWidgets itself; do **
|
18
|
+
As far as handling application code exceptions is concerned the same advice applies as for wxWidgets itself; do **NOT**
|
19
19
|
let exceptions escape your event handlers meaning that if you can reasonably expect application code to raise exceptions
|
20
20
|
you should make sure to catch any such exceptions within the context of the event handler like:
|
21
21
|
|
@@ -12,9 +12,9 @@ device context object is destroyed.
|
|
12
12
|
For this reason the common practice in wxWidgets C++ code would be to create temporary DC objects on the
|
13
13
|
stack and draw on them while they are in scope (for several classes it is even strongly advised to never create
|
14
14
|
them any other way and to never keep objects alive out of scope). When leaving the scope these object would than be
|
15
|
-
automatically destroyed and
|
15
|
+
automatically destroyed and any buffered output flushed to the final target.
|
16
16
|
|
17
|
-
In Ruby this approach is impossible as Ruby is a purely dynamic language and does not **this kind** of scope bound
|
17
|
+
In Ruby this approach is impossible as Ruby is a purely dynamic language and does not support **this kind** of scope bound
|
18
18
|
life cycles. Any DC object created would have to be dynamically created and due to the properties of the GC driven
|
19
19
|
life cycles could well be kept alive beyond the scope of it's creation. This will not always cause problems but could
|
20
20
|
and does not really have an upside.
|
@@ -24,7 +24,7 @@ cannot be instantiated using `new`. Rather all `Wx::DC` derived classes provide
|
|
24
24
|
temporary dc objects that will be passed on to blocks given and will only exist for the duration of the execution of
|
25
25
|
the block. This will guarantee proper DC cleanup when leaving it's usage scope.
|
26
26
|
|
27
|
-
> Note that it is a **BAD** idea to think about storing the dc reference
|
27
|
+
> Note that it is a **BAD** idea to think about storing the dc reference provided to the block for later access!
|
28
28
|
|
29
29
|
A typical usage of a `::draw_on` method would be:
|
30
30
|
|
@@ -48,7 +48,7 @@ The `Wx::PaintDC` and `Wx::AutoBufferedPaintDC` classes provide `::draw_on` meth
|
|
48
48
|
this is mostly to be consistent.
|
49
49
|
|
50
50
|
In this case it is recommended to instead use the `Wx::Window#paint` or `Wx::Window#paint_buffered` methods as these
|
51
|
-
provide some optimizations with regard to automatically detecting
|
51
|
+
provide some optimizations with regard to automatically detecting if the methods are called inside `Wx::EVT_PAINT`
|
52
52
|
handlers (which should normally be the case) or not.
|
53
53
|
|
54
54
|
So the typical way to do buffered painting inside a windows `Wx::EVT_PAINT` handler would be something like:
|
data/lib/wx/doc/font.rb
CHANGED
data/lib/wx/doc/functions.rb
CHANGED
@@ -11,32 +11,73 @@ module Wx
|
|
11
11
|
# @param lvl [Integer] logging level (like {Wx::LOG_Message})
|
12
12
|
# @param fmt [String] message (formatting) string
|
13
13
|
# @param args [Array<Object>] optional message arguments
|
14
|
-
# @
|
15
|
-
|
14
|
+
# @param filename [String] optional file name for log info
|
15
|
+
# @param line [Integer] optional line number for log info
|
16
|
+
# @param func [String] optional function name for log info
|
17
|
+
# @param component [String] optional component name for log info
|
18
|
+
# @return [void]
|
19
|
+
def self.log_generic(lvl, fmt, *args, filename: nil, line: 0, func: nil, component: nil) end
|
16
20
|
|
17
21
|
# Log a Wx low priority informational message to the current Wx log output
|
18
22
|
# @param fmt [String] message (formatting) string
|
19
23
|
# @param args [Array<Object>] optional message arguments
|
20
|
-
# @
|
21
|
-
|
24
|
+
# @param filename [String] optional file name for log info
|
25
|
+
# @param line [Integer] optional line number for log info
|
26
|
+
# @param func [String] optional function name for log info
|
27
|
+
# @param component [String] optional component name for log info
|
28
|
+
# @return [void]
|
29
|
+
def self.log_info(fmt, *args, filename: nil, line: 0, func: nil, component: nil) end
|
22
30
|
|
23
31
|
# Log a Wx Informational message to the current Wx log output
|
24
32
|
# @param fmt [String] message (formatting) string
|
25
33
|
# @param args [Array<Object>] optional message arguments
|
26
|
-
# @
|
27
|
-
|
34
|
+
# @param filename [String] optional file name for log info
|
35
|
+
# @param line [Integer] optional line number for log info
|
36
|
+
# @param func [String] optional function name for log info
|
37
|
+
# @param component [String] optional component name for log info
|
38
|
+
# @return [void]
|
39
|
+
def self.log_message(fmt, *args, filename: nil, line: 0, func: nil, component: nil) end
|
28
40
|
|
29
41
|
# Log a Wx Error message to the current Wx log output
|
30
42
|
# @param fmt [String] message (formatting) string
|
31
43
|
# @param args [Array<Object>] optional message arguments
|
32
|
-
# @
|
33
|
-
|
44
|
+
# @param filename [String] optional file name for log info
|
45
|
+
# @param line [Integer] optional line number for log info
|
46
|
+
# @param func [String] optional function name for log info
|
47
|
+
# @param component [String] optional component name for log info
|
48
|
+
# @return [void]
|
49
|
+
def self.log_error(fmt, *args, filename: nil, line: 0, func: nil, component: nil) end
|
34
50
|
|
35
51
|
# Log a Wx Warning message to the current Wx log output
|
36
52
|
# @param fmt [String] message (formatting) string
|
37
53
|
# @param args [Array<Object>] optional message arguments
|
38
|
-
# @
|
39
|
-
|
54
|
+
# @param filename [String] optional file name for log info
|
55
|
+
# @param line [Integer] optional line number for log info
|
56
|
+
# @param func [String] optional function name for log info
|
57
|
+
# @param component [String] optional component name for log info
|
58
|
+
# @return [void]
|
59
|
+
def self.log_warning(fmt, *args, filename: nil, line: 0, func: nil, component: nil) end
|
60
|
+
|
61
|
+
# Log a Wx verbose informational message to the current Wx log output
|
62
|
+
# (needs explicit activation to be shown)
|
63
|
+
# @param fmt [String] message (formatting) string
|
64
|
+
# @param args [Array<Object>] optional message arguments
|
65
|
+
# @param filename [String] optional file name for log info
|
66
|
+
# @param line [Integer] optional line number for log info
|
67
|
+
# @param func [String] optional function name for log info
|
68
|
+
# @param component [String] optional component name for log info
|
69
|
+
# @return [void]
|
70
|
+
def self.log_verbose(fmt, *args, filename: nil, line: 0, func: nil, component: nil) end
|
71
|
+
|
72
|
+
# Log a Wx debug message to the current Wx log output
|
73
|
+
# @param fmt [String] message (formatting) string
|
74
|
+
# @param args [Array<Object>] optional message arguments
|
75
|
+
# @param filename [String] optional file name for log info
|
76
|
+
# @param line [Integer] optional line number for log info
|
77
|
+
# @param func [String] optional function name for log info
|
78
|
+
# @param component [String] optional component name for log info
|
79
|
+
# @return [void]
|
80
|
+
def self.log_debug(fmt, *args, filename: nil, line: 0, func: nil, component: nil) end
|
40
81
|
|
41
82
|
# Log a Wx Status message - this is directed to the status bar of the
|
42
83
|
# specified Frame window, or the application main window if not specified.
|
@@ -51,19 +92,6 @@ module Wx
|
|
51
92
|
# @return [nil]
|
52
93
|
def self.log_status(fmt, *args) end
|
53
94
|
|
54
|
-
# Log a Wx verbose informational message to the current Wx log output
|
55
|
-
# (needs explicit activation to be shown)
|
56
|
-
# @param fmt [String] message (formatting) string
|
57
|
-
# @param args [Array<Object>] optional message arguments
|
58
|
-
# @return [nil]
|
59
|
-
def self.log_verbose(fmt, *args) end
|
60
|
-
|
61
|
-
# Log a Wx debug message to the current Wx log output
|
62
|
-
# @param fmt [String] message (formatting) string
|
63
|
-
# @param args [Array<Object>] optional message arguments
|
64
|
-
# @return [nil]
|
65
|
-
def self.log_debug(fmt, *args) end
|
66
|
-
|
67
95
|
# @!endgroup
|
68
96
|
|
69
97
|
# @!group Other class methods
|
data/lib/wx/doc/gc_dc.rb
CHANGED