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.
Files changed (238) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/README.md +47 -4
  4. data/assets/hello_button.png +0 -0
  5. data/assets/hello_button_clicked.png +0 -0
  6. data/assets/hello_world.png +0 -0
  7. data/assets/repo-social-preview.png +0 -0
  8. data/ext/wxbase32u_gcc_custom.dll +0 -0
  9. data/ext/wxbase32u_net_gcc_custom.dll +0 -0
  10. data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
  11. data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
  12. data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
  13. data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
  14. data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
  15. data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
  16. data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
  17. data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
  18. data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
  19. data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
  20. data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
  21. data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
  22. data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
  23. data/lib/wx/core/art_locator.rb +2 -2
  24. data/lib/wx/core/artprovider.rb +2 -2
  25. data/lib/wx/core/bitmap.rb +6 -5
  26. data/lib/wx/core/bitmap_combobox.rb +34 -0
  27. data/lib/wx/core/controlwithitems.rb +52 -14
  28. data/lib/wx/core/cursor.rb +1 -1
  29. data/lib/wx/core/dc.rb +0 -20
  30. data/lib/wx/core/event_blocker.rb +14 -0
  31. data/lib/wx/core/events/evt_list.rb +12 -0
  32. data/lib/wx/core/evthandler.rb +36 -0
  33. data/lib/wx/core/find_replace_dialog.rb +24 -0
  34. data/lib/wx/core/icon.rb +1 -1
  35. data/lib/wx/core/image.rb +1 -1
  36. data/lib/wx/core/paintdc.rb +8 -0
  37. data/lib/wx/core/text_entry.rb +15 -0
  38. data/lib/wx/core/v_list_box.rb +13 -0
  39. data/lib/wx/core/window.rb +1 -1
  40. data/lib/wx/doc/busy_info.rb +21 -0
  41. data/lib/wx/doc/client_dc.rb +28 -0
  42. data/lib/wx/doc/controlwithitems.rb +11 -0
  43. data/lib/wx/doc/dc.rb +0 -14
  44. data/lib/wx/doc/event_blocker.rb +27 -0
  45. data/lib/wx/doc/evthandler.rb +4 -0
  46. data/lib/wx/doc/extra/02_lifecycles.md +49 -0
  47. data/lib/wx/doc/extra/10_art.md +1 -1
  48. data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
  49. data/lib/wx/doc/gen/about_dialog_info.rb +27 -24
  50. data/lib/wx/doc/gen/accelerator.rb +11 -12
  51. data/lib/wx/doc/gen/app.rb +6 -3
  52. data/lib/wx/doc/gen/art_provider.rb +53 -29
  53. data/lib/wx/doc/gen/aui/aui_manager.rb +4 -0
  54. data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +1 -1
  55. data/lib/wx/doc/gen/aui/aui_pane_info.rb +2 -0
  56. data/lib/wx/doc/gen/aui/aui_tab_ctrl.rb +2 -0
  57. data/lib/wx/doc/gen/bitmap.rb +25 -25
  58. data/lib/wx/doc/gen/bitmap_combo_box.rb +157 -0
  59. data/lib/wx/doc/gen/box_sizer.rb +6 -8
  60. data/lib/wx/doc/gen/brush.rb +2 -0
  61. data/lib/wx/doc/gen/busy_info.rb +52 -46
  62. data/lib/wx/doc/gen/caret.rb +0 -4
  63. data/lib/wx/doc/gen/check_list_box.rb +0 -2
  64. data/lib/wx/doc/gen/choice.rb +1 -5
  65. data/lib/wx/doc/gen/client_dc.rb +13 -18
  66. data/lib/wx/doc/gen/clipboard.rb +30 -27
  67. data/lib/wx/doc/gen/collapsible_pane.rb +11 -9
  68. data/lib/wx/doc/gen/colour.rb +6 -3
  69. data/lib/wx/doc/gen/colour_dialog.rb +111 -23
  70. data/lib/wx/doc/gen/combo_box.rb +2 -4
  71. data/lib/wx/doc/gen/control.rb +20 -18
  72. data/lib/wx/doc/gen/core.rb +2 -2
  73. data/lib/wx/doc/gen/cursor.rb +18 -50
  74. data/lib/wx/doc/gen/data_format.rb +0 -2
  75. data/lib/wx/doc/gen/data_object.rb +37 -44
  76. data/lib/wx/doc/gen/dc.rb +16 -24
  77. data/lib/wx/doc/gen/defs.rb +3 -40
  78. data/lib/wx/doc/gen/dialog.rb +21 -17
  79. data/lib/wx/doc/gen/dir_dialog.rb +10 -8
  80. data/lib/wx/doc/gen/event.rb +2 -2
  81. data/lib/wx/doc/gen/event_blocker.rb +49 -0
  82. data/lib/wx/doc/gen/event_filter.rb +95 -0
  83. data/lib/wx/doc/gen/event_list.rb +16 -2
  84. data/lib/wx/doc/gen/events.rb +103 -112
  85. data/lib/wx/doc/gen/evt_handler.rb +28 -52
  86. data/lib/wx/doc/gen/file_dialog.rb +8 -4
  87. data/lib/wx/doc/gen/find_replace_dialog.rb +1 -1
  88. data/lib/wx/doc/gen/font.rb +10 -2
  89. data/lib/wx/doc/gen/font_data.rb +2 -0
  90. data/lib/wx/doc/gen/font_dialog.rb +1 -1
  91. data/lib/wx/doc/gen/frame.rb +4 -3
  92. data/lib/wx/doc/gen/fs_file.rb +8 -0
  93. data/lib/wx/doc/gen/gcdc.rb +2 -22
  94. data/lib/wx/doc/gen/gdi_common.rb +18 -2
  95. data/lib/wx/doc/gen/gdi_object.rb +2 -0
  96. data/lib/wx/doc/gen/graphics_context.rb +4 -43
  97. data/lib/wx/doc/gen/graphics_object.rb +2 -0
  98. data/lib/wx/doc/gen/grid/grid_cell_attr.rb +2 -1
  99. data/lib/wx/doc/gen/grid/grid_ctrl.rb +4 -2
  100. data/lib/wx/doc/gen/grid/grid_table_message.rb +2 -0
  101. data/lib/wx/doc/gen/grid_bag_sizer.rb +4 -0
  102. data/lib/wx/doc/gen/help_controller.rb +4 -1
  103. data/lib/wx/doc/gen/html/html_cell.rb +4 -1
  104. data/lib/wx/doc/gen/html/html_help_controller.rb +4 -1
  105. data/lib/wx/doc/gen/html/html_help_data.rb +4 -0
  106. data/lib/wx/doc/gen/html/html_help_window.rb +2 -1
  107. data/lib/wx/doc/gen/html/html_list_box.rb +138 -11
  108. data/lib/wx/doc/gen/html/html_window.rb +9 -3
  109. data/lib/wx/doc/gen/icon.rb +7 -1
  110. data/lib/wx/doc/gen/icon_location.rb +2 -0
  111. data/lib/wx/doc/gen/image.rb +15 -8
  112. data/lib/wx/doc/gen/keyboard_state.rb +6 -0
  113. data/lib/wx/doc/gen/list_box.rb +0 -11
  114. data/lib/wx/doc/gen/list_ctrl.rb +10 -13
  115. data/lib/wx/doc/gen/locale.rb +7 -3
  116. data/lib/wx/doc/gen/log.rb +6 -2
  117. data/lib/wx/doc/gen/mdi_frame.rb +2 -0
  118. data/lib/wx/doc/gen/media_ctrl.rb +2 -0
  119. data/lib/wx/doc/gen/memory_dc.rb +105 -18
  120. data/lib/wx/doc/gen/menu.rb +4 -2
  121. data/lib/wx/doc/gen/menu_bar.rb +0 -2
  122. data/lib/wx/doc/gen/menu_item.rb +9 -3
  123. data/lib/wx/doc/gen/message_dialog.rb +6 -3
  124. data/lib/wx/doc/gen/mirror_dc.rb +2 -8
  125. data/lib/wx/doc/gen/mouse_state.rb +2 -0
  126. data/lib/wx/doc/gen/multi_choice_dialog.rb +0 -2
  127. data/lib/wx/doc/gen/non_owned_window.rb +2 -1
  128. data/lib/wx/doc/gen/notebook.rb +4 -2
  129. data/lib/wx/doc/gen/paint_dc.rb +2 -6
  130. data/lib/wx/doc/gen/palette.rb +3 -3
  131. data/lib/wx/doc/gen/pen.rb +6 -1
  132. data/lib/wx/doc/gen/pg/pg_editor.rb +2 -1
  133. data/lib/wx/doc/gen/pg/pg_multi_button.rb +4 -0
  134. data/lib/wx/doc/gen/pg/pg_properties.rb +30 -3
  135. data/lib/wx/doc/gen/pg/pg_property.rb +30 -4
  136. data/lib/wx/doc/gen/pg/pg_validation_info.rb +2 -0
  137. data/lib/wx/doc/gen/pg/property_grid.rb +5 -2
  138. data/lib/wx/doc/gen/pg/property_grid_interface.rb +6 -2
  139. data/lib/wx/doc/gen/pg/property_grid_manager.rb +2 -0
  140. data/lib/wx/doc/gen/pg/property_grid_page_state.rb +2 -0
  141. data/lib/wx/doc/gen/picker_base.rb +2 -1
  142. data/lib/wx/doc/gen/platform_info.rb +4 -1
  143. data/lib/wx/doc/gen/property_sheet_dialog.rb +2 -0
  144. data/lib/wx/doc/gen/prt/post_script_dc.rb +2 -8
  145. data/lib/wx/doc/gen/prt/print_data.rb +6 -0
  146. data/lib/wx/doc/gen/prt/printer.rb +0 -3
  147. data/lib/wx/doc/gen/prt/printer_dc.rb +2 -6
  148. data/lib/wx/doc/gen/radio_box.rb +2 -2
  149. data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +6 -0
  150. data/lib/wx/doc/gen/rbn/ribbon_panel.rb +1 -1
  151. data/lib/wx/doc/gen/region.rb +2 -0
  152. data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +6 -0
  153. data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +0 -4
  154. data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +2 -0
  155. data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +2 -1
  156. data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +2 -0
  157. data/lib/wx/doc/gen/screen_dc.rb +2 -0
  158. data/lib/wx/doc/gen/scroll_bar.rb +2 -1
  159. data/lib/wx/doc/gen/scrolled_canvas.rb +4 -8
  160. data/lib/wx/doc/gen/scrolled_control.rb +4 -8
  161. data/lib/wx/doc/gen/scrolled_window.rb +4 -8
  162. data/lib/wx/doc/gen/search_ctrl.rb +131 -0
  163. data/lib/wx/doc/gen/single_choice_dialog.rb +0 -2
  164. data/lib/wx/doc/gen/sizer.rb +14 -3
  165. data/lib/wx/doc/gen/splash_screen.rb +2 -0
  166. data/lib/wx/doc/gen/static_box.rb +6 -3
  167. data/lib/wx/doc/gen/static_box_sizer.rb +2 -1
  168. data/lib/wx/doc/gen/status_bar.rb +0 -5
  169. data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +4 -5
  170. data/lib/wx/doc/gen/svg_file_dc.rb +10 -11
  171. data/lib/wx/doc/gen/text_ctrl.rb +10 -3
  172. data/lib/wx/doc/gen/text_entry.rb +8 -3
  173. data/lib/wx/doc/gen/text_entry_dialog.rb +4 -2
  174. data/lib/wx/doc/gen/timer_event.rb +2 -0
  175. data/lib/wx/doc/gen/tool_bar.rb +8 -4
  176. data/lib/wx/doc/gen/top_level_window.rb +5 -2
  177. data/lib/wx/doc/gen/tree_ctrl.rb +0 -6
  178. data/lib/wx/doc/gen/ui_action_simulator.rb +100 -0
  179. data/lib/wx/doc/gen/utils.rb +1 -1
  180. data/lib/wx/doc/gen/v_list_box.rb +36 -26
  181. data/lib/wx/doc/gen/validator.rb +2 -1
  182. data/lib/wx/doc/gen/variant.rb +10 -0
  183. data/lib/wx/doc/gen/window.rb +38 -17
  184. data/lib/wx/doc/gen/window_dc.rb +2 -0
  185. data/lib/wx/doc/gen/window_disabler.rb +2 -0
  186. data/lib/wx/doc/gen/wizard_page_simple.rb +2 -0
  187. data/lib/wx/doc/gen/xml_node.rb +6 -0
  188. data/lib/wx/doc/gen/xml_resource.rb +4 -1
  189. data/lib/wx/doc/memory_dc.rb +75 -0
  190. data/lib/wx/doc/mirror_dc.rb +16 -0
  191. data/lib/wx/doc/prt/printer_dc.rb +26 -0
  192. data/lib/wx/doc/screen_dc.rb +10 -6
  193. data/lib/wx/doc/svg_file_dc.rb +20 -0
  194. data/lib/wx/doc/v_list_box.rb +9 -0
  195. data/lib/wx/doc/window_disabler.rb +10 -0
  196. data/lib/wx/html/keyword_defs.rb +6 -7
  197. data/lib/wx/html/require.rb +1 -0
  198. data/lib/wx/html/simple_html_listbox.rb +105 -0
  199. data/lib/wx/keyword_defs.rb +7 -0
  200. data/lib/wx/version.rb +1 -1
  201. data/lib/wx/wxruby/cmd/test.rb +1 -1
  202. data/lib/wxruby_aui.so +0 -0
  203. data/lib/wxruby_core.so +0 -0
  204. data/lib/wxruby_grid.so +0 -0
  205. data/lib/wxruby_html.so +0 -0
  206. data/lib/wxruby_pg.so +0 -0
  207. data/lib/wxruby_prt.so +0 -0
  208. data/lib/wxruby_rbn.so +0 -0
  209. data/lib/wxruby_rtc.so +0 -0
  210. data/lib/wxruby_stc.so +0 -0
  211. data/rakelib/install.rb +3 -1
  212. data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
  213. data/samples/bigdemo/wxArtProvider.rbw +5 -4
  214. data/samples/controls/controls.rb +2 -2
  215. data/samples/controls/htlbox.rb +411 -0
  216. data/samples/controls/tn_htlbox.png +0 -0
  217. data/samples/drawing/graphics_drawing.rb +1 -2
  218. data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
  219. data/samples/drawing/tn_image_prt.png +0 -0
  220. data/samples/propgrid/propgrid.rb +23 -21
  221. data/samples/ribbon/ribbon.rb +47 -46
  222. data/tests/lib/wxapp_runner.rb +3 -3
  223. data/tests/lib/wxframe_runner.rb +59 -0
  224. data/tests/test_app_event_filter.rb +74 -0
  225. data/tests/test_art_provider.rb +52 -0
  226. data/tests/test_clipboard.rb +2 -1
  227. data/tests/test_event_handling.rb +199 -16
  228. data/tests/test_events.rb +4 -11
  229. data/tests/test_gdi_object.rb +161 -0
  230. data/tests/test_intl.rb +11 -14
  231. data/tests/test_item_data.rb +33 -1
  232. data/tests/test_std_controls.rb +147 -0
  233. metadata +38 -8
  234. data/lib/wx/doc/gen/auto_buffered_paint_dc.rb +0 -47
  235. data/lib/wx/doc/gen/buffered_dc.rb +0 -95
  236. data/lib/wx/doc/gen/buffered_paint_dc.rb +0 -55
  237. data/lib/wx/doc/gen/colour_data.rb +0 -96
  238. 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
