wxruby3 0.9.8 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/INSTALL.md +23 -1
- data/README.md +13 -27
- 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 +3 -2
- data/rakelib/gem.rb +3 -2
- data/rakelib/lib/config/linux.rb +1 -1
- data/rakelib/lib/config/mingw.rb +4 -101
- data/rakelib/lib/config/pkgman/linux.rb +31 -8
- data/rakelib/lib/config/pkgman/mingw.rb +112 -0
- 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 +9 -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_gdi_object.rb +2 -2
- data/tests/test_std_controls.rb +12 -12
- metadata +33 -32
- 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
@@ -16,7 +16,8 @@ module WXRuby3
|
|
16
16
|
super
|
17
17
|
spec.disable_proxies
|
18
18
|
spec.gc_as_untracked spec.module_name
|
19
|
-
|
19
|
+
case spec.module_name
|
20
|
+
when 'wxScreenDC'
|
20
21
|
spec.make_abstract 'wxScreenDC'
|
21
22
|
# as a ScreenDC should always be a temporary stack object
|
22
23
|
# we do not allow creation in Ruby but rather provide a class
|
@@ -41,7 +42,7 @@ module WXRuby3
|
|
41
42
|
spec.ignore 'wxScreenDC::StartDrawingOnTop',
|
42
43
|
'wxScreenDC::EndDrawingOnTop',
|
43
44
|
'wxScreenDC::wxScreenDC'
|
44
|
-
|
45
|
+
when 'wxClientDC'
|
45
46
|
spec.make_abstract 'wxClientDC'
|
46
47
|
spec.ignore 'wxClientDC::wxClientDC'
|
47
48
|
# as a ClientDC should best always be a temporary stack object
|
@@ -63,19 +64,38 @@ module WXRuby3
|
|
63
64
|
return rc;
|
64
65
|
}
|
65
66
|
__HEREDOC
|
66
|
-
|
67
|
+
when 'wxPaintDC'
|
67
68
|
spec.make_abstract 'wxPaintDC'
|
68
69
|
spec.ignore 'wxPaintDC::wxPaintDC'
|
69
|
-
|
70
|
-
|
70
|
+
spec.add_header_code <<~__HEREDOC
|
71
|
+
// we need this static method here because we do not want SWIG to parse the preprocessor
|
72
|
+
// statements (#if/#else/#endif) which it does in %extend blocks
|
73
|
+
#include "wx/dcbuffer.h"
|
74
|
+
static VALUE do_check_native_double_buffer()
|
75
|
+
{
|
76
|
+
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
|
77
|
+
return Qtrue;
|
78
|
+
#else
|
79
|
+
return Qfalse;
|
80
|
+
#endif
|
81
|
+
}
|
82
|
+
__HEREDOC
|
83
|
+
spec.add_extend_code 'wxPaintDC', <<~__HEREDOC
|
84
|
+
#include "wx/dcbuffer.h"
|
85
|
+
static VALUE has_native_double_buffer()
|
86
|
+
{
|
87
|
+
return do_check_native_double_buffer();
|
88
|
+
}
|
89
|
+
__HEREDOC
|
90
|
+
when 'wxMemoryDC'
|
91
|
+
spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC'
|
92
|
+
spec.gc_as_untracked %w[wxBufferedDC wxBufferedPaintDC]
|
71
93
|
spec.make_abstract 'wxMemoryDC'
|
72
94
|
spec.make_abstract 'wxBufferedDC'
|
73
95
|
spec.make_abstract 'wxBufferedPaintDC'
|
74
|
-
spec.make_abstract 'wxAutoBufferedPaintDC'
|
75
96
|
spec.ignore 'wxMemoryDC::wxMemoryDC',
|
76
97
|
'wxBufferedDC::wxBufferedDC',
|
77
|
-
'wxBufferedPaintDC::wxBufferedPaintDC'
|
78
|
-
'wxAutoBufferedPaintDC::wxAutoBufferedPaintDC'
|
98
|
+
'wxBufferedPaintDC::wxBufferedPaintDC'
|
79
99
|
# like all DC's these should best always be a temporary stack objects
|
80
100
|
# we do not allow creation in Ruby but rather provide a class
|
81
101
|
# method for block execution on a temp dc
|
@@ -197,23 +217,7 @@ module WXRuby3
|
|
197
217
|
return rc;
|
198
218
|
}
|
199
219
|
__HEREDOC
|
200
|
-
|
201
|
-
static VALUE draw_on(wxWindow* tgt)
|
202
|
-
{
|
203
|
-
if (!wxRuby_IsAppRunning())
|
204
|
-
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
205
|
-
VALUE rc = Qnil;
|
206
|
-
if (rb_block_given_p ())
|
207
|
-
{
|
208
|
-
wxAutoBufferedPaintDC dc(tgt);
|
209
|
-
wxAutoBufferedPaintDC* dc_ptr = &dc;
|
210
|
-
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxAutoBufferedPaintDC, 0);
|
211
|
-
rc = rb_yield(rb_dc);
|
212
|
-
}
|
213
|
-
return rc;
|
214
|
-
}
|
215
|
-
__HEREDOC
|
216
|
-
elsif spec.module_name == 'wxMirrorDC'
|
220
|
+
when 'wxMirrorDC'
|
217
221
|
spec.make_abstract 'wxMirrorDC'
|
218
222
|
spec.ignore 'wxMirrorDC::wxMirrorDC'
|
219
223
|
# as a MirrorDC should best always be a temporary stack object
|
@@ -235,7 +239,7 @@ module WXRuby3
|
|
235
239
|
return rc;
|
236
240
|
}
|
237
241
|
__HEREDOC
|
238
|
-
|
242
|
+
when 'wxSVGFileDC'
|
239
243
|
spec.items.concat %w[wxSVGBitmapHandler wxSVGBitmapFileHandler wxSVGBitmapEmbedHandler]
|
240
244
|
spec.make_abstract 'wxSVGFileDC'
|
241
245
|
spec.ignore 'wxSVGFileDC::wxSVGFileDC'
|
@@ -272,7 +276,7 @@ module WXRuby3
|
|
272
276
|
'wxSVGFileDC::EndDoc',
|
273
277
|
'wxSVGFileDC::StartPage',
|
274
278
|
'wxSVGFileDC::EndPage'
|
275
|
-
|
279
|
+
when 'wxGCDC'
|
276
280
|
spec.make_abstract 'wxGCDC'
|
277
281
|
spec.ignore 'wxGCDC::wxGCDC'
|
278
282
|
# like all DC this should best always be a temporary stack object
|
@@ -301,6 +305,24 @@ module WXRuby3
|
|
301
305
|
__HEREDOC
|
302
306
|
end
|
303
307
|
spec.add_extend_code 'wxGCDC', <<~__HEREDOC
|
308
|
+
static VALUE draw_on()
|
309
|
+
{
|
310
|
+
if (!wxRuby_IsAppRunning())
|
311
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
312
|
+
VALUE rc = Qnil;
|
313
|
+
if (rb_block_given_p ())
|
314
|
+
{
|
315
|
+
// Somehow there seems to be a problem with the Ruby GCDC value
|
316
|
+
// being GC-ed unless we block GC for the duration of the block
|
317
|
+
// execution. Unclear why. We have similar code for other objects
|
318
|
+
// where this issue does not come up.
|
319
|
+
wxGCDC gc_dc;
|
320
|
+
wxGCDC* dc_ptr = &gc_dc;
|
321
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(dc_ptr), SWIGTYPE_p_wxGCDC, 0);
|
322
|
+
rc = rb_yield(rb_dc);
|
323
|
+
}
|
324
|
+
return rc;
|
325
|
+
}
|
304
326
|
static VALUE draw_on(const wxWindowDC& dc)
|
305
327
|
{
|
306
328
|
if (!wxRuby_IsAppRunning())
|
@@ -355,9 +377,10 @@ module WXRuby3
|
|
355
377
|
}
|
356
378
|
return rc;
|
357
379
|
}
|
358
|
-
|
380
|
+
__HEREDOC
|
381
|
+
spec.disown 'wxGraphicsContext *gc'
|
359
382
|
spec.ignore 'wxGCDC::wxGCDC(const wxEnhMetaFileDC &)'
|
360
|
-
|
383
|
+
when 'wxScaledDC'
|
361
384
|
spec.items.clear # wxRuby extension; no XML docs
|
362
385
|
spec.override_inheritance_chain('wxScaledDC', %w[wxDC wxObject])
|
363
386
|
# as there are no dependencies parsed from XML make sure we're initialized after Wx::DC
|
@@ -398,7 +421,7 @@ module WXRuby3
|
|
398
421
|
wxScaledDC(wxDC& target, double scale);
|
399
422
|
};
|
400
423
|
__HEREDOC
|
401
|
-
|
424
|
+
when 'wxPrinterDC'
|
402
425
|
spec.make_abstract 'wxPrinterDC'
|
403
426
|
spec.ignore 'wxPrinterDC::wxPrinterDC'
|
404
427
|
# as a PrinterDC should best always be a temporary stack object
|
@@ -420,7 +443,7 @@ module WXRuby3
|
|
420
443
|
return rc;
|
421
444
|
}
|
422
445
|
__HEREDOC
|
423
|
-
|
446
|
+
when 'wxPostScriptDC'
|
424
447
|
spec.make_abstract 'wxPostScriptDC'
|
425
448
|
spec.ignore 'wxPostScriptDC::wxPostScriptDC'
|
426
449
|
# as a PostScriptDC should best always be a temporary stack object
|
@@ -442,6 +465,40 @@ module WXRuby3
|
|
442
465
|
return rc;
|
443
466
|
}
|
444
467
|
__HEREDOC
|
468
|
+
when 'wxDCOverlay'
|
469
|
+
spec.items << 'wxOverlay'
|
470
|
+
spec.make_abstract 'wxDCOverlay'
|
471
|
+
spec.ignore 'wxDCOverlay::wxDCOverlay'
|
472
|
+
spec.add_extend_code 'wxDCOverlay', <<~__HEREDOC
|
473
|
+
static VALUE draw_on(wxOverlay &overlay, wxDC *dc)
|
474
|
+
{
|
475
|
+
if (!wxRuby_IsAppRunning())
|
476
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
477
|
+
VALUE rc = Qnil;
|
478
|
+
if (rb_block_given_p ())
|
479
|
+
{
|
480
|
+
wxDCOverlay ovl_dc(overlay, dc);
|
481
|
+
wxDCOverlay* ovl_dc_ptr = &ovl_dc;
|
482
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxDCOverlay, 0);
|
483
|
+
rc = rb_yield(rb_dc);
|
484
|
+
}
|
485
|
+
return rc;
|
486
|
+
}
|
487
|
+
static VALUE draw_on(wxOverlay &overlay, wxDC *dc, int x, int y, int width, int height)
|
488
|
+
{
|
489
|
+
if (!wxRuby_IsAppRunning())
|
490
|
+
rb_raise(rb_eRuntimeError, "A running Wx::App is required.");
|
491
|
+
VALUE rc = Qnil;
|
492
|
+
if (rb_block_given_p ())
|
493
|
+
{
|
494
|
+
wxDCOverlay ovl_dc(overlay, dc, x, y, width, height);
|
495
|
+
wxDCOverlay* ovl_dc_ptr = &ovl_dc;
|
496
|
+
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxDCOverlay, 0);
|
497
|
+
rc = rb_yield(rb_dc);
|
498
|
+
}
|
499
|
+
return rc;
|
500
|
+
}
|
501
|
+
__HEREDOC
|
445
502
|
else
|
446
503
|
# ctors of all other derived DC require a running App
|
447
504
|
spec.require_app spec.module_name
|
@@ -212,14 +212,6 @@ module WXRuby3
|
|
212
212
|
return Qfalse;
|
213
213
|
}
|
214
214
|
__HEREDOC
|
215
|
-
when 'wxSymbolPickerDialog'
|
216
|
-
# redefine these to prevent problematic handling of title/caption defaults
|
217
|
-
spec.ignore 'wxSymbolPickerDialog::wxSymbolPickerDialog(const wxString &, const wxString &, const wxString &, wxWindow *, wxWindowID, const wxString &, const wxPoint &, const wxSize &, long)',
|
218
|
-
'wxSymbolPickerDialog::Create',
|
219
|
-
ignore_doc: false
|
220
|
-
spec.extend_interface 'wxSymbolPickerDialog',
|
221
|
-
'wxSymbolPickerDialog(const wxString &symbol, const wxString &initialFont, const wxString &normalTextFont, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style)',
|
222
|
-
'bool Create(const wxString &symbol, const wxString &initialFont, const wxString &normalTextFont, wxWindow *parent, wxWindowID id, const wxString &caption, const wxPoint &pos, const wxSize &size, long style)'
|
223
215
|
when 'wxWizard'
|
224
216
|
# special handling
|
225
217
|
spec.ignore 'wxWizard::GetBitmap'
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
2
|
+
#
|
3
|
+
# This software is released under the MIT license.
|
4
|
+
|
5
|
+
###
|
6
|
+
# wxRuby3 wxWidgets interface director
|
7
|
+
###
|
8
|
+
|
9
|
+
module WXRuby3
|
10
|
+
|
11
|
+
class Director
|
12
|
+
|
13
|
+
class Geometry < Director
|
14
|
+
|
15
|
+
def setup
|
16
|
+
spec.items.replace %w{wxPoint2DInt wxPoint2DDouble}
|
17
|
+
|
18
|
+
spec.ignore 'wxPoint2DInt::m_x', 'wxPoint2DInt::m_y',
|
19
|
+
'wxPoint2DDouble::m_x', 'wxPoint2DDouble::m_y'
|
20
|
+
|
21
|
+
spec.add_extend_code 'wxPoint2DInt', <<~__HEREDOC
|
22
|
+
wxInt32 get_x()
|
23
|
+
{
|
24
|
+
return $self->m_x;
|
25
|
+
}
|
26
|
+
wxInt32 set_x(wxInt32 v)
|
27
|
+
{
|
28
|
+
return ($self->m_x = v);
|
29
|
+
}
|
30
|
+
wxInt32 get_y()
|
31
|
+
{
|
32
|
+
return $self->m_y;
|
33
|
+
}
|
34
|
+
wxInt32 set_y(wxInt32 v)
|
35
|
+
{
|
36
|
+
return ($self->m_y = v);
|
37
|
+
}
|
38
|
+
void assign(const wxPoint2DInt& pt)
|
39
|
+
{
|
40
|
+
(*$self) = pt;
|
41
|
+
}
|
42
|
+
void add(const wxPoint2DInt& pt)
|
43
|
+
{
|
44
|
+
(*$self) += pt;
|
45
|
+
}
|
46
|
+
void sub(const wxPoint2DInt& pt)
|
47
|
+
{
|
48
|
+
(*$self) -= pt;
|
49
|
+
}
|
50
|
+
void mul(const wxPoint2DInt& pt)
|
51
|
+
{
|
52
|
+
(*$self) *= pt;
|
53
|
+
}
|
54
|
+
void mul(wxDouble v)
|
55
|
+
{
|
56
|
+
$self->m_x *= v; $self->m_y *= v;
|
57
|
+
}
|
58
|
+
void mul(wxInt32 v)
|
59
|
+
{
|
60
|
+
$self->m_x *= v; $self->m_y *= v;
|
61
|
+
}
|
62
|
+
void div(const wxPoint2DInt& pt)
|
63
|
+
{
|
64
|
+
(*$self) /= pt;
|
65
|
+
}
|
66
|
+
void div(wxDouble v)
|
67
|
+
{
|
68
|
+
$self->m_x /= v; $self->m_y /= v;
|
69
|
+
}
|
70
|
+
void div(wxInt32 v)
|
71
|
+
{
|
72
|
+
$self->m_x /= v; $self->m_y /= v;
|
73
|
+
}
|
74
|
+
__HEREDOC
|
75
|
+
|
76
|
+
spec.add_extend_code 'wxPoint2DDouble', <<~__HEREDOC
|
77
|
+
wxDouble get_x()
|
78
|
+
{
|
79
|
+
return $self->m_x;
|
80
|
+
}
|
81
|
+
wxDouble set_x(wxDouble v)
|
82
|
+
{
|
83
|
+
return ($self->m_x = v);
|
84
|
+
}
|
85
|
+
wxDouble get_y()
|
86
|
+
{
|
87
|
+
return $self->m_y;
|
88
|
+
}
|
89
|
+
wxDouble set_y(wxDouble v)
|
90
|
+
{
|
91
|
+
return ($self->m_y = v);
|
92
|
+
}
|
93
|
+
void assign(const wxPoint2DDouble& pt)
|
94
|
+
{
|
95
|
+
(*$self) = pt;
|
96
|
+
}
|
97
|
+
void add(const wxPoint2DDouble& pt)
|
98
|
+
{
|
99
|
+
(*$self) += pt;
|
100
|
+
}
|
101
|
+
void sub(const wxPoint2DDouble& pt)
|
102
|
+
{
|
103
|
+
(*$self) -= pt;
|
104
|
+
}
|
105
|
+
void mul(const wxPoint2DDouble& pt)
|
106
|
+
{
|
107
|
+
(*$self) *= pt;
|
108
|
+
}
|
109
|
+
void mul(wxDouble v)
|
110
|
+
{
|
111
|
+
$self->m_x *= v; $self->m_y *= v;
|
112
|
+
}
|
113
|
+
void mul(wxInt32 v)
|
114
|
+
{
|
115
|
+
$self->m_x *= v; $self->m_y *= v;
|
116
|
+
}
|
117
|
+
void div(const wxPoint2DDouble& pt)
|
118
|
+
{
|
119
|
+
(*$self) /= pt;
|
120
|
+
}
|
121
|
+
void div(wxDouble v)
|
122
|
+
{
|
123
|
+
$self->m_x /= v; $self->m_y /= v;
|
124
|
+
}
|
125
|
+
void div(wxInt32 v)
|
126
|
+
{
|
127
|
+
$self->m_x /= v; $self->m_y /= v;
|
128
|
+
}
|
129
|
+
__HEREDOC
|
130
|
+
|
131
|
+
spec.map_apply 'int * OUTPUT' => 'wxInt32 *'
|
132
|
+
|
133
|
+
# ignore all friend operators
|
134
|
+
spec.do_not_generate :functions
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
@@ -29,12 +29,13 @@ module WXRuby3
|
|
29
29
|
'wxGraphicsContext::CreateFromNativeHDC',
|
30
30
|
'wxGraphicsContext::CreateFromUnknownDC',
|
31
31
|
'wxGraphicsContext::GetNativeContext',
|
32
|
-
'wxGraphicsContext::Create',
|
32
|
+
'wxGraphicsContext::Create(const wxEnhMetaFileDC &)',
|
33
33
|
'wxGraphicsContext::CreateMatrix(const wxAffineMatrix2DBase &) const',
|
34
34
|
'wxGraphicsContext::DrawLines(size_t, const wxPoint2DDouble *, wxPolygonFillMode)',
|
35
35
|
'wxGraphicsContext::StrokeLines(size_t, const wxPoint2DDouble *)',
|
36
36
|
'wxGraphicsContext::StrokeLines (size_t, const wxPoint2DDouble *, const wxPoint2DDouble *)'
|
37
37
|
spec.ignore_unless(Config::AnyOf.new('WXMSW', 'WXOSX', 'USE_GTKPRINT'), 'wxGraphicsContext::Create(const wxPrinterDC &)')
|
38
|
+
spec.new_object 'wxGraphicsContext::Create'
|
38
39
|
spec.add_header_code <<~__HEREDOC
|
39
40
|
// special free funcs are needed to clean up Dashes array if it has been
|
40
41
|
// set; wxWidgets does not do this automatically so will leak if not
|
@@ -55,7 +56,7 @@ module WXRuby3
|
|
55
56
|
# dealt with below - these require special handling because of the use
|
56
57
|
# of wxDash array, which cannot be freed until the peninfo is disposed of
|
57
58
|
# or until a new dash pattern is specified.
|
58
|
-
spec.ignore(%w[wxGraphicsPenInfo::GetDashes wxGraphicsPenInfo::Dashes]
|
59
|
+
spec.ignore(%w[wxGraphicsPenInfo::GetDashes wxGraphicsPenInfo::Dashes])
|
59
60
|
spec.ignore 'wxGraphicsPenInfo::GetDash'
|
60
61
|
spec.add_extend_code 'wxGraphicsPenInfo', <<~__HEREDOC
|
61
62
|
// Returns a ruby array with the dash lengths
|
@@ -14,43 +14,36 @@ module WXRuby3
|
|
14
14
|
|
15
15
|
def setup
|
16
16
|
super
|
17
|
-
spec.items.concat %w[wxGraphicsPen wxGraphicsBrush wxGraphicsPath wxGraphicsFont wxGraphicsMatrix wxGraphicsBitmap]
|
17
|
+
spec.items.concat %w[wxGraphicsPen wxGraphicsBrush wxGraphicsPath wxGraphicsFont wxGraphicsMatrix wxGraphicsBitmap wxGraphicsRenderer]
|
18
18
|
spec.disable_proxies
|
19
|
-
spec.ignore 'wxGraphicsObject::GetRenderer'
|
20
19
|
spec.ignore 'wxGraphicsMatrix::Concat(const wxGraphicsMatrix &)'
|
21
20
|
spec.ignore 'wxGraphicsMatrix::IsEqual(const wxGraphicsMatrix &)'
|
22
21
|
spec.ignore 'wxGraphicsMatrix::GetNativeMatrix'
|
23
22
|
spec.ignore 'wxGraphicsBitmap::GetNativeBitmap'
|
24
23
|
spec.ignore 'wxGraphicsPath::GetNativePath',
|
25
|
-
'wxGraphicsPath::UnGetNativePath'
|
26
|
-
|
27
|
-
'
|
28
|
-
'
|
29
|
-
'
|
30
|
-
'
|
31
|
-
|
24
|
+
'wxGraphicsPath::UnGetNativePath'
|
25
|
+
spec.ignore 'wxGraphicsRenderer::CreateContextFromNativeHDC',
|
26
|
+
'wxGraphicsRenderer::CreateBitmapFromNativeBitmap',
|
27
|
+
'wxGraphicsRenderer::CreateContextFromNativeContext',
|
28
|
+
'wxGraphicsRenderer::CreateContextFromNativeWindow',
|
29
|
+
'wxGraphicsRenderer::CreateContext(const wxEnhMetaFileDC&)'
|
30
|
+
unless Config.instance.features_set?('USE_CAIRO')
|
31
|
+
spec.ignore 'wxGraphicsRenderer::GetCairoRenderer'
|
32
|
+
end
|
33
|
+
unless Config.instance.features_set?('WXMSW')
|
34
|
+
spec.ignore 'wxGraphicsRenderer::GetGDIPlusRenderer',
|
35
|
+
'wxGraphicsRenderer::GetDirect2DRenderer'
|
36
|
+
end
|
37
|
+
spec.new_object 'wxGraphicsRenderer::CreateContext'
|
32
38
|
# Deal with GraphicsMatrix#get method
|
33
39
|
spec.map_apply 'double *OUTPUT' => [ 'wxDouble *a', 'wxDouble *b',
|
34
40
|
'wxDouble *c', 'wxDouble *d',
|
35
41
|
'wxDouble *tx' , 'wxDouble *ty' ]
|
36
|
-
# type mapping for GraphicsPath wxPoint2DDouble args
|
37
|
-
spec.map 'const wxPoint2DDouble&' => 'Array<Float,Float>' do
|
38
|
-
map_in temp: 'wxPoint2DDouble tmp_pt', code: <<~__CODE
|
39
|
-
if (TYPE($input) == T_ARRAY && RARRAY_LEN($input) == 2)
|
40
|
-
{
|
41
|
-
tmp_pt = wxPoint2DDouble(NUM2DBL(rb_ary_entry($input, 0)),
|
42
|
-
NUM2DBL(rb_ary_entry($input, 1)));
|
43
|
-
$1 = &tmp_pt;
|
44
|
-
}
|
45
|
-
else
|
46
|
-
{
|
47
|
-
rb_raise(rb_eTypeError, "Wrong type for %i", $argnum-1);
|
48
|
-
}
|
49
|
-
__CODE
|
50
|
-
end
|
51
42
|
spec.ignore 'wxGraphicsPath::GetBox() const',
|
52
|
-
'wxGraphicsPath::GetCurrentPoint() const'
|
43
|
+
'wxGraphicsPath::GetCurrentPoint(wxDouble*,wxDouble*) const'
|
53
44
|
spec.map_apply 'double * OUTPUT' => 'wxDouble *'
|
45
|
+
# wxGraphicsRenderer::GetVersion
|
46
|
+
spec.map_apply 'int * OUTPUT' => ['int *major', 'int *minor', 'int *micro']
|
54
47
|
if Config.platform == :mingw
|
55
48
|
# it seems for WXMSW there is a problem cleaning up GraphicsObjects in GC after
|
56
49
|
# the wxApp has ended (probably because some other wxWidgets cleanup already
|
@@ -212,6 +212,65 @@ module WXRuby3
|
|
212
212
|
return rb_img_hist;
|
213
213
|
}
|
214
214
|
__HEREDOC
|
215
|
+
# make sure to wrap the public attributes
|
216
|
+
spec.regard 'wxImage::HSVValue::hue',
|
217
|
+
'wxImage::HSVValue::saturation',
|
218
|
+
'wxImage::HSVValue::value',
|
219
|
+
'wxImage::RGBValue::red',
|
220
|
+
'wxImage::RGBValue::green',
|
221
|
+
'wxImage::RGBValue::blue'
|
222
|
+
# ignore these and add customs
|
223
|
+
spec.ignore 'wxImage::HSVtoRGB',
|
224
|
+
'wxImage::RGBtoHSV'
|
225
|
+
spec.add_extend_code 'wxImage', <<~__HEREDOC
|
226
|
+
static wxImage::RGBValue hsv_to_rgb(VALUE arg)
|
227
|
+
{
|
228
|
+
std::unique_ptr<wxImage::HSVValue> tmp;
|
229
|
+
wxImage::HSVValue* p_hsv;
|
230
|
+
if ( TYPE(arg) == T_DATA )
|
231
|
+
{
|
232
|
+
void* argp;
|
233
|
+
SWIG_ConvertPtr(arg, &argp, SWIGTYPE_p_wxImage__HSVValue, 0);
|
234
|
+
p_hsv = reinterpret_cast< wxImage::HSVValue * >(argp);
|
235
|
+
}
|
236
|
+
else if ( TYPE(arg) == T_ARRAY && RARRAY_LEN(arg) == 3 )
|
237
|
+
{
|
238
|
+
p_hsv = new wxImage::HSVValue( NUM2DBL( rb_ary_entry(arg, 0) ),
|
239
|
+
NUM2DBL( rb_ary_entry(arg, 1) ),
|
240
|
+
NUM2DBL( rb_ary_entry(arg, 2) ) );
|
241
|
+
tmp.reset(p_hsv); // auto destruct when method scope ends
|
242
|
+
}
|
243
|
+
else
|
244
|
+
{
|
245
|
+
rb_raise(rb_eArgError, "Expected either Array(Float,Float,Float) or Wx::Image::HSVValue for #0");
|
246
|
+
}
|
247
|
+
return wxImage::HSVtoRGB(*p_hsv);
|
248
|
+
}
|
249
|
+
|
250
|
+
static wxImage::HSVValue rgb_to_hsv(VALUE arg)
|
251
|
+
{
|
252
|
+
std::unique_ptr<wxImage::RGBValue> tmp;
|
253
|
+
wxImage::RGBValue* p_rgb;
|
254
|
+
if ( TYPE(arg) == T_DATA )
|
255
|
+
{
|
256
|
+
void* argp;
|
257
|
+
SWIG_ConvertPtr(arg, &argp, SWIGTYPE_p_wxImage__RGBValue, 0);
|
258
|
+
p_rgb = reinterpret_cast< wxImage::RGBValue * >(argp);
|
259
|
+
}
|
260
|
+
else if ( TYPE(arg) == T_ARRAY && RARRAY_LEN(arg) == 3 )
|
261
|
+
{
|
262
|
+
p_rgb = new wxImage::RGBValue( NUM2DBL( rb_ary_entry(arg, 0) ),
|
263
|
+
NUM2DBL( rb_ary_entry(arg, 1) ),
|
264
|
+
NUM2DBL( rb_ary_entry(arg, 2) ) );
|
265
|
+
tmp.reset(p_rgb); // auto destruct when method scope ends
|
266
|
+
}
|
267
|
+
else
|
268
|
+
{
|
269
|
+
rb_raise(rb_eArgError, "Expected either Array(Float,Float,Float) or Wx::Image::RGBValue for #0");
|
270
|
+
}
|
271
|
+
return wxImage::RGBtoHSV(*p_rgb);
|
272
|
+
}
|
273
|
+
__HEREDOC
|
215
274
|
spec.do_not_generate(:functions)
|
216
275
|
end
|
217
276
|
end # class Image
|
@@ -90,9 +90,8 @@ module WXRuby3
|
|
90
90
|
# fix SWIG's problems with const& return value
|
91
91
|
spec.ignore('wxMenu::GetTitle', ignore_doc: false) # keep doc
|
92
92
|
spec.add_extend_code 'wxMenu', <<~__HEREDOC
|
93
|
-
wxString
|
94
|
-
|
95
|
-
return &const_cast<wxString&> (title);
|
93
|
+
wxString GetTitle() const {
|
94
|
+
return $self->GetTitle();
|
96
95
|
}
|
97
96
|
|
98
97
|
VALUE each_item()
|
@@ -23,9 +23,6 @@ module WXRuby3
|
|
23
23
|
'wxMenuBar::GetLabelTop',
|
24
24
|
'wxMenuBar::SetLabelTop',
|
25
25
|
'wxMenuBar::Refresh')
|
26
|
-
unless Config.instance.wx_version >= '3.3' || Config.instance.wx_abi_version > '3.0.0'
|
27
|
-
spec.ignore 'wxMenuBar::OSXGetAppleMenu'
|
28
|
-
end
|
29
26
|
# for FindItem
|
30
27
|
spec.map 'wxMenu **' => 'Wx::Menu' do
|
31
28
|
map_in ignore: true, temp: 'wxMenu *tmp', code: '$1 = &tmp;'
|
data/rakelib/lib/director/pen.rb
CHANGED
@@ -79,7 +79,7 @@ module WXRuby3
|
|
79
79
|
# dealt with below - these require special handling because of the use
|
80
80
|
# of wxDash array, which cannot be freed until the pen(info) is disposed of
|
81
81
|
# or until a new dash pattern is specified.
|
82
|
-
spec.ignore(%w[wxPen::GetDashes wxPen::SetDashes wxPenInfo::GetDashes wxPenInfo::Dashes]
|
82
|
+
spec.ignore(%w[wxPen::GetDashes wxPen::SetDashes wxPenInfo::GetDashes wxPenInfo::Dashes])
|
83
83
|
spec.ignore 'wxPenInfo::GetDash'
|
84
84
|
spec.add_extend_code 'wxPen', <<~__HEREDOC
|
85
85
|
// Returns a ruby array with the dash lengths
|
@@ -22,7 +22,7 @@ module WXRuby3
|
|
22
22
|
'wxSystemSettings::HasFeature',
|
23
23
|
'wxSystemSettings::GetScreenType'
|
24
24
|
spec.ignore 'wxSystemSettings::GetAppearance'
|
25
|
-
spec.add_extend_code <<~__HEREDOC
|
25
|
+
spec.add_extend_code 'wxSystemSettings', <<~__HEREDOC
|
26
26
|
static wxString GetAppearanceName()
|
27
27
|
{
|
28
28
|
return wxSystemSettings::GetAppearance().GetName();
|
@@ -150,13 +150,14 @@ module WXRuby3
|
|
150
150
|
static VALUE do_paint_buffered(wxWindow* ptr)
|
151
151
|
{
|
152
152
|
VALUE rc = Qnil;
|
153
|
-
wxAutoBufferedPaintDC dc(ptr);
|
154
153
|
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
|
154
|
+
wxPaintDC dc(ptr);
|
155
155
|
wxPaintDC* ptr_dc = &dc;
|
156
156
|
VALUE r_class = rb_const_get(mWxCore, rb_intern("PaintDC"));
|
157
157
|
#else
|
158
|
-
|
159
|
-
|
158
|
+
wxBufferedPaintDC dc(ptr);
|
159
|
+
wxBufferedPaintDC* ptr_dc = &dc;
|
160
|
+
VALUE r_class = rb_const_get(mWxCore, rb_intern("BufferedPaintDC"));
|
160
161
|
#endif
|
161
162
|
swig_type_info* swig_type = wxRuby_GetSwigTypeForClass(r_class);
|
162
163
|
VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ptr_dc), swig_type, 0);
|
@@ -314,6 +315,11 @@ module WXRuby3
|
|
314
315
|
"#{spec.class_name(citem)}::WarpPointer",
|
315
316
|
"#{spec.class_name(citem)}::AdjustForLayoutDirection",
|
316
317
|
"#{spec.class_name(citem)}::IsTransparentBackgroundSupported")
|
318
|
+
if Config.instance.features_set?('USE_ACCESSIBILITY')
|
319
|
+
if Config.instance.wx_version > '3.2.4'
|
320
|
+
spec.no_proxy "#{spec.class_name(citem)}::CreateAccessible"
|
321
|
+
end
|
322
|
+
end
|
317
323
|
end
|
318
324
|
end
|
319
325
|
if spec.module_name == 'wxWindow'
|
@@ -293,7 +293,7 @@ module WXRuby3
|
|
293
293
|
@is_static = element['static'] == 'yes'
|
294
294
|
@is_virtual = %w[virtual pure-virtual].include?(element['virt'])
|
295
295
|
@is_pure_virtual = (element['virt'] == 'pure-virtual')
|
296
|
-
@args_string.sub!(/\s*=0/, '') if @is_pure_virtual
|
296
|
+
@args_string.sub!(/\)(\s*const)?\s*=0/, ')\1') if @is_pure_virtual
|
297
297
|
@is_override = !!element.at_xpath('reimplements')
|
298
298
|
@is_const = (element['const'] == 'yes')
|
299
299
|
@is_ctor = (@name == @class_name)
|
@@ -13,3 +13,13 @@
|
|
13
13
|
animations.add("throbber_2x.gif")
|
14
14
|
animationCtrl.play if animationCtrl.set_animation(animations)
|
15
15
|
```
|
16
|
+
:wxAnimationCtrl.SetAnimation:
|
17
|
+
:detail:
|
18
|
+
:pre:
|
19
|
+
:programlisting:
|
20
|
+
- :pattern: !ruby/regexp /.*/
|
21
|
+
:replace: |
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
animationCtrl.set_animation(Wx::AnimationBundle.new('progress.gif'))
|
25
|
+
```
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
:wxBannerWindow:
|
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
|
+
|
14
|
+
# ... create the frame itself ...
|
15
|
+
|
16
|
+
# Create and initialize the banner.
|
17
|
+
banner = Wx::BannerWindow.new(self, Wx::TOP)
|
18
|
+
banner.set_text("Welcome to my wonderful program",
|
19
|
+
" Before doing anything else, you need to connect to the online server.\n" +
|
20
|
+
" Please enter your credentials in the controls below.")
|
21
|
+
|
22
|
+
# And position it along the top edge of the window.
|
23
|
+
sizer = Wx::VBoxSizer.new
|
24
|
+
sizer.add(banner, Wx::SizerFlags.new.expand)
|
25
|
+
|
26
|
+
# ... add the rest of the window contents to the same sizer ...
|
27
|
+
|
28
|
+
set_sizer_and_fit(sizer)
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
# ...
|
33
|
+
|
34
|
+
end
|
35
|
+
```
|