wxruby3 0.9.2-x64-mingw-ucrt → 0.9.4-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (668) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +35 -29
  3. data/README.md +24 -15
  4. data/ext/wxbase32u_gcc_custom.dll +0 -0
  5. data/ext/wxbase32u_net_gcc_custom.dll +0 -0
  6. data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
  7. data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
  8. data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
  9. data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
  10. data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
  11. data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
  12. data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
  13. data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
  14. data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
  15. data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
  16. data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
  17. data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
  18. data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
  19. data/lib/wx/core/bitmap_combobox.rb +17 -21
  20. data/lib/wx/core/book_ctrl_base.rb +16 -0
  21. data/lib/wx/core/combobox.rb +13 -3
  22. data/lib/wx/core/config.rb +454 -83
  23. data/lib/wx/core/controlwithitems.rb +40 -130
  24. data/lib/wx/core/enum.rb +17 -1
  25. data/lib/wx/core/event.rb +6 -1
  26. data/lib/wx/core/events/evt_list.rb +5 -4
  27. data/lib/wx/core/evthandler.rb +8 -2
  28. data/lib/wx/core/generic_validator.rb +312 -0
  29. data/lib/wx/core/listbox.rb +2 -2
  30. data/lib/wx/core/log.rb +1 -1
  31. data/lib/wx/core/notebook.rb +10 -8
  32. data/lib/wx/core/owner_drawn_combobox.rb +45 -0
  33. data/lib/wx/core/peristent_object.rb +15 -0
  34. data/lib/wx/core/persistence_manager.rb +39 -0
  35. data/lib/wx/core/persistent_window.rb +16 -0
  36. data/lib/wx/core/size.rb +4 -0
  37. data/lib/wx/core/sizer.rb +1 -2
  38. data/lib/wx/core/standard_paths.rb +22 -0
  39. data/lib/wx/core/text_entry.rb +4 -1
  40. data/lib/wx/core/top_level_window.rb +16 -0
  41. data/lib/wx/core/treebook.rb +18 -0
  42. data/lib/wx/core/validator.rb +70 -5
  43. data/lib/wx/core/window.rb +3 -7
  44. data/lib/wx/core.rb +4 -0
  45. data/lib/wx/doc/art_locator.rb +1 -0
  46. data/lib/wx/doc/book_ctrl_base.rb +19 -0
  47. data/lib/wx/doc/comboctrl.rb +18 -0
  48. data/lib/wx/doc/config.rb +101 -41
  49. data/lib/wx/doc/controlwithitems.rb +16 -0
  50. data/lib/wx/doc/date_picker_ctrl.rb +23 -0
  51. data/lib/wx/doc/editable_listbox.rb +44 -0
  52. data/lib/wx/doc/enum.rb +15 -0
  53. data/lib/wx/doc/event.rb +12 -0
  54. data/lib/wx/doc/extra/12_client_data.md +89 -0
  55. data/lib/wx/doc/extra/13_validators.md +139 -0
  56. data/lib/wx/doc/extra/14_config.md +101 -0
  57. data/lib/wx/doc/extra/15_persistence.md +148 -0
  58. data/lib/wx/doc/gdi_common.rb +4 -0
  59. data/lib/wx/doc/gen/about_dialog_info.rb +25 -0
  60. data/lib/wx/doc/gen/accelerator.rb +7 -1
  61. data/lib/wx/doc/gen/accessible.rb +13 -0
  62. data/lib/wx/doc/gen/activity_indicator.rb +7 -0
  63. data/lib/wx/doc/gen/animation.rb +12 -0
  64. data/lib/wx/doc/gen/animation_ctrl.rb +10 -0
  65. data/lib/wx/doc/gen/any_button.rb +17 -1
  66. data/lib/wx/doc/gen/app.rb +35 -1
  67. data/lib/wx/doc/gen/app_traits.rb +38 -5
  68. data/lib/wx/doc/gen/art_provider.rb +14 -0
  69. data/lib/wx/doc/gen/aui/aui_dock_art.rb +12 -0
  70. data/lib/wx/doc/gen/aui/aui_floating_frame.rb +1 -0
  71. data/lib/wx/doc/gen/aui/aui_manager.rb +24 -1
  72. data/lib/wx/doc/gen/aui/aui_manager_event.rb +9 -1
  73. data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +3 -0
  74. data/lib/wx/doc/gen/aui/aui_mdi_client_window.rb +2 -0
  75. data/lib/wx/doc/gen/aui/aui_mdi_parent_frame.rb +3 -1
  76. data/lib/wx/doc/gen/aui/aui_notebook.rb +20 -2
  77. data/lib/wx/doc/gen/aui/aui_notebook_event.rb +2 -1
  78. data/lib/wx/doc/gen/aui/aui_pane_info.rb +30 -1
  79. data/lib/wx/doc/gen/aui/aui_tab_art.rb +6 -0
  80. data/lib/wx/doc/gen/aui/aui_tab_ctrl.rb +1 -0
  81. data/lib/wx/doc/gen/aui/aui_tool_bar.rb +11 -0
  82. data/lib/wx/doc/gen/aui/aui_tool_bar_art.rb +2 -0
  83. data/lib/wx/doc/gen/aui/aui_tool_bar_event.rb +2 -1
  84. data/lib/wx/doc/gen/aui/aui_tool_bar_item.rb +4 -0
  85. data/lib/wx/doc/gen/banner_window.rb +7 -0
  86. data/lib/wx/doc/gen/bitmap.rb +64 -3
  87. data/lib/wx/doc/gen/bitmap_button.rb +6 -1
  88. data/lib/wx/doc/gen/bitmap_combo_box.rb +9 -3
  89. data/lib/wx/doc/gen/book_ctrl_base.rb +17 -2
  90. data/lib/wx/doc/gen/book_ctrl_event.rb +3 -1
  91. data/lib/wx/doc/gen/box_sizer.rb +5 -0
  92. data/lib/wx/doc/gen/brush.rb +16 -1
  93. data/lib/wx/doc/gen/busy_info.rb +8 -0
  94. data/lib/wx/doc/gen/button.rb +11 -3
  95. data/lib/wx/doc/gen/calculate_layout_event.rb +4 -0
  96. data/lib/wx/doc/gen/calendar_ctrl.rb +22 -0
  97. data/lib/wx/doc/gen/calendar_date_attr.rb +1 -0
  98. data/lib/wx/doc/gen/calendar_event.rb +3 -1
  99. data/lib/wx/doc/gen/caret.rb +3 -0
  100. data/lib/wx/doc/gen/check_box.rb +10 -0
  101. data/lib/wx/doc/gen/check_list_box.rb +3 -0
  102. data/lib/wx/doc/gen/choice.rb +14 -2
  103. data/lib/wx/doc/gen/choicebook.rb +1 -0
  104. data/lib/wx/doc/gen/client_dc.rb +1 -0
  105. data/lib/wx/doc/gen/clipboard.rb +9 -0
  106. data/lib/wx/doc/gen/collapsible_pane.rb +3 -0
  107. data/lib/wx/doc/gen/collapsible_pane_event.rb +1 -0
  108. data/lib/wx/doc/gen/colour.rb +20 -0
  109. data/lib/wx/doc/gen/colour_dialog.rb +10 -0
  110. data/lib/wx/doc/gen/colour_picker_ctrl.rb +4 -0
  111. data/lib/wx/doc/gen/colour_picker_event.rb +1 -0
  112. data/lib/wx/doc/gen/combo_box.rb +20 -1
  113. data/lib/wx/doc/gen/combo_ctrl.rb +54 -295
  114. data/lib/wx/doc/gen/command_link_button.rb +8 -0
  115. data/lib/wx/doc/gen/context_help_button.rb +7 -1
  116. data/lib/wx/doc/gen/control.rb +12 -0
  117. data/lib/wx/doc/gen/control_with_items.rb +45 -9
  118. data/lib/wx/doc/gen/core.rb +2 -2
  119. data/lib/wx/doc/gen/cursor.rb +4 -0
  120. data/lib/wx/doc/gen/data_format.rb +1 -0
  121. data/lib/wx/doc/gen/data_object.rb +27 -5
  122. data/lib/wx/doc/gen/date_event.rb +2 -1
  123. data/lib/wx/doc/gen/date_picker_ctrl.rb +7 -1
  124. data/lib/wx/doc/gen/dc.rb +87 -3
  125. data/lib/wx/doc/gen/dial_up_event.rb +2 -0
  126. data/lib/wx/doc/gen/dial_up_manager.rb +12 -0
  127. data/lib/wx/doc/gen/dialog.rb +42 -3
  128. data/lib/wx/doc/gen/dir_dialog.rb +6 -1
  129. data/lib/wx/doc/gen/dir_filter_list_ctrl.rb +1 -0
  130. data/lib/wx/doc/gen/dir_picker_ctrl.rb +5 -0
  131. data/lib/wx/doc/gen/drag_drop.rb +20 -0
  132. data/lib/wx/doc/gen/drag_image.rb +7 -0
  133. data/lib/wx/doc/gen/editable_list_box.rb +5 -3
  134. data/lib/wx/doc/gen/event.rb +26 -11
  135. data/lib/wx/doc/gen/event_blocker.rb +2 -1
  136. data/lib/wx/doc/gen/event_filter.rb +3 -2
  137. data/lib/wx/doc/gen/event_list.rb +4 -4
  138. data/lib/wx/doc/gen/events.rb +165 -26
  139. data/lib/wx/doc/gen/evt_handler.rb +40 -2
  140. data/lib/wx/doc/gen/ext_help_controller.rb +9 -0
  141. data/lib/wx/doc/gen/file_ctrl.rb +11 -2
  142. data/lib/wx/doc/gen/file_ctrl_event.rb +5 -1
  143. data/lib/wx/doc/gen/file_dialog.rb +13 -0
  144. data/lib/wx/doc/gen/file_dialog_custom_control.rb +12 -0
  145. data/lib/wx/doc/gen/file_dialog_customize_hook.rb +11 -2
  146. data/lib/wx/doc/gen/file_dir_picker_event.rb +2 -1
  147. data/lib/wx/doc/gen/file_picker_ctrl.rb +4 -0
  148. data/lib/wx/doc/gen/file_system.rb +17 -1
  149. data/lib/wx/doc/gen/find_dialog_event.rb +2 -1
  150. data/lib/wx/doc/gen/find_replace_data.rb +1 -0
  151. data/lib/wx/doc/gen/find_replace_dialog.rb +3 -0
  152. data/lib/wx/doc/gen/flex_grid_sizer.rb +13 -0
  153. data/lib/wx/doc/gen/font.rb +75 -3
  154. data/lib/wx/doc/gen/font_data.rb +14 -0
  155. data/lib/wx/doc/gen/font_dialog.rb +6 -0
  156. data/lib/wx/doc/gen/font_picker_ctrl.rb +8 -0
  157. data/lib/wx/doc/gen/font_picker_event.rb +1 -0
  158. data/lib/wx/doc/gen/frame.rb +24 -7
  159. data/lib/wx/doc/gen/fs_file.rb +22 -0
  160. data/lib/wx/doc/gen/gauge.rb +8 -0
  161. data/lib/wx/doc/gen/gb_sizer_item.rb +5 -0
  162. data/lib/wx/doc/gen/gcdc.rb +2 -0
  163. data/lib/wx/doc/gen/gdi_common.rb +50 -8
  164. data/lib/wx/doc/gen/gdi_object.rb +1 -0
  165. data/lib/wx/doc/gen/generic_dir_ctrl.rb +7 -0
  166. data/lib/wx/doc/gen/graphics_context.rb +36 -7
  167. data/lib/wx/doc/gen/graphics_object.rb +24 -0
  168. data/lib/wx/doc/gen/grid/grid_cell_activatable_editor.rb +2 -2
  169. data/lib/wx/doc/gen/grid/grid_cell_attr.rb +14 -4
  170. data/lib/wx/doc/gen/grid/grid_cell_auto_wrap_string_editor.rb +1 -2
  171. data/lib/wx/doc/gen/grid/grid_cell_auto_wrap_string_renderer.rb +1 -2
  172. data/lib/wx/doc/gen/grid/grid_cell_bool_editor.rb +2 -2
  173. data/lib/wx/doc/gen/grid/grid_cell_bool_renderer.rb +1 -2
  174. data/lib/wx/doc/gen/grid/grid_cell_choice_editor.rb +2 -2
  175. data/lib/wx/doc/gen/grid/grid_cell_date_editor.rb +1 -2
  176. data/lib/wx/doc/gen/grid/grid_cell_date_renderer.rb +1 -2
  177. data/lib/wx/doc/gen/grid/grid_cell_date_time_renderer.rb +1 -2
  178. data/lib/wx/doc/gen/grid/grid_cell_editor.rb +9 -2
  179. data/lib/wx/doc/gen/grid/grid_cell_enum_editor.rb +1 -2
  180. data/lib/wx/doc/gen/grid/grid_cell_enum_renderer.rb +1 -2
  181. data/lib/wx/doc/gen/grid/grid_cell_float_editor.rb +1 -2
  182. data/lib/wx/doc/gen/grid/grid_cell_float_renderer.rb +2 -2
  183. data/lib/wx/doc/gen/grid/grid_cell_number_editor.rb +2 -2
  184. data/lib/wx/doc/gen/grid/grid_cell_number_renderer.rb +1 -2
  185. data/lib/wx/doc/gen/grid/grid_cell_renderer.rb +6 -2
  186. data/lib/wx/doc/gen/grid/grid_cell_string_renderer.rb +1 -2
  187. data/lib/wx/doc/gen/grid/grid_cell_text_editor.rb +1 -2
  188. data/lib/wx/doc/gen/grid/grid_ctrl.rb +229 -7
  189. data/lib/wx/doc/gen/grid/grid_editor_created_event.rb +4 -1
  190. data/lib/wx/doc/gen/grid/grid_event.rb +4 -1
  191. data/lib/wx/doc/gen/grid/grid_range_select_event.rb +2 -1
  192. data/lib/wx/doc/gen/grid/grid_size_event.rb +2 -1
  193. data/lib/wx/doc/gen/grid/grid_string_table.rb +7 -0
  194. data/lib/wx/doc/gen/grid/grid_table_base.rb +27 -1
  195. data/lib/wx/doc/gen/grid/grid_table_message.rb +1 -0
  196. data/lib/wx/doc/gen/grid_bag_sizer.rb +24 -4
  197. data/lib/wx/doc/gen/grid_sizer.rb +11 -0
  198. data/lib/wx/doc/gen/gui_event_loop.rb +12 -2
  199. data/lib/wx/doc/gen/header_ctrl.rb +106 -6
  200. data/lib/wx/doc/gen/header_ctrl_event.rb +5 -1
  201. data/lib/wx/doc/gen/help_controller.rb +11 -0
  202. data/lib/wx/doc/gen/help_provider.rb +12 -3
  203. data/lib/wx/doc/gen/html/html_cell.rb +25 -0
  204. data/lib/wx/doc/gen/html/html_cell_event.rb +3 -1
  205. data/lib/wx/doc/gen/html/html_easy_printing.rb +13 -1
  206. data/lib/wx/doc/gen/html/html_help_controller.rb +18 -0
  207. data/lib/wx/doc/gen/html/html_help_data.rb +5 -0
  208. data/lib/wx/doc/gen/html/html_help_window.rb +8 -0
  209. data/lib/wx/doc/gen/html/html_link_event.rb +1 -0
  210. data/lib/wx/doc/gen/html/html_list_box.rb +49 -9
  211. data/lib/wx/doc/gen/html/html_printout.rb +7 -0
  212. data/lib/wx/doc/gen/html/html_window.rb +31 -0
  213. data/lib/wx/doc/gen/hyperlink_ctrl.rb +2 -1
  214. data/lib/wx/doc/gen/hyperlink_event.rb +1 -0
  215. data/lib/wx/doc/gen/icon.rb +19 -1
  216. data/lib/wx/doc/gen/icon_location.rb +1 -0
  217. data/lib/wx/doc/gen/image.rb +67 -10
  218. data/lib/wx/doc/gen/image_list.rb +12 -2
  219. data/lib/wx/doc/gen/info_bar.rb +12 -0
  220. data/lib/wx/doc/gen/keyboard_state.rb +11 -0
  221. data/lib/wx/doc/gen/list_box.rb +20 -3
  222. data/lib/wx/doc/gen/list_ctrl.rb +89 -0
  223. data/lib/wx/doc/gen/list_event.rb +11 -1
  224. data/lib/wx/doc/gen/listbook.rb +1 -0
  225. data/lib/wx/doc/gen/locale.rb +22 -0
  226. data/lib/wx/doc/gen/log.rb +42 -0
  227. data/lib/wx/doc/gen/mdi_client_window.rb +4 -1
  228. data/lib/wx/doc/gen/mdi_frame.rb +27 -4
  229. data/lib/wx/doc/gen/media_ctrl.rb +17 -0
  230. data/lib/wx/doc/gen/media_event.rb +2 -1
  231. data/lib/wx/doc/gen/memory_dc.rb +10 -0
  232. data/lib/wx/doc/gen/menu.rb +48 -7
  233. data/lib/wx/doc/gen/menu_bar.rb +32 -13
  234. data/lib/wx/doc/gen/menu_item.rb +26 -0
  235. data/lib/wx/doc/gen/message_dialog.rb +10 -0
  236. data/lib/wx/doc/gen/mini_frame.rb +5 -2
  237. data/lib/wx/doc/gen/mirror_dc.rb +1 -0
  238. data/lib/wx/doc/gen/mouse_state.rb +1 -0
  239. data/lib/wx/doc/gen/multi_choice_dialog.rb +3 -1
  240. data/lib/wx/doc/gen/non_owned_window.rb +3 -0
  241. data/lib/wx/doc/gen/notebook.rb +11 -1
  242. data/lib/wx/doc/gen/num_validator.rb +37 -0
  243. data/lib/wx/doc/gen/number_entry_dialog.rb +4 -0
  244. data/lib/wx/doc/gen/object.rb +3 -0
  245. data/lib/wx/doc/gen/owner_drawn_combo_box.rb +340 -0
  246. data/lib/wx/doc/gen/paint_dc.rb +1 -0
  247. data/lib/wx/doc/gen/palette.rb +5 -0
  248. data/lib/wx/doc/gen/panel.rb +10 -2
  249. data/lib/wx/doc/gen/pen.rb +30 -1
  250. data/lib/wx/doc/gen/persistence_manager.rb +135 -0
  251. data/lib/wx/doc/gen/persistent_object.rb +52 -0
  252. data/lib/wx/doc/gen/persistent_window.rb +116 -0
  253. data/lib/wx/doc/gen/pg/numeric_property_validator.rb +2 -1
  254. data/lib/wx/doc/gen/pg/pg_array_editor_dialog.rb +4 -1
  255. data/lib/wx/doc/gen/pg/pg_cell.rb +6 -1
  256. data/lib/wx/doc/gen/pg/pg_editor.rb +61 -15
  257. data/lib/wx/doc/gen/pg/pg_multi_button.rb +2 -0
  258. data/lib/wx/doc/gen/pg/pg_properties.rb +198 -81
  259. data/lib/wx/doc/gen/pg/pg_property.rb +129 -52
  260. data/lib/wx/doc/gen/pg/pg_validation_info.rb +2 -0
  261. data/lib/wx/doc/gen/pg/property_grid.rb +56 -14
  262. data/lib/wx/doc/gen/pg/property_grid_event.rb +16 -6
  263. data/lib/wx/doc/gen/pg/property_grid_interface.rb +98 -37
  264. data/lib/wx/doc/gen/pg/property_grid_manager.rb +29 -7
  265. data/lib/wx/doc/gen/pg/property_grid_page.rb +11 -4
  266. data/lib/wx/doc/gen/pg/property_grid_page_state.rb +7 -2
  267. data/lib/wx/doc/gen/picker_base.rb +11 -1
  268. data/lib/wx/doc/gen/platform_info.rb +31 -0
  269. data/lib/wx/doc/gen/popup_window.rb +5 -0
  270. data/lib/wx/doc/gen/progress_dialog.rb +4 -0
  271. data/lib/wx/doc/gen/property_sheet_dialog.rb +7 -1
  272. data/lib/wx/doc/gen/prt/page_setup_dialog.rb +2 -0
  273. data/lib/wx/doc/gen/prt/post_script_dc.rb +1 -0
  274. data/lib/wx/doc/gen/prt/preview_frame.rb +4 -0
  275. data/lib/wx/doc/gen/prt/print_abort_dialog.rb +1 -0
  276. data/lib/wx/doc/gen/prt/print_data.rb +27 -0
  277. data/lib/wx/doc/gen/prt/print_dialog.rb +4 -0
  278. data/lib/wx/doc/gen/prt/printer.rb +42 -5
  279. data/lib/wx/doc/gen/prt/printer_dc.rb +2 -0
  280. data/lib/wx/doc/gen/query_layout_info_event.rb +9 -0
  281. data/lib/wx/doc/gen/radio_box.rb +19 -0
  282. data/lib/wx/doc/gen/radio_button.rb +9 -0
  283. data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +63 -0
  284. data/lib/wx/doc/gen/rbn/ribbon_bar.rb +23 -0
  285. data/lib/wx/doc/gen/rbn/ribbon_bar_event.rb +2 -1
  286. data/lib/wx/doc/gen/rbn/ribbon_button_bar.rb +35 -9
  287. data/lib/wx/doc/gen/rbn/ribbon_button_bar_event.rb +2 -1
  288. data/lib/wx/doc/gen/rbn/ribbon_control.rb +10 -0
  289. data/lib/wx/doc/gen/rbn/ribbon_gallery.rb +17 -7
  290. data/lib/wx/doc/gen/rbn/ribbon_gallery_event.rb +2 -1
  291. data/lib/wx/doc/gen/rbn/ribbon_page.rb +12 -0
  292. data/lib/wx/doc/gen/rbn/ribbon_panel.rb +11 -0
  293. data/lib/wx/doc/gen/rbn/ribbon_panel_event.rb +2 -1
  294. data/lib/wx/doc/gen/rbn/ribbon_tool_bar.rb +25 -0
  295. data/lib/wx/doc/gen/rbn/ribbon_tool_bar_event.rb +2 -1
  296. data/lib/wx/doc/gen/rearrange_ctrl.rb +4 -0
  297. data/lib/wx/doc/gen/rearrange_list.rb +9 -0
  298. data/lib/wx/doc/gen/region.rb +42 -13
  299. data/lib/wx/doc/gen/region_iterator.rb +1 -0
  300. data/lib/wx/doc/gen/rtc/rich_text_box.rb +25 -8
  301. data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +41 -4
  302. data/lib/wx/doc/gen/rtc/rich_text_buffer_data_object.rb +1 -0
  303. data/lib/wx/doc/gen/rtc/rich_text_composite_object.rb +23 -11
  304. data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +74 -0
  305. data/lib/wx/doc/gen/rtc/rich_text_event.rb +6 -1
  306. data/lib/wx/doc/gen/rtc/rich_text_file_handler.rb +8 -0
  307. data/lib/wx/doc/gen/rtc/rich_text_formatting_dialog.rb +6 -0
  308. data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +1 -0
  309. data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +4 -0
  310. data/lib/wx/doc/gen/rtc/rich_text_image.rb +7 -0
  311. data/lib/wx/doc/gen/rtc/rich_text_object.rb +64 -4
  312. data/lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb +51 -4
  313. data/lib/wx/doc/gen/rtc/rich_text_printing.rb +13 -0
  314. data/lib/wx/doc/gen/rtc/rich_text_style_list_box.rb +9 -4
  315. data/lib/wx/doc/gen/rtc/rich_text_style_organiser_dialog.rb +3 -0
  316. data/lib/wx/doc/gen/rtc/rich_text_xml_handler.rb +2 -0
  317. data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +1 -0
  318. data/lib/wx/doc/gen/sash_event.rb +5 -1
  319. data/lib/wx/doc/gen/sash_layout_window.rb +10 -0
  320. data/lib/wx/doc/gen/sash_window.rb +3 -0
  321. data/lib/wx/doc/gen/screen_dc.rb +1 -0
  322. data/lib/wx/doc/gen/scroll_bar.rb +11 -2
  323. data/lib/wx/doc/gen/scrolled_canvas.rb +20 -4
  324. data/lib/wx/doc/gen/scrolled_control.rb +20 -4
  325. data/lib/wx/doc/gen/scrolled_window.rb +20 -4
  326. data/lib/wx/doc/gen/search_ctrl.rb +6 -0
  327. data/lib/wx/doc/gen/simplebook.rb +7 -0
  328. data/lib/wx/doc/gen/single_choice_dialog.rb +3 -1
  329. data/lib/wx/doc/gen/sizer.rb +79 -9
  330. data/lib/wx/doc/gen/sizer_item.rb +16 -2
  331. data/lib/wx/doc/gen/slider.rb +23 -0
  332. data/lib/wx/doc/gen/spin_button.rb +9 -0
  333. data/lib/wx/doc/gen/spin_ctrl.rb +11 -0
  334. data/lib/wx/doc/gen/spin_ctrl_double.rb +7 -0
  335. data/lib/wx/doc/gen/spin_double_event.rb +4 -1
  336. data/lib/wx/doc/gen/spin_event.rb +2 -1
  337. data/lib/wx/doc/gen/splash_screen.rb +2 -0
  338. data/lib/wx/doc/gen/splitter_event.rb +10 -1
  339. data/lib/wx/doc/gen/splitter_window.rb +38 -14
  340. data/lib/wx/doc/gen/static_bitmap.rb +99 -2
  341. data/lib/wx/doc/gen/static_box.rb +6 -0
  342. data/lib/wx/doc/gen/static_box_sizer.rb +3 -0
  343. data/lib/wx/doc/gen/static_line.rb +4 -0
  344. data/lib/wx/doc/gen/static_text.rb +5 -0
  345. data/lib/wx/doc/gen/status_bar.rb +17 -3
  346. data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +174 -6
  347. data/lib/wx/doc/gen/stc/styled_text_event.rb +27 -1
  348. data/lib/wx/doc/gen/std_dialog_button_sizer.rb +7 -0
  349. data/lib/wx/doc/gen/svg_file_dc.rb +9 -0
  350. data/lib/wx/doc/gen/system_options.rb +8 -0
  351. data/lib/wx/doc/gen/system_settings.rb +7 -0
  352. data/lib/wx/doc/gen/task_bar_button.rb +12 -0
  353. data/lib/wx/doc/gen/task_bar_icon.rb +5 -0
  354. data/lib/wx/doc/gen/task_bar_icon_event.rb +2 -1
  355. data/lib/wx/doc/gen/text_attr.rb +27 -0
  356. data/lib/wx/doc/gen/text_ctrl.rb +27 -3
  357. data/lib/wx/doc/gen/text_entry.rb +43 -9
  358. data/lib/wx/doc/gen/text_entry_dialog.rb +12 -0
  359. data/lib/wx/doc/gen/text_validator.rb +16 -0
  360. data/lib/wx/doc/gen/time_picker_ctrl.rb +6 -0
  361. data/lib/wx/doc/gen/timer.rb +8 -0
  362. data/lib/wx/doc/gen/timer_event.rb +1 -0
  363. data/lib/wx/doc/gen/tip_provider.rb +5 -0
  364. data/lib/wx/doc/gen/toggle_button.rb +68 -0
  365. data/lib/wx/doc/gen/tool_bar.rb +57 -14
  366. data/lib/wx/doc/gen/tool_tip.rb +6 -0
  367. data/lib/wx/doc/gen/toolbook.rb +3 -0
  368. data/lib/wx/doc/gen/top_level_window.rb +34 -3
  369. data/lib/wx/doc/gen/tree_ctrl.rb +49 -0
  370. data/lib/wx/doc/gen/tree_event.rb +7 -1
  371. data/lib/wx/doc/gen/treebook.rb +9 -0
  372. data/lib/wx/doc/gen/ui_action_simulator.rb +4 -0
  373. data/lib/wx/doc/gen/utils.rb +55 -16
  374. data/lib/wx/doc/gen/v_list_box.rb +21 -0
  375. data/lib/wx/doc/gen/v_scrolled_window.rb +15 -0
  376. data/lib/wx/doc/gen/validator.rb +9 -13
  377. data/lib/wx/doc/gen/variant.rb +6 -0
  378. data/lib/wx/doc/gen/window.rb +260 -52
  379. data/lib/wx/doc/gen/window_dc.rb +2 -0
  380. data/lib/wx/doc/gen/window_disabler.rb +1 -0
  381. data/lib/wx/doc/gen/with_images.rb +7 -1
  382. data/lib/wx/doc/gen/wizard.rb +18 -0
  383. data/lib/wx/doc/gen/wizard_event.rb +3 -1
  384. data/lib/wx/doc/gen/wizard_page.rb +5 -0
  385. data/lib/wx/doc/gen/wizard_page_simple.rb +4 -0
  386. data/lib/wx/doc/gen/wrap_sizer.rb +5 -0
  387. data/lib/wx/doc/gen/xml_node.rb +14 -0
  388. data/lib/wx/doc/gen/xml_resource.rb +22 -0
  389. data/lib/wx/doc/generic_validator.rb +95 -0
  390. data/lib/wx/doc/html/simple_html_listbox.rb +22 -0
  391. data/lib/wx/doc/num_validator.rb +387 -0
  392. data/lib/wx/doc/owner_drawn_combobox.rb +96 -0
  393. data/lib/wx/doc/persistence_manager.rb +36 -0
  394. data/lib/wx/doc/persistent_object.rb +27 -0
  395. data/lib/wx/doc/pg/numeric_property_validator.rb +33 -0
  396. data/lib/wx/doc/static_bitmap.rb +25 -0
  397. data/lib/wx/doc/text_validator.rb +10 -0
  398. data/lib/wx/doc/top_level_window.rb +19 -0
  399. data/lib/wx/doc/treebook.rb +6 -1
  400. data/lib/wx/doc/validator.rb +113 -0
  401. data/lib/wx/doc/window.rb +30 -0
  402. data/lib/wx/html/events/evt_list.rb +0 -10
  403. data/lib/wx/html/simple_html_listbox.rb +24 -91
  404. data/lib/wx/keyword_defs.rb +34 -2
  405. data/lib/wx/rbn/ribbon_gallery.rb +0 -21
  406. data/lib/wx/version.rb +1 -1
  407. data/lib/wxruby_aui.so +0 -0
  408. data/lib/wxruby_core.so +0 -0
  409. data/lib/wxruby_grid.so +0 -0
  410. data/lib/wxruby_html.so +0 -0
  411. data/lib/wxruby_pg.so +0 -0
  412. data/lib/wxruby_prt.so +0 -0
  413. data/lib/wxruby_rbn.so +0 -0
  414. data/lib/wxruby_rtc.so +0 -0
  415. data/lib/wxruby_stc.so +0 -0
  416. data/rakelib/lib/config/mingw.rb +12 -0
  417. data/samples/aui/aui.rb +1237 -1233
  418. data/samples/calendar/calendar.rb +293 -289
  419. data/samples/controls/get_item_sample.rb +83 -79
  420. data/samples/controls/htlbox.rb +331 -327
  421. data/samples/dialogs/dialogs.rb +682 -694
  422. data/samples/dialogs/wizard.rb +52 -55
  423. data/samples/dragdrop/dragdrop.rb +146 -142
  424. data/samples/drawing/bitmap.rb +29 -26
  425. data/samples/drawing/bitmap_image.rb +84 -80
  426. data/samples/drawing/graphics_drawing.rb +209 -205
  427. data/samples/drawing/image_prt.rb +344 -340
  428. data/samples/drawing/maths_images.rb +18 -1
  429. data/samples/drawing/rmagic_bitmap_image.rb +88 -84
  430. data/samples/etc/caret.rb +306 -0
  431. data/samples/etc/miniframe.rb +65 -60
  432. data/samples/etc/sash.rb +109 -105
  433. data/samples/etc/scrollwin.rb +86 -80
  434. data/samples/etc/system_settings.rb +216 -209
  435. data/samples/event/activation.rb +72 -67
  436. data/samples/event/event.rb +160 -153
  437. data/samples/event/threaded.rb +8 -1
  438. data/samples/event/update_ui_event.rb +67 -60
  439. data/samples/grid/grid.rb +188 -181
  440. data/samples/grid/gridtablebase.rb +136 -129
  441. data/samples/html/html.rb +208 -204
  442. data/samples/mdi/mdi.rb +59 -54
  443. data/samples/minimal/minimal.rb +54 -51
  444. data/samples/minimal/nothing.rb +1 -0
  445. data/samples/printing/printing.rb +367 -377
  446. data/samples/printing/printing2.rb +203 -198
  447. data/samples/propgrid/propgrid.rb +2312 -2308
  448. data/samples/propgrid/propgrid_minimal.rb +57 -50
  449. data/samples/ribbon/ribbon.rb +780 -774
  450. data/samples/sampler/ext.rb +0 -33
  451. data/samples/sampler/sample.rb +4 -9
  452. data/samples/sampler.rb +1 -1
  453. data/samples/splash/splash.rb +118 -116
  454. data/samples/text/rich_textctrl.rb +207 -201
  455. data/samples/text/richtext.rb +1409 -1405
  456. data/samples/text/scintilla.rb +137 -128
  457. data/samples/text/textctrl.rb +89 -83
  458. data/samples/text/unicode.rb +175 -168
  459. data/samples/treectrl/treectrl.rb +1430 -1426
  460. data/samples/widgets/activityindicator.rb +95 -0
  461. data/samples/widgets/art/widgets/activityindicator.xpm +278 -0
  462. data/samples/widgets/art/widgets/bmpbtn.xpm +37 -0
  463. data/samples/widgets/art/widgets/bmpcombobox.xpm +54 -0
  464. data/samples/widgets/art/widgets/button.xpm +54 -0
  465. data/samples/widgets/art/widgets/checkbox.xpm +54 -0
  466. data/samples/{bigdemo/icons → widgets/art/widgets}/choice.xpm +1 -1
  467. data/samples/widgets/art/widgets/choicebk.xpm +54 -0
  468. data/samples/widgets/art/widgets/clrpicker.xpm +193 -0
  469. data/samples/widgets/art/widgets/combobox.xpm +54 -0
  470. data/samples/widgets/art/widgets/datepick.xpm +200 -0
  471. data/samples/widgets/art/widgets/dirctrl.xpm +54 -0
  472. data/samples/widgets/art/widgets/dirpicker.xpm +213 -0
  473. data/samples/widgets/art/widgets/filepicker.xpm +214 -0
  474. data/samples/widgets/art/widgets/fontpicker.xpm +185 -0
  475. data/samples/widgets/art/widgets/gauge.xpm +54 -0
  476. data/samples/widgets/art/widgets/header.xpm +54 -0
  477. data/samples/widgets/art/widgets/hyperlnk.xpm +54 -0
  478. data/samples/widgets/art/widgets/listbook.xpm +54 -0
  479. data/samples/widgets/art/widgets/listbox.xpm +54 -0
  480. data/samples/widgets/art/widgets/native.xpm +81 -0
  481. data/samples/widgets/art/widgets/notebook.xpm +54 -0
  482. data/samples/widgets/art/widgets/odcombobox.xpm +54 -0
  483. data/samples/widgets/art/widgets/radiobox.xpm +54 -0
  484. data/samples/widgets/art/widgets/scrolbar.xpm +54 -0
  485. data/samples/widgets/art/widgets/slider.xpm +54 -0
  486. data/samples/widgets/art/widgets/spinbtn.xpm +40 -0
  487. data/samples/widgets/art/widgets/statbmp.xpm +40 -0
  488. data/samples/widgets/art/widgets/statbox.xpm +54 -0
  489. data/samples/widgets/art/widgets/stattext.xpm +54 -0
  490. data/samples/widgets/art/widgets/text.xpm +54 -0
  491. data/samples/widgets/art/widgets/timepick.xpm +207 -0
  492. data/samples/widgets/art/widgets/toggle.xpm +54 -0
  493. data/samples/widgets/art/widgets/toucan.png +0 -0
  494. data/samples/widgets/bmpcombobox.rb +651 -0
  495. data/samples/widgets/button.rb +462 -0
  496. data/samples/widgets/checkbox.rb +211 -0
  497. data/samples/widgets/choice.rb +287 -0
  498. data/samples/widgets/clrpicker.rb +156 -0
  499. data/samples/widgets/combobox.rb +516 -0
  500. data/samples/widgets/datepick.rb +215 -0
  501. data/samples/widgets/dirctrl.rb +265 -0
  502. data/samples/widgets/dirpicker.rb +158 -0
  503. data/samples/widgets/editlbox.rb +122 -0
  504. data/samples/widgets/filectrl.rb +216 -0
  505. data/samples/widgets/filepicker.rb +214 -0
  506. data/samples/widgets/fontpicker.rb +135 -0
  507. data/samples/widgets/gauge.rb +311 -0
  508. data/samples/widgets/headerctrl.rb +236 -0
  509. data/samples/widgets/hyperlink.rb +203 -0
  510. data/samples/widgets/itemcontainer.rb +185 -0
  511. data/samples/widgets/listbox.rb +473 -0
  512. data/samples/widgets/notebook.rb +488 -0
  513. data/samples/widgets/odcombobox.rb +608 -0
  514. data/samples/widgets/radiobox.rb +328 -0
  515. data/samples/widgets/searchctrl.rb +159 -0
  516. data/samples/widgets/slider.rb +594 -0
  517. data/samples/widgets/spinbtn.rb +443 -0
  518. data/samples/widgets/statbmp.rb +130 -0
  519. data/samples/widgets/static.rb +436 -0
  520. data/samples/widgets/textctrl.rb +700 -0
  521. data/samples/widgets/timepick.rb +148 -0
  522. data/samples/widgets/tn_widgets.png +0 -0
  523. data/samples/widgets/toggle.rb +385 -0
  524. data/samples/widgets/widgets.rb +1229 -0
  525. data/samples/xrc/custom_xrc_sample.rb +47 -41
  526. data/samples/xrc/xrc_sample.rb +53 -47
  527. data/tests/test_config.rb +207 -42
  528. data/tests/test_event_handling.rb +52 -34
  529. data/tests/test_events.rb +7 -0
  530. data/tests/test_item_data.rb +24 -0
  531. data/tests/test_persistence.rb +142 -0
  532. data/tests/test_sizer.rb +44 -1
  533. data/tests/test_validators.rb +805 -0
  534. metadata +103 -137
  535. data/lib/wx/core/choice.rb +0 -14
  536. data/lib/wx/core/combo_ctrl.rb +0 -110
  537. data/samples/bigdemo/About.rbw +0 -39
  538. data/samples/bigdemo/ColorPanel.rbw +0 -23
  539. data/samples/bigdemo/GridSimple.rbw +0 -78
  540. data/samples/bigdemo/MDIDemo.rbw +0 -57
  541. data/samples/bigdemo/PopupMenu.rbw +0 -146
  542. data/samples/bigdemo/ShapedWindow.rbw +0 -128
  543. data/samples/bigdemo/Sizers.rbw +0 -541
  544. data/samples/bigdemo/bigdemo.rb +0 -817
  545. data/samples/bigdemo/demoTemplate.rbw +0 -33
  546. data/samples/bigdemo/helpfile.htb +0 -0
  547. data/samples/bigdemo/icons/Test 015.jpg +0 -0
  548. data/samples/bigdemo/icons/Test 015.png +0 -0
  549. data/samples/bigdemo/icons/choice.bmp +0 -0
  550. data/samples/bigdemo/icons/combo.bmp +0 -0
  551. data/samples/bigdemo/icons/combo.xpm +0 -27
  552. data/samples/bigdemo/icons/copy.xpm +0 -25
  553. data/samples/bigdemo/icons/cut.xpm +0 -24
  554. data/samples/bigdemo/icons/gauge.bmp +0 -0
  555. data/samples/bigdemo/icons/gauge.xpm +0 -27
  556. data/samples/bigdemo/icons/help.xpm +0 -25
  557. data/samples/bigdemo/icons/list.bmp +0 -0
  558. data/samples/bigdemo/icons/list.xpm +0 -27
  559. data/samples/bigdemo/icons/mondrian.ico +0 -0
  560. data/samples/bigdemo/icons/mondrian.xpm +0 -44
  561. data/samples/bigdemo/icons/new.xpm +0 -24
  562. data/samples/bigdemo/icons/ogl.ico +0 -0
  563. data/samples/bigdemo/icons/ogl.xpm +0 -45
  564. data/samples/bigdemo/icons/open.xpm +0 -26
  565. data/samples/bigdemo/icons/paste.bmp +0 -0
  566. data/samples/bigdemo/icons/paste.xpm +0 -38
  567. data/samples/bigdemo/icons/pointy.png +0 -0
  568. data/samples/bigdemo/icons/preview.xpm +0 -26
  569. data/samples/bigdemo/icons/print.xpm +0 -26
  570. data/samples/bigdemo/icons/radio.bmp +0 -0
  571. data/samples/bigdemo/icons/radio.xpm +0 -27
  572. data/samples/bigdemo/icons/robert.xpm +0 -415
  573. data/samples/bigdemo/icons/sashtest.ico +0 -0
  574. data/samples/bigdemo/icons/save.xpm +0 -25
  575. data/samples/bigdemo/icons/smiles.bmp +0 -0
  576. data/samples/bigdemo/icons/smiles.xpm +0 -39
  577. data/samples/bigdemo/icons/smiley.ico +0 -0
  578. data/samples/bigdemo/icons/smiley.xpm +0 -42
  579. data/samples/bigdemo/icons/stattext.xpm +0 -24
  580. data/samples/bigdemo/icons/test2.bmp +0 -0
  581. data/samples/bigdemo/icons/test2.png +0 -0
  582. data/samples/bigdemo/icons/test2.xpm +0 -79
  583. data/samples/bigdemo/icons/text.bmp +0 -0
  584. data/samples/bigdemo/icons/text.xpm +0 -27
  585. data/samples/bigdemo/icons/tog1.bmp +0 -0
  586. data/samples/bigdemo/icons/tog1.xpm +0 -38
  587. data/samples/bigdemo/icons/tog2.bmp +0 -0
  588. data/samples/bigdemo/icons/tog2.xpm +0 -38
  589. data/samples/bigdemo/icons/wxruby-128x128.png +0 -0
  590. data/samples/bigdemo/icons/wxwin.ico +0 -0
  591. data/samples/bigdemo/icons/wxwin16x16.png +0 -0
  592. data/samples/bigdemo/icons/wxwin16x16.xpm +0 -25
  593. data/samples/bigdemo/icons/wxwin32x32.png +0 -0
  594. data/samples/bigdemo/icons/wxwin48x48.png +0 -0
  595. data/samples/bigdemo/run.rb +0 -98
  596. data/samples/bigdemo/tips.txt +0 -7
  597. data/samples/bigdemo/utils.rb +0 -20
  598. data/samples/bigdemo/wxArtProvider.rbw +0 -282
  599. data/samples/bigdemo/wxBitmapButton.rbw +0 -65
  600. data/samples/bigdemo/wxButton.rbw +0 -64
  601. data/samples/bigdemo/wxCalendarCtrl.rbw +0 -59
  602. data/samples/bigdemo/wxCheckBox.rbw +0 -50
  603. data/samples/bigdemo/wxCheckListBox.rbw +0 -65
  604. data/samples/bigdemo/wxChoice.rbw +0 -47
  605. data/samples/bigdemo/wxChoicebook.rbw +0 -78
  606. data/samples/bigdemo/wxColourDialog.rbw +0 -33
  607. data/samples/bigdemo/wxComboBox.rbw +0 -77
  608. data/samples/bigdemo/wxCursor.rbw +0 -136
  609. data/samples/bigdemo/wxDialog.rbw +0 -74
  610. data/samples/bigdemo/wxDirDialog.rbw +0 -29
  611. data/samples/bigdemo/wxDragImage.rbw +0 -70
  612. data/samples/bigdemo/wxFileDialog.rbw +0 -37
  613. data/samples/bigdemo/wxFileDialog_Save.rbw +0 -35
  614. data/samples/bigdemo/wxFindReplaceDialog.rbw +0 -82
  615. data/samples/bigdemo/wxFontDialog.rbw +0 -200
  616. data/samples/bigdemo/wxFrame.rbw +0 -53
  617. data/samples/bigdemo/wxGauge.rbw +0 -65
  618. data/samples/bigdemo/wxGenericDirCtrl.rbw +0 -74
  619. data/samples/bigdemo/wxGrid.rbw +0 -66
  620. data/samples/bigdemo/wxHtmlHelpController.rbw +0 -52
  621. data/samples/bigdemo/wxListBox.rbw +0 -140
  622. data/samples/bigdemo/wxListCtrl_virtual.rbw +0 -112
  623. data/samples/bigdemo/wxMDIWindows.rbw +0 -50
  624. data/samples/bigdemo/wxMenu.rbw +0 -247
  625. data/samples/bigdemo/wxMessageDialog.rbw +0 -27
  626. data/samples/bigdemo/wxMiniFrame.rbw +0 -70
  627. data/samples/bigdemo/wxMultipleChoiceDialog.rbw +0 -29
  628. data/samples/bigdemo/wxNotebook.rbw +0 -136
  629. data/samples/bigdemo/wxProgressDialog.rbw +0 -43
  630. data/samples/bigdemo/wxRadioBox.rbw +0 -72
  631. data/samples/bigdemo/wxRadioButton.rbw +0 -125
  632. data/samples/bigdemo/wxSashWindow.rbw +0 -141
  633. data/samples/bigdemo/wxScrolledMessageDialog.rbw +0 -57
  634. data/samples/bigdemo/wxScrolledWindow.rbw +0 -199
  635. data/samples/bigdemo/wxSingleChoiceDialog.rbw +0 -33
  636. data/samples/bigdemo/wxSlider.rbw +0 -42
  637. data/samples/bigdemo/wxSpinButton.rbw +0 -50
  638. data/samples/bigdemo/wxSpinCtrl.rbw +0 -51
  639. data/samples/bigdemo/wxSplitterWindow.rbw +0 -63
  640. data/samples/bigdemo/wxStaticBitmap.rbw +0 -47
  641. data/samples/bigdemo/wxStaticText.rbw +0 -55
  642. data/samples/bigdemo/wxStatusBar.rbw +0 -126
  643. data/samples/bigdemo/wxTextCtrl.rbw +0 -149
  644. data/samples/bigdemo/wxTextEntryDialog.rbw +0 -31
  645. data/samples/bigdemo/wxToggleButton.rbw +0 -49
  646. data/samples/bigdemo/wxToolBar.rbw +0 -131
  647. data/samples/bigdemo/wxTreeCtrl.rbw +0 -191
  648. data/samples/caret/caret.rb +0 -298
  649. data/samples/caret/mondrian.xpm +0 -44
  650. data/samples/controls/books.rb +0 -189
  651. data/samples/controls/choice.xpm +0 -27
  652. data/samples/controls/combo.xpm +0 -27
  653. data/samples/controls/controls.rb +0 -1099
  654. data/samples/controls/gauge.xpm +0 -27
  655. data/samples/controls/list.xpm +0 -27
  656. data/samples/controls/mondrian.ico +0 -0
  657. data/samples/controls/mondrian.xpm +0 -44
  658. data/samples/controls/radio.xpm +0 -27
  659. data/samples/controls/stattext.xpm +0 -24
  660. data/samples/controls/test2.bmp +0 -0
  661. data/samples/controls/text.xpm +0 -27
  662. data/samples/controls/tn_books.png +0 -0
  663. data/samples/controls/tn_controls.png +0 -0
  664. data/samples/etc/choice.rb +0 -87
  665. data/samples/etc/tn_choice.png +0 -0
  666. data/samples/text/mondrian.ico +0 -0
  667. data/samples/text/mondrian.xpm +0 -44
  668. /data/samples/{caret → etc}/tn_caret.png +0 -0
