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
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
:wxTextEntry.GetInsertionPoint:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
def get_current_char(txt_ctrl)
|
11
|
+
pos = txt_ctrl.get_insertion_point
|
12
|
+
return '' if pos == txt_ctrl.get_last_position
|
13
|
+
|
14
|
+
txt_ctrl.get_range(pos, pos + 1)
|
15
|
+
end
|
16
|
+
```
|
17
|
+
:wxTextCompleterSimple:
|
18
|
+
:detail:
|
19
|
+
:pre:
|
20
|
+
:programlisting:
|
21
|
+
- :pattern: !ruby/regexp /.*/
|
22
|
+
:replace: |
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
class MyTextCompleter < Wx::TextCompleterSimple
|
26
|
+
|
27
|
+
def get_completions(prefix)
|
28
|
+
firstWord = prefix.split(' ').shift
|
29
|
+
if firstWord == 'white'
|
30
|
+
['white pawn', 'white rook']
|
31
|
+
elsif firstWord == 'black'
|
32
|
+
['black king', 'black queen']
|
33
|
+
else
|
34
|
+
['white', 'black']
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
...
|
40
|
+
text_ctrl = ...
|
41
|
+
text_ctrl.auto_complete(MyTextCompleter.new)
|
42
|
+
```
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
:wxTextEntryDialog.SetTextValidator:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
Wx::TextEntryDialog(self, ...) do |dlg|
|
11
|
+
dlg.set_text_validator(Wx::FILTER_ALPHA)
|
12
|
+
if dlg.show_modal == Wx::ID_OK
|
13
|
+
# We can be certain that this string contains letters only.
|
14
|
+
value = dlg.get_value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
```
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
:wxTimerEvent:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class MyFrame < Wx::Frame
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
super(nil)
|
14
|
+
@timer = Wx::Timer.new(self, TIMER_ID)
|
15
|
+
|
16
|
+
evt_timer(TIMER_ID, :on_timer)
|
17
|
+
|
18
|
+
@timer.start(1000) # 1 second interval
|
19
|
+
end
|
20
|
+
|
21
|
+
...
|
22
|
+
|
23
|
+
def on_timer(event)
|
24
|
+
# do whatever you want to do every second here
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
```
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
:wxToolBar.SetToolBitmapSize:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
toolbar.set_tool_bitmap_size(from_dip(Wx::Size.new(32, 32)))
|
11
|
+
toolbar.add_tool(Wx::ID_NEW, 'New', Wx::BitmapBundle.from_XXX(...))
|
12
|
+
...
|
13
|
+
toolbar.realize
|
14
|
+
```
|
15
|
+
:wxToolBar:
|
16
|
+
:detail:
|
17
|
+
:pre:
|
18
|
+
:programlisting:
|
19
|
+
- :pattern: !ruby/regexp /0\);/
|
20
|
+
:replace: |
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
Wx::SystemOptions.set_option('msw.remap', 0)
|
24
|
+
```
|
25
|
+
- :pattern: !ruby/regexp /2\);/
|
26
|
+
:replace: |
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
Wx::SystemOptions.set_option('msw.remap', 2)
|
30
|
+
```
|
31
|
+
- :pattern: !ruby/regexp /wxTheApp/
|
32
|
+
:replace: ''
|
33
|
+
:para:
|
34
|
+
- :pattern: !ruby/regexp /But\s+only\s+use.*true\s+colour:/
|
35
|
+
:subst: ''
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
:wxTopLevelWindow.MSWGetSystemMenu:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
if Wx::PLATFORM == 'WXMSW'
|
11
|
+
```
|
12
|
+
:wxTopLevelWindow.UseNativeDecorations:
|
13
|
+
:detail:
|
14
|
+
:pre:
|
15
|
+
:programlisting:
|
16
|
+
- :pattern: !ruby/regexp /.*/
|
17
|
+
:replace: |
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
frame = MyFrame.new # use default ctor
|
21
|
+
frame.use_native_decorations(false) # change from default "true"
|
22
|
+
frame.create(parent, title, ...) # really create the frame
|
23
|
+
```
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:wxValidator.SetWindow:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
Wx::TextCtrl.new(self, Wx::ID_ANY, '', Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, 0,
|
11
|
+
Wx::TextValidator.new(Wx::FILTER_ALPHA))
|
12
|
+
```
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
:wxVariant:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:detaileddescription:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
A variant's value can be changed at run time, possibly to a different type of value.
|
10
|
+
In wxRuby Wx::Variant is the only available Wx variant class (unlike in C++) and almost exclusively for
|
11
|
+
use in combination with the property grid classes (see the {Wx::PG} module).
|
12
|
+
|
13
|
+
By default Wx::Variant can store values of type bool, {Integer}, {Float}, {String}, {Time} (or {Date} / {DateTime}), {Array} of {String},
|
14
|
+
{Array} of {Wx::Variant}, {Wx::Font}, {Wx::Colour} and {Wx::ColourPropertyValue}.
|
15
|
+
In addition Wx::Variant can store any Ruby {Object}.
|
16
|
+
|
17
|
+
An optional name member is associated with a Wx::Variant.
|
18
|
+
|
19
|
+
In wxRuby Wx::Variant also provides the standard conversion methods #to_i, #to_s and #to_f for supported
|
20
|
+
value types. In case of incompatible value types these methods will raise a {TypeError} exception.
|
21
|
+
:wxVariant.GetType:
|
22
|
+
:detail:
|
23
|
+
:post:
|
24
|
+
- :pattern: !ruby/regexp /\-\s+\"void\*\"$/
|
25
|
+
:subst: ''
|
26
|
+
- :pattern: !ruby/regexp /\Z/
|
27
|
+
:subst: |
|
28
|
+
|
29
|
+
If the variant contains an arbitrary Ruby {Object}, the value type returned is the result of `variant.get_object.class.name`.
|
@@ -0,0 +1,249 @@
|
|
1
|
+
---
|
2
|
+
:wxWindow.SetScrollbar:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
set_scrollbar(Wx::VERTICAL, 0, 16, 50)
|
11
|
+
```
|
12
|
+
:wxWindow.FromDIP:
|
13
|
+
:detail:
|
14
|
+
:pre:
|
15
|
+
:programlisting:
|
16
|
+
- :pattern: !ruby/regexp /.*/
|
17
|
+
:replace: |
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
bmp = Wx::Bitmap.new(from_dip(Wx::Size.new(32, 32)))
|
21
|
+
```
|
22
|
+
:wxWindow.ToDIP:
|
23
|
+
:detail:
|
24
|
+
:pre:
|
25
|
+
:programlisting:
|
26
|
+
- :pattern: !ruby/regexp /.*/
|
27
|
+
:replace: |
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
pt = Wx::Point.new(to_dip(get_position))
|
31
|
+
size = Wx::Size.new(to_dip(get_size))
|
32
|
+
```
|
33
|
+
:wxWindow.SetMaxClientSize:
|
34
|
+
:detail:
|
35
|
+
:pre:
|
36
|
+
:programlisting:
|
37
|
+
- :pattern: !ruby/regexp /.*/
|
38
|
+
:replace: |
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
set_max_size(client_to_window_size(size))
|
42
|
+
```
|
43
|
+
:wxWindow.SetMinClientSize:
|
44
|
+
:detail:
|
45
|
+
:pre:
|
46
|
+
:programlisting:
|
47
|
+
- :pattern: !ruby/regexp /.*/
|
48
|
+
:replace: |
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
set_min_size(client_to_window_size(size))
|
52
|
+
```
|
53
|
+
:wxWindow.Move:
|
54
|
+
:detail:
|
55
|
+
:pre:
|
56
|
+
:programlisting:
|
57
|
+
- :pattern: !ruby/regexp /.*/
|
58
|
+
:replace: |
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
set_size(x, y, Wx::DEFAULT_COORD, Wx::DEFAULT_COORD, Wx::SIZE_USE_EXISTING)
|
62
|
+
```
|
63
|
+
:wxWindow.ConvertDialogToPixels:
|
64
|
+
:detail:
|
65
|
+
:pre:
|
66
|
+
:para:
|
67
|
+
- :pattern: !ruby/regexp /A\s+convenience\s+macro\s+is\s+defined:/
|
68
|
+
:subst: ''
|
69
|
+
:programlisting:
|
70
|
+
- :pattern: !ruby/regexp /.*/
|
71
|
+
:replace: ''
|
72
|
+
:wxWindow.SetBackgroundStyle:
|
73
|
+
:detail:
|
74
|
+
:pre:
|
75
|
+
:programlisting:
|
76
|
+
- :pattern: !ruby/regexp /.*/
|
77
|
+
:replace: |
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
class MyWidget < Wx::Window
|
81
|
+
def initialize(parent, ...)
|
82
|
+
super() # Use default ctor here!
|
83
|
+
# Do this first:
|
84
|
+
set_background_style(Wx::BG_STYLE_TRANSPARENT)
|
85
|
+
|
86
|
+
# And really create the window afterwards:
|
87
|
+
create(parent, ...)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
```
|
91
|
+
:wxWindow.HandleWindowEvent:
|
92
|
+
:detail:
|
93
|
+
:pre:
|
94
|
+
:programlisting:
|
95
|
+
- :pattern: !ruby/regexp /.*/
|
96
|
+
:replace: |
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
get_event_handler.safely_process_event(event)
|
100
|
+
```
|
101
|
+
:wxWindow.ProcessWindowEvent:
|
102
|
+
:detail:
|
103
|
+
:pre:
|
104
|
+
:programlisting:
|
105
|
+
- :pattern: !ruby/regexp /.*/
|
106
|
+
:replace: |
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
get_event_handler.process_event(event)
|
110
|
+
```
|
111
|
+
:wxWindow.PushEventHandler:
|
112
|
+
:detail:
|
113
|
+
:pre:
|
114
|
+
:programlisting:
|
115
|
+
- :pattern: !ruby/regexp /.*/
|
116
|
+
:replace: |
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
W.push_event_handler(A)
|
120
|
+
W.push_event_handler(B)
|
121
|
+
```
|
122
|
+
:wxWindow.Enable:
|
123
|
+
:detail:
|
124
|
+
:pre:
|
125
|
+
:programlisting:
|
126
|
+
- :pattern: !ruby/regexp /.*/
|
127
|
+
:replace: |
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
w = MyWindow.new # Note: default ctor is used here.
|
131
|
+
w.enable(false)
|
132
|
+
w.create(parent, ... all the usual non-default ctor arguments ...)
|
133
|
+
```
|
134
|
+
:wxWindow.EnableTouchEvents:
|
135
|
+
:detail:
|
136
|
+
:pre:
|
137
|
+
:programlisting:
|
138
|
+
- :pattern: !ruby/regexp /.*/
|
139
|
+
:replace: |
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
enable_touch_events(Wx::TOUCH_ZOOM_GESTURE | Wx::TOUCH_ROTATE_GESTURE)
|
143
|
+
```
|
144
|
+
:wxWindow.DoUpdateWindowUI:
|
145
|
+
:detail:
|
146
|
+
:pre:
|
147
|
+
:programlisting:
|
148
|
+
- :pattern: !ruby/regexp /.*/
|
149
|
+
:replace: |
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
# do the window-specific processing after processing the update event
|
153
|
+
def Wx::TopLevelWindow.do_update_window_ui(event)
|
154
|
+
if event.get_set_enabled
|
155
|
+
enable(event.get_enabled)
|
156
|
+
end
|
157
|
+
|
158
|
+
if event.get_set_text
|
159
|
+
if event.get_text != get_title
|
160
|
+
set_title(event.get_text)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
```
|
165
|
+
:wxWindow.UpdateWindowUI:
|
166
|
+
:detail:
|
167
|
+
:pre:
|
168
|
+
:programlisting:
|
169
|
+
- :pattern: !ruby/regexp /.*/
|
170
|
+
:replace: |
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
class MyWindow
|
174
|
+
...
|
175
|
+
def on_internal_idle
|
176
|
+
update_window_ui(Wx::UPDATE_UI_FROMIDLE) if Wx::UpdateUIEvent.can_update(self)
|
177
|
+
end
|
178
|
+
...
|
179
|
+
end
|
180
|
+
```
|
181
|
+
:wxWindow.Create:
|
182
|
+
:detail:
|
183
|
+
:pre:
|
184
|
+
:programlisting:
|
185
|
+
- :pattern: !ruby/regexp /wxPanel/
|
186
|
+
:replace: |
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
panel = Wx::Panel.new # Note: default constructor used.
|
190
|
+
panel.hide # Can be called before actually creating it.
|
191
|
+
panel.create(parent, Wx::ID_ANY, ...) # Won't be shown yet.
|
192
|
+
... create all the panel children ...
|
193
|
+
panel.show # Now everything will be shown at once.
|
194
|
+
```
|
195
|
+
- :pattern: !ruby/regexp /MyCreateWindowObjectFunction/
|
196
|
+
:replace: |
|
197
|
+
|
198
|
+
```ruby
|
199
|
+
# Suppose we have this function (which would typically be in a
|
200
|
+
# different file from the rest of the code).
|
201
|
+
def my_create_window_object_function
|
202
|
+
MyCustomClassDerivingFromWindow.new
|
203
|
+
end
|
204
|
+
|
205
|
+
# Then we can create a window of MyCustomClassDerivingFromWindow
|
206
|
+
# class without really knowing about this type, as we would have
|
207
|
+
# to do if we wanted to use the non-default constructor, like this:
|
208
|
+
|
209
|
+
# First create the C++ object using the factory function.
|
210
|
+
window = my_create_window_object_function
|
211
|
+
|
212
|
+
# And now create the underlying window.
|
213
|
+
#
|
214
|
+
# This should call the base Wx::Window#create.
|
215
|
+
# In C++ (wxWidgets) this method is not virtual and cannot be overloaded
|
216
|
+
# so the derived class can't customize this part.
|
217
|
+
# In wxRuby however this method can be overloaded as long as the following
|
218
|
+
# is kept in mind:
|
219
|
+
# 1. the overloaded version will **NOT** be called when using a non-default
|
220
|
+
# constructor (Create will than be called from C++ which will always be
|
221
|
+
# the base Wx::Window version);
|
222
|
+
# 2. when calling the overloaded version from Ruby understand that the window
|
223
|
+
# will not actually be created until after the `super` version has been called.
|
224
|
+
# In general it's best not to overload this method but to define a different method
|
225
|
+
# if a custom initializer is needed.
|
226
|
+
window.create(parent, Wx::ID_ANY, ...)
|
227
|
+
```
|
228
|
+
:wxWindow.MSWDisableComposited:
|
229
|
+
:detail:
|
230
|
+
:pre:
|
231
|
+
:programlisting:
|
232
|
+
- :pattern: !ruby/regexp /.*/
|
233
|
+
:replace: |
|
234
|
+
|
235
|
+
```ruby
|
236
|
+
class MyFrame < Wx::Frame
|
237
|
+
def initialize(...)
|
238
|
+
...
|
239
|
+
p = Wx::Panel.new(self)
|
240
|
+
if Wx::PLATFORM == 'WXMSW'
|
241
|
+
p.msw_disable_composited
|
242
|
+
end
|
243
|
+
|
244
|
+
# Using Wx::ClientDC will work now with this panel in wxMSW --
|
245
|
+
# although it still won't with wxOSX nor wxGTK under Wayland.
|
246
|
+
end
|
247
|
+
...
|
248
|
+
end
|
249
|
+
```
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
:wxWizardPageSimple.Chain:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
firstPage = FirstPage.new # derived from Wx::WizardPageSimple
|
11
|
+
firstPage.chain(SecondPage.new)
|
12
|
+
.chain(ThirdPage.new)
|
13
|
+
.chain(LastPage.new)
|
14
|
+
```
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
:wxXmlResource.Load:
|
3
|
+
:detail:
|
4
|
+
:pre:
|
5
|
+
:programlisting:
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
7
|
+
:replace: |
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
if !Wx::XmlResource.get.load('rc/*.xrc')
|
11
|
+
Wx.log_error("Couldn't load resources!")
|
12
|
+
end
|
13
|
+
```
|
14
|
+
:wxXmlResource.LoadDialog:
|
15
|
+
:detail:
|
16
|
+
:pre:
|
17
|
+
:programlisting:
|
18
|
+
- :pattern: !ruby/regexp /.*/
|
19
|
+
:replace: |
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
dlg = MyDialog.new
|
23
|
+
Wx::XmlResource.get.load_dialog_subclass(dlg, main_frame, 'my_dialog')
|
24
|
+
dlg.show_modal
|
25
|
+
|
26
|
+
dlg.destroy
|
27
|
+
```
|
data/rakelib/lib/generate/doc.rb
CHANGED
@@ -277,6 +277,7 @@ module WXRuby3
|
|
277
277
|
|
278
278
|
def _ident_str_to_doc(s, ref_scope = nil)
|
279
279
|
return s if no_idents?
|
280
|
+
return s if %w[wxRuby wxMSW wxOSX wxGTK wxX11].any? { |w| s.start_with?(w) }
|
280
281
|
nmlist = s.split('::')
|
281
282
|
nm_str = nmlist.shift.to_s
|
282
283
|
constnm = rb_wx_name(nm_str)
|
@@ -403,7 +404,7 @@ module WXRuby3
|
|
403
404
|
itm_text = node_to_doc(node)
|
404
405
|
# fix possible unwanted leading spaces resulting in verbatim blocks
|
405
406
|
itm_text = itm_text.split("\n").collect {|s|s.lstrip}.join("\n") if itm_text.index("\n")
|
406
|
-
"- #{itm_text}"
|
407
|
+
"\n- #{itm_text}"
|
407
408
|
end
|
408
409
|
|
409
410
|
def node_to_doc(xmlnode)
|
@@ -589,6 +590,39 @@ module WXRuby3
|
|
589
590
|
DocGenerator.constants_xref_db
|
590
591
|
end
|
591
592
|
|
593
|
+
def type_to_doc(ctype_decl)
|
594
|
+
return ctype_decl if ctype_decl == 'void'
|
595
|
+
ctype = Typemap.strip_type_decl(ctype_decl)
|
596
|
+
nmlist = ctype.split('::')
|
597
|
+
nm_str = nmlist.shift.to_s
|
598
|
+
constnm = rb_wx_name(nm_str)
|
599
|
+
if nmlist.empty? # unscoped id?
|
600
|
+
if DocGenerator.constants_xref_db.has_key?(constnm)
|
601
|
+
"#{DocGenerator.constants_xref_db[constnm]['mod']}::#{constnm}"
|
602
|
+
elsif DocGenerator.constants_xref_db.has_key?(rb_constant_name(nm_str))
|
603
|
+
"Wx::#{rb_constant_name(nm_str)}"
|
604
|
+
elsif DocGenerator.constants_xref_db.has_key?(rb_constant_name(nm_str, false))
|
605
|
+
"Wx::#{rb_constant_name(nm_str, false)}"
|
606
|
+
else
|
607
|
+
Typemap.wx_type_to_rb(ctype)
|
608
|
+
end
|
609
|
+
else
|
610
|
+
itmnm = nmlist.shift.to_s
|
611
|
+
if DocGenerator.constants_xref_db.has_key?(constnm)
|
612
|
+
constnm = "#{DocGenerator.constants_xref_db[constnm]['mod']}::#{constnm}"
|
613
|
+
elsif DocGenerator.constants_xref_db.has_key?(rb_constant_name(nm_str))
|
614
|
+
cnm = rb_constant_name(nm_str)
|
615
|
+
constnm = "#{DocGenerator.constants_xref_db[cnm]['mod']}::#{cnm}"
|
616
|
+
elsif DocGenerator.constants_xref_db.has_key?(rb_constant_name(nm_str, false))
|
617
|
+
cnm = rb_constant_name(nm_str, false)
|
618
|
+
constnm = "#{DocGenerator.constants_xref_db[cnm]['mod']}::#{cnm}"
|
619
|
+
elsif nm_str.start_with?('wx')
|
620
|
+
constnm = "Wx::#{constnm}"
|
621
|
+
end
|
622
|
+
"#{constnm}::#{rb_wx_name(itmnm)}"
|
623
|
+
end
|
624
|
+
end
|
625
|
+
|
592
626
|
end
|
593
627
|
|
594
628
|
def run
|
@@ -17,6 +17,7 @@ module WXRuby3
|
|
17
17
|
Director.Spec(pkg, 'wxEvtHandler')
|
18
18
|
Director.Spec(pkg, 'wxEvents')
|
19
19
|
Director.Spec(pkg, 'wxEventFilter')
|
20
|
+
Director.Spec(pkg, 'wxGUIEventLoop')
|
20
21
|
Director.Spec(pkg, 'wxApp')
|
21
22
|
Director.Spec(pkg, 'wxDC')
|
22
23
|
Director.Spec(pkg, 'wxWindowDC', director: Director::DerivedDC)
|
data/rakelib/lib/swig_runner.rb
CHANGED
@@ -481,6 +481,43 @@ module WXRuby3
|
|
481
481
|
end
|
482
482
|
end
|
483
483
|
|
484
|
+
# Updates SWIG generated wrapper code for disowned allocation modules.
|
485
|
+
class FixDisownedAlloc < Processor
|
486
|
+
|
487
|
+
def run
|
488
|
+
# get the generated (class) items which have been defined to need disowned allocation
|
489
|
+
class_list = def_items.select { |itm| Extractor::ClassDef === itm && allocate_disowned?(itm) }
|
490
|
+
# setup a table with the required tracking methods for each class
|
491
|
+
track_table = class_list.inject({}) do |tbl, clsdef|
|
492
|
+
tbl[clsdef.name] = (gc_type(clsdef) == :GC_MANAGE_AS_UNTRACKED) ? '0' : 'SWIG_RubyRemoveTracking'
|
493
|
+
tbl
|
494
|
+
end
|
495
|
+
# create re match list for class names
|
496
|
+
cls_re_txt = class_list.collect { |clsdef| clsdef.name }.join('|')
|
497
|
+
# updating any matching alloc functions in generated SWIG sourcecode
|
498
|
+
# create regexp for 'initialize' wrappers (due to overloads this could be more than one per class)
|
499
|
+
alloc_re = /_wrap_(#{cls_re_txt})_allocate\(int\s+argc.*\)/
|
500
|
+
found_alloc = false
|
501
|
+
cpp_class = nil
|
502
|
+
update_source do |line|
|
503
|
+
if found_alloc # inside 'xxx_allocate' wrapper?
|
504
|
+
if line =~ /\A(\s*)return\s+vresult;/
|
505
|
+
# insert an override for the free method to disown the new instance
|
506
|
+
line = "#{$1}RDATA(vresult)->dfree = #{track_table[cpp_class]};\n#{line}"
|
507
|
+
elsif /\A}/ =~ line # end of wrapper function?
|
508
|
+
# stop matching
|
509
|
+
found_alloc = false
|
510
|
+
end
|
511
|
+
elsif alloc_re =~ line # are we at an 'xxx_allocate' wrapper?
|
512
|
+
found_alloc = true
|
513
|
+
cpp_class = $1
|
514
|
+
end
|
515
|
+
line
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
519
|
+
end
|
520
|
+
|
484
521
|
# Updates SWIG generated wrapper code for Mixin modules.
|
485
522
|
class FixInterfaceMixin < Processor
|
486
523
|
|
data/tests/test_art.rb
CHANGED
@@ -76,6 +76,15 @@ class TestArt < Test::Unit::TestCase
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
+
def test_image_histogram
|
80
|
+
img = Wx.Image(:wxruby, Wx::BitmapType::BITMAP_TYPE_JPEG)
|
81
|
+
img_hist = img.compute_histogram
|
82
|
+
assert(img_hist.is_a?(::Hash))
|
83
|
+
assert(img_hist.is_a?(Wx::Image::Histogram))
|
84
|
+
assert(img_hist.size > 0)
|
85
|
+
assert(img_hist.values.all? { |index, value| index>=0 && value>=1 })
|
86
|
+
end
|
87
|
+
|
79
88
|
def test_art
|
80
89
|
art = nil
|
81
90
|
assert_nothing_raised do
|