- mdc = Wx::MemoryDC.new(myTestBitmap1x)
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)
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
- mdc = Wx::MemoryDC.new(myTestBitmap2x)
1399
- mdc.set_background(Wx::WHITE_BRUSH)
1400
- mdc.clear
1401
- mdc.set_pen(Wx::Pen.new(Wx::BLUE, 2))
1402
- mdc.set_brush(Wx::WHITE_BRUSH)
1403
- mdc.draw_rectangle(0, 0, 120, 30)
1404
- mdc.draw_line(0, 0, 119, 31)
1405
- mdc.set_text_foreground(Wx::BLUE)
1406
- f = mdc.font
1407
- f.set_pixel_size(f.get_pixel_size * 2)
1408
- mdc.set_font(f)
1409
- mdc.draw_text("x2", 0, 0)
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))
@@ -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
- item = add_colour_to_gallery(gallery,
511
- clr.get_as_string(Wx::C2S_HTML_SYNTAX), @bitmap_creation_dc,
512
- clr)
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
- dc = @bitmap_creation_dc
742
- def_item = add_colour_to_gallery(gallery, "Default", dc, defclr)
743
- gallery.set_selection(def_item)
744
- add_colour_to_gallery(gallery, "BLUE", dc)
745
- add_colour_to_gallery(gallery, "BLUE VIOLET", dc)
746
- add_colour_to_gallery(gallery, "BROWN", dc)
747
- add_colour_to_gallery(gallery, "CADET BLUE", dc)
748
- add_colour_to_gallery(gallery, "CORAL", dc)
749
- add_colour_to_gallery(gallery, "CYAN", dc)
750
- add_colour_to_gallery(gallery, "DARK GREEN", dc)
751
- add_colour_to_gallery(gallery, "DARK ORCHID", dc)
752
- add_colour_to_gallery(gallery, "FIREBRICK", dc)
753
- add_colour_to_gallery(gallery, "GOLD", dc)
754
- add_colour_to_gallery(gallery, "GOLDENROD", dc)
755
- add_colour_to_gallery(gallery, "GREEN", dc)
756
- add_colour_to_gallery(gallery, "INDIAN RED", dc)
757
- add_colour_to_gallery(gallery, "KHAKI", dc)
758
- add_colour_to_gallery(gallery, "LIGHT BLUE", dc)
759
- add_colour_to_gallery(gallery, "LIME GREEN", dc)
760
- add_colour_to_gallery(gallery, "MAGENTA", dc)
761
- add_colour_to_gallery(gallery, "MAROON", dc)
762
- add_colour_to_gallery(gallery, "NAVY", dc)
763
- add_colour_to_gallery(gallery, "ORANGE", dc)
764
- add_colour_to_gallery(gallery, "ORCHID", dc)
765
- add_colour_to_gallery(gallery, "PINK", dc)
766
- add_colour_to_gallery(gallery, "PLUM", dc)
767
- add_colour_to_gallery(gallery, "PURPLE", dc)
768
- add_colour_to_gallery(gallery, "RED", dc)
769
- add_colour_to_gallery(gallery, "SALMON", dc)
770
- add_colour_to_gallery(gallery, "SEA GREEN", dc)
771
- add_colour_to_gallery(gallery, "SIENNA", dc)
772
- add_colour_to_gallery(gallery, "SKY BLUE", dc)
773
- add_colour_to_gallery(gallery, "TAN", dc)
774
- add_colour_to_gallery(gallery, "THISTLE", dc)
775
- add_colour_to_gallery(gallery, "TURQUOISE", dc)
776
- add_colour_to_gallery(gallery, "VIOLET", dc)
777
- add_colour_to_gallery(gallery, "VIOLET RED", dc)
778
- add_colour_to_gallery(gallery, "WHEAT", dc)
779
- add_colour_to_gallery(gallery, "WHITE", dc)
780
- add_colour_to_gallery(gallery, "YELLOW", dc)
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)
@@ -3,7 +3,7 @@ require 'test/unit'
3
3
  require 'test/unit/ui/console/testrunner'