@@ -8,872 +8,878 @@
8
8
 
9
9
  require 'wx'
10
10
 
11
- class MyFrame < Wx::Frame
12
-
13
- module ID
14
- %i[
15
- CIRCLE
16
- CROSS
17
- TRIANGLE
18
- SQUARE
19
- POLYGON
20
- SELECTION_EXPAND_H
21
- SELECTION_EXPAND_V
22
- SELECTION_CONTRACT
23
- BUTTON_XX
24
- BUTTON_XY
25
- PRIMARY_COLOUR
26
- SECONDARY_COLOUR
27
- DEFAULT_PROVIDER
28
- AUI_PROVIDER
29
- MSW_PROVIDER
30
- MAIN_TOOLBAR
31
- POSITION_TOP
32
- POSITION_TOP_ICONS
33
- POSITION_TOP_BOTH
34
- POSITION_LEFT
35
- POSITION_LEFT_LABELS
36
- POSITION_LEFT_BOTH
37
- TOGGLE_PANELS
38
- ENABLE
39
- DISABLE
40
- DISABLED
41
- UI_ENABLE_UPDATED
42
- CHECK
43
- UI_CHECK_UPDATED
44
- CHANGE_TEXT1
45
- CHANGE_TEXT2
46
- UI_CHANGE_TEXT_UPDATED
47
- REMOVE_PAGE
48
- HIDE_PAGES
49
- SHOW_PAGES
50
- PLUS_MINUS
51
- CHANGE_LABEL
52
- SMALL_BUTTON_1
53
- SMALL_BUTTON_2
54
- SMALL_BUTTON_3
55
- SMALL_BUTTON_4
56
- SMALL_BUTTON_5
57
- SMALL_BUTTON_6
58
- ].each_with_index { |sym, ix| self.const_set(sym, Wx::ID_HIGHEST+1+ix) }
59
- end
11
+ module Ribbon
12
+
13
+ class MyFrame < Wx::Frame
14
+
15
+ module ID
16
+ %i[
17
+ CIRCLE
18
+ CROSS
19
+ TRIANGLE
20
+ SQUARE
21
+ POLYGON
22
+ SELECTION_EXPAND_H
23
+ SELECTION_EXPAND_V
24
+ SELECTION_CONTRACT
25
+ BUTTON_XX
26
+ BUTTON_XY
27
+ PRIMARY_COLOUR
28
+ SECONDARY_COLOUR
29
+ DEFAULT_PROVIDER
30
+ AUI_PROVIDER
31
+ MSW_PROVIDER
32
+ MAIN_TOOLBAR
33
+ POSITION_TOP
34
+ POSITION_TOP_ICONS
35
+ POSITION_TOP_BOTH
36
+ POSITION_LEFT
37
+ POSITION_LEFT_LABELS
38
+ POSITION_LEFT_BOTH
39
+ TOGGLE_PANELS
40
+ ENABLE
41
+ DISABLE
42
+ DISABLED
43
+ UI_ENABLE_UPDATED
44
+ CHECK
45
+ UI_CHECK_UPDATED
46
+ CHANGE_TEXT1
47
+ CHANGE_TEXT2
48
+ UI_CHANGE_TEXT_UPDATED
49
+ REMOVE_PAGE
50
+ HIDE_PAGES
51
+ SHOW_PAGES
52
+ PLUS_MINUS
53
+ CHANGE_LABEL
54
+ SMALL_BUTTON_1
55
+ SMALL_BUTTON_2
56
+ SMALL_BUTTON_3
57
+ SMALL_BUTTON_4
58
+ SMALL_BUTTON_5
59
+ SMALL_BUTTON_6
60
+ ].each_with_index { |sym, ix| self.const_set(sym, Wx::ID_HIGHEST+1+ix) }
61
+ end
60
62
 
