wxruby3 0.9.0.pre.beta.14-x64-mingw-ucrt → 0.9.0.pre.rc.1-x64-mingw-ucrt
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/wxbase32u_gcc_custom.dll +0 -0
- data/ext/wxbase32u_net_gcc_custom.dll +0 -0
- data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
- 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/events/evt_list.rb +12 -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/gen/about_dialog_info.rb +27 -24
- data/lib/wx/doc/gen/accelerator.rb +11 -12
- data/lib/wx/doc/gen/app.rb +6 -3
- data/lib/wx/doc/gen/art_provider.rb +53 -29
- data/lib/wx/doc/gen/aui/aui_manager.rb +4 -0
- data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +1 -1
- data/lib/wx/doc/gen/aui/aui_pane_info.rb +2 -0
- data/lib/wx/doc/gen/aui/aui_tab_ctrl.rb +2 -0
- data/lib/wx/doc/gen/bitmap.rb +25 -25
- data/lib/wx/doc/gen/bitmap_combo_box.rb +157 -0
- data/lib/wx/doc/gen/box_sizer.rb +6 -8
- data/lib/wx/doc/gen/brush.rb +2 -0
- data/lib/wx/doc/gen/busy_info.rb +52 -46
- data/lib/wx/doc/gen/caret.rb +0 -4
- data/lib/wx/doc/gen/check_list_box.rb +0 -2
- data/lib/wx/doc/gen/choice.rb +1 -5
- data/lib/wx/doc/gen/client_dc.rb +13 -18
- data/lib/wx/doc/gen/clipboard.rb +30 -27
- data/lib/wx/doc/gen/collapsible_pane.rb +11 -9
- data/lib/wx/doc/gen/colour.rb +6 -3
- data/lib/wx/doc/gen/colour_dialog.rb +111 -23
- data/lib/wx/doc/gen/combo_box.rb +2 -4
- data/lib/wx/doc/gen/control.rb +20 -18
- data/lib/wx/doc/gen/core.rb +2 -2
- data/lib/wx/doc/gen/cursor.rb +18 -50
- data/lib/wx/doc/gen/data_format.rb +0 -2
- data/lib/wx/doc/gen/data_object.rb +37 -44
- data/lib/wx/doc/gen/dc.rb +16 -24
- data/lib/wx/doc/gen/defs.rb +3 -40
- data/lib/wx/doc/gen/dialog.rb +21 -17
- data/lib/wx/doc/gen/dir_dialog.rb +10 -8
- data/lib/wx/doc/gen/event.rb +2 -2
- data/lib/wx/doc/gen/event_blocker.rb +49 -0
- data/lib/wx/doc/gen/event_filter.rb +95 -0
- data/lib/wx/doc/gen/event_list.rb +16 -2
- data/lib/wx/doc/gen/events.rb +103 -112
- data/lib/wx/doc/gen/evt_handler.rb +28 -52
- data/lib/wx/doc/gen/file_dialog.rb +8 -4
- data/lib/wx/doc/gen/find_replace_dialog.rb +1 -1
- data/lib/wx/doc/gen/font.rb +10 -2
- data/lib/wx/doc/gen/font_data.rb +2 -0
- data/lib/wx/doc/gen/font_dialog.rb +1 -1
- data/lib/wx/doc/gen/frame.rb +4 -3
- data/lib/wx/doc/gen/fs_file.rb +8 -0
- data/lib/wx/doc/gen/gcdc.rb +2 -22
- data/lib/wx/doc/gen/gdi_common.rb +18 -2
- data/lib/wx/doc/gen/gdi_object.rb +2 -0
- data/lib/wx/doc/gen/graphics_context.rb +4 -43
- data/lib/wx/doc/gen/graphics_object.rb +2 -0
- data/lib/wx/doc/gen/grid/grid_cell_attr.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_ctrl.rb +4 -2
- data/lib/wx/doc/gen/grid/grid_table_message.rb +2 -0
- data/lib/wx/doc/gen/grid_bag_sizer.rb +4 -0
- data/lib/wx/doc/gen/help_controller.rb +4 -1
- data/lib/wx/doc/gen/html/html_cell.rb +4 -1
- data/lib/wx/doc/gen/html/html_help_controller.rb +4 -1
- data/lib/wx/doc/gen/html/html_help_data.rb +4 -0
- data/lib/wx/doc/gen/html/html_help_window.rb +2 -1
- data/lib/wx/doc/gen/html/html_list_box.rb +138 -11
- data/lib/wx/doc/gen/html/html_window.rb +9 -3
- data/lib/wx/doc/gen/icon.rb +7 -1
- data/lib/wx/doc/gen/icon_location.rb +2 -0
- data/lib/wx/doc/gen/image.rb +15 -8
- data/lib/wx/doc/gen/keyboard_state.rb +6 -0
- data/lib/wx/doc/gen/list_box.rb +0 -11
- data/lib/wx/doc/gen/list_ctrl.rb +10 -13
- data/lib/wx/doc/gen/locale.rb +7 -3
- data/lib/wx/doc/gen/log.rb +6 -2
- data/lib/wx/doc/gen/mdi_frame.rb +2 -0
- data/lib/wx/doc/gen/media_ctrl.rb +2 -0
- data/lib/wx/doc/gen/memory_dc.rb +105 -18
- data/lib/wx/doc/gen/menu.rb +4 -2
- data/lib/wx/doc/gen/menu_bar.rb +0 -2
- data/lib/wx/doc/gen/menu_item.rb +9 -3
- data/lib/wx/doc/gen/message_dialog.rb +6 -3
- data/lib/wx/doc/gen/mirror_dc.rb +2 -8
- data/lib/wx/doc/gen/mouse_state.rb +2 -0
- data/lib/wx/doc/gen/multi_choice_dialog.rb +0 -2
- data/lib/wx/doc/gen/non_owned_window.rb +2 -1
- data/lib/wx/doc/gen/notebook.rb +4 -2
- data/lib/wx/doc/gen/paint_dc.rb +2 -6
- data/lib/wx/doc/gen/palette.rb +3 -3
- data/lib/wx/doc/gen/pen.rb +6 -1
- data/lib/wx/doc/gen/pg/pg_editor.rb +2 -1
- data/lib/wx/doc/gen/pg/pg_multi_button.rb +4 -0
- data/lib/wx/doc/gen/pg/pg_properties.rb +30 -3
- data/lib/wx/doc/gen/pg/pg_property.rb +30 -4
- data/lib/wx/doc/gen/pg/pg_validation_info.rb +2 -0
- data/lib/wx/doc/gen/pg/property_grid.rb +5 -2
- data/lib/wx/doc/gen/pg/property_grid_interface.rb +6 -2
- data/lib/wx/doc/gen/pg/property_grid_manager.rb +2 -0
- data/lib/wx/doc/gen/pg/property_grid_page_state.rb +2 -0
- data/lib/wx/doc/gen/picker_base.rb +2 -1
- data/lib/wx/doc/gen/platform_info.rb +4 -1
- data/lib/wx/doc/gen/property_sheet_dialog.rb +2 -0
- data/lib/wx/doc/gen/prt/post_script_dc.rb +2 -8
- data/lib/wx/doc/gen/prt/print_data.rb +6 -0
- data/lib/wx/doc/gen/prt/printer.rb +0 -3
- data/lib/wx/doc/gen/prt/printer_dc.rb +2 -6
- data/lib/wx/doc/gen/radio_box.rb +2 -2
- data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +6 -0
- data/lib/wx/doc/gen/rbn/ribbon_panel.rb +1 -1
- data/lib/wx/doc/gen/region.rb +2 -0
- data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +6 -0
- data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +0 -4
- data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +2 -0
- data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +2 -1
- data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +2 -0
- data/lib/wx/doc/gen/screen_dc.rb +2 -0
- data/lib/wx/doc/gen/scroll_bar.rb +2 -1
- data/lib/wx/doc/gen/scrolled_canvas.rb +4 -8
- data/lib/wx/doc/gen/scrolled_control.rb +4 -8
- data/lib/wx/doc/gen/scrolled_window.rb +4 -8
- data/lib/wx/doc/gen/search_ctrl.rb +131 -0
- data/lib/wx/doc/gen/single_choice_dialog.rb +0 -2
- data/lib/wx/doc/gen/sizer.rb +14 -3
- data/lib/wx/doc/gen/splash_screen.rb +2 -0
- data/lib/wx/doc/gen/static_box.rb +6 -3
- data/lib/wx/doc/gen/static_box_sizer.rb +2 -1
- data/lib/wx/doc/gen/status_bar.rb +0 -5
- data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +4 -5
- data/lib/wx/doc/gen/svg_file_dc.rb +10 -11
- data/lib/wx/doc/gen/text_ctrl.rb +10 -3
- data/lib/wx/doc/gen/text_entry.rb +8 -3
- data/lib/wx/doc/gen/text_entry_dialog.rb +4 -2
- data/lib/wx/doc/gen/timer_event.rb +2 -0
- data/lib/wx/doc/gen/tool_bar.rb +8 -4
- data/lib/wx/doc/gen/top_level_window.rb +5 -2
- data/lib/wx/doc/gen/tree_ctrl.rb +0 -6
- data/lib/wx/doc/gen/ui_action_simulator.rb +100 -0
- data/lib/wx/doc/gen/utils.rb +1 -1
- data/lib/wx/doc/gen/v_list_box.rb +36 -26
- data/lib/wx/doc/gen/validator.rb +2 -1
- data/lib/wx/doc/gen/variant.rb +10 -0
- data/lib/wx/doc/gen/window.rb +38 -17
- data/lib/wx/doc/gen/window_dc.rb +2 -0
- data/lib/wx/doc/gen/window_disabler.rb +2 -0
- data/lib/wx/doc/gen/wizard_page_simple.rb +2 -0
- data/lib/wx/doc/gen/xml_node.rb +6 -0
- data/lib/wx/doc/gen/xml_resource.rb +4 -1
- 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/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/lib/wxruby_aui.so +0 -0
- data/lib/wxruby_core.so +0 -0
- data/lib/wxruby_grid.so +0 -0
- data/lib/wxruby_html.so +0 -0
- data/lib/wxruby_pg.so +0 -0
- data/lib/wxruby_prt.so +0 -0
- data/lib/wxruby_rbn.so +0 -0
- data/lib/wxruby_rtc.so +0 -0
- data/lib/wxruby_stc.so +0 -0
- data/rakelib/install.rb +3 -1
- 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 +38 -8
- data/lib/wx/doc/gen/auto_buffered_paint_dc.rb +0 -47
- data/lib/wx/doc/gen/buffered_dc.rb +0 -95
- data/lib/wx/doc/gen/buffered_paint_dc.rb +0 -55
- data/lib/wx/doc/gen/colour_data.rb +0 -96
- data/samples/drawing/tn_svgtest.png +0 -0
@@ -1384,29 +1384,31 @@ class FormMain < Wx::Frame
|
|
1384
1384
|
Wx::PG::PG_LABEL,
|
1385
1385
|
"Test Text"))
|
1386
1386
|
myTestBitmap1x = Wx::Bitmap.new(60, 15, 32)
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1387
|
+
Wx::MemoryDC.draw_on(myTestBitmap1x) do |mdc|
|
1388
|
+
mdc.set_background(Wx::WHITE_BRUSH)
|
1389
|
+
mdc.clear
|
1390
|
+
mdc.set_pen(Wx::BLACK_PEN)
|
1391
|
+
mdc.set_brush(Wx::WHITE_BRUSH)
|
1392
|
+
mdc.draw_rectangle(0, 0, 60, 15)
|
1393
|
+
mdc.draw_line(0, 0, 59, 14)
|
1394
|
+
mdc.set_text_foreground(Wx::BLACK)
|
1395
|
+
mdc.draw_text("x1", 0, 0)
|
1396
|
+
end
|
1396
1397
|
|
1397
1398
|
myTestBitmap2x = Wx::Bitmap.new(120, 30, 32)
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1399
|
+
Wx::MemoryDC.draw_on(myTestBitmap2x) do |mdc|
|
1400
|
+
mdc.set_background(Wx::WHITE_BRUSH)
|
1401
|
+
mdc.clear
|
1402
|
+
mdc.set_pen(Wx::Pen.new(Wx::BLUE, 2))
|
1403
|
+
mdc.set_brush(Wx::WHITE_BRUSH)
|
1404
|
+
mdc.draw_rectangle(0, 0, 120, 30)
|
1405
|
+
mdc.draw_line(0, 0, 119, 31)
|
1406
|
+
mdc.set_text_foreground(Wx::BLUE)
|
1407
|
+
f = mdc.font
|
1408
|
+
f.set_pixel_size(f.get_pixel_size * 2)
|
1409
|
+
mdc.set_font(f)
|
1410
|
+
mdc.draw_text("x2", 0, 0)
|
1411
|
+
end
|
1410
1412
|
|
1411
1413
|
myTestBitmap2x.set_scale_factor(2)
|
1412
1414
|
pg.set_property_image("StringPropertyWithBitmap", Wx::BitmapBundle.from_bitmaps(myTestBitmap1x, myTestBitmap2x))
|
data/samples/ribbon/ribbon.rb
CHANGED
@@ -153,9 +153,7 @@ class MyFrame < Wx::Frame
|
|
153
153
|
sizer_panelsizer_h.add(sizer_panelsizer_v, 0)
|
154
154
|
sizer_panel.set_sizer(sizer_panelsizer_h)
|
155
155
|
|
156
|
-
label_font = Wx::Font.new(Wx::FontInfo.new(8).light)
|
157
|
-
@bitmap_creation_dc = Wx::MemoryDC.new
|
158
|
-
@bitmap_creation_dc.set_font(label_font)
|
156
|
+
@label_font = Wx::Font.new(Wx::FontInfo.new(8).light)
|
159
157
|
|
160
158
|
scheme = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Appearance", bitmap_(:eye_xpm))
|
161
159
|
@default_primary = Wx::Colour.new
|
@@ -507,9 +505,10 @@ class MyFrame < Wx::Frame
|
|
507
505
|
|
508
506
|
# Colour not in gallery - add it
|
509
507
|
unless item
|
510
|
-
|
511
|
-
|
512
|
-
|
508
|
+
Wx::MemoryDC.draw_on do |dc|
|
509
|
+
item = add_colour_to_gallery(gallery,
|
510
|
+
clr.get_as_string(Wx::C2S_HTML_SYNTAX), dc, clr)
|
511
|
+
end
|
513
512
|
gallery.realise
|
514
513
|
end
|
515
514
|
|
@@ -738,46 +737,47 @@ class MyFrame < Wx::Frame
|
|
738
737
|
else
|
739
738
|
gallery = Wx::RBN::RibbonGallery.new(panel, gallery_id)
|
740
739
|
end
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
740
|
+
Wx::MemoryDC.draw_on do |dc|
|
741
|
+
def_item = add_colour_to_gallery(gallery, "Default", dc, defclr)
|
742
|
+
gallery.set_selection(def_item)
|
743
|
+
add_colour_to_gallery(gallery, "BLUE", dc)
|
744
|
+
add_colour_to_gallery(gallery, "BLUE VIOLET", dc)
|
745
|
+
add_colour_to_gallery(gallery, "BROWN", dc)
|
746
|
+
add_colour_to_gallery(gallery, "CADET BLUE", dc)
|
747
|
+
add_colour_to_gallery(gallery, "CORAL", dc)
|
748
|
+
add_colour_to_gallery(gallery, "CYAN", dc)
|
749
|
+
add_colour_to_gallery(gallery, "DARK GREEN", dc)
|
750
|
+
add_colour_to_gallery(gallery, "DARK ORCHID", dc)
|
751
|
+
add_colour_to_gallery(gallery, "FIREBRICK", dc)
|
752
|
+
add_colour_to_gallery(gallery, "GOLD", dc)
|
753
|
+
add_colour_to_gallery(gallery, "GOLDENROD", dc)
|
754
|
+
add_colour_to_gallery(gallery, "GREEN", dc)
|
755
|
+
add_colour_to_gallery(gallery, "INDIAN RED", dc)
|
756
|
+
add_colour_to_gallery(gallery, "KHAKI", dc)
|
757
|
+
add_colour_to_gallery(gallery, "LIGHT BLUE", dc)
|
758
|
+
add_colour_to_gallery(gallery, "LIME GREEN", dc)
|
759
|
+
add_colour_to_gallery(gallery, "MAGENTA", dc)
|
760
|
+
add_colour_to_gallery(gallery, "MAROON", dc)
|
761
|
+
add_colour_to_gallery(gallery, "NAVY", dc)
|
762
|
+
add_colour_to_gallery(gallery, "ORANGE", dc)
|
763
|
+
add_colour_to_gallery(gallery, "ORCHID", dc)
|
764
|
+
add_colour_to_gallery(gallery, "PINK", dc)
|
765
|
+
add_colour_to_gallery(gallery, "PLUM", dc)
|
766
|
+
add_colour_to_gallery(gallery, "PURPLE", dc)
|
767
|
+
add_colour_to_gallery(gallery, "RED", dc)
|
768
|
+
add_colour_to_gallery(gallery, "SALMON", dc)
|
769
|
+
add_colour_to_gallery(gallery, "SEA GREEN", dc)
|
770
|
+
add_colour_to_gallery(gallery, "SIENNA", dc)
|
771
|
+
add_colour_to_gallery(gallery, "SKY BLUE", dc)
|
772
|
+
add_colour_to_gallery(gallery, "TAN", dc)
|
773
|
+
add_colour_to_gallery(gallery, "THISTLE", dc)
|
774
|
+
add_colour_to_gallery(gallery, "TURQUOISE", dc)
|
775
|
+
add_colour_to_gallery(gallery, "VIOLET", dc)
|
776
|
+
add_colour_to_gallery(gallery, "VIOLET RED", dc)
|
777
|
+
add_colour_to_gallery(gallery, "WHEAT", dc)
|
778
|
+
add_colour_to_gallery(gallery, "WHITE", dc)
|
779
|
+
add_colour_to_gallery(gallery, "YELLOW", dc)
|
780
|
+
end
|
781
781
|
|
782
782
|
gallery
|
783
783
|
end
|
@@ -802,6 +802,7 @@ class MyFrame < Wx::Frame
|
|
802
802
|
|
803
803
|
bitmap = Wx::Bitmap.new(iWidth, iHeight)
|
804
804
|
dc.select_object(bitmap)
|
805
|
+
dc.set_font(@label_font)
|
805
806
|
b = Wx::Brush.new (c)
|
806
807
|
dc.set_pen(Wx::BLACK_PEN)
|
807
808
|
dc.set_brush(b)
|
data/tests/lib/wxapp_runner.rb
CHANGED
@@ -3,7 +3,7 @@ require 'test/unit'
|
|
3
3
|
require 'test/unit/ui/console/testrunner'
|
4
4
|
require 'wx'
|
5
5
|
|
6
|
-
module
|
6
|
+
module WxRuby
|
7
7
|
|
8
8
|
module Test
|
9
9
|
|
@@ -33,7 +33,7 @@ module Wx::SF
|
|
33
33
|
|
34
34
|
org_start_mtd = instance_method :start
|
35
35
|
define_method :start do
|
36
|
-
(app =
|
36
|
+
(app = WxRuby::Test::App.new(self, org_start_mtd)).run
|
37
37
|
app.result
|
38
38
|
end
|
39
39
|
|
@@ -46,7 +46,7 @@ end
|
|
46
46
|
module Test
|
47
47
|
module Unit
|
48
48
|
AutoRunner.register_runner(:wxapp) do |auto_runner|
|
49
|
-
|
49
|
+
WxRuby::Test::Runner
|
50
50
|
end
|
51
51
|
AutoRunner.default_runner = :wxapp
|
52
52
|
if defined? ::IntelliJ
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
require_relative './wxapp_runner'
|
3
|
+
|
4
|
+
module WxRuby
|
5
|
+
|
6
|
+
module Test
|
7
|
+
|
8
|
+
class App < Wx::App
|
9
|
+
def on_init
|
10
|
+
@tests_have_run = false
|
11
|
+
evt_idle :on_idle
|
12
|
+
@frame = Wx::Frame.new(nil, size: [600,400])
|
13
|
+
@frame.show
|
14
|
+
end
|
15
|
+
|
16
|
+
def on_idle(_evt)
|
17
|
+
done = @tests_have_run
|
18
|
+
@tests_have_run = true
|
19
|
+
@result = @start_mtd.bind(@test_runner).call unless done
|
20
|
+
self.exit_main_loop
|
21
|
+
end
|
22
|
+
|
23
|
+
attr_reader :frame
|
24
|
+
end
|
25
|
+
|
26
|
+
class GUITests < ::Test::Unit::TestCase
|
27
|
+
|
28
|
+
def test_frame
|
29
|
+
Wx.get_app.frame
|
30
|
+
end
|
31
|
+
|
32
|
+
class EventCounter
|
33
|
+
def initialize
|
34
|
+
@count = 0
|
35
|
+
end
|
36
|
+
attr_accessor :count
|
37
|
+
|
38
|
+
def inc
|
39
|
+
@count +=1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def count_events(win, evt, id1=Wx::ID_ANY, id2=nil)
|
44
|
+
return 0 unless block_given?
|
45
|
+
evt_count = EventCounter.new
|
46
|
+
if id2.nil?
|
47
|
+
win.event_handler.send(evt.to_sym, id1, ->(_evt){ evt_count.inc })
|
48
|
+
else
|
49
|
+
win.event_handler.send(evt.to_sym, id1, id2, ->(_evt){ evt_count.inc })
|
50
|
+
end
|
51
|
+
yield evt_count
|
52
|
+
evt_count.count
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
|
2
|
+
require_relative './lib/wxapp_runner'
|
3
|
+
|
4
|
+
class AppEventFilterTests < Test::Unit::TestCase
|
5
|
+
|
6
|
+
class TestEvent < Wx::Event
|
7
|
+
EVT_TEST_EVENT = Wx::EvtHandler.register_class(self, nil, 'evt_test_event', 0)
|
8
|
+
def initialize(id=0)
|
9
|
+
super(EVT_TEST_EVENT, id)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class TestCmdEvent < Wx::CommandEvent
|
14
|
+
EVT_TEST_CMD_EVENT = Wx::EvtHandler.register_class(self, nil, 'evt_test_cmd_event', 0)
|
15
|
+
def initialize(id=0)
|
16
|
+
super(EVT_TEST_CMD_EVENT, id)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class TestFrame < Wx::Frame
|
21
|
+
def initialize
|
22
|
+
super(nil, size: [300,300])
|
23
|
+
@test_event = false
|
24
|
+
@test_cmd_event = false
|
25
|
+
|
26
|
+
evt_test_event { |evt| @test_event = true }
|
27
|
+
evt_test_cmd_event { |evt| @test_cmd_event = true }
|
28
|
+
end
|
29
|
+
|
30
|
+
attr_reader :test_event, :test_cmd_event
|
31
|
+
|
32
|
+
def reset
|
33
|
+
@test_event = false
|
34
|
+
@test_cmd_event = false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
module ::WxRuby
|
39
|
+
module Test
|
40
|
+
class App < Wx::App
|
41
|
+
def filter_event(event)
|
42
|
+
@filtered = true if event.is_a?(TestEvent)
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
def filtered
|
47
|
+
@filtered
|
48
|
+
end
|
49
|
+
|
50
|
+
def filtered=(f)
|
51
|
+
@filtered = f
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_app_event_filter
|
58
|
+
GC.start
|
59
|
+
win = TestFrame.new
|
60
|
+
win.event_handler.process_event(TestEvent.new)
|
61
|
+
GC.start
|
62
|
+
assert(Wx.get_app.filtered)
|
63
|
+
Wx.get_app.filtered = false
|
64
|
+
win.event_handler.process_event(TestCmdEvent.new)
|
65
|
+
GC.start
|
66
|
+
assert(!Wx.get_app.filtered)
|
67
|
+
assert_nothing_raised { Wx::EvtHandler.clear_filters }
|
68
|
+
GC.start
|
69
|
+
win.event_handler.process_event(TestEvent.new)
|
70
|
+
assert(Wx.get_app.filtered)
|
71
|
+
GC.start
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
|
2
|
+
require_relative './lib/wxapp_runner'
|
3
|
+
|
4
|
+
class TestArtProvider < Test::Unit::TestCase
|
5
|
+
|
6
|
+
class MyArtProvider < Wx::ArtProvider
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def is_called?
|
10
|
+
!!@called
|
11
|
+
end
|
12
|
+
def set_called(f = true)
|
13
|
+
@called = f
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_bitmap(id, client, size)
|
18
|
+
if id == Wx::ArtProvider.get_message_box_icon_id(Wx::ICON_INFORMATION)
|
19
|
+
MyArtProvider.set_called
|
20
|
+
Wx::Bitmap(:sample3)
|
21
|
+
else
|
22
|
+
MyArtProvider.set_called(false)
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_custom_provider
|
30
|
+
assert_not_nil(Wx::ArtProvider.get_message_box_icon(Wx::ICON_INFORMATION))
|
31
|
+
GC.start
|
32
|
+
assert(!MyArtProvider.is_called?)
|
33
|
+
GC.start
|
34
|
+
assert_nothing_raised { Wx::ArtProvider.push(MyArtProvider.new) }
|
35
|
+
GC.start
|
36
|
+
assert_not_nil(Wx::ArtProvider.get_message_box_icon(Wx::ICON_INFORMATION))
|
37
|
+
GC.start
|
38
|
+
assert(MyArtProvider.is_called?)
|
39
|
+
GC.start
|
40
|
+
assert_not_nil(Wx::ArtProvider.get_message_box_icon(Wx::ICON_ERROR))
|
41
|
+
GC.start
|
42
|
+
assert(!MyArtProvider.is_called?)
|
43
|
+
GC.start
|
44
|
+
assert_nothing_raised { Wx::ArtProvider.pop }
|
45
|
+
GC.start
|
46
|
+
assert_not_nil(Wx::ArtProvider.get_message_box_icon(Wx::ICON_INFORMATION))
|
47
|
+
GC.start
|
48
|
+
assert(!MyArtProvider.is_called?)
|
49
|
+
GC.start
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
data/tests/test_clipboard.rb
CHANGED
@@ -54,6 +54,7 @@ if Wx.has_feature?(:USE_HTML) && Wx::WXWIDGETS_VERSION >= '3.3'
|
|
54
54
|
Wx::Clipboard.open do | clip |
|
55
55
|
clip.fetch td_2
|
56
56
|
end
|
57
|
+
|
57
58
|
assert_equal('<html><body><h1>Header</h1></body></html>', td_2.html)
|
58
59
|
|
59
60
|
Wx::Clipboard.open do | clip |
|
@@ -64,7 +65,7 @@ if Wx.has_feature?(:USE_HTML) && Wx::WXWIDGETS_VERSION >= '3.3'
|
|
64
65
|
Wx::Clipboard.open do | clip |
|
65
66
|
clip.fetch td_3
|
66
67
|
end
|
67
|
-
assert_equal('', td_3.
|
68
|
+
assert_equal('', td_3.get_html)
|
68
69
|
end
|
69
70
|
end
|
70
71
|
end
|
@@ -41,6 +41,7 @@ class EventHandlingTests < Test::Unit::TestCase
|
|
41
41
|
@child = Child.new(self)
|
42
42
|
@test_event = false
|
43
43
|
@test_cmd_event = false
|
44
|
+
@called_after = false
|
44
45
|
|
45
46
|
evt_test_event { |evt| @test_event = true }
|
46
47
|
evt_test_cmd_event { |evt| @test_cmd_event = true }
|
@@ -48,45 +49,227 @@ class EventHandlingTests < Test::Unit::TestCase
|
|
48
49
|
|
49
50
|
attr_reader :child
|
50
51
|
attr_reader :test_event, :test_cmd_event
|
52
|
+
attr_accessor :called_after
|
51
53
|
|
52
54
|
def reset
|
53
55
|
@test_event = false
|
54
56
|
@test_cmd_event = false
|
57
|
+
@called_after = false
|
55
58
|
child.reset
|
56
59
|
end
|
57
60
|
end
|
58
61
|
|
59
62
|
def test_event
|
60
63
|
win = TestFrame.new
|
61
|
-
|
62
|
-
|
64
|
+
assert(!win.test_event)
|
65
|
+
assert(!win.child.test_event)
|
63
66
|
win.child.event_handler.process_event(TestEvent.new)
|
64
|
-
|
65
|
-
|
67
|
+
assert(!win.test_event)
|
68
|
+
assert(win.child.test_event)
|
66
69
|
win.reset
|
67
70
|
win.child.event_handler.process_event(TestEvent.new(1))
|
68
|
-
|
69
|
-
|
71
|
+
assert(!win.test_event)
|
72
|
+
assert(win.child.test_event)
|
70
73
|
win.reset
|
71
74
|
win.event_handler.process_event(TestEvent.new)
|
72
|
-
|
73
|
-
|
75
|
+
assert(win.test_event)
|
76
|
+
assert(!win.child.test_event)
|
77
|
+
win.destroy
|
78
|
+
Wx.get_app.yield
|
74
79
|
end
|
75
80
|
|
76
81
|
def test_cmd_event
|
77
82
|
win = TestFrame.new
|
78
|
-
|
79
|
-
|
83
|
+
assert(!win.test_cmd_event)
|
84
|
+
assert(!win.child.test_cmd_event)
|
80
85
|
win.child.event_handler.process_event(TestCmdEvent.new)
|
81
|
-
|
82
|
-
|
86
|
+
assert(!win.test_cmd_event)
|
87
|
+
assert(win.child.test_cmd_event)
|
83
88
|
win.reset
|
84
89
|
win.child.event_handler.process_event(TestCmdEvent.new(1))
|
85
|
-
|
86
|
-
|
90
|
+
assert(win.test_cmd_event)
|
91
|
+
assert(win.child.test_cmd_event)
|
87
92
|
win.reset
|
88
93
|
win.event_handler.process_event(TestCmdEvent.new)
|
89
|
-
|
90
|
-
|
94
|
+
assert(win.test_cmd_event)
|
95
|
+
assert(!win.child.test_cmd_event)
|
96
|
+
win.destroy
|
97
|
+
Wx.get_app.yield
|
91
98
|
end
|
99
|
+
|
100
|
+
def test_queue_event
|
101
|
+
win = TestFrame.new
|
102
|
+
assert(!win.test_cmd_event)
|
103
|
+
assert(!win.child.test_cmd_event)
|
104
|
+
win.child.event_handler.queue_event(TestCmdEvent.new)
|
105
|
+
Wx.get_app.yield
|
106
|
+
assert(!win.test_cmd_event)
|
107
|
+
assert(win.child.test_cmd_event)
|
108
|
+
win.reset
|
109
|
+
win.child.event_handler.queue_event(TestCmdEvent.new(1))
|
110
|
+
Wx.get_app.yield
|
111
|
+
assert(win.test_cmd_event)
|
112
|
+
assert(win.child.test_cmd_event)
|
113
|
+
win.reset
|
114
|
+
win.event_handler.queue_event(TestCmdEvent.new)
|
115
|
+
Wx.get_app.yield
|
116
|
+
assert(win.test_cmd_event)
|
117
|
+
assert(!win.child.test_cmd_event)
|
118
|
+
win.destroy
|
119
|
+
Wx.get_app.yield
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_pending_event
|
123
|
+
win = TestFrame.new
|
124
|
+
assert(!win.test_cmd_event)
|
125
|
+
assert(!win.child.test_cmd_event)
|
126
|
+
win.child.event_handler.add_pending_event(TestCmdEvent.new)
|
127
|
+
Wx.get_app.yield
|
128
|
+
assert(!win.test_cmd_event)
|
129
|
+
assert(win.child.test_cmd_event)
|
130
|
+
win.reset
|
131
|
+
win.child.event_handler.add_pending_event(TestCmdEvent.new(1))
|
132
|
+
Wx.get_app.yield
|
133
|
+
assert(win.test_cmd_event)
|
134
|
+
assert(win.child.test_cmd_event)
|
135
|
+
win.reset
|
136
|
+
win.event_handler.add_pending_event(TestCmdEvent.new)
|
137
|
+
Wx.get_app.yield
|
138
|
+
assert(win.test_cmd_event)
|
139
|
+
assert(!win.child.test_cmd_event)
|
140
|
+
win.destroy
|
141
|
+
Wx.get_app.yield
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_post_event
|
145
|
+
win = TestFrame.new
|
146
|
+
assert(!win.test_cmd_event)
|
147
|
+
assert(!win.child.test_cmd_event)
|
148
|
+
Wx.post_event(win.child.event_handler, TestCmdEvent.new)
|
149
|
+
Wx.get_app.yield
|
150
|
+
assert(!win.test_cmd_event)
|
151
|
+
assert(win.child.test_cmd_event)
|
152
|
+
win.reset
|
153
|
+
Wx.post_event(win.child.event_handler, TestCmdEvent.new(1))
|
154
|
+
Wx.get_app.yield
|
155
|
+
assert(win.test_cmd_event)
|
156
|
+
assert(win.child.test_cmd_event)
|
157
|
+
win.reset
|
158
|
+
Wx.post_event(win.event_handler, TestCmdEvent.new)
|
159
|
+
Wx.get_app.yield
|
160
|
+
assert(win.test_cmd_event)
|
161
|
+
assert(!win.child.test_cmd_event)
|
162
|
+
win.destroy
|
163
|
+
Wx.get_app.yield
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_call_after
|
167
|
+
win = TestFrame.new
|
168
|
+
assert(!win.called_after)
|
169
|
+
win.event_handler.call_after { win.called_after = true }
|
170
|
+
Wx.get_app.yield
|
171
|
+
assert(win.called_after)
|
172
|
+
win.reset
|
173
|
+
win.child.event_handler.call_after { win.called_after = true }
|
174
|
+
Wx.get_app.yield
|
175
|
+
assert(win.called_after)
|
176
|
+
win.destroy
|
177
|
+
Wx.get_app.yield
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_event_blocker
|
181
|
+
win = TestFrame.new
|
182
|
+
assert(!win.test_event)
|
183
|
+
win.event_handler.process_event(TestEvent.new)
|
184
|
+
assert(win.test_event)
|
185
|
+
win.reset
|
186
|
+
Wx::EventBlocker.blocked_for(win) do |blkr|
|
187
|
+
win.event_handler.process_event(TestEvent.new(1))
|
188
|
+
end
|
189
|
+
assert(!win.test_event)
|
190
|
+
win.event_handler.process_event(TestEvent.new)
|
191
|
+
assert(win.test_event)
|
192
|
+
win.reset
|
193
|
+
Wx::EventBlocker.blocked_for(win, TestEvent::EVT_TEST_EVENT) do |blkr|
|
194
|
+
win.event_handler.process_event(TestEvent.new(1))
|
195
|
+
end
|
196
|
+
assert(!win.test_event)
|
197
|
+
win.event_handler.process_event(TestEvent.new)
|
198
|
+
assert(win.test_event)
|
199
|
+
win.reset
|
200
|
+
Wx::EventBlocker.blocked_for(win, Wx::EVT_ACTIVATE) do |blkr|
|
201
|
+
win.event_handler.process_event(TestEvent.new(1))
|
202
|
+
end
|
203
|
+
assert(win.test_event)
|
204
|
+
win.destroy
|
205
|
+
Wx.get_app.yield
|
206
|
+
end
|
207
|
+
|
208
|
+
class MyEventFilter < Wx::EventFilter
|
209
|
+
def initialize
|
210
|
+
super
|
211
|
+
@filtered = false
|
212
|
+
end
|
213
|
+
|
214
|
+
attr_accessor :filtered
|
215
|
+
|
216
|
+
def filter_event(event)
|
217
|
+
@filtered = true if event.is_a?(TestEvent)
|
218
|
+
Wx::EventFilter::Event_Skip
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
def test_event_filter
|
223
|
+
filter = MyEventFilter.new
|
224
|
+
assert_nothing_raised { Wx::EvtHandler.add_filter(filter) }
|
225
|
+
GC.start
|
226
|
+
win = TestFrame.new
|
227
|
+
win.child.event_handler.process_event(TestEvent.new)
|
228
|
+
GC.start
|
229
|
+
assert(filter.filtered)
|
230
|
+
filter.filtered = false
|
231
|
+
win.child.event_handler.process_event(TestCmdEvent.new)
|
232
|
+
GC.start
|
233
|
+
assert(!filter.filtered)
|
234
|
+
assert_nothing_raised { Wx::EvtHandler.remove_filter(filter) }
|
235
|
+
GC.start
|
236
|
+
win.child.event_handler.process_event(TestEvent.new)
|
237
|
+
assert(!filter.filtered)
|
238
|
+
GC.start
|
239
|
+
win.destroy
|
240
|
+
Wx.get_app.yield
|
241
|
+
end
|
242
|
+
|
243
|
+
class MyEventFilter2 < Wx::EventFilter
|
244
|
+
|
245
|
+
class << self
|
246
|
+
attr_accessor :filtered
|
247
|
+
end
|
248
|
+
|
249
|
+
def filter_event(event)
|
250
|
+
MyEventFilter2.filtered = true if event.is_a?(TestEvent)
|
251
|
+
Wx::EventFilter::Event_Skip
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def test_event_filter_clear
|
256
|
+
assert_nothing_raised { Wx::EvtHandler.add_filter(MyEventFilter2.new) }
|
257
|
+
GC.start
|
258
|
+
win = TestFrame.new
|
259
|
+
win.child.event_handler.process_event(TestEvent.new)
|
260
|
+
GC.start
|
261
|
+
assert(MyEventFilter2.filtered)
|
262
|
+
MyEventFilter2.filtered = false
|
263
|
+
win.child.event_handler.process_event(TestCmdEvent.new)
|
264
|
+
GC.start
|
265
|
+
assert(!MyEventFilter2.filtered)
|
266
|
+
assert_nothing_raised { Wx::EvtHandler.clear_filters }
|
267
|
+
GC.start
|
268
|
+
win.child.event_handler.process_event(TestEvent.new)
|
269
|
+
assert(!MyEventFilter2.filtered)
|
270
|
+
GC.start
|
271
|
+
win.destroy
|
272
|
+
Wx.get_app.yield
|
273
|
+
end
|
274
|
+
|
92
275
|
end
|
data/tests/test_events.rb
CHANGED
@@ -7,9 +7,9 @@ class EventTests < Test::Unit::TestCase
|
|
7
7
|
evt = Wx::Event.new(100, 1)
|
8
8
|
assert_equal(100, evt.event_type)
|
9
9
|
assert_equal(1, evt.id)
|
10
|
-
|
10
|
+
assert(!evt.should_propagate)
|
11
11
|
evt.skip
|
12
|
-
|
12
|
+
assert(evt.skipped)
|
13
13
|
evt_dup = evt.clone
|
14
14
|
assert_not_equal(evt, evt_dup)
|
15
15
|
assert_equal(evt.event_type, evt_dup.event_type)
|
@@ -20,9 +20,9 @@ class EventTests < Test::Unit::TestCase
|
|
20
20
|
evt = Wx::CommandEvent.new(100, 1)
|
21
21
|
assert_equal(100, evt.event_type)
|
22
22
|
assert_equal(1, evt.id)
|
23
|
-
|
23
|
+
assert(evt.should_propagate)
|
24
24
|
evt.skip
|
25
|
-
|
25
|
+
assert(evt.skipped)
|
26
26
|
evt.string = 'CommandEvent Test'
|
27
27
|
assert_equal('CommandEvent Test', evt.string)
|
28
28
|
evt_dup = evt.clone
|
@@ -44,10 +44,3 @@ class EventTests < Test::Unit::TestCase
|
|
44
44
|
assert_equal(evt.position, evt_dup.position)
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
48
|
-
class TestApp < Wx::App
|
49
|
-
def on_init
|
50
|
-
Test::Unit::UI::Console::TestRunner.run(EventTests)
|
51
|
-
false
|
52
|
-
end
|
53
|
-
end
|