4
4
  require 'wx'
5
5
 
6
- module Wx::SF
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 = Wx::SF::Test::App.new(self, org_start_mtd)).run
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
- Wx::SF::Test::Runner
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
@@ -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.get_data_here)
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
- assert_boolean(!win.test_event)
62
- assert_boolean(!win.child.test_event)
64
+ assert(!win.test_event)
65
+ assert(!win.child.test_event)
63
66
  win.child.event_handler.process_event(TestEvent.new)
64
- assert_boolean(!win.test_event)
65
- assert_boolean(win.child.test_event)
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
- assert_boolean(!win.test_event)
69
- assert_boolean(win.child.test_event)
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
- assert_boolean(win.test_event)
73
- assert_boolean(!win.child.test_event)
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
- assert_boolean(!win.test_cmd_event)
79
- assert_boolean(!win.child.test_cmd_event)
83
+ assert(!win.test_cmd_event)
84
+ assert(!win.child.test_cmd_event)
80
85
  win.child.event_handler.process_event(TestCmdEvent.new)
81
- assert_boolean(!win.test_cmd_event)
82
- assert_boolean(win.child.test_cmd_event)
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
- assert_boolean(win.test_cmd_event)
86
- assert_boolean(win.child.test_cmd_event)
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
- assert_boolean(win.test_cmd_event)
90
- assert_boolean(!win.child.test_cmd_event)
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
- assert_boolean(!evt.should_propagate)
10
+ assert(!evt.should_propagate)
11
11
  evt.skip
12
- assert_boolean(evt.skipped)
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
- assert_boolean(evt.should_propagate)
23
+ assert(evt.should_propagate)
24
24
  evt.skip
25
- assert_boolean(evt.skipped)
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