61
- def initialize
62
- super(nil, Wx::ID_ANY, "wxRibbon Sample Application", size: [800, 600], style: Wx::DEFAULT_FRAME_STYLE)
63
-
64
- @colour_data = Wx::ColourData.new
65
- @ribbon = Wx::RBN::RibbonBar.new(self, Wx::ID_ANY,
66
- style: Wx::RBN::RIBBON_BAR_FLOW_HORIZONTAL |
67
- Wx::RBN::RIBBON_BAR_SHOW_PAGE_LABELS |
68
- Wx::RBN::RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS |
69
- Wx::RBN::RIBBON_BAR_SHOW_TOGGLE_BUTTON |
70
- Wx::RBN::RIBBON_BAR_SHOW_HELP_BUTTON)
71
-
72
- home = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Examples", bitmap_(:ribbon_xpm))
73
- toolbar_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Toolbar",
74
- style: Wx::RBN::RIBBON_PANEL_NO_AUTO_MINIMISE |
75
- Wx::RBN::RIBBON_PANEL_EXT_BUTTON)
76
- toolbar = Wx::RBN::RibbonToolBar.new(toolbar_panel, ID::MAIN_TOOLBAR)
77
- toolbar.add_toggle_tool(Wx::ID_JUSTIFY_LEFT, bitmap_(:align_left_xpm))
78
- toolbar.add_toggle_tool(Wx::ID_JUSTIFY_CENTER , bitmap_(:align_center_xpm))
79
- toolbar.add_toggle_tool(Wx::ID_JUSTIFY_RIGHT, bitmap_(:align_right_xpm))
80
- toolbar.add_separator
81
- toolbar.add_hybrid_tool(Wx::ID_NEW, Wx::ArtProvider.get_bitmap(Wx::ART_NEW, Wx::ART_OTHER, Wx::Size.new(16, 15)))
82
- toolbar.add_tool(Wx::ID_OPEN, Wx::ArtProvider.get_bitmap(Wx::ART_FILE_OPEN, Wx::ART_OTHER, Wx::Size.new(16, 15)), "Open something")
83
- toolbar.add_tool(Wx::ID_SAVE, Wx::ArtProvider.get_bitmap(Wx::ART_FILE_SAVE, Wx::ART_OTHER, Wx::Size.new(16, 15)), "Save something")
84
- toolbar.add_tool(Wx::ID_SAVEAS, Wx::ArtProvider.get_bitmap(Wx::ART_FILE_SAVE_AS, Wx::ART_OTHER, Wx::Size.new(16, 15)), "Save something as ...")
85
- toolbar.enable_tool(Wx::ID_OPEN, false)
86
- toolbar.enable_tool(Wx::ID_SAVE, false)
87
- toolbar.enable_tool(Wx::ID_SAVEAS, false)
88
- toolbar.add_separator
89
- toolbar.add_dropdown_tool(Wx::ID_UNDO, Wx::ArtProvider.get_bitmap(Wx::ART_UNDO, Wx::ART_OTHER, Wx::Size.new(16, 15)))
90
- toolbar.add_dropdown_tool(Wx::ID_REDO, Wx::ArtProvider.get_bitmap(Wx::ART_REDO, Wx::ART_OTHER, Wx::Size.new(16, 15)))
91
- toolbar.add_separator
92
- toolbar.add_tool(Wx::ID_ANY, Wx::ArtProvider.get_bitmap(Wx::ART_REPORT_VIEW, Wx::ART_OTHER, Wx::Size.new(16, 15)))
93
- toolbar.add_tool(Wx::ID_ANY, Wx::ArtProvider.get_bitmap(Wx::ART_LIST_VIEW, Wx::ART_OTHER, Wx::Size.new(16, 15)))
94
- toolbar.add_separator
95
- toolbar.add_hybrid_tool(ID::POSITION_LEFT, bitmap_(:position_left_xpm),
96
- "Align ribbonbar vertically\non the left\nfor demonstration purposes")
97
- toolbar.add_hybrid_tool(ID::POSITION_TOP, bitmap_(:position_top_xpm),
98
- "Align the ribbonbar horizontally\nat the top\nfor demonstration purposes")
99
- toolbar.add_separator
100
- prt_tool = toolbar.add_hybrid_tool(Wx::ID_PRINT, Wx::ArtProvider.get_bitmap(Wx::ART_PRINT, Wx::ART_OTHER, Wx::Size.new(16, 15)),
101
- "This is the Print button tooltip\ndemonstrating a tooltip")
102
- toolbar.set_rows(2, 3)
103
-
104
- if toolbar.tool_count != (toolbar.tool_pos(prt_tool)+1)
105
- Wx.log_error('Wx::RibbonToolBar::get_tool_count or Wx::RibbonToolBar::get_tool_pos is broken')
106
- elsif Wx::ID_PRINT != toolbar.tool_by_pos(toolbar.tool_pos(prt_tool))
107
- Wx.log_error('Wx::RibbonToolBar::get_tool_by_pos is broken')
108
- end
109
-
110
- selection_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Selection", bitmap_(:selection_panel_xpm))
111
- selection = Wx::RBN::RibbonButtonBar.new(selection_panel)
112
- selection.add_button(ID::SELECTION_EXPAND_V, "Expand Vertically", bitmap_(:expand_selection_v_xpm),
113
- "This is a tooltip for Expand Vertically\ndemonstrating a tooltip")
114
- selection.add_button(ID::SELECTION_EXPAND_H, "Expand Horizontally", bitmap_(:expand_selection_h_xpm), '')
115
- selection.add_button(ID::SELECTION_CONTRACT, "Contract", bitmap_(:auto_crop_selection_xpm), bitmap_(:auto_crop_selection_small_xpm))
116
-
117
- shapes_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Shapes", bitmap_(:circle_small_xpm))
118
- shapes = Wx::RBN::RibbonButtonBar.new(shapes_panel)
119
- shapes.add_button(ID::CIRCLE, "Circle", bitmap_(:circle_xpm), bitmap_(:circle_small_xpm),
120
- Wx::NULL_BITMAP, Wx::NULL_BITMAP, Wx::RBN::RIBBON_BUTTON_NORMAL,
121
- "This is a tooltip for the circle button\ndemonstrating another tooltip")
122
- shapes.add_button(ID::CROSS, "Cross", bitmap_(:cross_xpm), '')
123
- shapes.add_hybrid_button(ID::TRIANGLE, "Triangle", bitmap_(:triangle_xpm))
124
- shapes.add_button(ID::SQUARE, "Square", bitmap_(:square_xpm), '')
125
- shapes.add_dropdown_button(ID::POLYGON, "Other Polygon", bitmap_(:hexagon_xpm), '')
126
-
127
- sizer_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Panel with Sizer",
128
- style: Wx::RBN::RIBBON_PANEL_DEFAULT_STYLE)
129
-
130
- as = ["Item 1 using a box sizer now", "Item 2 using a box sizer now"]
131
- sizer_panelcombo = Wx::ComboBox.new(sizer_panel, Wx::ID_ANY,
132
- choices: as, style: Wx::CB_READONLY)
133
-
134
- sizer_panelcombo2 = Wx::ComboBox.new(sizer_panel, Wx::ID_ANY,
135
- choices: as, style: Wx::CB_READONLY)
136
-
137
- sizer_panelcombo.select(0)
138
- sizer_panelcombo2.select(1)
139
- sizer_panelcombo.set_min_size(Wx::Size.new(150, -1))
140
- sizer_panelcombo2.set_min_size(Wx::Size.new(150, -1))
141
-
142
- bar = Wx::RBN::RibbonButtonBar.new(sizer_panel, Wx::ID_ANY)
143
- bar.add_button(ID::BUTTON_XX, "xx", bitmap_(:ribbon_xpm))
144
- bar.add_button(ID::BUTTON_XY, "xy", bitmap_(:ribbon_xpm))
145
- # This prevents ribbon buttons in panels with sizer from collapsing.
146
- bar.set_button_min_size_class(ID::BUTTON_XX, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_LARGE)
147
- bar.set_button_min_size_class(ID::BUTTON_XY, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_LARGE)
148
-
149
- sizer_panelsizer_h = Wx::BoxSizer.new(Wx::HORIZONTAL)
150
- sizer_panelsizer_v = Wx::BoxSizer.new(Wx::VERTICAL)
151
- sizer_panelsizer_v.add_stretch_spacer(1)
152
- sizer_panelsizer_v.add(sizer_panelcombo, 0, Wx::ALL|Wx::EXPAND, 2)
153
- sizer_panelsizer_v.add(sizer_panelcombo2, 0, Wx::ALL|Wx::EXPAND, 2)
154
- sizer_panelsizer_v.add_stretch_spacer(1)
155
- sizer_panelsizer_h.add(bar, 0, Wx::EXPAND)
156
- sizer_panelsizer_h.add(sizer_panelsizer_v, 0)
157
- sizer_panel.set_sizer(sizer_panelsizer_h)
158
-
159
- @label_font = Wx::Font.new(Wx::FontInfo.new(8).light)
160
-
161
- scheme = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Appearance", bitmap_(:eye_xpm))
162
- @default_primary = Wx::Colour.new
163
- @default_secondary = Wx::Colour.new
164
- @default_tertiary = Wx::Colour.new
165
- @ribbon.get_art_provider.get_colour_scheme(@default_primary, @default_secondary, @default_tertiary)
166
- provider_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
167
- "Art", style: Wx::RBN::RIBBON_PANEL_NO_AUTO_MINIMISE)
168
- provider_bar = Wx::RBN::RibbonButtonBar.new(provider_panel, Wx::ID_ANY)
169
- provider_bar.add_button(ID::DEFAULT_PROVIDER, "Default Provider",
170
- Wx::ArtProvider.get_bitmap(Wx::ART_QUESTION, Wx::ART_OTHER, Wx::Size.new(32, 32)))
171
- provider_bar.add_button(ID::AUI_PROVIDER, "AUI Provider", bitmap_(:aui_style_xpm))
172
- provider_bar.add_button(ID::MSW_PROVIDER, "MSW Provider", bitmap_(:msw_style_xpm))
173
- primary_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
174
- "Primary Colour", bitmap_(:colours_xpm))
175
- @primary_gallery = populate_colours_panel(primary_panel,
176
- @default_primary, ID::PRIMARY_COLOUR)
177
- secondary_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
178
- "Secondary Colour", bitmap_(:colours_xpm))
179
- @secondary_gallery = populate_colours_panel(secondary_panel,
180
- @default_secondary, ID::SECONDARY_COLOUR)
181
-
182
- page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "UI Updated", bitmap_(:ribbon_xpm))
183
- panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Enable/Disable", bitmap_(:ribbon_xpm))
184
- bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
185
- bar.add_button(ID::DISABLED, "Disabled", bitmap_(:ribbon_xpm))
186
- bar.add_button(ID::ENABLE, "Enable", bitmap_(:ribbon_xpm))
187
- bar.add_button(ID::DISABLE, "Disable", bitmap_(:ribbon_xpm))
188
- bar.add_button(ID::UI_ENABLE_UPDATED, "Enable UI updated", bitmap_(:ribbon_xpm))
189
- bar.enable_button(ID::DISABLED, false)
190
- @bEnabled = true
191
-
192
- panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Toggle", bitmap_(:ribbon_xpm))
193
- bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
194
- bar.add_button(ID::CHECK, "Toggle", bitmap_(:ribbon_xpm))
195
- bar.add_toggle_button(ID::UI_CHECK_UPDATED, "Toggled UI updated", bitmap_(:ribbon_xpm))
196
- @bChecked = true
197
-
198
- panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Change text", bitmap_(:ribbon_xpm))
199
- bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
200
- bar.add_button(ID::CHANGE_TEXT1, "One", bitmap_(:ribbon_xpm))
201
- bar.add_button(ID::CHANGE_TEXT2, "Two", bitmap_(:ribbon_xpm))
202
- bar.add_button(ID::UI_CHANGE_TEXT_UPDATED, "Zero", bitmap_(:ribbon_xpm))
203
-
204
- # Also set the general disabled text colour:
205
- artProvider = @ribbon.get_art_provider
206
- tColour = artProvider.get_color(Wx::RBN::RIBBON_ART_BUTTON_BAR_LABEL_COLOUR)
207
- artProvider.set_color(Wx::RBN::RIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR, tColour.make_disabled)
208
-
209
- Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Empty Page", bitmap_(:empty_xpm))
210
-
211
- page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Another Page", bitmap_(:empty_xpm))
212
- panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Page manipulation", bitmap_(:ribbon_xpm))
213
- bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
214
- bar.add_button(ID::REMOVE_PAGE, "Remove", Wx::ArtProvider.get_bitmap(Wx::ART_DELETE, Wx::ART_OTHER, Wx::Size.new(24, 24)))
215
- bar.add_button(ID::HIDE_PAGES, "Hide Pages", bitmap_(:ribbon_xpm))
216
- bar.add_button(ID::SHOW_PAGES, "Show Pages", bitmap_(:ribbon_xpm))
217
-
218
- panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Button bar manipulation", bitmap_(:ribbon_xpm))
219
- button_bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
220
- button_bar.add_button(ID::PLUS_MINUS, "+/-",
221
- Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, Wx::Size.new(24, 24)))
222
- @plus_minus_state = false
223
- button_bar.add_button(ID::CHANGE_LABEL, "short", bitmap_(:ribbon_xpm))
224
- button_bar.set_button_text_min_width(ID::CHANGE_LABEL, "some long text")
225
- @change_label_state = false
226
-
227
- panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Always medium buttons", bitmap_(:ribbon_xpm))
228
- bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
229
- bar.add_button(ID::SMALL_BUTTON_1, "Button 1", bitmap_(:ribbon_xpm))
230
- bar.set_button_max_size_class(ID::SMALL_BUTTON_1, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
231
- bar.add_button(ID::SMALL_BUTTON_2, "Button 2", bitmap_(:ribbon_xpm))
232
- bar.set_button_max_size_class(ID::SMALL_BUTTON_2, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
233
- bar.add_button(ID::SMALL_BUTTON_3, "Button 3", bitmap_(:ribbon_xpm))
234
- bar.add_button(ID::SMALL_BUTTON_4, "Button 4", bitmap_(:ribbon_xpm))
235
- bar.add_button(ID::SMALL_BUTTON_5, "Button 5", bitmap_(:ribbon_xpm))
236
- bar.set_button_max_size_class(ID::SMALL_BUTTON_5, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
237
- bar.add_button(ID::SMALL_BUTTON_6, "Button 6", bitmap_(:ribbon_xpm))
238
- bar.set_button_max_size_class(ID::SMALL_BUTTON_6, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
239
-
240
- Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Highlight Page", bitmap_(:empty_xpm))
241
- @ribbon.add_page_highlight(@ribbon.get_page_count-1)
242
-
243
-
244
- page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Advanced", bitmap_(:empty_xpm))
245
- panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Button bar manipulation", bitmap_(:ribbon_xpm))
246
- button_bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
247
- button_bar.add_button(ID::PLUS_MINUS, "+/-",
248
- Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, Wx::Size.new(24, 24)))
249
- @plus_minus_state = false
250
- button_bar.add_button(ID::CHANGE_LABEL, "short", bitmap_(:ribbon_xpm))
251
- button_bar.set_button_text_min_width(ID::CHANGE_LABEL, "some long text")
252
- @change_label_state = false
253
-
254
- panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Always medium buttons", bitmap_(:ribbon_xpm))
255
- bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
256
- bar.add_button(ID::SMALL_BUTTON_1, "Button 1", bitmap_(:ribbon_xpm))
257
- bar.set_button_max_size_class(ID::SMALL_BUTTON_1, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
258
- bar.add_button(ID::SMALL_BUTTON_2, "Button 2", bitmap_(:ribbon_xpm))
259
- bar.set_button_max_size_class(ID::SMALL_BUTTON_2, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
260
- bar.add_button(ID::SMALL_BUTTON_3, "Button 3", bitmap_(:ribbon_xpm))
261
- bar.add_button(ID::SMALL_BUTTON_4, "Button 4", bitmap_(:ribbon_xpm))
262
- bar.add_button(ID::SMALL_BUTTON_5, "Button 5", bitmap_(:ribbon_xpm))
263
- bar.set_button_max_size_class(ID::SMALL_BUTTON_5, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
264
- bar.add_button(ID::SMALL_BUTTON_6, "Button 6", bitmap_(:ribbon_xpm))
265
- bar.set_button_max_size_class(ID::SMALL_BUTTON_6, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
266
-
267
- @ribbon.realize
268
-
269
- @logwindow = Wx::TextCtrl.new(self, Wx::ID_ANY, style: Wx::TE_MULTILINE | Wx::TE_READONLY |
270
- Wx::TE_LEFT | Wx::TE_BESTWRAP | Wx::BORDER_NONE)
271
-
272
- @togglePanels = Wx::ToggleButton.new(self, ID::TOGGLE_PANELS, "&Toggle panels")
273
- @togglePanels.set_value(true)
274
-
275
- s = Wx::BoxSizer.new(Wx::VERTICAL)
276
-
277
- s.add(@ribbon, 0, Wx::EXPAND)
278
- s.add(@logwindow, 1, Wx::EXPAND)
279
- s.add(@togglePanels, Wx::SizerFlags.new.border)
280
-
281
- set_sizer(s)
282
-
283
- evt_ribbonbuttonbar_clicked(ID::ENABLE, :on_enable)
284
- evt_ribbonbuttonbar_clicked(ID::DISABLE, :on_disable)
285
- evt_ribbonbuttonbar_clicked(ID::DISABLED, :on_disabled)
286
- evt_ribbonbuttonbar_clicked(ID::UI_ENABLE_UPDATED, :on_enable_updated)
287
- evt_update_ui(ID::UI_ENABLE_UPDATED, :on_enable_update_ui)
288
- evt_ribbonbuttonbar_clicked(ID::CHECK, :on_check)
289
- evt_update_ui(ID::UI_CHECK_UPDATED, :on_check_update_ui)
290
- evt_ribbonbuttonbar_clicked(ID::CHANGE_TEXT1, :on_change_text1)
291
- evt_ribbonbuttonbar_clicked(ID::CHANGE_TEXT2, :on_change_text2)
292
- evt_update_ui(ID::UI_CHANGE_TEXT_UPDATED, :on_change_text_update_ui)
293
- evt_ribbonbuttonbar_clicked(ID::DEFAULT_PROVIDER, :on_default_provider)
294
- evt_ribbonbuttonbar_clicked(ID::AUI_PROVIDER, :on_aui_provider)
295
- evt_ribbonbuttonbar_clicked(ID::MSW_PROVIDER, :on_msw_provider)
296
- evt_ribbonbuttonbar_clicked(ID::SELECTION_EXPAND_H, :on_selection_expand_h_button)
297
- evt_ribbonbuttonbar_clicked(ID::SELECTION_EXPAND_V, :on_selection_expand_v_button)
298
- evt_ribbonbuttonbar_clicked(ID::SELECTION_CONTRACT, :on_selection_contract_button)
299
- evt_ribbonbuttonbar_clicked(ID::CIRCLE, :on_circle_button)
300
- evt_ribbonbuttonbar_clicked(ID::CROSS, :on_cross_button)
301
- evt_ribbonbuttonbar_clicked(ID::TRIANGLE, :on_triangle_button)
302
- evt_ribbonbuttonbar_clicked(ID::SQUARE, :on_square_button)
303
- evt_ribbonbuttonbar_dropdown_clicked(ID::TRIANGLE, :on_triangle_dropdown)
304
- evt_ribbonbuttonbar_dropdown_clicked(ID::POLYGON, :on_polygon_dropdown)
305
- evt_ribbongallery_hover_changed(ID::PRIMARY_COLOUR, :on_hovered_colour_change)
306
- evt_ribbongallery_hover_changed(ID::SECONDARY_COLOUR, :on_hovered_colour_change)
307
- evt_ribbongallery_selected(ID::PRIMARY_COLOUR, :on_primary_colour_select)
308
- evt_ribbongallery_selected(ID::SECONDARY_COLOUR, :on_secondary_colour_select)
309
- evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_LEFT, :on_justify)
310
- evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_CENTER, :on_justify)
311
- evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_RIGHT, :on_justify)
312
- evt_update_ui(Wx::ID_JUSTIFY_LEFT, :on_justify_update_ui)
313
- evt_update_ui(Wx::ID_JUSTIFY_CENTER, :on_justify_update_ui)
314
- evt_update_ui(Wx::ID_JUSTIFY_RIGHT, :on_justify_update_ui)
315
- evt_ribbontoolbar_clicked(Wx::ID_NEW, :on_new)
316
- evt_ribbontoolbar_dropdown_clicked(Wx::ID_NEW, :on_new_dropdown)
317
- evt_ribbontoolbar_clicked(Wx::ID_PRINT, :on_print)
318
- evt_ribbontoolbar_dropdown_clicked(Wx::ID_PRINT, :on_print_dropdown)
319
- evt_ribbontoolbar_dropdown_clicked(Wx::ID_REDO, :on_redo_dropdown)
320
- evt_ribbontoolbar_dropdown_clicked(Wx::ID_UNDO, :on_undo_dropdown)
321
- evt_ribbontoolbar_clicked(ID::POSITION_LEFT, :on_position_left)
322
- evt_ribbontoolbar_dropdown_clicked(ID::POSITION_LEFT, :on_position_left_dropdown)
323
- evt_ribbontoolbar_clicked(ID::POSITION_TOP, :on_position_top)
324
- evt_ribbontoolbar_dropdown_clicked(ID::POSITION_TOP, :on_position_top_dropdown)
325
- evt_button(ID::PRIMARY_COLOUR, :on_colour_gallery_button)
326
- evt_button(ID::SECONDARY_COLOUR, :on_colour_gallery_button)
327
- evt_menu(ID::POSITION_LEFT, :on_position_left_icons)
328
- evt_menu(ID::POSITION_LEFT_LABELS, :on_position_left_labels)
329
- evt_menu(ID::POSITION_LEFT_BOTH, :on_position_left_both)
330
- evt_menu(ID::POSITION_TOP, :on_position_top_labels)
331
- evt_menu(ID::POSITION_TOP_ICONS, :on_position_top_icons)
332
- evt_menu(ID::POSITION_TOP_BOTH, :on_position_top_both)
333
- evt_togglebutton(ID::TOGGLE_PANELS, :on_toggle_panels)
334
- evt_ribbonpanel_extbutton_activated(Wx::ID_ANY, :on_ext_button)
335
- evt_ribbonbuttonbar_clicked(ID::REMOVE_PAGE, :on_remove_page)
336
- evt_ribbonbuttonbar_clicked(ID::HIDE_PAGES, :on_hide_pages)
337
- evt_ribbonbuttonbar_clicked(ID::SHOW_PAGES, :on_show_pages)
338
- evt_ribbonbuttonbar_clicked(ID::PLUS_MINUS, :on_plus_minus)
339
- evt_ribbonbuttonbar_clicked(ID::CHANGE_LABEL, :on_change_label)
340
- evt_ribbonbar_toggled(Wx::ID_ANY, :on_ribbon_bar_toggled)
341
- evt_ribbonbar_help_click(Wx::ID_ANY, :on_ribbon_bar_help_clicked)
342
- evt_size(:on_size_event)
343
- end
63
+ def initialize
64
+ super(nil, Wx::ID_ANY, "wxRibbon Sample Application", size: [800, 600], style: Wx::DEFAULT_FRAME_STYLE)
65
+
66
+ self.icon = Wx.Icon(:sample, Wx::BITMAP_TYPE_XPM, art_path: File.join(__dir__, '..'))
67
+
68
+ @colour_data = Wx::ColourData.new
69
+ @ribbon = Wx::RBN::RibbonBar.new(self, Wx::ID_ANY,
70
+ style: Wx::RBN::RIBBON_BAR_FLOW_HORIZONTAL |
71
+ Wx::RBN::RIBBON_BAR_SHOW_PAGE_LABELS |
72
+ Wx::RBN::RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS |
73
+ Wx::RBN::RIBBON_BAR_SHOW_TOGGLE_BUTTON |
74
+ Wx::RBN::RIBBON_BAR_SHOW_HELP_BUTTON)
75
+
76
+ home = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Examples", bitmap_(:ribbon_xpm))
77
+ toolbar_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Toolbar",
78
+ style: Wx::RBN::RIBBON_PANEL_NO_AUTO_MINIMISE |
79
+ Wx::RBN::RIBBON_PANEL_EXT_BUTTON)
80
+ toolbar = Wx::RBN::RibbonToolBar.new(toolbar_panel, ID::MAIN_TOOLBAR)
81
+ toolbar.add_toggle_tool(Wx::ID_JUSTIFY_LEFT, bitmap_(:align_left_xpm))
82
+ toolbar.add_toggle_tool(Wx::ID_JUSTIFY_CENTER , bitmap_(:align_center_xpm))
83
+ toolbar.add_toggle_tool(Wx::ID_JUSTIFY_RIGHT, bitmap_(:align_right_xpm))
84
+ toolbar.add_separator
85
+ toolbar.add_hybrid_tool(Wx::ID_NEW, Wx::ArtProvider.get_bitmap(Wx::ART_NEW, Wx::ART_OTHER, Wx::Size.new(16, 15)))
86
+ toolbar.add_tool(Wx::ID_OPEN, Wx::ArtProvider.get_bitmap(Wx::ART_FILE_OPEN, Wx::ART_OTHER, Wx::Size.new(16, 15)), "Open something")
87
+ toolbar.add_tool(Wx::ID_SAVE, Wx::ArtProvider.get_bitmap(Wx::ART_FILE_SAVE, Wx::ART_OTHER, Wx::Size.new(16, 15)), "Save something")
88
+ toolbar.add_tool(Wx::ID_SAVEAS, Wx::ArtProvider.get_bitmap(Wx::ART_FILE_SAVE_AS, Wx::ART_OTHER, Wx::Size.new(16, 15)), "Save something as ...")
89
+ toolbar.enable_tool(Wx::ID_OPEN, false)
90
+ toolbar.enable_tool(Wx::ID_SAVE, false)
91
+ toolbar.enable_tool(Wx::ID_SAVEAS, false)
92
+ toolbar.add_separator
93
+ toolbar.add_dropdown_tool(Wx::ID_UNDO, Wx::ArtProvider.get_bitmap(Wx::ART_UNDO, Wx::ART_OTHER, Wx::Size.new(16, 15)))
94
+ toolbar.add_dropdown_tool(Wx::ID_REDO, Wx::ArtProvider.get_bitmap(Wx::ART_REDO, Wx::ART_OTHER, Wx::Size.new(16, 15)))
95
+ toolbar.add_separator
96
+ toolbar.add_tool(Wx::ID_ANY, Wx::ArtProvider.get_bitmap(Wx::ART_REPORT_VIEW, Wx::ART_OTHER, Wx::Size.new(16, 15)))
97
+ toolbar.add_tool(Wx::ID_ANY, Wx::ArtProvider.get_bitmap(Wx::ART_LIST_VIEW, Wx::ART_OTHER, Wx::Size.new(16, 15)))
98
+ toolbar.add_separator
99
+ toolbar.add_hybrid_tool(ID::POSITION_LEFT, bitmap_(:position_left_xpm),
100
+ "Align ribbonbar vertically\non the left\nfor demonstration purposes")
101
+ toolbar.add_hybrid_tool(ID::POSITION_TOP, bitmap_(:position_top_xpm),
102
+ "Align the ribbonbar horizontally\nat the top\nfor demonstration purposes")
103
+ toolbar.add_separator
104
+ prt_tool = toolbar.add_hybrid_tool(Wx::ID_PRINT, Wx::ArtProvider.get_bitmap(Wx::ART_PRINT, Wx::ART_OTHER, Wx::Size.new(16, 15)),
105
+ "This is the Print button tooltip\ndemonstrating a tooltip")
106
+ toolbar.set_rows(2, 3)
107
+
108
+ if toolbar.tool_count != (toolbar.tool_pos(prt_tool)+1)
109
+ Wx.log_error('Wx::RibbonToolBar::get_tool_count or Wx::RibbonToolBar::get_tool_pos is broken')
110
+ elsif Wx::ID_PRINT != toolbar.tool_by_pos(toolbar.tool_pos(prt_tool))
111
+ Wx.log_error('Wx::RibbonToolBar::get_tool_by_pos is broken')
112
+ end
344
113
 
345
- # utility function to find an icon relative to this ruby script
346
- def bitmap_(bitmap_name)
347
- Wx::Bitmap.new(File.join(File.dirname(__FILE__), bitmap_name.to_s.sub(/_([A-Za-z]+)\Z/, '.\1')))
348
- end
114
+ selection_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Selection", bitmap_(:selection_panel_xpm))
115
+ selection = Wx::RBN::RibbonButtonBar.new(selection_panel)
116
+ selection.add_button(ID::SELECTION_EXPAND_V, "Expand Vertically", bitmap_(:expand_selection_v_xpm),
117
+ "This is a tooltip for Expand Vertically\ndemonstrating a tooltip")
118
+ selection.add_button(ID::SELECTION_EXPAND_H, "Expand Horizontally", bitmap_(:expand_selection_h_xpm), '')
119
+ selection.add_button(ID::SELECTION_CONTRACT, "Contract", bitmap_(:auto_crop_selection_xpm), bitmap_(:auto_crop_selection_small_xpm))
120
+
121
+ shapes_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Shapes", bitmap_(:circle_small_xpm))
122
+ shapes = Wx::RBN::RibbonButtonBar.new(shapes_panel)
123
+ shapes.add_button(ID::CIRCLE, "Circle", bitmap_(:circle_xpm), bitmap_(:circle_small_xpm),
124
+ Wx::NULL_BITMAP, Wx::NULL_BITMAP, Wx::RBN::RIBBON_BUTTON_NORMAL,
125
+ "This is a tooltip for the circle button\ndemonstrating another tooltip")
126
+ shapes.add_button(ID::CROSS, "Cross", bitmap_(:cross_xpm), '')
127
+ shapes.add_hybrid_button(ID::TRIANGLE, "Triangle", bitmap_(:triangle_xpm))
128
+ shapes.add_button(ID::SQUARE, "Square", bitmap_(:square_xpm), '')
129
+ shapes.add_dropdown_button(ID::POLYGON, "Other Polygon", bitmap_(:hexagon_xpm), '')
130
+
131
+ sizer_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Panel with Sizer",
132
+ style: Wx::RBN::RIBBON_PANEL_DEFAULT_STYLE)
133
+
134
+ as = ["Item 1 using a box sizer now", "Item 2 using a box sizer now"]
135
+ sizer_panelcombo = Wx::ComboBox.new(sizer_panel, Wx::ID_ANY,
136
+ choices: as, style: Wx::CB_READONLY)
137
+
138
+ sizer_panelcombo2 = Wx::ComboBox.new(sizer_panel, Wx::ID_ANY,
139
+ choices: as, style: Wx::CB_READONLY)
140
+
141
+ sizer_panelcombo.select(0)
142
+ sizer_panelcombo2.select(1)
143
+ sizer_panelcombo.set_min_size(Wx::Size.new(150, -1))
144
+ sizer_panelcombo2.set_min_size(Wx::Size.new(150, -1))
145
+
146
+ bar = Wx::RBN::RibbonButtonBar.new(sizer_panel, Wx::ID_ANY)
147
+ bar.add_button(ID::BUTTON_XX, "xx", bitmap_(:ribbon_xpm))
148
+ bar.add_button(ID::BUTTON_XY, "xy", bitmap_(:ribbon_xpm))
149
+ # This prevents ribbon buttons in panels with sizer from collapsing.
150
+ bar.set_button_min_size_class(ID::BUTTON_XX, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_LARGE)
151
+ bar.set_button_min_size_class(ID::BUTTON_XY, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_LARGE)
152
+
153
+ sizer_panelsizer_h = Wx::BoxSizer.new(Wx::HORIZONTAL)
154
+ sizer_panelsizer_v = Wx::BoxSizer.new(Wx::VERTICAL)
155
+ sizer_panelsizer_v.add_stretch_spacer(1)
156
+ sizer_panelsizer_v.add(sizer_panelcombo, 0, Wx::ALL|Wx::EXPAND, 2)
157
+ sizer_panelsizer_v.add(sizer_panelcombo2, 0, Wx::ALL|Wx::EXPAND, 2)
158
+ sizer_panelsizer_v.add_stretch_spacer(1)
159
+ sizer_panelsizer_h.add(bar, 0, Wx::EXPAND)
160
+ sizer_panelsizer_h.add(sizer_panelsizer_v, 0)
161
+ sizer_panel.set_sizer(sizer_panelsizer_h)
162
+
163
+ @label_font = Wx::Font.new(Wx::FontInfo.new(8).light)
164
+
165
+ scheme = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Appearance", bitmap_(:eye_xpm))
166
+ @default_primary = Wx::Colour.new
167
+ @default_secondary = Wx::Colour.new
168
+ @default_tertiary = Wx::Colour.new
169
+ @ribbon.get_art_provider.get_colour_scheme(@default_primary, @default_secondary, @default_tertiary)
170
+ provider_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
171
+ "Art", style: Wx::RBN::RIBBON_PANEL_NO_AUTO_MINIMISE)
172
+ provider_bar = Wx::RBN::RibbonButtonBar.new(provider_panel, Wx::ID_ANY)
173
+ provider_bar.add_button(ID::DEFAULT_PROVIDER, "Default Provider",
174
+ Wx::ArtProvider.get_bitmap(Wx::ART_QUESTION, Wx::ART_OTHER, Wx::Size.new(32, 32)))
175
+ provider_bar.add_button(ID::AUI_PROVIDER, "AUI Provider", bitmap_(:aui_style_xpm))
176
+ provider_bar.add_button(ID::MSW_PROVIDER, "MSW Provider", bitmap_(:msw_style_xpm))
177
+ primary_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
178
+ "Primary Colour", bitmap_(:colours_xpm))
179
+ @primary_gallery = populate_colours_panel(primary_panel,
180
+ @default_primary, ID::PRIMARY_COLOUR)
181
+ secondary_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
182
+ "Secondary Colour", bitmap_(:colours_xpm))
183
+ @secondary_gallery = populate_colours_panel(secondary_panel,
184
+ @default_secondary, ID::SECONDARY_COLOUR)
185
+
186
+ page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "UI Updated", bitmap_(:ribbon_xpm))
187
+ panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Enable/Disable", bitmap_(:ribbon_xpm))
188
+ bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
189
+ bar.add_button(ID::DISABLED, "Disabled", bitmap_(:ribbon_xpm))
190
+ bar.add_button(ID::ENABLE, "Enable", bitmap_(:ribbon_xpm))
191
+ bar.add_button(ID::DISABLE, "Disable", bitmap_(:ribbon_xpm))
192
+ bar.add_button(ID::UI_ENABLE_UPDATED, "Enable UI updated", bitmap_(:ribbon_xpm))
193
+ bar.enable_button(ID::DISABLED, false)
194
+ @bEnabled = true
195
+
196
+ panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Toggle", bitmap_(:ribbon_xpm))
197
+ bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
198
+ bar.add_button(ID::CHECK, "Toggle", bitmap_(:ribbon_xpm))
199
+ bar.add_toggle_button(ID::UI_CHECK_UPDATED, "Toggled UI updated", bitmap_(:ribbon_xpm))
200
+ @bChecked = true
201
+
202
+ panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Change text", bitmap_(:ribbon_xpm))
203
+ bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
204
+ bar.add_button(ID::CHANGE_TEXT1, "One", bitmap_(:ribbon_xpm))
205
+ bar.add_button(ID::CHANGE_TEXT2, "Two", bitmap_(:ribbon_xpm))
206
+ bar.add_button(ID::UI_CHANGE_TEXT_UPDATED, "Zero", bitmap_(:ribbon_xpm))
207
+
208
+ # Also set the general disabled text colour:
209
+ artProvider = @ribbon.get_art_provider
210
+ tColour = artProvider.get_color(Wx::RBN::RIBBON_ART_BUTTON_BAR_LABEL_COLOUR)
211
+ artProvider.set_color(Wx::RBN::RIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR, tColour.make_disabled)
212
+
213
+ Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Empty Page", bitmap_(:empty_xpm))
214
+
215
+ page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Another Page", bitmap_(:empty_xpm))
216
+ panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Page manipulation", bitmap_(:ribbon_xpm))
217
+ bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
218
+ bar.add_button(ID::REMOVE_PAGE, "Remove", Wx::ArtProvider.get_bitmap(Wx::ART_DELETE, Wx::ART_OTHER, Wx::Size.new(24, 24)))
219
+ bar.add_button(ID::HIDE_PAGES, "Hide Pages", bitmap_(:ribbon_xpm))
220
+ bar.add_button(ID::SHOW_PAGES, "Show Pages", bitmap_(:ribbon_xpm))
221
+
222
+ panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Button bar manipulation", bitmap_(:ribbon_xpm))
223
+ button_bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
224
+ button_bar.add_button(ID::PLUS_MINUS, "+/-",
225
+ Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, Wx::Size.new(24, 24)))
226
+ @plus_minus_state = false
227
+ button_bar.add_button(ID::CHANGE_LABEL, "short", bitmap_(:ribbon_xpm))
228
+ button_bar.set_button_text_min_width(ID::CHANGE_LABEL, "some long text")
229
+ @change_label_state = false
349
230
 
