wxruby3 0.9.0.pre.beta.13-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/accessors.rb +8 -2
- data/lib/wx/core/art_locator.rb +2 -2
- data/lib/wx/core/artprovider.rb +2 -2
- data/lib/wx/core/bitmap.rb +6 -5
- data/lib/wx/core/bitmap_combobox.rb +34 -0
- data/lib/wx/core/controlwithitems.rb +52 -14
- data/lib/wx/core/cursor.rb +1 -1
- data/lib/wx/core/dc.rb +0 -20
- data/lib/wx/core/event_blocker.rb +14 -0
- data/lib/wx/core/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/global_const.rb +24 -18
- data/lib/wx/html/keyword_defs.rb +6 -7
- data/lib/wx/html/require.rb +1 -0
- data/lib/wx/html/simple_html_listbox.rb +105 -0
- data/lib/wx/keyword_defs.rb +7 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/cmd/test.rb +1 -1
- data/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
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
require 'wx'
|
6
6
|
|
7
|
-
class
|
7
|
+
class ImagePage < Wx::ScrolledWindow
|
8
8
|
|
9
9
|
PAGES = [
|
10
10
|
'Lines',
|
@@ -41,9 +41,36 @@ class SVGPage < Wx::ScrolledWindow
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def on_save(filename)
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
case File.extname(filename)
|
45
|
+
when '.svg'
|
46
|
+
Wx::SVGFileDC.draw_on(filename, 600, 650) do |svgDC|
|
47
|
+
on_draw(svgDC)
|
48
|
+
svgDC.ok?
|
49
|
+
end
|
50
|
+
when '.ps'
|
51
|
+
print_data = Wx::PRT::PrintData.new
|
52
|
+
print_data.set_print_mode(Wx::PRINT_MODE_FILE)
|
53
|
+
print_data.set_filename(filename)
|
54
|
+
print_data.set_orientation(Wx::PrintOrientation::PORTRAIT)
|
55
|
+
print_data.set_paper_id(Wx::PaperSize::PAPER_A4)
|
56
|
+
screen_ppi = printer_ppi = nil
|
57
|
+
Wx::ScreenDC.draw_on do |dc|
|
58
|
+
screen_ppi = dc.get_ppi
|
59
|
+
end
|
60
|
+
Wx::PRT::PostScriptDC.draw_on(print_data) do |dc|
|
61
|
+
printer_ppi = dc.get_ppi
|
62
|
+
scale = printer_ppi.x.to_f / screen_ppi.x.to_f
|
63
|
+
dc.start_doc("Drawing sample")
|
64
|
+
# Define default font.
|
65
|
+
dc.set_font(Wx::FontInfo.new(10).family(Wx::FontFamily::FONTFAMILY_MODERN))
|
66
|
+
dc.start_page
|
67
|
+
Wx::ScaledDC.draw_on(dc, scale) do |sdc|
|
68
|
+
on_draw(sdc)
|
69
|
+
end
|
70
|
+
dc.end_page
|
71
|
+
dc.end_doc
|
72
|
+
end
|
73
|
+
end
|
47
74
|
end
|
48
75
|
|
49
76
|
def on_paint
|
@@ -278,10 +305,10 @@ class SVGPage < Wx::ScrolledWindow
|
|
278
305
|
|
279
306
|
end
|
280
307
|
|
281
|
-
class
|
308
|
+
class ImageFrame < Wx::Frame
|
282
309
|
|
283
310
|
def initialize
|
284
|
-
super(nil, title: '
|
311
|
+
super(nil, title: 'ImagePrint Demo', size: [500, 400])
|
285
312
|
|
286
313
|
icon_file = File.join(__dir__,'..', 'art', "wxruby.png")
|
287
314
|
self.icon = Wx::Icon.new(icon_file)
|
@@ -310,8 +337,8 @@ class SVGFrame < Wx::Frame
|
|
310
337
|
@notebook = Wx::Notebook.new(self, style: Wx::BK_TOP)
|
311
338
|
|
312
339
|
# Add SVG Windows to a notebook
|
313
|
-
|
314
|
-
@notebook.add_page(
|
340
|
+
ImagePage::PAGES.each_with_index do |title, index|
|
341
|
+
@notebook.add_page(ImagePage.new(@notebook, index), title)
|
315
342
|
end
|
316
343
|
|
317
344
|
evt_menu Wx::ID_SAVE, :file_save_picture
|
@@ -322,9 +349,13 @@ class SVGFrame < Wx::Frame
|
|
322
349
|
def file_save_picture(event)
|
323
350
|
page = @notebook.current_page
|
324
351
|
|
352
|
+
wildcard = 'SVG vector picture files (*.svg)|*.svg'
|
353
|
+
if Wx.has_feature?(:USE_PRINTING_ARCHITECTURE)
|
354
|
+
wildcard << '|PostScript files (*.ps)|*.ps'
|
355
|
+
end
|
325
356
|
Wx::FileDialog(self, 'Save Picture as', '',
|
326
357
|
@notebook.get_page_text(@notebook.get_selection),
|
327
|
-
|
358
|
+
wildcard,
|
328
359
|
Wx::FD_SAVE|Wx::FD_OVERWRITE_PROMPT) do |dlg|
|
329
360
|
if dlg.show_modal == Wx::ID_OK
|
330
361
|
page.on_save(dlg.get_path)
|
@@ -334,14 +365,14 @@ class SVGFrame < Wx::Frame
|
|
334
365
|
|
335
366
|
def on_about(event)
|
336
367
|
Wx.message_box(
|
337
|
-
"wxRuby
|
338
|
-
"(converted from wxWidgets)\n" +
|
368
|
+
"wxRuby ImagePrint sample\n" +
|
369
|
+
"(converted from wxWidgets SVGTest)\n" +
|
339
370
|
"Authors:\n" +
|
340
371
|
" Chris Elliott (c) 2002-2009\n" +
|
341
372
|
" Prashant Kumar Nirmal (c) 2017\n" +
|
342
373
|
" Martin Corino (c) 2023\n" +
|
343
|
-
'Usage: click File|Save to Save the Selected
|
344
|
-
'About
|
374
|
+
'Usage: click File|Save to Save the Selected Image page',
|
375
|
+
'About ImagePrint Test')
|
345
376
|
end
|
346
377
|
|
347
378
|
def on_quit(event)
|
@@ -350,24 +381,24 @@ class SVGFrame < Wx::Frame
|
|
350
381
|
|
351
382
|
end
|
352
383
|
|
353
|
-
module
|
384
|
+
module ImagePrintSample
|
354
385
|
|
355
386
|
include WxRuby::Sample if defined? WxRuby::Sample
|
356
387
|
|
357
388
|
def self.describe
|
358
389
|
{ file: __FILE__,
|
359
|
-
summary: 'wxRuby
|
360
|
-
description: 'wxRuby example showcasing Wx::SVGFileDC to create SVG files.' }
|
390
|
+
summary: 'wxRuby Image printing example.',
|
391
|
+
description: 'wxRuby example showcasing Wx::SVGFileDC/Wx::PostScriptDC to create SVG/PS files.' }
|
361
392
|
end
|
362
393
|
|
363
394
|
def self.activate
|
364
|
-
frame =
|
395
|
+
frame = ImageFrame.new
|
365
396
|
frame.show
|
366
397
|
frame
|
367
398
|
end
|
368
399
|
|
369
400
|
if $0 == __FILE__
|
370
|
-
Wx::App.run {
|
401
|
+
Wx::App.run { ImagePrintSample.activate }
|
371
402
|
end
|
372
403
|
|
373
404
|
end
|
Binary file
|
@@ -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
|