wxruby3 0.9.0 → 0.9.2
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/.yardopts +1 -0
- data/ext/wxruby3/include/wxRubyApp.h +338 -0
- data/ext/wxruby3/include/wxruby-Config.h +6 -6
- data/ext/wxruby3/include/wxruby-runtime.h +3 -0
- data/ext/wxruby3/swig/common.i +22 -0
- data/ext/wxruby3/swig/custom/director.swg +296 -0
- data/ext/wxruby3/swig/custom/rubyapi.swg +19 -0
- data/ext/wxruby3/swig/custom/rubyerrors.swg +45 -0
- data/ext/wxruby3/swig/custom/rubyhead.swg +192 -0
- data/ext/wxruby3/swig/custom/rubyrun.swg +187 -0
- data/ext/wxruby3/swig/custom/swigrun.swg +363 -0
- data/ext/wxruby3/swig/custom/typemaps/swigtypemaps.swg +173 -0
- data/ext/wxruby3/swig/wx.i +50 -30
- data/lib/wx/aui/aui_tab_ctrl.rb +18 -0
- data/lib/wx/aui/auinotebook.rb +6 -2
- data/lib/wx/aui/require.rb +1 -0
- data/lib/wx/core/app.rb +2 -2
- data/lib/wx/core/collapsible_pane.rb +1 -1
- data/lib/wx/core/const.rb +83 -0
- data/lib/wx/core/controlwithitems.rb +8 -6
- data/lib/wx/core/menu.rb +10 -0
- data/lib/wx/core/notebook.rb +6 -2
- data/lib/wx/core/sizer.rb +11 -0
- data/lib/wx/core/task_bar_button.rb +19 -0
- data/lib/wx/core/textctrl.rb +11 -1
- data/lib/wx/core/{treectrl.rb → tree_ctrl.rb} +31 -12
- data/lib/wx/core/window.rb +10 -0
- data/lib/wx/doc/app.rb +48 -38
- data/lib/wx/doc/art_locator.rb +47 -43
- data/lib/wx/doc/aui/auimanager.rb +16 -8
- data/lib/wx/doc/aui/auinotebook.rb +20 -5
- data/lib/wx/doc/clipboard.rb +11 -7
- data/lib/wx/doc/colour_dialog.rb +14 -10
- data/lib/wx/doc/const.rb +66 -66
- data/lib/wx/doc/controlwithitems.rb +17 -7
- data/lib/wx/doc/data_object.rb +2 -2
- data/lib/wx/doc/event.rb +0 -6
- data/lib/wx/doc/evthandler.rb +113 -108
- data/lib/wx/doc/font.rb +1 -0
- data/lib/wx/doc/functions.rb +9 -9
- data/lib/wx/doc/gc_dc.rb +6 -1
- data/lib/wx/doc/graphics_context.rb +1 -0
- data/lib/wx/doc/grid/grid.rb +22 -1
- data/lib/wx/doc/help_controller.rb +11 -7
- data/lib/wx/doc/html/html_help_controller.rb +12 -4
- data/lib/wx/doc/list_ctrl.rb +33 -29
- data/lib/wx/doc/menu.rb +20 -0
- data/lib/wx/doc/notebook.rb +21 -0
- data/lib/wx/doc/pg/events.rb +13 -9
- data/lib/wx/doc/pg/pg_property.rb +18 -0
- data/lib/wx/doc/progress_dialog.rb +36 -32
- data/lib/wx/doc/prt/page_setup_dialog.rb +20 -12
- data/lib/wx/doc/prt/print_data.rb +13 -5
- data/lib/wx/doc/prt/print_dialog.rb +31 -23
- data/lib/wx/doc/prt/printer.rb +20 -12
- data/lib/wx/doc/radio_box.rb +19 -15
- data/lib/wx/doc/rbn/ribbon_bar.rb +13 -5
- data/lib/wx/doc/rbn/ribbon_button_bar.rb +13 -5
- data/lib/wx/doc/rbn/ribbon_gallery.rb +13 -5
- data/lib/wx/doc/rbn/ribbon_tool_bar.rb +13 -5
- data/lib/wx/doc/region_iterator.rb +32 -28
- data/lib/wx/doc/rtc/rich_text_composite_object.rb +24 -0
- data/lib/wx/doc/rtc/rich_text_ctrl.rb +24 -0
- data/lib/wx/doc/rtc/rich_text_paragraph.rb +24 -0
- data/lib/wx/doc/rtc/richtext_buffer.rb +27 -19
- data/lib/wx/doc/rtc/richtext_printing.rb +17 -9
- data/lib/wx/doc/rtc/richtext_style_sheet.rb +17 -9
- data/lib/wx/doc/sizer.rb +20 -0
- data/lib/wx/doc/stc/styled_text_ctrl.rb +24 -0
- data/lib/wx/doc/stream.rb +39 -35
- data/lib/wx/doc/system_settings.rb +30 -26
- data/lib/wx/doc/text_validator.rb +12 -8
- data/lib/wx/doc/textctrl.rb +16 -0
- data/lib/wx/doc/tree_ctrl.rb +95 -0
- data/lib/wx/doc/treebook.rb +9 -5
- data/lib/wx/doc/v_list_box.rb +9 -5
- data/lib/wx/doc/variant.rb +164 -160
- data/lib/wx/doc/window.rb +57 -42
- data/lib/wx/doc/window_disabler.rb +10 -6
- data/lib/wx/grid/grid.rb +27 -4
- data/lib/wx/keyword_defs.rb +43 -6
- data/lib/wx/pg/pg_property.rb +22 -0
- data/lib/wx/rtc/require.rb +3 -0
- data/lib/wx/rtc/rich_text_composite_object.rb +25 -0
- data/lib/wx/rtc/rich_text_ctrl.rb +25 -0
- data/lib/wx/rtc/rich_text_paragraph.rb +25 -0
- data/lib/wx/stc/require.rb +1 -0
- data/lib/wx/stc/styled_text_ctrl.rb +25 -0
- data/lib/wx/version.rb +1 -1
- data/rakelib/lib/config/linux.rb +0 -3
- data/rakelib/lib/config/macosx.rb +1 -1
- data/rakelib/lib/config/mingw.rb +1 -1
- data/rakelib/lib/config/unixish.rb +1 -1
- data/rakelib/lib/config.rb +14 -4
- data/rakelib/lib/core/include/funcall.inc +33 -14
- data/rakelib/lib/core/include/swigdirector.inc +384 -0
- data/rakelib/lib/core/include/swigrubyerrors.inc +161 -0
- data/{ext/wxruby3/swig/custom/swig4/rubyrun.swg → rakelib/lib/core/include/swigrubyrun.inc} +245 -120
- data/rakelib/lib/core/include/swigrun.inc +700 -0
- data/rakelib/lib/core/package.rb +19 -9
- data/rakelib/lib/core/parameter.rb +3 -0
- data/rakelib/lib/core/spec.rb +6 -1
- data/rakelib/lib/director/accelerator.rb +3 -4
- data/rakelib/lib/director/accessible.rb +47 -0
- data/rakelib/lib/director/animation.rb +1 -1
- data/rakelib/lib/director/animation_ctrl.rb +20 -0
- data/rakelib/lib/director/app.rb +15 -304
- data/rakelib/lib/director/app_traits.rb +10 -12
- data/rakelib/lib/director/art_provider.rb +1 -1
- data/rakelib/lib/director/ctrl_with_items.rb +17 -5
- data/rakelib/lib/director/data_format.rb +1 -1
- data/rakelib/lib/director/data_object_simple_base.rb +1 -2
- data/rakelib/lib/director/derived_dc.rb +1 -1
- data/rakelib/lib/director/dialog.rb +6 -0
- data/rakelib/lib/director/dialup_event.rb +44 -0
- data/rakelib/lib/director/dialup_manager.rb +45 -0
- data/rakelib/lib/director/drag_image.rb +2 -3
- data/rakelib/lib/director/event.rb +22 -4
- data/rakelib/lib/director/file_ctrl.rb +35 -0
- data/rakelib/lib/director/file_ctrl_event.rb +26 -0
- data/rakelib/lib/director/frame.rb +1 -3
- data/rakelib/lib/director/gdicommon.rb +27 -11
- data/rakelib/lib/director/graphics_context.rb +2 -4
- data/rakelib/lib/director/grid_cell_editor.rb +6 -6
- data/rakelib/lib/director/grid_ctrl.rb +34 -3
- data/rakelib/lib/director/help_controller.rb +1 -1
- data/rakelib/lib/director/icon.rb +5 -2
- data/rakelib/lib/director/list_ctrl.rb +5 -6
- data/rakelib/lib/director/locale.rb +1 -3
- data/rakelib/lib/director/log.rb +1 -4
- data/rakelib/lib/director/media_ctrl.rb +54 -0
- data/rakelib/lib/director/menu.rb +16 -1
- data/rakelib/lib/director/menu_item.rb +2 -2
- data/rakelib/lib/director/pgarray_editor_dialog.rb +0 -6
- data/rakelib/lib/director/pgeditor.rb +2 -2
- data/rakelib/lib/director/pgproperties.rb +3 -3
- data/rakelib/lib/director/pgproperty.rb +24 -1
- data/rakelib/lib/director/property_grid_interface.rb +5 -10
- data/rakelib/lib/director/richtext_buffer.rb +1 -1
- data/rakelib/lib/director/richtext_composite_object.rb +25 -0
- data/rakelib/lib/director/richtext_ctrl.rb +15 -5
- data/rakelib/lib/director/richtext_formatting_dialog.rb +7 -5
- data/rakelib/lib/director/richtext_paragraph_layout_box.rb +9 -7
- data/rakelib/lib/director/sash_event.rb +42 -0
- data/rakelib/lib/director/sizer.rb +79 -1
- data/rakelib/lib/director/sizer_item.rb +22 -0
- data/rakelib/lib/director/static_box.rb +4 -5
- data/rakelib/lib/director/styled_text_ctrl.rb +12 -0
- data/rakelib/lib/director/task_bar_button.rb +30 -0
- data/rakelib/lib/director/task_bar_icon.rb +6 -14
- data/rakelib/lib/director/textctrl.rb +12 -1
- data/rakelib/lib/director/tool_tip.rb +1 -1
- data/rakelib/lib/director/top_level_window.rb +4 -5
- data/rakelib/lib/director/tree_ctrl.rb +24 -50
- data/rakelib/lib/director/variant.rb +1 -1
- data/rakelib/lib/director/window.rb +24 -5
- data/rakelib/lib/director.rb +4 -4
- data/rakelib/lib/extractor/function.rb +6 -6
- data/rakelib/lib/extractor.rb +34 -5
- data/rakelib/lib/generate/analyzer.rb +8 -3
- data/rakelib/lib/generate/doc/animation_ctrl.yaml +15 -0
- data/rakelib/lib/generate/doc/busy_info.yaml +0 -2
- data/rakelib/lib/generate/doc/clipboard.yaml +0 -2
- data/rakelib/lib/generate/doc/cursor.yaml +0 -2
- data/rakelib/lib/generate/doc/events.yaml +10 -4
- data/rakelib/lib/generate/doc/panel.yaml +7 -0
- data/rakelib/lib/generate/doc/static_box.yaml +8 -0
- data/rakelib/lib/generate/doc/xml_resource.yaml +3 -0
- data/rakelib/lib/generate/doc.rb +89 -16
- data/rakelib/lib/generate/interface.rb +4 -3
- data/rakelib/lib/specs/interfaces.rb +161 -156
- data/rakelib/lib/swig_runner.rb +4 -50
- data/rakelib/lib/typemap/common.rb +54 -10
- data/rakelib/lib/typemap/data_format.rb +1 -1
- data/rakelib/lib/typemap/data_object_data.rb +2 -2
- data/rakelib/lib/typemap/pgprop_arg.rb +7 -2
- data/rakelib/lib/typemap/points_list.rb +5 -7
- data/rakelib/lib/util/string.rb +10 -8
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +74 -2
- data/rakelib/yard/templates/default/fulldoc/html/full_list.erb +38 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +39 -0
- data/rakelib/yard/templates/default/tags/html/wxrb_require.erb +10 -0
- data/rakelib/yard/templates/default/tags/setup.rb +16 -0
- data/rakelib/yard/yard-custom-templates.rb +3 -0
- data/samples/text/richtext.rb +0 -30
- data/samples/treectrl/treectrl.rb +1 -1
- data/tests/media/beep_lo.wav +0 -0
- data/tests/test_app_exit_exception.rb +36 -0
- data/tests/test_app_init_exception.rb +20 -0
- data/tests/test_book_controls.rb +29 -0
- data/tests/test_exceptions.rb +41 -0
- data/tests/test_list_ctrl.rb +1 -1
- data/tests/test_media_ctrl.rb +38 -0
- data/tests/test_menu.rb +69 -0
- data/tests/test_pg.rb +27 -0
- data/tests/test_richtext.rb +45 -0
- data/tests/test_sizer.rb +59 -0
- data/tests/test_std_controls.rb +78 -1
- data/tests/test_styled_text_ctrl.rb +46 -0
- data/tests/test_tree_ctrl.rb +138 -0
- data/tests/test_window.rb +12 -0
- data/tests/testapp_noframe.rb +1 -1
- metadata +54 -5
- data/ext/wxruby3/swig/custom/swig3/rubyrun.swg +0 -456
|
@@ -215,7 +215,7 @@ module WXRuby3
|
|
|
215
215
|
if ( TYPE($input) == T_DATA )
|
|
216
216
|
{
|
|
217
217
|
void* argp$argnum;
|
|
218
|
-
SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor,
|
|
218
|
+
SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 0);
|
|
219
219
|
$1 = reinterpret_cast< $1_basetype * >(argp$argnum);
|
|
220
220
|
}
|
|
221
221
|
else if ( TYPE($input) == T_ARRAY )
|
|
@@ -240,6 +240,28 @@ module WXRuby3
|
|
|
240
240
|
__CODE
|
|
241
241
|
end
|
|
242
242
|
|
|
243
|
+
map 'wxSize' => 'Array(Integer, Integer), Wx::Size',
|
|
244
|
+
'wxPoint' => 'Array(Integer, Integer), Wx::Point' do
|
|
245
|
+
|
|
246
|
+
map_directorout code: <<~__CODE
|
|
247
|
+
if (TYPE($input) == T_ARRAY && RARRAY_LEN($input) == 2)
|
|
248
|
+
{
|
|
249
|
+
$result = $1_basetype(NUM2INT( rb_ary_entry($input, 0)),
|
|
250
|
+
NUM2INT( rb_ary_entry($input, 1)));
|
|
251
|
+
}
|
|
252
|
+
else
|
|
253
|
+
{
|
|
254
|
+
void *ptr;
|
|
255
|
+
int res = SWIG_ConvertPtr($input, &ptr, $&1_descriptor, SWIG_POINTER_NO_NULL);
|
|
256
|
+
if (!SWIG_IsOK(res)) {
|
|
257
|
+
Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", SWIG_ErrorType(SWIG_ArgError(res)), "in output value of type '""$1_type""'");
|
|
258
|
+
}
|
|
259
|
+
$result = *(reinterpret_cast< $1_type * >(ptr));
|
|
260
|
+
}
|
|
261
|
+
__CODE
|
|
262
|
+
|
|
263
|
+
end
|
|
264
|
+
|
|
243
265
|
# Integer <> wxItemKind type mappings
|
|
244
266
|
|
|
245
267
|
map 'wxItemKind' => 'Integer' do
|
|
@@ -414,6 +436,35 @@ module WXRuby3
|
|
|
414
436
|
# do not seem to be virtual methods returning that
|
|
415
437
|
end
|
|
416
438
|
|
|
439
|
+
# const wxVector<int>&
|
|
440
|
+
|
|
441
|
+
map 'const wxVector<int>&' => 'Array<Integer>' do
|
|
442
|
+
map_in temp: 'wxVector<int> tmp', code: <<~__CODE
|
|
443
|
+
if (($input == Qnil) || (TYPE($input) != T_ARRAY))
|
|
444
|
+
{
|
|
445
|
+
VALUE dump = rb_inspect($input);
|
|
446
|
+
rb_raise(rb_eArgError, "expected Array of Integer for %d but got %s",
|
|
447
|
+
$argnum-1, StringValuePtr(dump));
|
|
448
|
+
}
|
|
449
|
+
else
|
|
450
|
+
{
|
|
451
|
+
for (int i = 0; i < RARRAY_LEN($input); i++)
|
|
452
|
+
{
|
|
453
|
+
tmp.push_back(NUM2INT(rb_ary_entry($input,i)));
|
|
454
|
+
}
|
|
455
|
+
$1 = &tmp;
|
|
456
|
+
}
|
|
457
|
+
__CODE
|
|
458
|
+
map_directorin code: <<~__CODE
|
|
459
|
+
$input = rb_ary_new();
|
|
460
|
+
for (size_t i = 0; i < $1.size(); i++)
|
|
461
|
+
{
|
|
462
|
+
rb_ary_push($input,INT2NUM( $1[i] ) );
|
|
463
|
+
}
|
|
464
|
+
__CODE
|
|
465
|
+
map_typecheck precedence: 'INT32_ARRAY', code: '$1 = (TYPE($input) == T_ARRAY);'
|
|
466
|
+
end
|
|
467
|
+
|
|
417
468
|
# various enumerator type mappings
|
|
418
469
|
|
|
419
470
|
map *%w[wxEdge wxRelationship wxKeyCode], as: 'Integer' do
|
|
@@ -456,12 +507,10 @@ module WXRuby3
|
|
|
456
507
|
end
|
|
457
508
|
|
|
458
509
|
|
|
459
|
-
# Validators must be cast to correct subclass, but
|
|
460
|
-
# is a clone, and should not be freed, so disown after wrapping.
|
|
510
|
+
# Validators must be cast to correct subclass, but not owned
|
|
461
511
|
map 'wxValidator*' => 'Wx::Validator' do
|
|
462
512
|
map_out code: <<~__CODE
|
|
463
513
|
$result = wxRuby_WrapWxObjectInRuby($1);
|
|
464
|
-
if (!NIL_P($result)) RDATA($result)->dfree = SWIG_RubyRemoveTracking;
|
|
465
514
|
__CODE
|
|
466
515
|
end
|
|
467
516
|
|
|
@@ -633,14 +682,9 @@ module WXRuby3
|
|
|
633
682
|
end
|
|
634
683
|
end
|
|
635
684
|
|
|
636
|
-
# special case bc SWIG causes trouble in Window.cpp
|
|
637
|
-
map 'const wxRegion&', 'const wxRegion*', as: 'Wx::Region' do
|
|
638
|
-
map_out code: '$result = wxRuby_WrapWxObjectInRuby(new wxRegion(*static_cast<const wxRegion*> ($1)));'
|
|
639
|
-
end
|
|
640
|
-
|
|
641
685
|
# add type mapping for wxVariant input args
|
|
642
686
|
intypes = 'nil,String,Integer,Float,Time,Wx::Font,Wx::Colour,Wx::Variant,Array<WxVariant>,Array<String>,Object'
|
|
643
|
-
if Config.instance.features_set?('
|
|
687
|
+
if Config.instance.features_set?('USE_PROPGRID')
|
|
644
688
|
intypes << 'Wx::PG::ColourPropertyValue'
|
|
645
689
|
end
|
|
646
690
|
map 'const wxVariant&' => intypes do
|
|
@@ -30,7 +30,7 @@ module WXRuby3
|
|
|
30
30
|
void* argp$argnum = NULL;
|
|
31
31
|
if ( TYPE($input) == T_DATA )
|
|
32
32
|
{
|
|
33
|
-
if (SWIG_IsOK(SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor,
|
|
33
|
+
if (SWIG_IsOK(SWIG_ConvertPtr($input, &argp$argnum, $1_descriptor, 0)) && argp$argnum)
|
|
34
34
|
{
|
|
35
35
|
$1 = reinterpret_cast< $1_basetype * >(argp$argnum);
|
|
36
36
|
}
|
|
@@ -69,7 +69,7 @@ module WXRuby3
|
|
|
69
69
|
}
|
|
70
70
|
else
|
|
71
71
|
{
|
|
72
|
-
Swig::DirectorTypeMismatchException::raise(rb_eTypeError,
|
|
72
|
+
Swig::DirectorTypeMismatchException::raise(swig_get_self(), "$symname", rb_eTypeError,
|
|
73
73
|
"get_data_here should return a string, or nil on failure");
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -20,6 +20,11 @@ module WXRuby3
|
|
|
20
20
|
define do
|
|
21
21
|
|
|
22
22
|
map 'const wxPGPropArgCls&' => 'String,Wx::PG::PGProperty' do
|
|
23
|
+
|
|
24
|
+
add_header_code <<~__CODE
|
|
25
|
+
static WxRuby_ID s_pg_property_id("PGProperty");
|
|
26
|
+
__CODE
|
|
27
|
+
|
|
23
28
|
map_in temp: 'wxPGPropArgCls temp = (wxPGProperty *)0', code: <<~__CODE
|
|
24
29
|
if (!NIL_P($input))
|
|
25
30
|
{
|
|
@@ -29,12 +34,12 @@ module WXRuby3
|
|
|
29
34
|
}
|
|
30
35
|
else if (TYPE($input) == T_DATA)
|
|
31
36
|
{
|
|
32
|
-
VALUE rb_klass = rb_const_get(mWxPG,
|
|
37
|
+
VALUE rb_klass = rb_const_get(mWxPG, s_pg_property_id());
|
|
33
38
|
if (rb_obj_is_kind_of($input, rb_klass))
|
|
34
39
|
{
|
|
35
40
|
swig_type_info* swig_type = wxRuby_GetSwigTypeForClass(rb_klass);
|
|
36
41
|
wxPGProperty *pgprop = (wxPGProperty *)0;
|
|
37
|
-
SWIG_ConvertPtr($input, SWIG_as_voidptrptr(&pgprop), swig_type,
|
|
42
|
+
SWIG_ConvertPtr($input, SWIG_as_voidptrptr(&pgprop), swig_type, 0);
|
|
38
43
|
temp = wxPGPropArgCls(pgprop);
|
|
39
44
|
}
|
|
40
45
|
else
|
|
@@ -29,28 +29,26 @@ module WXRuby3
|
|
|
29
29
|
add_header_code <<~__CODE
|
|
30
30
|
static void wxRuby_PointArrayRubyToC(VALUE rb_arr, wxPoint wx_arr[])
|
|
31
31
|
{
|
|
32
|
-
wxPoint *wx_point;
|
|
33
32
|
VALUE rb_item;
|
|
34
33
|
for (int i = 0; i < RARRAY_LEN(rb_arr); i++)
|
|
35
34
|
{
|
|
36
35
|
rb_item = rb_ary_entry (rb_arr, i);
|
|
37
36
|
if (TYPE(rb_item) == T_DATA)
|
|
38
37
|
{
|
|
38
|
+
wxPoint *wx_point;
|
|
39
39
|
SWIG_ConvertPtr (rb_item, (void **) &wx_point,
|
|
40
|
-
SWIGTYPE_p_wxPoint,
|
|
40
|
+
SWIGTYPE_p_wxPoint, 0);
|
|
41
|
+
wx_arr[i] = *wx_point;
|
|
41
42
|
}
|
|
42
43
|
else if (TYPE(rb_item) == T_ARRAY && RARRAY_LEN(rb_item) == 2)
|
|
43
44
|
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// Create a ruby object so the C++ obj is freed when GC runs
|
|
47
|
-
SWIG_NewPointerObj (wx_point, SWIGTYPE_p_wxPoint, 1);
|
|
45
|
+
wx_arr[i] = wxPoint (NUM2INT( rb_ary_entry(rb_item, 0)),
|
|
46
|
+
NUM2INT(rb_ary_entry (rb_item, 1)));
|
|
48
47
|
}
|
|
49
48
|
else
|
|
50
49
|
{
|
|
51
50
|
rb_raise(rb_eTypeError, "Wrong type for wxPoint parameter %i", i);
|
|
52
51
|
}
|
|
53
|
-
wx_arr[i] = *wx_point;
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
__CODE
|
data/rakelib/lib/util/string.rb
CHANGED
|
@@ -91,14 +91,18 @@ module WXRuby3
|
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def rb_constant_value(name)
|
|
94
|
-
|
|
95
|
-
case
|
|
96
|
-
when
|
|
94
|
+
name = name.strip
|
|
95
|
+
case name
|
|
96
|
+
when /\A(null|nullptr)\Z/i
|
|
97
97
|
'nil'
|
|
98
|
+
when /\A(true|false)\Z/i
|
|
99
|
+
name.downcase
|
|
98
100
|
when /EmptyString/
|
|
99
101
|
%q['']
|
|
102
|
+
when /\A\"/
|
|
103
|
+
name
|
|
100
104
|
else
|
|
101
|
-
|
|
105
|
+
"#{name.start_with?('wx') ? 'Wx::' : ''}#{rb_constant_name(name)}"
|
|
102
106
|
end
|
|
103
107
|
end
|
|
104
108
|
|
|
@@ -110,7 +114,7 @@ module WXRuby3
|
|
|
110
114
|
ids = idstr.split('::')
|
|
111
115
|
if ids.size > 1
|
|
112
116
|
is_scoped = true
|
|
113
|
-
scoped_name =
|
|
117
|
+
scoped_name = rb_wx_name(ids.shift)
|
|
114
118
|
while ids.size > 1
|
|
115
119
|
scoped_name << '::' << ids.shift
|
|
116
120
|
end
|
|
@@ -127,7 +131,7 @@ module WXRuby3
|
|
|
127
131
|
when 'wxString'
|
|
128
132
|
'('
|
|
129
133
|
else
|
|
130
|
-
"#{
|
|
134
|
+
"#{idstr.start_with?('wx') ? 'Wx::' : ''}#{rb_wx_name(idstr)}.new("
|
|
131
135
|
end
|
|
132
136
|
end
|
|
133
137
|
else
|
|
@@ -143,8 +147,6 @@ module WXRuby3
|
|
|
143
147
|
# constant
|
|
144
148
|
if /[\-\+\.\d]+/ =~ idstr
|
|
145
149
|
idstr # numeric constant
|
|
146
|
-
elsif /\A(true|false|NULL|nullptr)/ =~ idstr
|
|
147
|
-
($1 == 'NULL' || $1 == 'nullptr') ? 'nil' : $1
|
|
148
150
|
else
|
|
149
151
|
if const_xref.has_key?(rb_constant_name(idstr))
|
|
150
152
|
"#{const_xref[rb_constant_name(idstr)]['mod']}::#{rb_constant_name(idstr)}"
|
|
@@ -1,7 +1,79 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
div.wxrb-note {
|
|
3
3
|
background: #f7f7f9;
|
|
4
|
-
border-left: .
|
|
4
|
+
border-left: .6em solid #f3ba6f;
|
|
5
|
+
border-radius: 3px;
|
|
5
6
|
margin: 14px;
|
|
6
7
|
padding-left: 14px;
|
|
8
|
+
padding-top: 10px;
|
|
9
|
+
padding-bottom: 10px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
div.wxrb-remark {
|
|
13
|
+
background: #f7f7f9;
|
|
14
|
+
border-left: .6em solid #f6f4ab;
|
|
15
|
+
border-radius: 3px;
|
|
16
|
+
margin: 14px;
|
|
17
|
+
padding-left: 14px;
|
|
18
|
+
padding-top: 10px;
|
|
19
|
+
padding-bottom: 10px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
div.wxrb-note p,
|
|
23
|
+
div.wxrb-remark p {
|
|
24
|
+
margin: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
div.wxrb-logo {
|
|
28
|
+
float: right;
|
|
29
|
+
padding-top: 12px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
div.wxrb-logo img {
|
|
33
|
+
vertical-align: middle;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
div.wxrb-logo span.wxrb-name {
|
|
37
|
+
font-size: large;
|
|
38
|
+
font-weight: bold;
|
|
39
|
+
margin-left: 10px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
div.wxrb-logo span.wxrb-name a {
|
|
43
|
+
color: black;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
div.wxrb-logo span.wxrb-version {
|
|
47
|
+
font-size: medium;
|
|
48
|
+
font-weight: normal;
|
|
49
|
+
margin-right: 15px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
div.wxrb-logo span.wxrb-wxver {
|
|
53
|
+
font-size: 0.9em;
|
|
54
|
+
font-weight: normal;
|
|
55
|
+
margin-right: 15px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
div.wxrb-logo table {
|
|
59
|
+
display: inline;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
div.wxrb-logo table td {
|
|
63
|
+
margin: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.discussion div.note {
|
|
67
|
+
background: #f7f7f9;
|
|
68
|
+
border-left: .6em solid #f3ba6f;
|
|
69
|
+
margin: 14px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.tags span.wxrb-require {
|
|
73
|
+
border-radius: 5px;
|
|
74
|
+
border: 1px solid #E1E1E8;
|
|
75
|
+
padding: 0px 3px 0px 3px;
|
|
76
|
+
background: #f3ba6f;
|
|
77
|
+
font-weight: bold;
|
|
78
|
+
font-size: 0.9em;
|
|
7
79
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
|
+
<meta charset="<%= charset %>" />
|
|
6
|
+
<% stylesheets_full_list.each do |stylesheet| %>
|
|
7
|
+
<link rel="stylesheet" href="<%= mtime_url(stylesheet) %>" type="text/css" media="screen" />
|
|
8
|
+
<% end %>
|
|
9
|
+
|
|
10
|
+
<% javascripts_full_list.each do |javascript| %>
|
|
11
|
+
<script type="text/javascript" charset="utf-8" src="<%= mtime_url(javascript) %>"></script>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<title><%= @list_title %></title>
|
|
15
|
+
<base id="base_target" target="_parent" />
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<div id="content">
|
|
19
|
+
<div class="fixed_header">
|
|
20
|
+
<%= logo_and_version %>
|
|
21
|
+
<h1 id="full_list_header"><%= @list_title %></h1>
|
|
22
|
+
<div id="full_list_nav">
|
|
23
|
+
<% menu_lists.each do |list| %>
|
|
24
|
+
<span><a target="_self" href="<%= url_for_list list[:type] %>">
|
|
25
|
+
<%= list[:title] %>
|
|
26
|
+
</a></span>
|
|
27
|
+
<% end %>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div id="search">Search: <input type="text" /></div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<ul id="full_list" class="<%= @list_class || @list_type %>">
|
|
34
|
+
<%= erb "full_list_#{@list_type}" %>
|
|
35
|
+
</ul>
|
|
36
|
+
</div>
|
|
37
|
+
</body>
|
|
38
|
+
</html>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
def init
|
|
4
|
+
# It seems YARD messes things up so that a number of classes are not properly
|
|
5
|
+
# registered in their enclosing namespaces.
|
|
6
|
+
# This hack makes sure that if that is the case we fix that here.
|
|
7
|
+
all_classes = Registry.all(:class)
|
|
8
|
+
all_classes.each do |c|
|
|
9
|
+
if (ns = c.namespace)
|
|
10
|
+
unless ns.children.any? { |nsc| nsc.path == c.path }
|
|
11
|
+
ns.children << c # class missing from child list of enclosing namespace -> add here
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
if (ns = Registry[c.namespace.path])
|
|
15
|
+
unless ns.children.any? { |nsc| nsc.path == c.path }
|
|
16
|
+
ns.children << c # class missing from child list of enclosing namespace -> add here
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
super
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def stylesheets_full_list
|
|
24
|
+
super + %w(css/wxruby3.css)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def logo_and_version
|
|
28
|
+
wxver = Registry['Wx::WXRUBY_VERSION']
|
|
29
|
+
wxwver = Registry['Wx::WXWIDGETS_VERSION']
|
|
30
|
+
<<~__HTML
|
|
31
|
+
<div class='wxrb-logo'>
|
|
32
|
+
<img src='assets/logo.png' height='38'/>
|
|
33
|
+
<table><tbody>
|
|
34
|
+
<tr><td><span class='wxrb-name'><a href="https://github.com/mcorino/wxRuby3">wxRuby3</a></span></td><td><span class='wxrb-version'>Version: #{::Kernel.eval(wxver.value)}</span></td></tr>
|
|
35
|
+
<tr><td></td><td><span class="wxrb-wxver">(wxWidgets: #{::Kernel.eval(wxwver.value)})</span></td></tr>
|
|
36
|
+
</tbody></table>
|
|
37
|
+
</div>
|
|
38
|
+
__HTML
|
|
39
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
def wxrb_require
|
|
4
|
+
erb('wxrb_require')
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def wxruby_requires
|
|
8
|
+
object.tags(:wxrb_require).inject([]) do |list, tag|
|
|
9
|
+
tag.text.split(',').each do |feature|
|
|
10
|
+
list << feature.split('|').collect do |s|
|
|
11
|
+
s.split('&').collect { |ss| %Q[<span class="wxrb-require">#{ss.strip}</span>] }.join('&')
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
list
|
|
15
|
+
end
|
|
16
|
+
end
|
data/samples/text/richtext.rb
CHANGED
|
@@ -1432,36 +1432,6 @@ class MyFrame < Wx::Frame
|
|
|
1432
1432
|
|
|
1433
1433
|
end
|
|
1434
1434
|
|
|
1435
|
-
# Forward command events to the current rich text control, if any
|
|
1436
|
-
def try_before(event)
|
|
1437
|
-
if event.is_command_event && !event.is_a?(Wx::ChildFocusEvent)
|
|
1438
|
-
# Problem: we can get infinite recursion because the events
|
|
1439
|
-
# climb back up to this frame, and repeat.
|
|
1440
|
-
# Assume that command events don't cause another command event
|
|
1441
|
-
# to be called, so we can rely on inCommand not being overwritten
|
|
1442
|
-
|
|
1443
|
-
if MyFrame.win_id != event.id && MyFrame.event_type != event.event_type
|
|
1444
|
-
MyFrame.event_type = event.event_type
|
|
1445
|
-
MyFrame.win_id = event.id
|
|
1446
|
-
focusWin = Wx.find_focus_descendant(self)
|
|
1447
|
-
focusWin = @richTextCtrl unless focusWin
|
|
1448
|
-
|
|
1449
|
-
if focusWin && focusWin.get_event_handler.process_event(event)
|
|
1450
|
-
MyFrame.event_type = 0
|
|
1451
|
-
MyFrame.win_id = 0
|
|
1452
|
-
return true
|
|
1453
|
-
end
|
|
1454
|
-
|
|
1455
|
-
MyFrame.event_type = 0
|
|
1456
|
-
MyFrame.win_id = 0
|
|
1457
|
-
else
|
|
1458
|
-
return false
|
|
1459
|
-
end
|
|
1460
|
-
end
|
|
1461
|
-
|
|
1462
|
-
false
|
|
1463
|
-
end
|
|
1464
|
-
|
|
1465
1435
|
# Write text
|
|
1466
1436
|
def write_initial_text
|
|
1467
1437
|
r = @richTextCtrl
|
|
Binary file
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
|
2
|
+
#
|
|
3
|
+
# This software is released under the MIT license.
|
|
4
|
+
|
|
5
|
+
require 'test/unit'
|
|
6
|
+
require 'wx'
|
|
7
|
+
|
|
8
|
+
class TestApp < Test::Unit::TestCase
|
|
9
|
+
|
|
10
|
+
class TestFrame < Wx::Frame
|
|
11
|
+
def initialize
|
|
12
|
+
super(nil, -1, '')
|
|
13
|
+
evt_paint { on_paint }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def on_paint
|
|
17
|
+
paint {}
|
|
18
|
+
close
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class TestApp < Wx::App
|
|
23
|
+
def on_init
|
|
24
|
+
TestFrame.new.show
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def on_exit
|
|
28
|
+
raise RuntimeError, 'on_exit exception'
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_self_closing_frame
|
|
33
|
+
assert_raise_kind_of(RuntimeError) { TestApp.run }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
|
2
|
+
#
|
|
3
|
+
# This software is released under the MIT license.
|
|
4
|
+
|
|
5
|
+
require 'test/unit'
|
|
6
|
+
require 'wx'
|
|
7
|
+
|
|
8
|
+
class AppInitExitExceptions < Test::Unit::TestCase
|
|
9
|
+
|
|
10
|
+
class TestApp < Wx::App
|
|
11
|
+
def on_init
|
|
12
|
+
raise RuntimeError, 'on_init exception'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_on_init_exception
|
|
17
|
+
assert_raise_kind_of(RuntimeError) { TestApp.run }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
|
2
|
+
#
|
|
3
|
+
# This software is released under the MIT license.
|
|
4
|
+
|
|
5
|
+
require_relative './lib/wxframe_runner'
|
|
6
|
+
|
|
7
|
+
class BookCtrlTests < WxRuby::Test::GUITests
|
|
8
|
+
|
|
9
|
+
def setup
|
|
10
|
+
super
|
|
11
|
+
@book = Wx::Choicebook.new(frame_win, name: 'ChoiceBook')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def cleanup
|
|
15
|
+
@book.destroy
|
|
16
|
+
super
|
|
17
|
+
GC.start
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
attr_reader :book
|
|
21
|
+
|
|
22
|
+
def test_control_sizer
|
|
23
|
+
btn = Wx::Button.new(book, Wx::ID_ANY, 'First')
|
|
24
|
+
# issue #199 : returning the control sizer should not cause it to be owned by Ruby
|
|
25
|
+
# because that would cause double deletes
|
|
26
|
+
book.get_control_sizer.add(btn, Wx::SizerFlags.new.expand.border(Wx::ALL))
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
|
2
|
+
#
|
|
3
|
+
# This software is released under the MIT license.
|
|
4
|
+
|
|
5
|
+
require_relative './lib/wxframe_runner'
|
|
6
|
+
|
|
7
|
+
class DirectorExceptionTests < WxRuby::Test::GUITests
|
|
8
|
+
|
|
9
|
+
class InvalidOutputSizer < Wx::BoxSizer
|
|
10
|
+
|
|
11
|
+
def calc_min
|
|
12
|
+
Wx::Point.new(1,1) # expects Wx::Size
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_invalid_output
|
|
18
|
+
szr = InvalidOutputSizer.new(Wx::Orientation::VERTICAL)
|
|
19
|
+
szr.add(Wx::Button.new(frame_win, name: 'button'), Wx::Direction::TOP)
|
|
20
|
+
frame_win.sizer = szr
|
|
21
|
+
assert_raise_kind_of(TypeError) { frame_win.layout }
|
|
22
|
+
frame_win.sizer = nil
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class ExceptionSizer < Wx::BoxSizer
|
|
26
|
+
|
|
27
|
+
def calc_min
|
|
28
|
+
raise RuntimeError, 'AnyThing'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_exception_in_overload
|
|
34
|
+
szr = ExceptionSizer.new(Wx::Orientation::VERTICAL)
|
|
35
|
+
szr.add(Wx::Button.new(frame_win, name: 'button'), Wx::Direction::TOP)
|
|
36
|
+
frame_win.sizer = szr
|
|
37
|
+
assert_raise_kind_of(RuntimeError) { frame_win.layout }
|
|
38
|
+
frame_win.sizer = nil
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
data/tests/test_list_ctrl.rb
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
|
|
2
|
+
#
|
|
3
|
+
# This software is released under the MIT license.
|
|
4
|
+
|
|
5
|
+
require_relative './lib/wxframe_runner'
|
|
6
|
+
|
|
7
|
+
# test seems to deadlock for WXGTK
|
|
8
|
+
if Wx.has_feature?(:USE_MEDIACTRL)
|
|
9
|
+
|
|
10
|
+
require 'uri'
|
|
11
|
+
|
|
12
|
+
class MediaCtrlTests < WxRuby::Test::GUITests
|
|
13
|
+
|
|
14
|
+
def setup
|
|
15
|
+
super
|
|
16
|
+
@media = Wx::MediaCtrl.new(frame_win)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def cleanup
|
|
20
|
+
@media.destroy
|
|
21
|
+
super
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
attr_reader :media
|
|
25
|
+
|
|
26
|
+
def test_uri
|
|
27
|
+
# just checking if Ruby URI is properly mapped
|
|
28
|
+
# it doesn't seem the mediactrl returns a very consistent result whether the resource is not a media file
|
|
29
|
+
# or if it is a non-existing file so only check whether it is a boolean return.
|
|
30
|
+
uri = URI("file://#{File.join(__dir__, 'media/beep_lo.wav')}")
|
|
31
|
+
assert_boolean(media.load(uri))
|
|
32
|
+
uri = URI("file://#{File.join(__dir__, 'art/test_art/image/wxruby.png')}")
|
|
33
|
+
assert_boolean(media.load(uri))
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|