350
- def on_enable_update_ui(evt)
351
- evt.enable(@bEnabled)
352
- end
231
+ panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Always medium buttons", bitmap_(:ribbon_xpm))
232
+ bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
233
+ bar.add_button(ID::SMALL_BUTTON_1, "Button 1", bitmap_(:ribbon_xpm))
234
+ bar.set_button_max_size_class(ID::SMALL_BUTTON_1, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
235
+ bar.add_button(ID::SMALL_BUTTON_2, "Button 2", bitmap_(:ribbon_xpm))
236
+ bar.set_button_max_size_class(ID::SMALL_BUTTON_2, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
237
+ bar.add_button(ID::SMALL_BUTTON_3, "Button 3", bitmap_(:ribbon_xpm))
238
+ bar.add_button(ID::SMALL_BUTTON_4, "Button 4", bitmap_(:ribbon_xpm))
239
+ bar.add_button(ID::SMALL_BUTTON_5, "Button 5", bitmap_(:ribbon_xpm))
240
+ bar.set_button_max_size_class(ID::SMALL_BUTTON_5, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
241
+ bar.add_button(ID::SMALL_BUTTON_6, "Button 6", bitmap_(:ribbon_xpm))
242
+ bar.set_button_max_size_class(ID::SMALL_BUTTON_6, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
243
+
244
+ Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Highlight Page", bitmap_(:empty_xpm))
245
+ @ribbon.add_page_highlight(@ribbon.get_page_count-1)
246
+
247
+
248
+ page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Advanced", bitmap_(:empty_xpm))
249
+ panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Button bar manipulation", bitmap_(:ribbon_xpm))
250
+ button_bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
251
+ button_bar.add_button(ID::PLUS_MINUS, "+/-",
252
+ Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, Wx::Size.new(24, 24)))
253
+ @plus_minus_state = false
254
+ button_bar.add_button(ID::CHANGE_LABEL, "short", bitmap_(:ribbon_xpm))
255
+ button_bar.set_button_text_min_width(ID::CHANGE_LABEL, "some long text")
256
+ @change_label_state = false
353
257
 
354
- def on_check_update_ui(evt)
355
- evt.check(@bChecked)
356
- end
258
+ panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Always medium buttons", bitmap_(:ribbon_xpm))
259
+ bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
260
+ bar.add_button(ID::SMALL_BUTTON_1, "Button 1", bitmap_(:ribbon_xpm))
261
+ bar.set_button_max_size_class(ID::SMALL_BUTTON_1, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
262
+ bar.add_button(ID::SMALL_BUTTON_2, "Button 2", bitmap_(:ribbon_xpm))
263
+ bar.set_button_max_size_class(ID::SMALL_BUTTON_2, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
264
+ bar.add_button(ID::SMALL_BUTTON_3, "Button 3", bitmap_(:ribbon_xpm))
265
+ bar.add_button(ID::SMALL_BUTTON_4, "Button 4", bitmap_(:ribbon_xpm))
266
+ bar.add_button(ID::SMALL_BUTTON_5, "Button 5", bitmap_(:ribbon_xpm))
267
+ bar.set_button_max_size_class(ID::SMALL_BUTTON_5, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
268
+ bar.add_button(ID::SMALL_BUTTON_6, "Button 6", bitmap_(:ribbon_xpm))
269
+ bar.set_button_max_size_class(ID::SMALL_BUTTON_6, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
270
+
271
+ @ribbon.realize
357
272
 
358
- def on_change_text_update_ui(evt)
359
- unless @new_text.nil? || @new_text.empty?
360
- evt.set_text(@new_text)
361
- @new_text = ''
273
+ @logwindow = Wx::TextCtrl.new(self, Wx::ID_ANY, style: Wx::TE_MULTILINE | Wx::TE_READONLY |
274
+ Wx::TE_LEFT | Wx::TE_BESTWRAP | Wx::BORDER_NONE)
275
+
276
+ @togglePanels = Wx::ToggleButton.new(self, ID::TOGGLE_PANELS, "&Toggle panels")
277
+ @togglePanels.set_value(true)
278
+
279
+ s = Wx::BoxSizer.new(Wx::VERTICAL)
280
+
281
+ s.add(@ribbon, 0, Wx::EXPAND)
282
+ s.add(@logwindow, 1, Wx::EXPAND)
283
+ s.add(@togglePanels, Wx::SizerFlags.new.border)
284
+
285
+ set_sizer(s)
286
+
287
+ evt_ribbonbuttonbar_clicked(ID::ENABLE, :on_enable)
288
+ evt_ribbonbuttonbar_clicked(ID::DISABLE, :on_disable)
289
+ evt_ribbonbuttonbar_clicked(ID::DISABLED, :on_disabled)
290
+ evt_ribbonbuttonbar_clicked(ID::UI_ENABLE_UPDATED, :on_enable_updated)
291
+ evt_update_ui(ID::UI_ENABLE_UPDATED, :on_enable_update_ui)
292
+ evt_ribbonbuttonbar_clicked(ID::CHECK, :on_check)
293
+ evt_update_ui(ID::UI_CHECK_UPDATED, :on_check_update_ui)
294
+ evt_ribbonbuttonbar_clicked(ID::CHANGE_TEXT1, :on_change_text1)
295
+ evt_ribbonbuttonbar_clicked(ID::CHANGE_TEXT2, :on_change_text2)
296
+ evt_update_ui(ID::UI_CHANGE_TEXT_UPDATED, :on_change_text_update_ui)
297
+ evt_ribbonbuttonbar_clicked(ID::DEFAULT_PROVIDER, :on_default_provider)
298
+ evt_ribbonbuttonbar_clicked(ID::AUI_PROVIDER, :on_aui_provider)
299
+ evt_ribbonbuttonbar_clicked(ID::MSW_PROVIDER, :on_msw_provider)
300
+ evt_ribbonbuttonbar_clicked(ID::SELECTION_EXPAND_H, :on_selection_expand_h_button)
301
+ evt_ribbonbuttonbar_clicked(ID::SELECTION_EXPAND_V, :on_selection_expand_v_button)
302
+ evt_ribbonbuttonbar_clicked(ID::SELECTION_CONTRACT, :on_selection_contract_button)
303
+ evt_ribbonbuttonbar_clicked(ID::CIRCLE, :on_circle_button)
304
+ evt_ribbonbuttonbar_clicked(ID::CROSS, :on_cross_button)
305
+ evt_ribbonbuttonbar_clicked(ID::TRIANGLE, :on_triangle_button)
306
+ evt_ribbonbuttonbar_clicked(ID::SQUARE, :on_square_button)
307
+ evt_ribbonbuttonbar_dropdown_clicked(ID::TRIANGLE, :on_triangle_dropdown)
308
+ evt_ribbonbuttonbar_dropdown_clicked(ID::POLYGON, :on_polygon_dropdown)
309
+ evt_ribbongallery_hover_changed(ID::PRIMARY_COLOUR, :on_hovered_colour_change)
310
+ evt_ribbongallery_hover_changed(ID::SECONDARY_COLOUR, :on_hovered_colour_change)
311
+ evt_ribbongallery_selected(ID::PRIMARY_COLOUR, :on_primary_colour_select)
312
+ evt_ribbongallery_selected(ID::SECONDARY_COLOUR, :on_secondary_colour_select)
313
+ evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_LEFT, :on_justify)
314
+ evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_CENTER, :on_justify)
315
+ evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_RIGHT, :on_justify)
316
+ evt_update_ui(Wx::ID_JUSTIFY_LEFT, :on_justify_update_ui)
317
+ evt_update_ui(Wx::ID_JUSTIFY_CENTER, :on_justify_update_ui)
318
+ evt_update_ui(Wx::ID_JUSTIFY_RIGHT, :on_justify_update_ui)
319
+ evt_ribbontoolbar_clicked(Wx::ID_NEW, :on_new)
320
+ evt_ribbontoolbar_dropdown_clicked(Wx::ID_NEW, :on_new_dropdown)
321
+ evt_ribbontoolbar_clicked(Wx::ID_PRINT, :on_print)
322
+ evt_ribbontoolbar_dropdown_clicked(Wx::ID_PRINT, :on_print_dropdown)
323
+ evt_ribbontoolbar_dropdown_clicked(Wx::ID_REDO, :on_redo_dropdown)
324
+ evt_ribbontoolbar_dropdown_clicked(Wx::ID_UNDO, :on_undo_dropdown)
325
+ evt_ribbontoolbar_clicked(ID::POSITION_LEFT, :on_position_left)
326
+ evt_ribbontoolbar_dropdown_clicked(ID::POSITION_LEFT, :on_position_left_dropdown)
327
+ evt_ribbontoolbar_clicked(ID::POSITION_TOP, :on_position_top)
328
+ evt_ribbontoolbar_dropdown_clicked(ID::POSITION_TOP, :on_position_top_dropdown)
329
+ evt_button(ID::PRIMARY_COLOUR, :on_colour_gallery_button)
330
+ evt_button(ID::SECONDARY_COLOUR, :on_colour_gallery_button)
331
+ evt_menu(ID::POSITION_LEFT, :on_position_left_icons)
332
+ evt_menu(ID::POSITION_LEFT_LABELS, :on_position_left_labels)
333
+ evt_menu(ID::POSITION_LEFT_BOTH, :on_position_left_both)
334
+ evt_menu(ID::POSITION_TOP, :on_position_top_labels)
335
+ evt_menu(ID::POSITION_TOP_ICONS, :on_position_top_icons)
336
+ evt_menu(ID::POSITION_TOP_BOTH, :on_position_top_both)
337
+ evt_togglebutton(ID::TOGGLE_PANELS, :on_toggle_panels)
338
+ evt_ribbonpanel_extbutton_activated(Wx::ID_ANY, :on_ext_button)
339
+ evt_ribbonbuttonbar_clicked(ID::REMOVE_PAGE, :on_remove_page)
340
+ evt_ribbonbuttonbar_clicked(ID::HIDE_PAGES, :on_hide_pages)
341
+ evt_ribbonbuttonbar_clicked(ID::SHOW_PAGES, :on_show_pages)
342
+ evt_ribbonbuttonbar_clicked(ID::PLUS_MINUS, :on_plus_minus)
343
+ evt_ribbonbuttonbar_clicked(ID::CHANGE_LABEL, :on_change_label)
344
+ evt_ribbonbar_toggled(Wx::ID_ANY, :on_ribbon_bar_toggled)
345
+ evt_ribbonbar_help_click(Wx::ID_ANY, :on_ribbon_bar_help_clicked)
346
+ evt_size(:on_size_event)
362
347
  end
363
- end
364
348
 
365
- def on_check(evt)
366
- @bChecked = !@bChecked
367
- end
349
+ # utility function to find an icon relative to this ruby script
350
+ def bitmap_(bitmap_name)
351
+ Wx::Bitmap.new(File.join(File.dirname(__FILE__), bitmap_name.to_s.sub(/_([A-Za-z]+)\Z/, '.\1')))
352
+ end
368
353
 
369
- def on_enable(evt)
370
- @bEnabled = true
371
- end
354
+ def on_enable_update_ui(evt)
355
+ evt.enable(@bEnabled)
356
+ end
372
357
 
373
- def on_disable(evt)
374
- @bEnabled = false
375
- end
358
+ def on_check_update_ui(evt)
359
+ evt.check(@bChecked)
360
+ end
376
361
 
377
- def on_disabled(evt)
378
- add_text("ERROR: Disabled button activated (not supposed to happen)")
379
- end
362
+ def on_change_text_update_ui(evt)
363
+ unless @new_text.nil? || @new_text.empty?
364
+ evt.set_text(@new_text)
365
+ @new_text = ''
366
+ end
367
+ end
380
368
 
381
- def on_enable_updated(evt)
382
- add_text("Button activated")
383
- end
369
+ def on_check(evt)
370
+ @bChecked = !@bChecked
371
+ end
384
372
 
385
- def on_change_text1(evt)
386
- @new_text = "One"
387
- end
373
+ def on_enable(evt)
374
+ @bEnabled = true
375
+ end
388
376
 
389
- def on_change_text2(evt)
390
- @new_text = "Two"
391
- end
377
+ def on_disable(evt)
378
+ @bEnabled = false
379
+ end
392
380
 
393
- def on_circle_button(evt)
394
- add_text("Circle button clicked.")
395
- end
381
+ def on_disabled(evt)
382
+ add_text("ERROR: Disabled button activated (not supposed to happen)")
383
+ end
396
384
 
397
- def on_cross_button(evt)
398
- add_text("Cross button clicked.")
399
- end
385
+ def on_enable_updated(evt)
386
+ add_text("Button activated")
387
+ end
400
388
 
401
- def on_triangle_button(evt)
402
- add_text("Triangle button clicked.")
403
- end
389
+ def on_change_text1(evt)
390
+ @new_text = "One"
391
+ end
404
392
 
405
- def on_triangle_dropdown(evt)
406
- menu = Wx::Menu.new
407
- menu.append(Wx::ID_ANY, "Equilateral")
408
- menu.append(Wx::ID_ANY, "Isosceles")
409
- menu.append(Wx::ID_ANY, "Scalene")
393
+ def on_change_text2(evt)
394
+ @new_text = "Two"
395
+ end
410
396
 
411
- evt.popup_menu(menu)
412
- end
397
+ def on_circle_button(evt)
398
+ add_text("Circle button clicked.")
399
+ end
413
400
 
414
- def on_square_button(evt)
415
- add_text("Square button clicked.")
416
- end
401
+ def on_cross_button(evt)
402
+ add_text("Cross button clicked.")
403
+ end
417
404
 
418
- def on_polygon_dropdown(evt)
419
- menu = Wx::Menu.new
420
- menu.append(Wx::ID_ANY, "Pentagon (5 sided)")
421
- menu.append(Wx::ID_ANY, "Hexagon (6 sided)")
422
- menu.append(Wx::ID_ANY, "Heptagon (7 sided)")
423
- menu.append(Wx::ID_ANY, "Octogon (8 sided)")
424
- menu.append(Wx::ID_ANY, "Nonagon (9 sided)")
425
- menu.append(Wx::ID_ANY, "Decagon (10 sided)")
405
+ def on_triangle_button(evt)
406
+ add_text("Triangle button clicked.")
407
+ end
426
408
 
427
- evt.popup_menu(menu)
428
- end
409
+ def on_triangle_dropdown(evt)
410
+ menu = Wx::Menu.new
411
+ menu.append(Wx::ID_ANY, "Equilateral")
412
+ menu.append(Wx::ID_ANY, "Isosceles")
413
+ menu.append(Wx::ID_ANY, "Scalene")
429
414
 
430
- def on_selection_expand_v_button(evt)
431
- add_text("Expand selection horizontally button clicked.")
432
- end
415
+ evt.popup_menu(menu)
416
+ end
433
417
 
434
- def on_selection_expand_h_button(evt)
435
- add_text("Expand selection vertically button clicked.")
436
- end
418
+ def on_square_button(evt)
419
+ add_text("Square button clicked.")
420
+ end
437
421
 
438
- def on_selection_contract_button(evt)
439
- add_text("Contract selection button clicked.")
440
- end
422
+ def on_polygon_dropdown(evt)
423
+ menu = Wx::Menu.new
424
+ menu.append(Wx::ID_ANY, "Pentagon (5 sided)")
425
+ menu.append(Wx::ID_ANY, "Hexagon (6 sided)")
426
+ menu.append(Wx::ID_ANY, "Heptagon (7 sided)")
427
+ menu.append(Wx::ID_ANY, "Octogon (8 sided)")
428
+ menu.append(Wx::ID_ANY, "Nonagon (9 sided)")
429
+ menu.append(Wx::ID_ANY, "Decagon (10 sided)")
441
430
 
442
- def on_hovered_colour_change(evt)
443
- # Set the background of the gallery to the hovered colour, or back to the
444
- # default if there is no longer a hovered item.
431
+ evt.popup_menu(menu)
432
+ end
445
433
 
446
- gallery = evt.gallery
447
- provider = gallery.get_art_provider
434
+ def on_selection_expand_v_button(evt)
435
+ add_text("Expand selection horizontally button clicked.")
436
+ end
448
437
 
449
- if evt.gallery_item != 0
450
- if provider == @ribbon.art_provider
451
- provider = provider.clone
452
- gallery.set_art_provider(provider)
453
- end
454
- _, colour = get_gallery_colour(evt.get_gallery, evt.get_gallery_item)
455
- provider.set_colour(Wx::RIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR,
456
- colour)
457
- else
458
- if provider != @ribbon.get_art_provider
459
- gallery.set_art_provider(@ribbon.get_art_provider)
438
+ def on_selection_expand_h_button(evt)
439
+ add_text("Expand selection vertically button clicked.")
440
+ end
441
+
442
+ def on_selection_contract_button(evt)
443
+ add_text("Contract selection button clicked.")
444
+ end
445
+
446
+ def on_hovered_colour_change(evt)
447
+ # Set the background of the gallery to the hovered colour, or back to the
448
+ # default if there is no longer a hovered item.
449
+
450
+ gallery = evt.gallery
451
+ provider = gallery.get_art_provider
452
+
453
+ if evt.gallery_item != 0
454
+ if provider == @ribbon.art_provider
455
+ provider = provider.clone
456
+ gallery.set_art_provider(provider)
457
+ end
458
+ _, colour = get_gallery_colour(evt.get_gallery, evt.get_gallery_item)
459
+ provider.set_colour(Wx::RIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR,
460
+ colour)
461
+ else
462
+ if provider != @ribbon.get_art_provider
463
+ gallery.set_art_provider(@ribbon.get_art_provider)
464
+ end
460
465
  end
461
466
  end
462
- end
463
467
 
464
- def on_primary_colour_select(evt)
465
- name, colour = get_gallery_colour(evt.get_gallery, evt.get_gallery_item)
466
- add_text("Colour \"" + name + "\" selected as primary.")
467
- secondary = Wx::Colour.new
468
- tertiary = Wx::Colour.new
469
- @ribbon.get_art_provider.get_colour_scheme(nil, secondary, tertiary)
470
- @ribbon.get_art_provider.set_colour_scheme(colour, secondary, tertiary)
471
- reset_gallery_art_providers
472
- @ribbon.refresh
473
- end
468
+ def on_primary_colour_select(evt)
469
+ name, colour = get_gallery_colour(evt.get_gallery, evt.get_gallery_item)
470
+ add_text("Colour \"" + name + "\" selected as primary.")
471
+ secondary = Wx::Colour.new
472
+ tertiary = Wx::Colour.new
473
+ @ribbon.get_art_provider.get_colour_scheme(nil, secondary, tertiary)
474
+ @ribbon.get_art_provider.set_colour_scheme(colour, secondary, tertiary)
475
+ reset_gallery_art_providers
476
+ @ribbon.refresh
477
+ end
474
478
 
475
- def on_secondary_colour_select(evt)
476
- name, colour = get_gallery_colour(evt.get_gallery, evt.get_gallery_item)
477
- add_text("Colour \"" + name + "\" selected as secondary.")
478
- primary = Wx::Colour.new
479
- tertiary = Wx::Colour.new
480
- @ribbon.art_provider.get_colour_scheme(primary, nil, tertiary)
481
- @ribbon.art_provider.set_colour_scheme(primary, colour, tertiary)
482
- reset_gallery_art_providers
483
- @ribbon.refresh
484
- end
479
+ def on_secondary_colour_select(evt)
480
+ name, colour = get_gallery_colour(evt.get_gallery, evt.get_gallery_item)
481
+ add_text("Colour \"" + name + "\" selected as secondary.")
482
+ primary = Wx::Colour.new
483
+ tertiary = Wx::Colour.new
484
+ @ribbon.art_provider.get_colour_scheme(primary, nil, tertiary)
485
+ @ribbon.art_provider.set_colour_scheme(primary, colour, tertiary)
486
+ reset_gallery_art_providers
487
+ @ribbon.refresh
488
+ end
489
+
490
+ def on_colour_gallery_button(evt)
491
+ gallery = evt.get_event_object
492
+ return unless gallery
493
+
494
+ @ribbon.dismiss_expanded_panel
495
+ if gallery.get_selection
496
+ _, c = get_gallery_colour(gallery, gallery.get_selection)
497
+ @colour_data.colour = c
498
+ end
499
+ Wx.ColourDialog(self, @colour_data) do |dlg|
500
+ if dlg.show_modal == Wx::ID_OK
501
+ @colour_data = dlg.colour_data
502
+ clr = @colour_data.colour
485
503
 
486
- def on_colour_gallery_button(evt)
487
- gallery = evt.get_event_object
488
- return unless gallery
489
-
490
- @ribbon.dismiss_expanded_panel
491
- if gallery.get_selection
492
- _, c = get_gallery_colour(gallery, gallery.get_selection)
493
- @colour_data.colour = c
494
- end
495
- Wx.ColourDialog(self, @colour_data) do |dlg|
496
- if dlg.show_modal == Wx::ID_OK
497
- @colour_data = dlg.colour_data
498
- clr = @colour_data.colour
499
-
500
- # Try to find colour in gallery
501
- item = nil
502
- gallery.count.times do |i|
503
- item = gallery.item(i)
504
- _, c = get_gallery_colour(gallery, item)
505
- break if c == clr
504
+ # Try to find colour in gallery
506
505
  item = nil
507
- end
506
+ gallery.count.times do |i|
507
+ item = gallery.item(i)
508
+ _, c = get_gallery_colour(gallery, item)
509
+ break if c == clr
510
+ item = nil
511
+ end
508
512
 
509
- # Colour not in gallery - add it
510
- unless item
511
- Wx::MemoryDC.draw_on do |dc|
512
- item = add_colour_to_gallery(gallery,
513
- clr.get_as_string(Wx::C2S_HTML_SYNTAX), dc, clr)
513
+ # Colour not in gallery - add it
514
+ unless item
515
+ Wx::MemoryDC.draw_on do |dc|
516
+ item = add_colour_to_gallery(gallery,
517
+ clr.get_as_string(Wx::C2S_HTML_SYNTAX), dc, clr)
518
+ end
519
+ gallery.realise
514
520
  end
515
- gallery.realise
516
- end
517
521
 
518
- # Set selection
519
- gallery.ensure_visible(item)
520
- gallery.set_selection(item)
522
+ # Set selection
523
+ gallery.ensure_visible(item)
524
+ gallery.set_selection(item)
521
525
 
522
- # Send an event to respond to the selection change
523
- dummy = Wx::RBN::RibbonGalleryEvent.new(Wx::RBN::EVT_RIBBONGALLERY_SELECTED, gallery.id)
524
- dummy.set_event_object(gallery)
525
- dummy.set_gallery(gallery)
526
- dummy.set_gallery_item(item)
527
- process_window_event(dummy)
526
+ # Send an event to respond to the selection change
527
+ dummy = Wx::RBN::RibbonGalleryEvent.new(Wx::RBN::EVT_RIBBONGALLERY_SELECTED, gallery.id)
528
+ dummy.set_event_object(gallery)
529
+ dummy.set_gallery(gallery)
530
+ dummy.set_gallery_item(item)
531
+ process_window_event(dummy)
532
+ end
528
533
  end
529
534
  end
530
- end
531
535
 
532
- def on_default_provider(evt)
533
- @ribbon.dismiss_expanded_panel
534
- set_art_provider(Wx::RibbonDefaultArtProvider.new)
535
- end
536
+ def on_default_provider(evt)
537
+ @ribbon.dismiss_expanded_panel
538
+ set_art_provider(Wx::RibbonDefaultArtProvider.new)
539
+ end
536
540
 
537
- def on_aui_provider(evt)
538
- @ribbon.dismiss_expanded_panel
539
- set_art_provider(Wx::RBN::RibbonAUIArtProvider.new)
540
- end
541
+ def on_aui_provider(evt)
542
+ @ribbon.dismiss_expanded_panel
543
+ set_art_provider(Wx::RBN::RibbonAUIArtProvider.new)
544
+ end
541
545
 
542
- def on_msw_provider(evt)
543
- @ribbon.dismiss_expanded_panel
544
- set_art_provider(Wx::RBN::RibbonMSWArtProvider.new)
545
- end
546
+ def on_msw_provider(evt)
547
+ @ribbon.dismiss_expanded_panel
548
+ set_art_provider(Wx::RBN::RibbonMSWArtProvider.new)
549
+ end
546
550
 
547
- def on_justify(evt)
548
- style = @logwindow.get_window_style & ~(Wx::TE_LEFT | Wx::TE_CENTER | Wx::TE_RIGHT)
549
- case evt.id
550
- when Wx::ID_JUSTIFY_LEFT
551
- @logwindow.set_window_style(style | Wx::TE_LEFT)
552
- when Wx::ID_JUSTIFY_CENTER
553
- @logwindow.set_window_style(style | Wx::TE_CENTER)
554
- when Wx::ID_JUSTIFY_RIGHT
555
- @logwindow.set_window_style(style | Wx::TE_RIGHT)
551
+ def on_justify(evt)
552
+ style = @logwindow.get_window_style & ~(Wx::TE_LEFT | Wx::TE_CENTER | Wx::TE_RIGHT)
553
+ case evt.id
554
+ when Wx::ID_JUSTIFY_LEFT
555
+ @logwindow.set_window_style(style | Wx::TE_LEFT)
556
+ when Wx::ID_JUSTIFY_CENTER
557
+ @logwindow.set_window_style(style | Wx::TE_CENTER)
558
+ when Wx::ID_JUSTIFY_RIGHT
559
+ @logwindow.set_window_style(style | Wx::TE_RIGHT)
560
+ end
556
561
  end
557
- end
558
562
 
559
- def on_justify_update_ui(evt)
560
- case evt.id
561
- when Wx::ID_JUSTIFY_LEFT
562
- evt.check(!@logwindow.has_flag(Wx::TE_CENTER | Wx::TE_RIGHT))
563
- when Wx::ID_JUSTIFY_CENTER
564
- evt.check(@logwindow.has_flag(Wx::TE_CENTER))
565
- when Wx::ID_JUSTIFY_RIGHT
566
- evt.check(@logwindow.has_flag(Wx::TE_RIGHT))
563
+ def on_justify_update_ui(evt)
564
+ case evt.id
565
+ when Wx::ID_JUSTIFY_LEFT
566
+ evt.check(!@logwindow.has_flag(Wx::TE_CENTER | Wx::TE_RIGHT))
567
+ when Wx::ID_JUSTIFY_CENTER
568
+ evt.check(@logwindow.has_flag(Wx::TE_CENTER))
569
+ when Wx::ID_JUSTIFY_RIGHT
570
+ evt.check(@logwindow.has_flag(Wx::TE_RIGHT))
571
+ end
567
572
  end
568
- end
569
573
 
570
- def on_new(evt)
571
- add_text("New button clicked.")
572
- end
574
+ def on_new(evt)
575
+ add_text("New button clicked.")
576
+ end
573
577
 
574
- def on_new_dropdown(evt)
575
- menu = Wx::Menu.new
576
- menu.append(Wx::ID_ANY, "New Document")
577
- menu.append(Wx::ID_ANY, "New Template")
578
- menu.append(Wx::ID_ANY, "New Mail")
578
+ def on_new_dropdown(evt)
579
+ menu = Wx::Menu.new
580
+ menu.append(Wx::ID_ANY, "New Document")
581
+ menu.append(Wx::ID_ANY, "New Template")
582
+ menu.append(Wx::ID_ANY, "New Mail")
579
583
 
580
- evt.popup_menu(menu)
581
- end
584
+ evt.popup_menu(menu)
585
+ end
582
586
 
583
- def on_print(evt)
584
- add_text("Print button clicked.")
585
- end
587
+ def on_print(evt)
588
+ add_text("Print button clicked.")
589
+ end
586
590
 
587
- def on_print_dropdown(evt)
588
- menu = Wx::Menu.new
589
- menu.append(Wx::ID_ANY, "Print")
590
- menu.append(Wx::ID_ANY, "Preview")
591
- menu.append(Wx::ID_ANY, "Options")
591
+ def on_print_dropdown(evt)
592
+ menu = Wx::Menu.new
593
+ menu.append(Wx::ID_ANY, "Print")
594
+ menu.append(Wx::ID_ANY, "Preview")
595
+ menu.append(Wx::ID_ANY, "Options")
592
596
 
593
- evt.popup_menu(menu)
594
- end
597
+ evt.popup_menu(menu)
598
+ end
595
599
 
596
- def on_redo_dropdown(evt)
597
- menu = Wx::Menu.new
598
- menu.append(Wx::ID_ANY, "Redo E")
599
- menu.append(Wx::ID_ANY, "Redo F")
600
- menu.append(Wx::ID_ANY, "Redo G")
600
+ def on_redo_dropdown(evt)
601
+ menu = Wx::Menu.new
602
+ menu.append(Wx::ID_ANY, "Redo E")
603
+ menu.append(Wx::ID_ANY, "Redo F")
604
+ menu.append(Wx::ID_ANY, "Redo G")
601
605
 
602
- evt.popup_menu(menu)
603
- end
606
+ evt.popup_menu(menu)
607
+ end
604
608
 
605
- def on_undo_dropdown(evt)
606
- menu = Wx::Menu.new
607
- menu.append(Wx::ID_ANY, "Undo C")
608
- menu.append(Wx::ID_ANY, "Undo B")
609
- menu.append(Wx::ID_ANY, "Undo A")
609
+ def on_undo_dropdown(evt)
610
+ menu = Wx::Menu.new
611
+ menu.append(Wx::ID_ANY, "Undo C")
612
+ menu.append(Wx::ID_ANY, "Undo B")
613
+ menu.append(Wx::ID_ANY, "Undo A")
610
614
 
611
- evt.popup_menu(menu)
612
- end
615
+ evt.popup_menu(menu)
616
+ end
613
617
 
614
- def on_position_top(evt)
615
- on_position_top_labels(evt)
616
- end
618
+ def on_position_top(evt)
619
+ on_position_top_labels(evt)
620
+ end
617
621
 
618
- def on_position_top_labels(evt)
619
- set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE)
620
- end
622
+ def on_position_top_labels(evt)
623
+ set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE)
624
+ end
621
625
 
622
- def on_position_top_icons(evt)
623
- set_bar_style((Wx::RBN::RIBBON_BAR_DEFAULT_STYLE & (~Wx::RBN::RIBBON_BAR_SHOW_PAGE_LABELS)) | Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS)
624
- end
626
+ def on_position_top_icons(evt)
627
+ set_bar_style((Wx::RBN::RIBBON_BAR_DEFAULT_STYLE & (~Wx::RBN::RIBBON_BAR_SHOW_PAGE_LABELS)) | Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS)
628
+ end
625
629
 
626
- def on_position_top_both(evt)
627
- set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE | Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS)
628
- end
629
-
630
- def on_position_top_dropdown(evt)
631
- menu = Wx::Menu.new
632
- menu.append(ID::POSITION_TOP, "Top with Labels")
633
- menu.append(ID::POSITION_TOP_ICONS, "Top with Icons")
634
- menu.append(ID::POSITION_TOP_BOTH, "Top with Both")
635
- evt.popup_menu(menu)
636
- end
630
+ def on_position_top_both(evt)
631
+ set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE | Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS)
632
+ end
637
633
 
