wxruby3 0.9.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/INSTALL.md +23 -1
- data/README.md +12 -26
- data/ext/mkrf_conf_ext.rb +11 -7
- data/lib/wx/core/app.rb +16 -0
- data/lib/wx/core/colour.rb +36 -28
- data/lib/wx/core/const.rb +19 -0
- data/lib/wx/core/enum.rb +17 -1
- data/lib/wx/core/geometry.rb +121 -0
- data/lib/wx/core/graphics_pen_info.rb +18 -0
- data/lib/wx/core/image.rb +49 -0
- data/lib/wx/core/menu_bar.rb +11 -0
- data/lib/wx/core/paintdc.rb +9 -3
- data/lib/wx/doc/app.rb +97 -41
- data/lib/wx/doc/bitmap.rb +4 -0
- data/lib/wx/doc/client_dc.rb +2 -2
- data/lib/wx/doc/clipboard.rb +1 -1
- data/lib/wx/doc/colour.rb +12 -0
- data/lib/wx/doc/const.rb +16 -0
- data/lib/wx/doc/cursor.rb +4 -0
- data/lib/wx/doc/dc_overlay.rb +34 -0
- data/lib/wx/doc/enum.rb +7 -1
- data/lib/wx/doc/event_blocker.rb +1 -1
- data/lib/wx/doc/evthandler.rb +25 -3
- data/lib/wx/doc/functions.rb +3 -6
- data/lib/wx/doc/gc_dc.rb +13 -4
- data/lib/wx/doc/geometry.rb +136 -0
- data/lib/wx/doc/graphics_context.rb +25 -7
- data/lib/wx/doc/icon.rb +4 -0
- data/lib/wx/doc/image.rb +56 -0
- data/lib/wx/doc/list_ctrl.rb +6 -6
- data/lib/wx/doc/memory_dc.rb +2 -11
- data/lib/wx/doc/mirror_dc.rb +1 -1
- data/lib/wx/doc/pen.rb +26 -0
- data/lib/wx/doc/persistence_manager.rb +1 -1
- data/lib/wx/doc/persistent_object.rb +1 -1
- data/lib/wx/doc/pg/property_grid_interface.rb +3 -3
- data/lib/wx/doc/prt/printer_dc.rb +2 -2
- data/lib/wx/doc/region_iterator.rb +1 -1
- data/lib/wx/doc/scaled_dc.rb +1 -1
- data/lib/wx/doc/screen_dc.rb +1 -1
- data/lib/wx/doc/svg_file_dc.rb +1 -1
- data/lib/wx/doc/textctrl.rb +1 -1
- data/lib/wx/doc/tree_ctrl.rb +2 -2
- data/lib/wx/doc/validator.rb +6 -6
- data/lib/wx/doc/variant.rb +2 -2
- data/lib/wx/doc/window.rb +5 -4
- data/lib/wx/grid/keyword_defs.rb +1 -1
- data/lib/wx/html/keyword_defs.rb +3 -3
- data/lib/wx/keyword_defs.rb +76 -71
- data/lib/wx/pg/keyword_defs.rb +2 -2
- data/lib/wx/pg/pg_property.rb +12 -0
- data/lib/wx/rbn/keyword_defs.rb +1 -1
- data/lib/wx/rtc/keyword_defs.rb +1 -1
- data/lib/wx/stc/keyword_defs.rb +1 -1
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/cmd/setup.rb +3 -0
- data/rakelib/configure.rb +7 -0
- data/rakelib/gem.rake +2 -1
- data/rakelib/gem.rb +3 -2
- data/rakelib/lib/config/linux.rb +1 -1
- data/rakelib/lib/config/unixish.rb +6 -7
- data/rakelib/lib/config.rb +25 -4
- data/rakelib/lib/core/include/enum.inc +31 -1
- data/rakelib/lib/director/affine_matrix.rb +51 -0
- data/rakelib/lib/director/app.rb +29 -13
- data/rakelib/lib/director/art_provider.rb +4 -0
- data/rakelib/lib/director/cursor.rb +6 -2
- data/rakelib/lib/director/dc.rb +1 -6
- data/rakelib/lib/director/derived_dc.rb +88 -31
- data/rakelib/lib/director/dialog.rb +0 -8
- data/rakelib/lib/director/geometry.rb +142 -0
- data/rakelib/lib/director/graphics_context.rb +3 -2
- data/rakelib/lib/director/graphics_object.rb +18 -25
- data/rakelib/lib/director/image.rb +59 -0
- data/rakelib/lib/director/menu.rb +2 -3
- data/rakelib/lib/director/menu_bar.rb +0 -3
- data/rakelib/lib/director/pen.rb +1 -1
- data/rakelib/lib/director/richtext_ctrl.rb +1 -1
- data/rakelib/lib/director/system_settings.rb +1 -1
- data/rakelib/lib/director/window.rb +4 -3
- data/rakelib/lib/extractor/function.rb +1 -1
- data/rakelib/lib/generate/doc/animation_ctrl.yaml +10 -0
- data/rakelib/lib/generate/doc/banner_window.yaml +35 -0
- data/rakelib/lib/generate/doc/graphics_context.yaml +12 -0
- data/rakelib/lib/generate/doc/graphics_object.yaml +12 -0
- data/rakelib/lib/generate/doc/grid_ctrl.yaml +25 -0
- data/rakelib/lib/generate/doc/header_ctrl.yaml +91 -0
- data/rakelib/lib/generate/doc/icon.yaml +10 -0
- data/rakelib/lib/generate/doc/info_bar.yaml +27 -0
- data/rakelib/lib/generate/doc/log.yaml +1 -1
- data/rakelib/lib/generate/doc/media_ctrl.yaml +27 -0
- data/rakelib/lib/generate/doc/persistent_window.yaml +22 -0
- data/rakelib/lib/generate/doc/pg_editor.yaml +1 -1
- data/rakelib/lib/generate/doc/pg_property.yaml +4 -4
- data/rakelib/lib/generate/doc/rearrange_list.yaml +14 -0
- data/rakelib/lib/generate/doc/ribbon_panel.yaml +15 -0
- data/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml +26 -0
- data/rakelib/lib/generate/doc/text_ctrl.yaml +1 -1
- data/rakelib/lib/generate/doc/wizard.yaml +27 -0
- data/rakelib/lib/generate/doc.rb +4 -4
- data/rakelib/lib/generate/interface.rb +1 -1
- data/rakelib/lib/specs/interfaces.rb +3 -0
- data/rakelib/lib/swig_runner.rb +24 -3
- data/rakelib/lib/typemap/points_list.rb +8 -2
- data/rakelib/lib/typemap/richtext.rb +17 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +3 -3
- data/samples/dialogs/wizard.rb +20 -19
- data/samples/drawing/art/drawing/image.bmp +0 -0
- data/samples/drawing/art/drawing/mask.bmp +0 -0
- data/samples/drawing/art/drawing/pat35.bmp +0 -0
- data/samples/drawing/art/drawing/pat36.bmp +0 -0
- data/samples/drawing/art/drawing/pat4.bmp +0 -0
- data/samples/drawing/art/drawing/smile.xpm +42 -0
- data/samples/drawing/drawing.rb +2276 -0
- data/samples/drawing/tn_drawing.png +0 -0
- data/samples/html/html.rb +1 -1
- data/samples/propgrid/propgrid.rb +1 -1
- data/samples/propgrid/propgrid_minimal.rb +1 -1
- data/samples/propgrid/sample_props.rb +1 -1
- data/samples/sampler/editor.rb +13 -11
- data/samples/sampler.rb +14 -10
- data/samples/text/richtext.rb +53 -0
- data/samples/text/scintilla.rb +1 -1
- data/samples/text/unicode.rb +4 -4
- data/tests/test_ext_controls.rb +12 -5
- data/tests/test_std_controls.rb +12 -12
- metadata +30 -30
- data/lib/wx/doc/extra/00_starting.md +0 -154
- data/lib/wx/doc/extra/01_packages.md +0 -180
- data/lib/wx/doc/extra/02_lifecycles.md +0 -166
- data/lib/wx/doc/extra/03_dialogs.md +0 -57
- data/lib/wx/doc/extra/04_enums.md +0 -143
- data/lib/wx/doc/extra/05_event-handling.md +0 -191
- data/lib/wx/doc/extra/06_geometry.md +0 -62
- data/lib/wx/doc/extra/07_colour_and_font.md +0 -52
- data/lib/wx/doc/extra/08_extensions.md +0 -144
- data/lib/wx/doc/extra/09_exceptions.md +0 -54
- data/lib/wx/doc/extra/10_art.md +0 -111
- data/lib/wx/doc/extra/11_drawing_and_dc.md +0 -62
- data/lib/wx/doc/extra/12_client_data.md +0 -89
- data/lib/wx/doc/extra/13_validators.md +0 -139
- data/lib/wx/doc/extra/14_config.md +0 -101
- data/lib/wx/doc/extra/15_persistence.md +0 -148
- data/samples/sampler/back.xpm +0 -21
- data/samples/sampler/copy.xpm +0 -44
- data/samples/sampler/cut.xpm +0 -46
- data/samples/sampler/filesave.xpm +0 -42
- data/samples/sampler/find.xpm +0 -62
- data/samples/sampler/findrepl.xpm +0 -63
- data/samples/sampler/forward.xpm +0 -21
- data/samples/sampler/paste.xpm +0 -46
- data/samples/sampler/redo.xpm +0 -58
- data/samples/sampler/undo.xpm +0 -58
|
@@ -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);
|
|
@@ -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
|
+
```
|
|
@@ -32,3 +32,15 @@
|
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
```
|
|
35
|
+
:wxGraphicsPenInfo:
|
|
36
|
+
:detail:
|
|
37
|
+
:pre:
|
|
38
|
+
:programlisting:
|
|
39
|
+
- :pattern: !ruby/regexp /.*/
|
|
40
|
+
:replace: |
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
ctx = Wx::GraphicsContext.create(dc)
|
|
44
|
+
|
|
45
|
+
ctx.set_pen(Wx::GraphicsPenInfo.new(Wx::BLUE).width(1.25).style(Wx::PENSTYLE_DOT))
|
|
46
|
+
```
|
|
@@ -23,3 +23,28 @@
|
|
|
23
23
|
|
|
24
24
|
end
|
|
25
25
|
```
|
|
26
|
+
:wxGrid.GetSelectedBlocks:
|
|
27
|
+
:detail:
|
|
28
|
+
:pre:
|
|
29
|
+
:programlisting:
|
|
30
|
+
- :pattern: !ruby/regexp /.*/
|
|
31
|
+
:replace: |
|
|
32
|
+
|
|
33
|
+
```ruby
|
|
34
|
+
grid.get_selected_blocks.each do |gbc|
|
|
35
|
+
break if gbc.intersects(my_block)
|
|
36
|
+
end
|
|
37
|
+
```
|
|
38
|
+
:post:
|
|
39
|
+
- :pattern: !ruby/regexp /,\s+e\.g\.\s+with\s+range-for\s+loop:/
|
|
40
|
+
:subst: ':'
|
|
41
|
+
:wxGridFitMode:
|
|
42
|
+
:detail:
|
|
43
|
+
:pre:
|
|
44
|
+
:programlisting:
|
|
45
|
+
- :pattern: !ruby/regexp /.*/
|
|
46
|
+
:replace: |
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
grid.set_default_cell_fit_mode(Wx::GRID::GridFitMode.clip)
|
|
50
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
:wxHeaderCtrl.Create:
|
|
3
|
+
:detail:
|
|
4
|
+
:pre:
|
|
5
|
+
:programlisting:
|
|
6
|
+
- :pattern: !ruby/regexp /.*/
|
|
7
|
+
:replace: |
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
Wx::HD_DEFAULT_STYLE & ~Wx::HD_ALLOW_REORDER
|
|
11
|
+
```
|
|
12
|
+
:wxHeaderCtrl.AddColumnsItems:
|
|
13
|
+
:detail:
|
|
14
|
+
:pre:
|
|
15
|
+
:programlisting:
|
|
16
|
+
- :pattern: !ruby/regexp /.*/
|
|
17
|
+
:replace: |
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
menu = Wx::Menu.new
|
|
21
|
+
menu.append(100, 'Some custom command')
|
|
22
|
+
menu.append_separator
|
|
23
|
+
add_columns_items(menu, 200)
|
|
24
|
+
rc = get_popup_menu_selection_from_user(menu, pt)
|
|
25
|
+
if rc >= 200
|
|
26
|
+
# ... toggle visibility of the column rc-200 ...
|
|
27
|
+
end
|
|
28
|
+
```
|
|
29
|
+
:wxHeaderCtrl.UpdateColumnWidthToFit:
|
|
30
|
+
:detail:
|
|
31
|
+
:pre:
|
|
32
|
+
:programlisting:
|
|
33
|
+
- :pattern: !ruby/regexp /.*/
|
|
34
|
+
:replace: |
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
class MyHeaderColumn < Wx::HeaderColumn
|
|
38
|
+
# ...
|
|
39
|
+
|
|
40
|
+
def set_width(width)
|
|
41
|
+
@width = width
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def get_width
|
|
45
|
+
@width
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
class MyHeaderCtrl < Wx::HeaderCtrl
|
|
51
|
+
# ...
|
|
52
|
+
|
|
53
|
+
protected
|
|
54
|
+
|
|
55
|
+
def get_column(idx)
|
|
56
|
+
# @cols = Array<MyHeaderColumn>
|
|
57
|
+
@cols[idx]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def update_column_width_to_fit(idx, widthTitle)
|
|
61
|
+
widthContents = # ... compute minimal width for column idx ...
|
|
62
|
+
@cols[idx].set_width([widthContents, widthTitle].max)
|
|
63
|
+
true
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
```
|
|
68
|
+
:wxHeaderCtrlSimple.HideColumn:
|
|
69
|
+
:detail:
|
|
70
|
+
:pre:
|
|
71
|
+
:programlisting:
|
|
72
|
+
- :pattern: !ruby/regexp /.*/
|
|
73
|
+
:replace: |
|
|
74
|
+
|
|
75
|
+
```ruby
|
|
76
|
+
show_column(idx, false)
|
|
77
|
+
```
|
|
78
|
+
:wxHeaderColumnSimple:
|
|
79
|
+
:detail:
|
|
80
|
+
:pre:
|
|
81
|
+
:programlisting:
|
|
82
|
+
- :pattern: !ruby/regexp /.*/
|
|
83
|
+
:replace: |
|
|
84
|
+
|
|
85
|
+
```ruby
|
|
86
|
+
header = Wx::HeaderCtrlSimple.new(...)
|
|
87
|
+
col = Wx::HeaderColumnSimple.new('Title')
|
|
88
|
+
col.set_width(100)
|
|
89
|
+
col.set_sortable(100)
|
|
90
|
+
header.append_column(col)
|
|
91
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
:wxInfoBar:
|
|
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
|
+
@infoBar = Wx::InfoBar.new(self)
|
|
15
|
+
|
|
16
|
+
sizer = Wx::VBoxSizer.new
|
|
17
|
+
sizer.add(@infoBar, Wx::SizerFlags.new.expand)
|
|
18
|
+
# ... add other frame controls to the sizer ...
|
|
19
|
+
set_sizer(sizer)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def some_method
|
|
23
|
+
@infoBar.show_message('Something happened', Wx::ICON_INFORMATION)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
:wxMediaCtrl:
|
|
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
|
+
# ... setup frame controls ...
|
|
14
|
+
# bind events
|
|
15
|
+
# ...
|
|
16
|
+
evt_media_stop MY_ID, :on_media_stop
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def on_media_stop(evt)
|
|
20
|
+
if @userWantsToSeek
|
|
21
|
+
@mediactrl.seek(@mediactrl.length - 1)
|
|
22
|
+
evt.veto
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
```
|