wxruby3 0.9.0.pre.beta.13 → 0.9.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +47 -4
- data/assets/hello_button.png +0 -0
- data/assets/hello_button_clicked.png +0 -0
- data/assets/hello_world.png +0 -0
- data/assets/repo-social-preview.png +0 -0
- data/ext/wxruby3/include/wxruby-runtime.h +1 -0
- data/ext/wxruby3/swig/memory_management.i +6 -10
- data/ext/wxruby3/swig/wx.i +17 -6
- data/lib/wx/accessors.rb +8 -2
- data/lib/wx/core/art_locator.rb +2 -2
- data/lib/wx/core/artprovider.rb +2 -2
- data/lib/wx/core/bitmap.rb +6 -5
- data/lib/wx/core/bitmap_combobox.rb +34 -0
- data/lib/wx/core/controlwithitems.rb +52 -14
- data/lib/wx/core/cursor.rb +1 -1
- data/lib/wx/core/dc.rb +0 -20
- data/lib/wx/core/event_blocker.rb +14 -0
- data/lib/wx/core/evthandler.rb +36 -0
- data/lib/wx/core/find_replace_dialog.rb +24 -0
- data/lib/wx/core/icon.rb +1 -1
- data/lib/wx/core/image.rb +1 -1
- data/lib/wx/core/paintdc.rb +8 -0
- data/lib/wx/core/text_entry.rb +15 -0
- data/lib/wx/core/v_list_box.rb +13 -0
- data/lib/wx/core/window.rb +1 -1
- data/lib/wx/doc/busy_info.rb +21 -0
- data/lib/wx/doc/client_dc.rb +28 -0
- data/lib/wx/doc/controlwithitems.rb +11 -0
- data/lib/wx/doc/dc.rb +0 -14
- data/lib/wx/doc/event_blocker.rb +27 -0
- data/lib/wx/doc/evthandler.rb +4 -0
- data/lib/wx/doc/extra/02_lifecycles.md +49 -0
- data/lib/wx/doc/extra/10_art.md +1 -1
- data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
- data/lib/wx/doc/memory_dc.rb +75 -0
- data/lib/wx/doc/mirror_dc.rb +16 -0
- data/lib/wx/doc/prt/printer_dc.rb +26 -0
- data/lib/wx/doc/screen_dc.rb +10 -6
- data/lib/wx/doc/svg_file_dc.rb +20 -0
- data/lib/wx/doc/v_list_box.rb +9 -0
- data/lib/wx/doc/window_disabler.rb +10 -0
- data/lib/wx/global_const.rb +24 -18
- data/lib/wx/html/keyword_defs.rb +6 -7
- data/lib/wx/html/require.rb +1 -0
- data/lib/wx/html/simple_html_listbox.rb +105 -0
- data/lib/wx/keyword_defs.rb +7 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/cmd/test.rb +1 -1
- data/rakelib/install.rb +3 -1
- data/rakelib/lib/core/mapping.rb +5 -5
- data/rakelib/lib/core/spec.rb +7 -3
- data/rakelib/lib/core/spec_helper.rb +9 -1
- data/rakelib/lib/director/accelerator.rb +1 -1
- data/rakelib/lib/director/app.rb +25 -3
- data/rakelib/lib/director/art_provider.rb +5 -1
- data/rakelib/lib/director/aui_pane_info.rb +1 -1
- data/rakelib/lib/director/aui_tab_ctrl.rb +1 -1
- data/rakelib/lib/director/bitmap.rb +2 -1
- data/rakelib/lib/director/bitmap_combobox.rb +32 -0
- data/rakelib/lib/director/brush.rb +1 -0
- data/rakelib/lib/director/busy_info.rb +1 -1
- data/rakelib/lib/director/choice.rb +1 -0
- data/rakelib/lib/director/clipboard.rb +1 -1
- data/rakelib/lib/director/colour.rb +1 -0
- data/rakelib/lib/director/colour_picker_ctrl.rb +1 -1
- data/rakelib/lib/director/combobox.rb +1 -2
- data/rakelib/lib/director/ctrl_with_items.rb +3 -0
- data/rakelib/lib/director/cursor.rb +1 -0
- data/rakelib/lib/director/data_object.rb +5 -7
- data/rakelib/lib/director/dc.rb +5 -1
- data/rakelib/lib/director/defs.rb +3 -0
- data/rakelib/lib/director/derived_dc.rb +278 -27
- data/rakelib/lib/director/dialog.rb +4 -1
- data/rakelib/lib/director/dir_picker_ctrl.rb +1 -1
- data/rakelib/lib/director/event.rb +3 -3
- data/rakelib/lib/director/event_blocker.rb +41 -0
- data/rakelib/lib/director/event_filter.rb +20 -0
- data/rakelib/lib/director/event_handler.rb +29 -2
- data/rakelib/lib/director/file_picker_ctrl.rb +1 -1
- data/rakelib/lib/director/find_replace_data.rb +1 -0
- data/rakelib/lib/director/font.rb +2 -1
- data/rakelib/lib/director/font_data.rb +1 -0
- data/rakelib/lib/director/font_picker_ctrl.rb +1 -1
- data/rakelib/lib/director/gdi_object.rb +1 -0
- data/rakelib/lib/director/graphics_context.rb +6 -6
- data/rakelib/lib/director/grid_table_message.rb +1 -1
- data/rakelib/lib/director/html_cell.rb +1 -1
- data/rakelib/lib/director/html_data_object.rb +5 -7
- data/rakelib/lib/director/html_listbox.rb +65 -1
- data/rakelib/lib/director/icon.rb +2 -0
- data/rakelib/lib/director/listbox.rb +1 -0
- data/rakelib/lib/director/locale.rb +2 -1
- data/rakelib/lib/director/palette.rb +1 -0
- data/rakelib/lib/director/pen.rb +2 -1
- data/rakelib/lib/director/pgproperties.rb +1 -1
- data/rakelib/lib/director/pgproperty.rb +1 -1
- data/rakelib/lib/director/pgvalidation_info.rb +1 -1
- data/rakelib/lib/director/platform_info.rb +1 -1
- data/rakelib/lib/director/print_data.rb +1 -1
- data/rakelib/lib/director/property_grid_interface.rb +1 -1
- data/rakelib/lib/director/property_grid_page_state.rb +1 -1
- data/rakelib/lib/director/region.rb +1 -0
- data/rakelib/lib/director/ribbon_art_provider.rb +1 -1
- data/rakelib/lib/director/richtext_buffer_data_object.rb +5 -7
- data/rakelib/lib/director/richtext_header_footer_data.rb +1 -1
- data/rakelib/lib/director/searchctrl.rb +24 -0
- data/rakelib/lib/director/sizer.rb +2 -2
- data/rakelib/lib/director/styled_text_ctrl.rb +2 -0
- data/rakelib/lib/director/text_entry.rb +2 -2
- data/rakelib/lib/director/tree_ctrl.rb +6 -3
- data/rakelib/lib/director/uiaction_simulator.rb +20 -0
- data/rakelib/lib/director/variant.rb +1 -1
- data/rakelib/lib/director/vlistbox.rb +25 -0
- data/rakelib/lib/director/window.rb +0 -6
- data/rakelib/lib/director/with_images.rb +1 -1
- data/rakelib/lib/director/xml_node.rb +1 -1
- data/rakelib/lib/extractor/function.rb +5 -3
- data/rakelib/lib/generate/doc/about_dialog_info.yaml +46 -0
- data/rakelib/lib/generate/doc/accelerator.yaml +21 -0
- data/rakelib/lib/generate/doc/art_provider.yaml +35 -0
- data/rakelib/lib/generate/doc/bitmap.yaml +37 -0
- data/rakelib/lib/generate/doc/box_sizer.yaml +15 -0
- data/rakelib/lib/generate/doc/busy_info.yaml +74 -0
- data/rakelib/lib/generate/doc/client_dc.yaml +19 -0
- data/rakelib/lib/generate/doc/clipboard.yaml +43 -0
- data/rakelib/lib/generate/doc/collapsible_pane.yaml +21 -0
- data/rakelib/lib/generate/doc/colour_dialog.yaml +32 -0
- data/rakelib/lib/generate/doc/control.yaml +46 -0
- data/rakelib/lib/generate/doc/cursor.yaml +40 -0
- data/rakelib/lib/generate/doc/data_object.yaml +55 -0
- data/rakelib/lib/generate/doc/dc.yaml +14 -0
- data/rakelib/lib/generate/doc/dialog.yaml +36 -0
- data/rakelib/lib/generate/doc/dir_dialog.yaml +25 -0
- data/rakelib/lib/generate/doc/events.yaml +152 -0
- data/rakelib/lib/generate/doc/evt_handler.yaml +63 -0
- data/rakelib/lib/generate/doc.rb +77 -14
- data/rakelib/lib/generate/interface.rb +11 -0
- data/rakelib/lib/specs/interfaces.rb +5 -4
- data/rakelib/lib/swig_runner.rb +3 -3
- data/rakelib/lib/typemap/common.rb +15 -3
- data/rakelib/lib/util/string.rb +1 -0
- data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
- data/samples/bigdemo/wxArtProvider.rbw +5 -4
- data/samples/controls/controls.rb +2 -2
- data/samples/controls/htlbox.rb +411 -0
- data/samples/controls/tn_htlbox.png +0 -0
- data/samples/drawing/graphics_drawing.rb +1 -2
- data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
- data/samples/drawing/tn_image_prt.png +0 -0
- data/samples/propgrid/propgrid.rb +23 -21
- data/samples/ribbon/ribbon.rb +47 -46
- data/tests/lib/wxapp_runner.rb +3 -3
- data/tests/lib/wxframe_runner.rb +59 -0
- data/tests/test_app_event_filter.rb +74 -0
- data/tests/test_art_provider.rb +52 -0
- data/tests/test_clipboard.rb +2 -1
- data/tests/test_event_handling.rb +199 -16
- data/tests/test_events.rb +4 -11
- data/tests/test_gdi_object.rb +161 -0
- data/tests/test_intl.rb +11 -14
- data/tests/test_item_data.rb +33 -1
- data/tests/test_std_controls.rb +147 -0
- metadata +56 -4
- data/samples/drawing/tn_svgtest.png +0 -0
@@ -12,24 +12,24 @@ module WXRuby3
|
|
12
12
|
def setup
|
13
13
|
super
|
14
14
|
spec.disable_proxies
|
15
|
+
spec.gc_as_untracked spec.module_name
|
15
16
|
if spec.module_name == 'wxScreenDC'
|
16
17
|
spec.make_abstract 'wxScreenDC'
|
17
|
-
spec.gc_never 'wxScreenDC'
|
18
18
|
# as a ScreenDC should always be a temporary stack object
|
19
19
|
# we do not allow creation in Ruby but rather provide a class
|
20
20
|
# method for block execution on a temp dc
|
21
21
|
spec.add_extend_code 'wxScreenDC', <<~__HEREDOC
|
22
|
-
static VALUE
|
22
|
+
static VALUE draw_on()
|
23
23
|
{
|
24
|
+
if (!wxRuby_IsAppRunning())
|
25
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
24
26
|
VALUE rc = Qnil;
|
25
27
|
if (rb_block_given_p ())
|
26
28
|
{
|
27
29
|
wxScreenDC screen_dc;
|
28
|
-
|
30
|
+
wxScreenDC* dc_ptr = &screen_dc;
|
29
31
|
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxScreenDC, 0);
|
30
32
|
rc = rb_yield(rb_dc);
|
31
|
-
SWIG_RubyRemoveTracking((void *)dc_ptr);
|
32
|
-
DATA_PTR(rb_dc) = NULL;
|
33
33
|
}
|
34
34
|
return rc;
|
35
35
|
}
|
@@ -38,8 +38,223 @@ module WXRuby3
|
|
38
38
|
spec.ignore 'wxScreenDC::StartDrawingOnTop',
|
39
39
|
'wxScreenDC::EndDrawingOnTop',
|
40
40
|
'wxScreenDC::wxScreenDC'
|
41
|
+
elsif spec.module_name == 'wxClientDC'
|
42
|
+
spec.make_abstract 'wxClientDC'
|
43
|
+
spec.ignore 'wxClientDC::wxClientDC'
|
44
|
+
# as a ClientDC should best always be a temporary stack object
|
45
|
+
# we do not allow creation in Ruby but rather provide a class
|
46
|
+
# method for block execution on a temp dc
|
47
|
+
spec.add_extend_code 'wxClientDC', <<~__HEREDOC
|
48
|
+
static VALUE draw_on(wxWindow* win)
|
49
|
+
{
|
50
|
+
if (!wxRuby_IsAppRunning())
|
51
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
52
|
+
VALUE rc = Qnil;
|
53
|
+
if (rb_block_given_p ())
|
54
|
+
{
|
55
|
+
wxClientDC client_dc(win);
|
56
|
+
wxClientDC* dc_ptr = &client_dc;
|
57
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxClientDC, 0);
|
58
|
+
rc = rb_yield(rb_dc);
|
59
|
+
}
|
60
|
+
return rc;
|
61
|
+
}
|
62
|
+
__HEREDOC
|
63
|
+
elsif spec.module_name == 'wxPaintDC'
|
64
|
+
spec.make_abstract 'wxPaintDC'
|
65
|
+
spec.ignore 'wxPaintDC::wxPaintDC'
|
66
|
+
elsif spec.module_name == 'wxMemoryDC'
|
67
|
+
spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC' << 'wxAutoBufferedPaintDC'
|
68
|
+
spec.make_abstract 'wxMemoryDC'
|
69
|
+
spec.make_abstract 'wxBufferedDC'
|
70
|
+
spec.make_abstract 'wxBufferedPaintDC'
|
71
|
+
spec.make_abstract 'wxAutoBufferedPaintDC'
|
72
|
+
spec.ignore 'wxMemoryDC::wxMemoryDC',
|
73
|
+
'wxBufferedDC::wxBufferedDC',
|
74
|
+
'wxBufferedPaintDC::wxBufferedPaintDC',
|
75
|
+
'wxAutoBufferedPaintDC::wxAutoBufferedPaintDC'
|
76
|
+
# like all DC's these should best always be a temporary stack objects
|
77
|
+
# we do not allow creation in Ruby but rather provide a class
|
78
|
+
# method for block execution on a temp dc
|
79
|
+
spec.add_extend_code 'wxMemoryDC', <<~__HEREDOC
|
80
|
+
static VALUE draw_on()
|
81
|
+
{
|
82
|
+
if (!wxRuby_IsAppRunning())
|
83
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
84
|
+
VALUE rc = Qnil;
|
85
|
+
if (rb_block_given_p ())
|
86
|
+
{
|
87
|
+
wxMemoryDC mem_dc;
|
88
|
+
wxMemoryDC* dc_ptr = &mem_dc;
|
89
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxMemoryDC, 0);
|
90
|
+
rc = rb_yield(rb_dc);
|
91
|
+
}
|
92
|
+
return rc;
|
93
|
+
}
|
94
|
+
static VALUE draw_on(wxDC* tgt)
|
95
|
+
{
|
96
|
+
if (!wxRuby_IsAppRunning())
|
97
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
98
|
+
VALUE rc = Qnil;
|
99
|
+
if (rb_block_given_p ())
|
100
|
+
{
|
101
|
+
wxMemoryDC mem_dc(tgt);
|
102
|
+
wxMemoryDC* dc_ptr = &mem_dc;
|
103
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxMemoryDC, 0);
|
104
|
+
rc = rb_yield(rb_dc);
|
105
|
+
}
|
106
|
+
return rc;
|
107
|
+
}
|
108
|
+
static VALUE draw_on(wxBitmap& tgt)
|
109
|
+
{
|
110
|
+
if (!wxRuby_IsAppRunning())
|
111
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
112
|
+
VALUE rc = Qnil;
|
113
|
+
if (rb_block_given_p ())
|
114
|
+
{
|
115
|
+
wxMemoryDC mem_dc(tgt);
|
116
|
+
wxMemoryDC* dc_ptr = &mem_dc;
|
117
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxMemoryDC, 0);
|
118
|
+
rc = rb_yield(rb_dc);
|
119
|
+
}
|
120
|
+
return rc;
|
121
|
+
}
|
122
|
+
__HEREDOC
|
123
|
+
spec.add_extend_code 'wxBufferedDC', <<~__HEREDOC
|
124
|
+
static VALUE draw_on()
|
125
|
+
{
|
126
|
+
if (!wxRuby_IsAppRunning())
|
127
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
128
|
+
VALUE rc = Qnil;
|
129
|
+
if (rb_block_given_p ())
|
130
|
+
{
|
131
|
+
wxBufferedDC dc;
|
132
|
+
wxBufferedDC* dc_ptr = &dc;
|
133
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxBufferedDC, 0);
|
134
|
+
rc = rb_yield(rb_dc);
|
135
|
+
}
|
136
|
+
return rc;
|
137
|
+
}
|
138
|
+
static VALUE draw_on(wxDC* tgt, const wxSize &area, int style=wxBUFFER_CLIENT_AREA)
|
139
|
+
{
|
140
|
+
if (!wxRuby_IsAppRunning())
|
141
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
142
|
+
VALUE rc = Qnil;
|
143
|
+
if (rb_block_given_p ())
|
144
|
+
{
|
145
|
+
wxBufferedDC dc(tgt, area, style);
|
146
|
+
wxBufferedDC* dc_ptr = &dc;
|
147
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxBufferedDC, 0);
|
148
|
+
rc = rb_yield(rb_dc);
|
149
|
+
}
|
150
|
+
return rc;
|
151
|
+
}
|
152
|
+
static VALUE draw_on(wxDC* tgt, wxBitmap &buffer=wxNullBitmap, int style=wxBUFFER_CLIENT_AREA)
|
153
|
+
{
|
154
|
+
if (!wxRuby_IsAppRunning())
|
155
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
156
|
+
VALUE rc = Qnil;
|
157
|
+
if (rb_block_given_p ())
|
158
|
+
{
|
159
|
+
wxBufferedDC dc(tgt, buffer, style);
|
160
|
+
wxBufferedDC* dc_ptr = &dc;
|
161
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxBufferedDC, 0);
|
162
|
+
rc = rb_yield(rb_dc);
|
163
|
+
}
|
164
|
+
return rc;
|
165
|
+
}
|
166
|
+
__HEREDOC
|
167
|
+
spec.add_extend_code 'wxBufferedPaintDC', <<~__HEREDOC
|
168
|
+
static VALUE draw_on(wxWindow* tgt, int style=wxBUFFER_CLIENT_AREA)
|
169
|
+
{
|
170
|
+
if (!wxRuby_IsAppRunning())
|
171
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
172
|
+
VALUE rc = Qnil;
|
173
|
+
if (rb_block_given_p ())
|
174
|
+
{
|
175
|
+
wxBufferedPaintDC dc(tgt, style);
|
176
|
+
wxBufferedPaintDC* dc_ptr = &dc;
|
177
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxBufferedPaintDC, 0);
|
178
|
+
rc = rb_yield(rb_dc);
|
179
|
+
}
|
180
|
+
return rc;
|
181
|
+
}
|
182
|
+
static VALUE draw_on(wxWindow* tgt, wxBitmap &buffer=wxNullBitmap, int style=wxBUFFER_CLIENT_AREA)
|
183
|
+
{
|
184
|
+
if (!wxRuby_IsAppRunning())
|
185
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
186
|
+
VALUE rc = Qnil;
|
187
|
+
if (rb_block_given_p ())
|
188
|
+
{
|
189
|
+
wxBufferedPaintDC dc(tgt, buffer, style);
|
190
|
+
wxBufferedPaintDC* dc_ptr = &dc;
|
191
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxBufferedPaintDC, 0);
|
192
|
+
rc = rb_yield(rb_dc);
|
193
|
+
}
|
194
|
+
return rc;
|
195
|
+
}
|
196
|
+
__HEREDOC
|
197
|
+
spec.add_extend_code 'wxAutoBufferedPaintDC', <<~__HEREDOC
|
198
|
+
static VALUE draw_on(wxWindow* tgt)
|
199
|
+
{
|
200
|
+
if (!wxRuby_IsAppRunning())
|
201
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
202
|
+
VALUE rc = Qnil;
|
203
|
+
if (rb_block_given_p ())
|
204
|
+
{
|
205
|
+
wxAutoBufferedPaintDC dc(tgt);
|
206
|
+
wxAutoBufferedPaintDC* dc_ptr = &dc;
|
207
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxAutoBufferedPaintDC, 0);
|
208
|
+
rc = rb_yield(rb_dc);
|
209
|
+
}
|
210
|
+
return rc;
|
211
|
+
}
|
212
|
+
__HEREDOC
|
213
|
+
elsif spec.module_name == 'wxMirrorDC'
|
214
|
+
spec.make_abstract 'wxMirrorDC'
|
215
|
+
spec.ignore 'wxMirrorDC::wxMirrorDC'
|
216
|
+
# as a MirrorDC should best always be a temporary stack object
|
217
|
+
# we do not allow creation in Ruby but rather provide a class
|
218
|
+
# method for block execution on a temp dc
|
219
|
+
spec.add_extend_code 'wxMirrorDC', <<~__HEREDOC
|
220
|
+
static VALUE draw_on(wxDC* dc, bool mirror)
|
221
|
+
{
|
222
|
+
if (!wxRuby_IsAppRunning())
|
223
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
224
|
+
VALUE rc = Qnil;
|
225
|
+
if (rb_block_given_p ())
|
226
|
+
{
|
227
|
+
wxMirrorDC dc(dc, mirror);
|
228
|
+
wxMirrorDC* dc_ptr = &dc;
|
229
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxMirrorDC, 0);
|
230
|
+
rc = rb_yield(rb_dc);
|
231
|
+
}
|
232
|
+
return rc;
|
233
|
+
}
|
234
|
+
__HEREDOC
|
41
235
|
elsif spec.module_name == 'wxSVGFileDC'
|
42
236
|
spec.items.concat %w[wxSVGBitmapHandler wxSVGBitmapFileHandler wxSVGBitmapEmbedHandler]
|
237
|
+
spec.make_abstract 'wxSVGFileDC'
|
238
|
+
spec.ignore 'wxSVGFileDC::wxSVGFileDC'
|
239
|
+
# like all DC this should best always be a temporary stack object
|
240
|
+
# we do not allow creation in Ruby but rather provide a class
|
241
|
+
# method for block execution on a temp dc
|
242
|
+
spec.add_extend_code 'wxSVGFileDC', <<~__HEREDOC
|
243
|
+
static VALUE draw_on(const wxString &filename, int width=320, int height=240, double dpi=72, const wxString &title=wxString())
|
244
|
+
{
|
245
|
+
if (!wxRuby_IsAppRunning())
|
246
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
247
|
+
VALUE rc = Qnil;
|
248
|
+
if (rb_block_given_p ())
|
249
|
+
{
|
250
|
+
wxSVGFileDC dc(filename, width, height, dpi, title);
|
251
|
+
wxSVGFileDC* dc_ptr = &dc;
|
252
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxSVGFileDC, 0);
|
253
|
+
rc = rb_yield(rb_dc);
|
254
|
+
}
|
255
|
+
return rc;
|
256
|
+
}
|
257
|
+
__HEREDOC
|
43
258
|
spec.disown 'wxSVGBitmapHandler *handler'
|
44
259
|
# all inherited from wxDC; only documented since they are not implemented for this DC class
|
45
260
|
spec.ignore 'wxSVGFileDC::DestroyClippingRegion',
|
@@ -56,13 +271,15 @@ module WXRuby3
|
|
56
271
|
'wxSVGFileDC::EndPage'
|
57
272
|
elsif spec.module_name == 'wxGCDC'
|
58
273
|
spec.make_abstract 'wxGCDC'
|
59
|
-
spec.
|
60
|
-
#
|
274
|
+
spec.ignore 'wxGCDC::wxGCDC'
|
275
|
+
# like all DC this should best always be a temporary stack object
|
61
276
|
# we do not allow creation in Ruby but rather provide class
|
62
277
|
# methods for block execution on a temp dc
|
63
278
|
spec.add_extend_code 'wxGCDC', <<~__HEREDOC
|
64
279
|
static VALUE draw_on(const wxWindowDC& dc)
|
65
280
|
{
|
281
|
+
if (!wxRuby_IsAppRunning())
|
282
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
66
283
|
VALUE rc = Qnil;
|
67
284
|
if (rb_block_given_p ())
|
68
285
|
{
|
@@ -70,19 +287,17 @@ module WXRuby3
|
|
70
287
|
// being GC-ed unless we block GC for the duration of the block
|
71
288
|
// execution. Unclear why. We have similar code for other objects
|
72
289
|
// where this issue does not come up.
|
73
|
-
VALUE gc_on = rb_gc_disable();
|
74
290
|
wxGCDC gc_dc(dc);
|
75
291
|
wxGCDC* dc_ptr = &gc_dc;
|
76
292
|
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxGCDC, 0);
|
77
293
|
rc = rb_yield(rb_dc);
|
78
|
-
SWIG_RubyRemoveTracking((void *)dc_ptr);
|
79
|
-
DATA_PTR(rb_dc) = NULL;
|
80
|
-
if (gc_on == Qtrue) rb_gc_enable();
|
81
294
|
}
|
82
295
|
return rc;
|
83
296
|
}
|
84
297
|
static VALUE draw_on(const wxMemoryDC& dc)
|
85
298
|
{
|
299
|
+
if (!wxRuby_IsAppRunning())
|
300
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
86
301
|
VALUE rc = Qnil;
|
87
302
|
if (rb_block_given_p ())
|
88
303
|
{
|
@@ -90,19 +305,17 @@ module WXRuby3
|
|
90
305
|
// being GC-ed unless we block GC for the duration of the block
|
91
306
|
// execution. Unclear why. We have similar code for other objects
|
92
307
|
// where this issue does not come up.
|
93
|
-
VALUE gc_on = rb_gc_disable();
|
94
308
|
wxGCDC gc_dc(dc);
|
95
309
|
wxGCDC* dc_ptr = &gc_dc;
|
96
310
|
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxGCDC, 0);
|
97
311
|
rc = rb_yield(rb_dc);
|
98
|
-
SWIG_RubyRemoveTracking((void *)dc_ptr);
|
99
|
-
DATA_PTR(rb_dc) = NULL;
|
100
|
-
if (gc_on == Qtrue) rb_gc_enable();
|
101
312
|
}
|
102
313
|
return rc;
|
103
314
|
}
|
104
315
|
static VALUE draw_on(const wxPrinterDC& dc)
|
105
316
|
{
|
317
|
+
if (!wxRuby_IsAppRunning())
|
318
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
106
319
|
VALUE rc = Qnil;
|
107
320
|
if (rb_block_given_p ())
|
108
321
|
{
|
@@ -110,19 +323,17 @@ module WXRuby3
|
|
110
323
|
// being GC-ed unless we block GC for the duration of the block
|
111
324
|
// execution. Unclear why. We have similar code for other objects
|
112
325
|
// where this issue does not come up.
|
113
|
-
VALUE gc_on = rb_gc_disable();
|
114
326
|
wxGCDC gc_dc(dc);
|
115
327
|
wxGCDC* dc_ptr = &gc_dc;
|
116
328
|
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxGCDC, 0);
|
117
329
|
rc = rb_yield(rb_dc);
|
118
|
-
SWIG_RubyRemoveTracking((void *)dc_ptr);
|
119
|
-
DATA_PTR(rb_dc) = NULL;
|
120
|
-
if (gc_on == Qtrue) rb_gc_enable();
|
121
330
|
}
|
122
331
|
return rc;
|
123
332
|
}
|
124
333
|
static VALUE draw_on(wxGraphicsContext* gc)
|
125
334
|
{
|
335
|
+
if (!wxRuby_IsAppRunning())
|
336
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
126
337
|
VALUE rc = Qnil;
|
127
338
|
if (rb_block_given_p ())
|
128
339
|
{
|
@@ -130,14 +341,10 @@ module WXRuby3
|
|
130
341
|
// being GC-ed unless we block GC for the duration of the block
|
131
342
|
// execution. Unclear why. We have similar code for other objects
|
132
343
|
// where this issue does not come up.
|
133
|
-
VALUE gc_on = rb_gc_disable();
|
134
344
|
wxGCDC gc_dc(gc);
|
135
345
|
wxGCDC* dc_ptr = &gc_dc;
|
136
346
|
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxGCDC, 0);
|
137
347
|
rc = rb_yield(rb_dc);
|
138
|
-
SWIG_RubyRemoveTracking((void *)dc_ptr);
|
139
|
-
DATA_PTR(rb_dc) = NULL;
|
140
|
-
if (gc_on == Qtrue) rb_gc_enable();
|
141
348
|
}
|
142
349
|
return rc;
|
143
350
|
}
|
@@ -148,7 +355,6 @@ module WXRuby3
|
|
148
355
|
spec.override_inheritance_chain('wxScaledDC', %w[wxDC wxObject])
|
149
356
|
# as there are no dependencies parsed from XML make sure we're initialized after Wx::DC
|
150
357
|
spec.initialize_at_end = true
|
151
|
-
spec.gc_never 'wxScaledDC'
|
152
358
|
spec.no_proxy 'wxScaledDC'
|
153
359
|
spec.include 'wxruby-ScaledDC.h'
|
154
360
|
# wxScaledDc should ever only be used in a restricted scope
|
@@ -160,6 +366,8 @@ module WXRuby3
|
|
160
366
|
%extend wxScaledDC {
|
161
367
|
static VALUE draw_on(wxDC& target, double scale)
|
162
368
|
{
|
369
|
+
if (!wxRuby_IsAppRunning())
|
370
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
163
371
|
VALUE rc = Qnil;
|
164
372
|
if (rb_block_given_p())
|
165
373
|
{
|
@@ -167,8 +375,6 @@ module WXRuby3
|
|
167
375
|
wxScaledDC* p_scaled_dc = &scaled_dc;
|
168
376
|
VALUE rb_scaled_dc = SWIG_NewPointerObj(SWIG_as_voidptr(p_scaled_dc), SWIGTYPE_p_wxScaledDC, 0);
|
169
377
|
rc = rb_yield(rb_scaled_dc);
|
170
|
-
SWIG_RubyRemoveTracking((void *)p_scaled_dc);
|
171
|
-
DATA_PTR(rb_scaled_dc) = NULL;
|
172
378
|
}
|
173
379
|
return rc;
|
174
380
|
}
|
@@ -180,10 +386,55 @@ module WXRuby3
|
|
180
386
|
class wxScaledDC : public wxDC
|
181
387
|
{
|
182
388
|
public:
|
183
|
-
wxScaledDC(wxDC& target, double scale);
|
184
389
|
virtual ~wxScaledDC() = 0;
|
390
|
+
protected:
|
391
|
+
wxScaledDC(wxDC& target, double scale);
|
185
392
|
};
|
186
393
|
__HEREDOC
|
394
|
+
elsif spec.module_name == 'wxPrinterDC'
|
395
|
+
spec.make_abstract 'wxPrinterDC'
|
396
|
+
spec.ignore 'wxPrinterDC::wxPrinterDC'
|
397
|
+
# as a PrinterDC should best always be a temporary stack object
|
398
|
+
# we do not allow creation in Ruby but rather provide a class
|
399
|
+
# method for block execution on a temp dc
|
400
|
+
spec.add_extend_code 'wxPrinterDC', <<~__HEREDOC
|
401
|
+
static VALUE draw_on(const wxPrintData &printData)
|
402
|
+
{
|
403
|
+
if (!wxRuby_IsAppRunning())
|
404
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
405
|
+
VALUE rc = Qnil;
|
406
|
+
if (rb_block_given_p ())
|
407
|
+
{
|
408
|
+
wxPrinterDC dc(printData);
|
409
|
+
wxPrinterDC* dc_ptr = &dc;
|
410
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxPrinterDC, 0);
|
411
|
+
rc = rb_yield(rb_dc);
|
412
|
+
}
|
413
|
+
return rc;
|
414
|
+
}
|
415
|
+
__HEREDOC
|
416
|
+
elsif spec.module_name == 'wxPostScriptDC'
|
417
|
+
spec.make_abstract 'wxPostScriptDC'
|
418
|
+
spec.ignore 'wxPostScriptDC::wxPostScriptDC'
|
419
|
+
# as a PostScriptDC should best always be a temporary stack object
|
420
|
+
# we do not allow creation in Ruby but rather provide a class
|
421
|
+
# method for block execution on a temp dc
|
422
|
+
spec.add_extend_code 'wxPostScriptDC', <<~__HEREDOC
|
423
|
+
static VALUE draw_on(const wxPrintData &printData)
|
424
|
+
{
|
425
|
+
if (!wxRuby_IsAppRunning())
|
426
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
427
|
+
VALUE rc = Qnil;
|
428
|
+
if (rb_block_given_p ())
|
429
|
+
{
|
430
|
+
wxPostScriptDC dc(printData);
|
431
|
+
wxPostScriptDC* dc_ptr = &dc;
|
432
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxPostScriptDC, 0);
|
433
|
+
rc = rb_yield(rb_dc);
|
434
|
+
}
|
435
|
+
return rc;
|
436
|
+
}
|
437
|
+
__HEREDOC
|
187
438
|
else
|
188
439
|
# ctors of all other derived DC require a running App
|
189
440
|
spec.require_app spec.module_name
|
@@ -64,9 +64,12 @@ module WXRuby3
|
|
64
64
|
__HEREDOC
|
65
65
|
when 'wxFindReplaceDialog'
|
66
66
|
spec.ignore 'wxFindReplaceDialog::wxFindReplaceDialog()'
|
67
|
-
|
67
|
+
# add undocumented method
|
68
|
+
spec.extend_interface 'wxFindReplaceDialog', 'void SetData(wxFindReplaceData *data)'
|
68
69
|
spec.do_not_generate(:variables, :enums)
|
69
70
|
when 'wxColourDialog'
|
71
|
+
spec.items << 'wxColourData'
|
72
|
+
spec.gc_as_untracked 'wxColourData'
|
70
73
|
# make interface GC-safe
|
71
74
|
spec.ignore 'wxColourDialog::GetColourData'
|
72
75
|
spec.add_extend_code 'wxColourDialog', <<~__HEREDOC
|
@@ -13,7 +13,7 @@ module WXRuby3
|
|
13
13
|
|
14
14
|
def setup
|
15
15
|
super
|
16
|
-
spec.
|
16
|
+
spec.make_concrete 'wxDirPickerCtrl'
|
17
17
|
spec.do_not_generate(:variables, :defines, :enums, :functions) # with FileDirPickerEvent
|
18
18
|
end
|
19
19
|
end # class DirPickerCtrl
|
@@ -29,7 +29,7 @@ module WXRuby3
|
|
29
29
|
spec.no_proxy 'wxEvent::Clone'
|
30
30
|
spec.regard 'wxEvent::Clone', regard_doc: false # need updated doc
|
31
31
|
# need this to force alloc func
|
32
|
-
spec.
|
32
|
+
spec.make_concrete 'wxEvent'
|
33
33
|
# type mapping for result #clone
|
34
34
|
spec.map 'wxEvent*' => 'Wx::Event' do
|
35
35
|
map_out code: <<~__CODE
|
@@ -143,7 +143,7 @@ module WXRuby3
|
|
143
143
|
wxCommandEvent::GetExtraLong
|
144
144
|
}
|
145
145
|
# need this to force alloc func
|
146
|
-
spec.
|
146
|
+
spec.make_concrete 'wxCommandEvent'
|
147
147
|
spec.add_header_code <<~__HEREDOC
|
148
148
|
// Cf wxEvent - has to be written as a C+++ subclass to ensure correct
|
149
149
|
// GC/thread protection of Ruby instance variables when user-written
|
@@ -222,7 +222,7 @@ module WXRuby3
|
|
222
222
|
spec.make_abstract(citem)
|
223
223
|
else
|
224
224
|
# need this to force alloc func
|
225
|
-
spec.
|
225
|
+
spec.make_concrete(citem)
|
226
226
|
end
|
227
227
|
end
|
228
228
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
###
|
2
|
+
# wxRuby3 wxWidgets interface director
|
3
|
+
# Copyright (c) M.J.N. Corino, The Netherlands
|
4
|
+
###
|
5
|
+
|
6
|
+
module WXRuby3
|
7
|
+
|
8
|
+
class Director
|
9
|
+
|
10
|
+
class EventBlocker < Director
|
11
|
+
|
12
|
+
def setup
|
13
|
+
super
|
14
|
+
spec.gc_as_untracked # no tracking
|
15
|
+
spec.make_abstract('wxEventBlocker')
|
16
|
+
spec.ignore 'wxEventBlocker::wxEventBlocker'
|
17
|
+
spec.no_proxy 'wxEventBlocker'
|
18
|
+
# needs construction on stack so make abstract and add factory class method for block execution
|
19
|
+
spec.add_extend_code 'wxEventBlocker', <<~__HEREDOC
|
20
|
+
static VALUE blocked_for(wxWindow* win, wxEventType evt_type = wxEVT_ANY)
|
21
|
+
{
|
22
|
+
if (!wxRuby_IsAppRunning())
|
23
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
24
|
+
VALUE rc = Qnil;
|
25
|
+
if (rb_block_given_p ())
|
26
|
+
{
|
27
|
+
wxEventBlocker blkr(win, evt_type);
|
28
|
+
wxEventBlocker *blk_p = &blkr;
|
29
|
+
VALUE rb_blkr = SWIG_NewPointerObj(SWIG_as_voidptr(blk_p), SWIGTYPE_p_wxEventBlocker, 0);
|
30
|
+
rc = rb_yield(rb_blkr);
|
31
|
+
}
|
32
|
+
return rc;
|
33
|
+
}
|
34
|
+
__HEREDOC
|
35
|
+
spec.do_not_generate :variables, :defines, :enums, :functions
|
36
|
+
end
|
37
|
+
end # class EventBlocker
|
38
|
+
|
39
|
+
end # class Director
|
40
|
+
|
41
|
+
end # module WXRuby3
|
@@ -0,0 +1,20 @@
|
|
1
|
+
###
|
2
|
+
# wxRuby3 wxWidgets interface director
|
3
|
+
# Copyright (c) M.J.N. Corino, The Netherlands
|
4
|
+
###
|
5
|
+
|
6
|
+
module WXRuby3
|
7
|
+
|
8
|
+
class Director
|
9
|
+
|
10
|
+
class EventFilter < Director
|
11
|
+
|
12
|
+
def setup
|
13
|
+
super
|
14
|
+
spec.gc_as_untracked # no tracking
|
15
|
+
end
|
16
|
+
end # class EventFilter
|
17
|
+
|
18
|
+
end # class Director
|
19
|
+
|
20
|
+
end # module WXRuby3
|
@@ -64,6 +64,32 @@ module WXRuby3
|
|
64
64
|
$1 = wx_ev;
|
65
65
|
__CODE
|
66
66
|
end
|
67
|
+
# add special mapping for event filters so we can accept the app instance as well
|
68
|
+
# although Wx::App is not derived from Wx::EventFilter in wxRuby (no multiple inheritance)
|
69
|
+
spec.map 'wxEventFilter*' => 'Wx::EventFilter,Wx::App' do
|
70
|
+
map_in code: <<~__CODE
|
71
|
+
int res = SWIG_ERROR;
|
72
|
+
void *argp = 0;
|
73
|
+
if (rb_obj_is_kind_of($input, ((swig_class*)SWIGTYPE_p_wxEventFilter->clientdata)->klass))
|
74
|
+
{
|
75
|
+
res = SWIG_ConvertPtr($input, &argp, SWIGTYPE_p_wxEventFilter, 0);
|
76
|
+
if (SWIG_IsOK(res)) $1 = reinterpret_cast< wxEventFilter * >(argp);
|
77
|
+
}
|
78
|
+
else
|
79
|
+
{
|
80
|
+
VALUE app_klass = rb_eval_string("Wx::App");
|
81
|
+
if (rb_obj_is_kind_of($input, app_klass))
|
82
|
+
{
|
83
|
+
res = SWIG_ConvertPtr($input, &argp, wxRuby_GetSwigTypeForClass(app_klass), 0);
|
84
|
+
if (SWIG_IsOK(res)) $1 = reinterpret_cast< wxApp * >(argp);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
if (!SWIG_IsOK(res))
|
88
|
+
{
|
89
|
+
SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "wxEventFilter *","wxEvtHandler::$symname", 1, $input));
|
90
|
+
}
|
91
|
+
__CODE
|
92
|
+
end
|
67
93
|
spec.add_runtime_code <<~__HEREDOC
|
68
94
|
static swig_class wxRuby_GetSwigClassWxEvtHandler();
|
69
95
|
WXRUBY_EXPORT VALUE wxRuby_GetEventTypeClassMap();
|
@@ -324,8 +350,9 @@ module WXRuby3
|
|
324
350
|
}
|
325
351
|
|
326
352
|
WXRUBY_EXPORT VALUE wxRuby_GetEventTypeClassMap() {
|
327
|
-
|
328
|
-
|
353
|
+
return rb_funcall(wxRuby_GetSwigClassWxEvtHandler().klass,
|
354
|
+
rb_intern("send"),
|
355
|
+
1, ID2SYM(rb_intern("get_event_type_class_map")), 0);
|
329
356
|
}
|
330
357
|
__HEREDOC
|
331
358
|
spec.do_not_generate :typedefs, :variables, :enums, :defines, :functions
|
@@ -13,7 +13,7 @@ module WXRuby3
|
|
13
13
|
|
14
14
|
def setup
|
15
15
|
super
|
16
|
-
spec.
|
16
|
+
spec.make_concrete 'wxFilePickerCtrl'
|
17
17
|
spec.do_not_generate(:variables, :defines, :enums, :functions) # with FileDirPickerEvent
|
18
18
|
end
|
19
19
|
end # class FilePickerCtrl
|
@@ -12,7 +12,8 @@ module WXRuby3
|
|
12
12
|
def setup
|
13
13
|
super
|
14
14
|
spec.items << 'wxFontInfo'
|
15
|
-
spec.
|
15
|
+
spec.gc_as_untracked 'wxFontInfo'
|
16
|
+
spec.gc_as_untracked 'wxFont'
|
16
17
|
# all but the default ctor require a running App
|
17
18
|
spec.require_app 'wxFont::wxFont(const wxFont &)',
|
18
19
|
'wxFont::wxFont(const wxFontInfo &)',
|
@@ -13,7 +13,7 @@ module WXRuby3
|
|
13
13
|
|
14
14
|
def setup
|
15
15
|
super
|
16
|
-
spec.
|
16
|
+
spec.make_concrete 'wxFontPickerCtrl'
|
17
17
|
spec.do_not_generate(:variables, :defines, :enums, :functions) # with FontPickerEvent
|
18
18
|
end
|
19
19
|
end # class FontPickerCtrl
|