638
- def on_position_left(evt)
639
- on_position_left_icons(evt)
640
- end
634
+ def on_position_top_dropdown(evt)
635
+ menu = Wx::Menu.new
636
+ menu.append(ID::POSITION_TOP, "Top with Labels")
637
+ menu.append(ID::POSITION_TOP_ICONS, "Top with Icons")
638
+ menu.append(ID::POSITION_TOP_BOTH, "Top with Both")
639
+ evt.popup_menu(menu)
640
+ end
641
641
 
642
- def on_position_left_labels(evt)
643
- set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE | Wx::RBN::RIBBON_BAR_FLOW_VERTICAL)
644
- end
642
+ def on_position_left(evt)
643
+ on_position_left_icons(evt)
644
+ end
645
645
 
646
- def on_position_left_icons(evt)
647
- set_bar_style((Wx::RBN::RIBBON_BAR_DEFAULT_STYLE & (~Wx::RBN::RIBBON_BAR_SHOW_PAGE_LABELS)) |
648
- Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS | Wx::RBN::RIBBON_BAR_FLOW_VERTICAL)
649
- end
646
+ def on_position_left_labels(evt)
647
+ set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE | Wx::RBN::RIBBON_BAR_FLOW_VERTICAL)
648
+ end
650
649
 
651
- def on_position_left_both(evt)
652
- set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE | Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS |
653
- Wx::RBN::RIBBON_BAR_FLOW_VERTICAL)
654
- end
650
+ def on_position_left_icons(evt)
651
+ set_bar_style((Wx::RBN::RIBBON_BAR_DEFAULT_STYLE & (~Wx::RBN::RIBBON_BAR_SHOW_PAGE_LABELS)) |
652
+ Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS | Wx::RBN::RIBBON_BAR_FLOW_VERTICAL)
653
+ end
655
654
 
656
- def on_position_left_dropdown(evt)
657
- menu = Wx::Menu.new
658
- menu.append(ID::POSITION_LEFT, "Left with Icons")
659
- menu.append(ID::POSITION_LEFT_LABELS, "Left with Labels")
660
- menu.append(ID::POSITION_LEFT_BOTH, "Left with Both")
661
- evt.popup_menu(menu)
662
- end
655
+ def on_position_left_both(evt)
656
+ set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE | Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS |
657
+ Wx::RBN::RIBBON_BAR_FLOW_VERTICAL)
658
+ end
663
659
 
664
- def on_remove_page(evt)
665
- n = @ribbon.get_page_count
666
- if n > 0
667
- @ribbon.delete_page(n-1)
668
- @ribbon.realize
660
+ def on_position_left_dropdown(evt)
661
+ menu = Wx::Menu.new
662
+ menu.append(ID::POSITION_LEFT, "Left with Icons")
663
+ menu.append(ID::POSITION_LEFT_LABELS, "Left with Labels")
664
+ menu.append(ID::POSITION_LEFT_BOTH, "Left with Both")
665
+ evt.popup_menu(menu)
669
666
  end
670
- end
671
667
 
672
- def on_hide_pages(evt)
673
- @ribbon.hide_page(1)
674
- @ribbon.hide_page(2)
675
- @ribbon.hide_page(3)
676
- @ribbon.realize
677
- end
668
+ def on_remove_page(evt)
669
+ n = @ribbon.get_page_count
670
+ if n > 0
671
+ @ribbon.delete_page(n-1)
672
+ @ribbon.realize
673
+ end
674
+ end
678
675
 
679
- def on_show_pages(evt)
680
- @ribbon.show_page(1)
681
- @ribbon.show_page(2)
682
- @ribbon.show_page(3)
683
- @ribbon.realize
684
- end
676
+ def on_hide_pages(evt)
677
+ @ribbon.hide_page(1)
678
+ @ribbon.hide_page(2)
679
+ @ribbon.hide_page(3)
680
+ @ribbon.realize
681
+ end
685
682
 
686
- def on_plus_minus(evt)
687
- if @plus_minus_state
688
- evt.bar.set_button_icon(ID::PLUS_MINUS,
689
- Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, [24, 24]))
690
- @plus_minus_state = false
691
- else
692
- evt.bar.set_button_icon(ID::PLUS_MINUS,
693
- Wx::ArtProvider.get_bitmap(Wx::ART_MINUS, Wx::ART_OTHER, [24, 24]))
694
- @plus_minus_state = true
683
+ def on_show_pages(evt)
684
+ @ribbon.show_page(1)
685
+ @ribbon.show_page(2)
686
+ @ribbon.show_page(3)
687
+ @ribbon.realize
695
688
  end
696
- end
697
689
 
698
- def on_change_label(evt)
699
- if @change_label_state
700
- evt.bar.set_button_text(ID::CHANGE_LABEL, "short")
701
- @change_label_state = false
702
- else
703
- evt.bar.set_button_text(ID::CHANGE_LABEL, "some long text")
704
- @change_label_state = true
690
+ def on_plus_minus(evt)
691
+ if @plus_minus_state
692
+ evt.bar.set_button_icon(ID::PLUS_MINUS,
693
+ Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, [24, 24]))
694
+ @plus_minus_state = false
695
+ else
696
+ evt.bar.set_button_icon(ID::PLUS_MINUS,
697
+ Wx::ArtProvider.get_bitmap(Wx::ART_MINUS, Wx::ART_OTHER, [24, 24]))
698
+ @plus_minus_state = true
699
+ end
705
700
  end
706
- end
707
701
 
708
- def on_toggle_panels(evt)
709
- @ribbon.show_panels(@togglePanels.value)
710
- end
702
+ def on_change_label(evt)
703
+ if @change_label_state
704
+ evt.bar.set_button_text(ID::CHANGE_LABEL, "short")
705
+ @change_label_state = false
706
+ else
707
+ evt.bar.set_button_text(ID::CHANGE_LABEL, "some long text")
708
+ @change_label_state = true
709
+ end
710
+ end
711
711
 
712
- def on_ribbon_bar_toggled(evt)
713
- add_text("Ribbon bar %s." %
714
- (@ribbon.are_panels_shown ? "expanded" : "collapsed"))
715
- end
712
+ def on_toggle_panels(evt)
713
+ @ribbon.show_panels(@togglePanels.value)
714
+ end
716
715
 
717
- def on_ribbon_bar_help_clicked(evt)
718
- add_text("Ribbon bar help clicked")
719
- end
716
+ def on_ribbon_bar_toggled(evt)
717
+ add_text("Ribbon bar %s." %
718
+ (@ribbon.are_panels_shown ? "expanded" : "collapsed"))
719
+ end
720
720
 
721
- def on_size_event(evt)
722
- if evt.size.width < 200
723
- @ribbon.hide()
724
- else
725
- @ribbon.show
721
+ def on_ribbon_bar_help_clicked(evt)
722
+ add_text("Ribbon bar help clicked")
726
723
  end
727
- evt.skip
728
- end
729
724
 
730
- def on_ext_button(evt)
731
- Wx.message_box("Extension button clicked")
732
- end
725
+ def on_size_event(evt)
726
+ if evt.size.width < 200
727
+ @ribbon.hide()
728
+ else
729
+ @ribbon.show
730
+ end
731
+ evt.skip
732
+ end
733
733
 
734
- protected
735
-
736
- def populate_colours_panel(panel, defclr, gallery_id)
737
- gallery = panel.find_window_by_id(gallery_id)
738
- if gallery
739
- gallery.clear
740
- else
741
- gallery = Wx::RBN::RibbonGallery.new(panel, gallery_id)
742
- end
743
- Wx::MemoryDC.draw_on do |dc|
744
- def_item = add_colour_to_gallery(gallery, "Default", dc, defclr)
745
- gallery.set_selection(def_item)
746
- add_colour_to_gallery(gallery, "BLUE", dc)
747
- add_colour_to_gallery(gallery, "BLUE VIOLET", dc)
748
- add_colour_to_gallery(gallery, "BROWN", dc)
749
- add_colour_to_gallery(gallery, "CADET BLUE", dc)
750
- add_colour_to_gallery(gallery, "CORAL", dc)
751
- add_colour_to_gallery(gallery, "CYAN", dc)
752
- add_colour_to_gallery(gallery, "DARK GREEN", dc)
753
- add_colour_to_gallery(gallery, "DARK ORCHID", dc)
754
- add_colour_to_gallery(gallery, "FIREBRICK", dc)
755
- add_colour_to_gallery(gallery, "GOLD", dc)
756
- add_colour_to_gallery(gallery, "GOLDENROD", dc)
757
- add_colour_to_gallery(gallery, "GREEN", dc)
758
- add_colour_to_gallery(gallery, "INDIAN RED", dc)
759
- add_colour_to_gallery(gallery, "KHAKI", dc)
760
- add_colour_to_gallery(gallery, "LIGHT BLUE", dc)
761
- add_colour_to_gallery(gallery, "LIME GREEN", dc)
762
- add_colour_to_gallery(gallery, "MAGENTA", dc)
763
- add_colour_to_gallery(gallery, "MAROON", dc)
764
- add_colour_to_gallery(gallery, "NAVY", dc)
765
- add_colour_to_gallery(gallery, "ORANGE", dc)
766
- add_colour_to_gallery(gallery, "ORCHID", dc)
767
- add_colour_to_gallery(gallery, "PINK", dc)
768
- add_colour_to_gallery(gallery, "PLUM", dc)
769
- add_colour_to_gallery(gallery, "PURPLE", dc)
770
- add_colour_to_gallery(gallery, "RED", dc)
771
- add_colour_to_gallery(gallery, "SALMON", dc)
772
- add_colour_to_gallery(gallery, "SEA GREEN", dc)
773
- add_colour_to_gallery(gallery, "SIENNA", dc)
774
- add_colour_to_gallery(gallery, "SKY BLUE", dc)
775
- add_colour_to_gallery(gallery, "TAN", dc)
776
- add_colour_to_gallery(gallery, "THISTLE", dc)
777
- add_colour_to_gallery(gallery, "TURQUOISE", dc)
778
- add_colour_to_gallery(gallery, "VIOLET", dc)
779
- add_colour_to_gallery(gallery, "VIOLET RED", dc)
780
- add_colour_to_gallery(gallery, "WHEAT", dc)
781
- add_colour_to_gallery(gallery, "WHITE", dc)
782
- add_colour_to_gallery(gallery, "YELLOW", dc)
783
- end
784
-
785
- gallery
786
- end
734
+ def on_ext_button(evt)
735
+ Wx.message_box("Extension button clicked")
736
+ end
787
737
 
788
- def add_text(msg)
789
- @logwindow.append_text(msg)
790
- @logwindow.append_text("\n")
791
- @ribbon.dismiss_expanded_panel
792
- end
738
+ protected
793
739
 
794
- def add_colour_to_gallery(gallery, colour, dc, value = nil)
795
- item = nil
796
-
797
- c = nil
798
- c = Wx::Colour.new(colour) if colour != "Default"
799
-
800
- c = value unless c && c.ok?
801
-
802
- if c.ok?
803
- iWidth = 64
804
- iHeight = 40
805
-
806
- bitmap = Wx::Bitmap.new(iWidth, iHeight)
807
- dc.select_object(bitmap)
808
- dc.set_font(@label_font)
809
- b = Wx::Brush.new (c)
810
- dc.set_pen(Wx::BLACK_PEN)
811
- dc.set_brush(b)
812
- dc.draw_rectangle(0, 0, iWidth, iHeight)
813
-
814
- colour = colour[0] + colour[1,colour.size].downcase
815
- size = dc.get_text_extent(colour)
816
- foreground = Wx::Colour.new(~c.red, ~c.green, ~c.blue)
817
- if ((foreground.red - c.red).abs +
818
- (foreground.blue - c.blue).abs +
819
- (foreground.green - c.green).abs) < 64
820
- # Foreground too similar to background - use a different
821
- # strategy to find a contrasting colour
822
- foreground = Wx::Colour.new((c.red + 64) % 256, 255 - c.green, (c.blue + 192) % 256)
740
+ def populate_colours_panel(panel, defclr, gallery_id)
741
+ gallery = panel.find_window_by_id(gallery_id)
742
+ if gallery
743
+ gallery.clear
744
+ else
745
+ gallery = Wx::RBN::RibbonGallery.new(panel, gallery_id)
746
+ end
747
+ Wx::MemoryDC.draw_on do |dc|
748
+ def_item = add_colour_to_gallery(gallery, "Default", dc, defclr)
749
+ gallery.set_selection(def_item)
750
+ add_colour_to_gallery(gallery, "BLUE", dc)
751
+ add_colour_to_gallery(gallery, "BLUE VIOLET", dc)
752
+ add_colour_to_gallery(gallery, "BROWN", dc)
753
+ add_colour_to_gallery(gallery, "CADET BLUE", dc)
754
+ add_colour_to_gallery(gallery, "CORAL", dc)
755
+ add_colour_to_gallery(gallery, "CYAN", dc)
756
+ add_colour_to_gallery(gallery, "DARK GREEN", dc)
757
+ add_colour_to_gallery(gallery, "DARK ORCHID", dc)
758
+ add_colour_to_gallery(gallery, "FIREBRICK", dc)
759
+ add_colour_to_gallery(gallery, "GOLD", dc)
760
+ add_colour_to_gallery(gallery, "GOLDENROD", dc)
761
+ add_colour_to_gallery(gallery, "GREEN", dc)
762
+ add_colour_to_gallery(gallery, "INDIAN RED", dc)
763
+ add_colour_to_gallery(gallery, "KHAKI", dc)
764
+ add_colour_to_gallery(gallery, "LIGHT BLUE", dc)
765
+ add_colour_to_gallery(gallery, "LIME GREEN", dc)
766
+ add_colour_to_gallery(gallery, "MAGENTA", dc)
767
+ add_colour_to_gallery(gallery, "MAROON", dc)
768
+ add_colour_to_gallery(gallery, "NAVY", dc)
769
+ add_colour_to_gallery(gallery, "ORANGE", dc)
770
+ add_colour_to_gallery(gallery, "ORCHID", dc)
771
+ add_colour_to_gallery(gallery, "PINK", dc)
772
+ add_colour_to_gallery(gallery, "PLUM", dc)
773
+ add_colour_to_gallery(gallery, "PURPLE", dc)
774
+ add_colour_to_gallery(gallery, "RED", dc)
775
+ add_colour_to_gallery(gallery, "SALMON", dc)
776
+ add_colour_to_gallery(gallery, "SEA GREEN", dc)
777
+ add_colour_to_gallery(gallery, "SIENNA", dc)
778
+ add_colour_to_gallery(gallery, "SKY BLUE", dc)
779
+ add_colour_to_gallery(gallery, "TAN", dc)
780
+ add_colour_to_gallery(gallery, "THISTLE", dc)
781
+ add_colour_to_gallery(gallery, "TURQUOISE", dc)
782
+ add_colour_to_gallery(gallery, "VIOLET", dc)
783
+ add_colour_to_gallery(gallery, "VIOLET RED", dc)
784
+ add_colour_to_gallery(gallery, "WHEAT", dc)
785
+ add_colour_to_gallery(gallery, "WHITE", dc)
786
+ add_colour_to_gallery(gallery, "YELLOW", dc)
823
787
  end
824
- dc.set_text_foreground(foreground)
825
- dc.draw_text(colour, (iWidth - size[0] + 1).div(2), (iHeight - size[1]).div(2))
826
- dc.select_object_as_source(Wx::NULL_BITMAP)
827
788
 
828
- item = gallery.append(bitmap, Wx::ID_ANY)
829
- gallery.set_item_client_data(item, [colour, c])
789
+ gallery
830
790
  end
831
- item
832
- end
833
791
 
834
- def get_gallery_colour(gallery, item)
835
- gallery.get_item_client_data(item)
836
- end
792
+ def add_text(msg)
793
+ @logwindow.append_text(msg)
794
+ @logwindow.append_text("\n")
795
+ @ribbon.dismiss_expanded_panel
796
+ end
797
+
798
+ def add_colour_to_gallery(gallery, colour, dc, value = nil)
799
+ item = nil
800
+
801
+ c = nil
802
+ c = Wx::Colour.new(colour) if colour != "Default"
803
+
804
+ c = value unless c && c.ok?
805
+
806
+ if c.ok?
807
+ iWidth = 64
808
+ iHeight = 40
809
+
810
+ bitmap = Wx::Bitmap.new(iWidth, iHeight)
811
+ dc.select_object(bitmap)
812
+ dc.set_font(@label_font)
813
+ b = Wx::Brush.new (c)
814
+ dc.set_pen(Wx::BLACK_PEN)
815
+ dc.set_brush(b)
816
+ dc.draw_rectangle(0, 0, iWidth, iHeight)
817
+
818
+ colour = colour[0] + colour[1,colour.size].downcase
819
+ size = dc.get_text_extent(colour)
820
+ foreground = Wx::Colour.new(~c.red, ~c.green, ~c.blue)
821
+ if ((foreground.red - c.red).abs +
822
+ (foreground.blue - c.blue).abs +
823
+ (foreground.green - c.green).abs) < 64
824
+ # Foreground too similar to background - use a different
825
+ # strategy to find a contrasting colour
826
+ foreground = Wx::Colour.new((c.red + 64) % 256, 255 - c.green, (c.blue + 192) % 256)
827
+ end
828
+ dc.set_text_foreground(foreground)
829
+ dc.draw_text(colour, (iWidth - size[0] + 1).div(2), (iHeight - size[1]).div(2))
830
+ dc.select_object_as_source(Wx::NULL_BITMAP)
837
831
 
838
- def reset_gallery_art_providers
839
- if @primary_gallery.get_art_provider != @ribbon.get_art_provider
840
- @primary_gallery.set_art_provider(@ribbon.get_art_provider)
832
+ item = gallery.append(bitmap, Wx::ID_ANY)
833
+ gallery.set_item_client_object(item, [colour, c])
834
+ end
835
+ item
841
836
  end
842
- if @secondary_gallery.art_provider != @ribbon.art_provider
843
- @secondary_gallery.art_provider= @ribbon.art_provider
837
+
838
+ def get_gallery_colour(gallery, item)
839
+ gallery.get_item_client_object(item)
844
840
  end
845
- end
846
841
 
847
- def set_art_provider(prov)
848
- @ribbon.freeze
849
- @ribbon.set_art_provider(prov)
842
+ def reset_gallery_art_providers
843
+ if @primary_gallery.get_art_provider != @ribbon.get_art_provider
844
+ @primary_gallery.set_art_provider(@ribbon.get_art_provider)
845
+ end
846
+ if @secondary_gallery.art_provider != @ribbon.art_provider
847
+ @secondary_gallery.art_provider= @ribbon.art_provider
848
+ end
849
+ end
850
850
 
851
- prov.get_colour_scheme(@default_primary, @default_secondary, @default_tertiary)
852
- populate_colours_panel(@primary_gallery.get_parent, @default_primary, ID::PRIMARY_COLOUR)
853
- populate_colours_panel(@secondary_gallery.parent, @default_secondary, ID::SECONDARY_COLOUR)
851
+ def set_art_provider(prov)
852
+ @ribbon.freeze
853
+ @ribbon.set_art_provider(prov)
854
854
 
855
- @ribbon.realize
856
- @ribbon.thaw
857
- get_sizer.layout
858
- end
855
+ prov.get_colour_scheme(@default_primary, @default_secondary, @default_tertiary)
856
+ populate_colours_panel(@primary_gallery.get_parent, @default_primary, ID::PRIMARY_COLOUR)
857
+ populate_colours_panel(@secondary_gallery.parent, @default_secondary, ID::SECONDARY_COLOUR)
858
+
859
+ @ribbon.realize
860
+ @ribbon.thaw
861
+ get_sizer.layout
862
+ end
863
+
864
+ def set_bar_style(style)
865
+ @ribbon.freeze
866
+ @ribbon.set_window_style_flag(style)
867
+ pTopSize = get_sizer
868
+ pToolbar = find_window_by_id(ID::MAIN_TOOLBAR)
869
+ if (style & Wx::RBN::RIBBON_BAR_FLOW_VERTICAL) == Wx::RBN::RIBBON_BAR_FLOW_VERTICAL
870
+ @ribbon.set_tab_ctrl_margins(10, 10)
871
+ pTopSize.set_orientation(Wx::HORIZONTAL)
872
+ pToolbar.set_rows(3, 5) if pToolbar
873
+ else
874
+ @ribbon.set_tab_ctrl_margins(50, 20)
875
+ pTopSize.set_orientation(Wx::VERTICAL)
876
+ pToolbar.set_rows(2, 3) if pToolbar
877
+ end
878
+ @ribbon.realise
879
+ layout
880
+ @ribbon.thaw
881
+ end
859
882
 
860
- def set_bar_style(style)
861
- @ribbon.freeze
862
- @ribbon.set_window_style_flag(style)
863
- pTopSize = get_sizer
864
- pToolbar = find_window_by_id(ID::MAIN_TOOLBAR)
865
- if (style & Wx::RBN::RIBBON_BAR_FLOW_VERTICAL) == Wx::RBN::RIBBON_BAR_FLOW_VERTICAL
866
- @ribbon.set_tab_ctrl_margins(10, 10)
867
- pTopSize.set_orientation(Wx::HORIZONTAL)
868
- pToolbar.set_rows(3, 5) if pToolbar
869
- else
870
- @ribbon.set_tab_ctrl_margins(50, 20)
871
- pTopSize.set_orientation(Wx::VERTICAL)
872
- pToolbar.set_rows(2, 3) if pToolbar
873
- end
874
- @ribbon.realise
875
- layout
876
- @ribbon.thaw
877
883
  end
878
884
 
879
885
  end
@@ -889,7 +895,7 @@ module RibbonSample
889
895
  end
890
896
 
891
897
  def self.activate
892
- frame = MyFrame.new
898
+ frame = Ribbon::MyFrame.new
893
899
  frame.show(true)
894
900
  frame
895
901
  end