wxruby3 0.9.0.pre.beta.8-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (839) hide show
  1. checksums.yaml +7 -0
  2. data/.wxconfig +17 -0
  3. data/.yardopts +13 -0
  4. data/CREDITS.md +52 -0
  5. data/LICENSE +21 -0
  6. data/README.md +139 -0
  7. data/bin/wxruby +9 -0
  8. data/bin/wxruby.bat +20 -0
  9. data/ext/mkrf_conf_bingem.rb +18 -0
  10. data/ext/wxbase32u_gcc_custom.dll +0 -0
  11. data/ext/wxbase32u_net_gcc_custom.dll +0 -0
  12. data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
  13. data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
  14. data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
  15. data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
  16. data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
  17. data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
  18. data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
  19. data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
  20. data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
  21. data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
  22. data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
  23. data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
  24. data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
  25. data/lib/wx/accessors.rb +63 -0
  26. data/lib/wx/aui/auimanager.rb +17 -0
  27. data/lib/wx/aui/auinotebook.rb +9 -0
  28. data/lib/wx/aui/events/evt_list.rb +143 -0
  29. data/lib/wx/aui/require.rb +9 -0
  30. data/lib/wx/aui.rb +14 -0
  31. data/lib/wx/core/acceleratortable.rb +28 -0
  32. data/lib/wx/core/animation.rb +18 -0
  33. data/lib/wx/core/app.rb +89 -0
  34. data/lib/wx/core/artprovider.rb +31 -0
  35. data/lib/wx/core/bitmap.rb +59 -0
  36. data/lib/wx/core/busycursor.rb +12 -0
  37. data/lib/wx/core/choice.rb +4 -0
  38. data/lib/wx/core/choicedlg.rb +54 -0
  39. data/lib/wx/core/clientdc.rb +13 -0
  40. data/lib/wx/core/clipboard.rb +56 -0
  41. data/lib/wx/core/collapsible_pane.rb +12 -0
  42. data/lib/wx/core/colour.rb +34 -0
  43. data/lib/wx/core/combobox.rb +4 -0
  44. data/lib/wx/core/controlwithitems.rb +10 -0
  45. data/lib/wx/core/data_object.rb +10 -0
  46. data/lib/wx/core/dataformat.rb +26 -0
  47. data/lib/wx/core/dc.rb +68 -0
  48. data/lib/wx/core/dialog.rb +50 -0
  49. data/lib/wx/core/enum.rb +28 -0
  50. data/lib/wx/core/event.rb +16 -0
  51. data/lib/wx/core/events/evt_list.rb +1378 -0
  52. data/lib/wx/core/evthandler.rb +253 -0
  53. data/lib/wx/core/ext.rb +58 -0
  54. data/lib/wx/core/font/encoding.rb +113 -0
  55. data/lib/wx/core/font.rb +22 -0
  56. data/lib/wx/core/functions.rb +44 -0
  57. data/lib/wx/core/gauge.rb +12 -0
  58. data/lib/wx/core/genericdirctrl.rb +36 -0
  59. data/lib/wx/core/hboxsizer.rb +6 -0
  60. data/lib/wx/core/helpcontroller.rb +5 -0
  61. data/lib/wx/core/helpcontrollerhelpprovider.rb +24 -0
  62. data/lib/wx/core/helpprovider.rb +15 -0
  63. data/lib/wx/core/icon.rb +40 -0
  64. data/lib/wx/core/image.rb +68 -0
  65. data/lib/wx/core/imagelist.rb +3 -0
  66. data/lib/wx/core/listbox.rb +4 -0
  67. data/lib/wx/core/listctrl.rb +33 -0
  68. data/lib/wx/core/locale.rb +73 -0
  69. data/lib/wx/core/log.rb +20 -0
  70. data/lib/wx/core/menu.rb +78 -0
  71. data/lib/wx/core/menu_bar.rb +20 -0
  72. data/lib/wx/core/menuitem.rb +7 -0
  73. data/lib/wx/core/notebook.rb +9 -0
  74. data/lib/wx/core/object.rb +14 -0
  75. data/lib/wx/core/pen_info.rb +11 -0
  76. data/lib/wx/core/platform_info.rb +13 -0
  77. data/lib/wx/core/point.rb +92 -0
  78. data/lib/wx/core/real_point.rb +92 -0
  79. data/lib/wx/core/rect.rb +57 -0
  80. data/lib/wx/core/simplehelpprovider.rb +38 -0
  81. data/lib/wx/core/size.rb +86 -0
  82. data/lib/wx/core/sizer.rb +43 -0
  83. data/lib/wx/core/splash_screen.rb +44 -0
  84. data/lib/wx/core/textctrl.rb +8 -0
  85. data/lib/wx/core/timer.rb +104 -0
  86. data/lib/wx/core/toolbar.rb +37 -0
  87. data/lib/wx/core/toolbartool.rb +4 -0
  88. data/lib/wx/core/treectrl.rb +46 -0
  89. data/lib/wx/core/validator.rb +8 -0
  90. data/lib/wx/core/variant.rb +62 -0
  91. data/lib/wx/core/vboxsizer.rb +6 -0
  92. data/lib/wx/core/window.rb +95 -0
  93. data/lib/wx/core/window_update_locker.rb +12 -0
  94. data/lib/wx/core/xmlresource.rb +56 -0
  95. data/lib/wx/core.rb +61 -0
  96. data/lib/wx/doc/aui/auimanager.rb +12 -0
  97. data/lib/wx/doc/aui/auinotebook.rb +9 -0
  98. data/lib/wx/doc/colour_dialog.rb +15 -0
  99. data/lib/wx/doc/core.rb +11 -0
  100. data/lib/wx/doc/dc.rb +49 -0
  101. data/lib/wx/doc/enum.rb +88 -0
  102. data/lib/wx/doc/evthandler.rb +87 -0
  103. data/lib/wx/doc/extra/00_starting.md +154 -0
  104. data/lib/wx/doc/extra/01_packages.md +179 -0
  105. data/lib/wx/doc/extra/02_lifecycles.md +116 -0
  106. data/lib/wx/doc/extra/03_dialogs.md +57 -0
  107. data/lib/wx/doc/extra/04_enums.md +143 -0
  108. data/lib/wx/doc/extra/05_event-handling.md +166 -0
  109. data/lib/wx/doc/extra/06_geometry.md +56 -0
  110. data/lib/wx/doc/extra/07_colour_and_font.md +52 -0
  111. data/lib/wx/doc/extra/08_extensions.md +144 -0
  112. data/lib/wx/doc/extra/09_exceptions.md +54 -0
  113. data/lib/wx/doc/functions.rb +221 -0
  114. data/lib/wx/doc/gdi_common.rb +181 -0
  115. data/lib/wx/doc/gen/about_dialog_info.rb +315 -0
  116. data/lib/wx/doc/gen/accelerator.rb +172 -0
  117. data/lib/wx/doc/gen/accessible.rb +817 -0
  118. data/lib/wx/doc/gen/animation.rb +253 -0
  119. data/lib/wx/doc/gen/animation_ctrl.rb +129 -0
  120. data/lib/wx/doc/gen/any_button.rb +170 -0
  121. data/lib/wx/doc/gen/app.rb +363 -0
  122. data/lib/wx/doc/gen/art_provider.rb +497 -0
  123. data/lib/wx/doc/gen/aui/aui_dock_art.rb +421 -0
  124. data/lib/wx/doc/gen/aui/aui_floating_frame.rb +39 -0
  125. data/lib/wx/doc/gen/aui/aui_manager.rb +323 -0
  126. data/lib/wx/doc/gen/aui/aui_manager_event.rb +112 -0
  127. data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +163 -0
  128. data/lib/wx/doc/gen/aui/aui_mdi_client_window.rb +46 -0
  129. data/lib/wx/doc/gen/aui/aui_mdi_parent_frame.rb +109 -0
  130. data/lib/wx/doc/gen/aui/aui_notebook.rb +329 -0
  131. data/lib/wx/doc/gen/aui/aui_notebook_event.rb +179 -0
  132. data/lib/wx/doc/gen/aui/aui_pane_info.rb +665 -0
  133. data/lib/wx/doc/gen/aui/aui_tab_art.rb +372 -0
  134. data/lib/wx/doc/gen/aui/aui_tab_ctrl.rb +147 -0
  135. data/lib/wx/doc/gen/aui/aui_tool_bar.rb +437 -0
  136. data/lib/wx/doc/gen/aui/aui_tool_bar_art.rb +272 -0
  137. data/lib/wx/doc/gen/aui/aui_tool_bar_event.rb +195 -0
  138. data/lib/wx/doc/gen/aui/aui_tool_bar_item.rb +224 -0
  139. data/lib/wx/doc/gen/aui/event_list.rb +162 -0
  140. data/lib/wx/doc/gen/auto_buffered_paint_dc.rb +47 -0
  141. data/lib/wx/doc/gen/bitmap.rb +638 -0
  142. data/lib/wx/doc/gen/bitmap_button.rb +91 -0
  143. data/lib/wx/doc/gen/book_ctrl_base.rb +240 -0
  144. data/lib/wx/doc/gen/book_ctrl_event.rb +60 -0
  145. data/lib/wx/doc/gen/box_sizer.rb +66 -0
  146. data/lib/wx/doc/gen/brush.rb +219 -0
  147. data/lib/wx/doc/gen/buffered_dc.rb +95 -0
  148. data/lib/wx/doc/gen/buffered_paint_dc.rb +55 -0
  149. data/lib/wx/doc/gen/busy_info.rb +141 -0
  150. data/lib/wx/doc/gen/button.rb +133 -0
  151. data/lib/wx/doc/gen/calculate_layout_event.rb +59 -0
  152. data/lib/wx/doc/gen/calendar_ctrl.rb +236 -0
  153. data/lib/wx/doc/gen/calendar_date_attr.rb +137 -0
  154. data/lib/wx/doc/gen/calendar_event.rb +150 -0
  155. data/lib/wx/doc/gen/caret.rb +99 -0
  156. data/lib/wx/doc/gen/check_box.rb +145 -0
  157. data/lib/wx/doc/gen/check_list_box.rb +96 -0
  158. data/lib/wx/doc/gen/choice.rb +143 -0
  159. data/lib/wx/doc/gen/choicebook.rb +100 -0
  160. data/lib/wx/doc/gen/client_dc.rb +49 -0
  161. data/lib/wx/doc/gen/clipboard.rb +128 -0
  162. data/lib/wx/doc/gen/collapsible_pane.rb +120 -0
  163. data/lib/wx/doc/gen/collapsible_pane_event.rb +45 -0
  164. data/lib/wx/doc/gen/colour.rb +289 -0
  165. data/lib/wx/doc/gen/colour_data.rb +96 -0
  166. data/lib/wx/doc/gen/colour_dialog.rb +84 -0
  167. data/lib/wx/doc/gen/colour_picker_ctrl.rb +89 -0
  168. data/lib/wx/doc/gen/colour_picker_event.rb +74 -0
  169. data/lib/wx/doc/gen/combo_box.rb +228 -0
  170. data/lib/wx/doc/gen/context_help_button.rb +34 -0
  171. data/lib/wx/doc/gen/control.rb +245 -0
  172. data/lib/wx/doc/gen/control_with_items.rb +339 -0
  173. data/lib/wx/doc/gen/core.rb +42 -0
  174. data/lib/wx/doc/gen/cursor.rb +127 -0
  175. data/lib/wx/doc/gen/data_format.rb +94 -0
  176. data/lib/wx/doc/gen/data_object.rb +439 -0
  177. data/lib/wx/doc/gen/date_event.rb +48 -0
  178. data/lib/wx/doc/gen/date_picker_ctrl.rb +127 -0
  179. data/lib/wx/doc/gen/dc.rb +1278 -0
  180. data/lib/wx/doc/gen/defs.rb +2832 -0
  181. data/lib/wx/doc/gen/dialog.rb +426 -0
  182. data/lib/wx/doc/gen/dir_dialog.rb +134 -0
  183. data/lib/wx/doc/gen/dir_filter_list_ctrl.rb +80 -0
  184. data/lib/wx/doc/gen/dir_picker_ctrl.rb +103 -0
  185. data/lib/wx/doc/gen/drag_drop.rb +292 -0
  186. data/lib/wx/doc/gen/drag_image.rb +123 -0
  187. data/lib/wx/doc/gen/editable_list_box.rb +89 -0
  188. data/lib/wx/doc/gen/event.rb +911 -0
  189. data/lib/wx/doc/gen/event_list.rb +1512 -0
  190. data/lib/wx/doc/gen/events.rb +2499 -0
  191. data/lib/wx/doc/gen/evt_handler.rb +224 -0
  192. data/lib/wx/doc/gen/ext_help_controller.rb +100 -0
  193. data/lib/wx/doc/gen/file_dialog.rb +294 -0
  194. data/lib/wx/doc/gen/file_dir_picker_event.rb +98 -0
  195. data/lib/wx/doc/gen/file_picker_ctrl.rb +107 -0
  196. data/lib/wx/doc/gen/find_dialog_event.rb +119 -0
  197. data/lib/wx/doc/gen/find_replace_data.rb +59 -0
  198. data/lib/wx/doc/gen/find_replace_dialog.rb +44 -0
  199. data/lib/wx/doc/gen/flex_grid_sizer.rb +145 -0
  200. data/lib/wx/doc/gen/font.rb +1282 -0
  201. data/lib/wx/doc/gen/font_data.rb +132 -0
  202. data/lib/wx/doc/gen/font_dialog.rb +71 -0
  203. data/lib/wx/doc/gen/font_picker_ctrl.rb +120 -0
  204. data/lib/wx/doc/gen/font_picker_event.rb +64 -0
  205. data/lib/wx/doc/gen/frame.rb +276 -0
  206. data/lib/wx/doc/gen/fs_file.rb +269 -0
  207. data/lib/wx/doc/gen/functions.rb +10 -0
  208. data/lib/wx/doc/gen/gauge.rb +127 -0
  209. data/lib/wx/doc/gen/gb_sizer_item.rb +78 -0
  210. data/lib/wx/doc/gen/gcdc.rb +61 -0
  211. data/lib/wx/doc/gen/gdi_common.rb +1108 -0
  212. data/lib/wx/doc/gen/gdi_object.rb +29 -0
  213. data/lib/wx/doc/gen/generic_dir_ctrl.rb +198 -0
  214. data/lib/wx/doc/gen/graphics_context.rb +764 -0
  215. data/lib/wx/doc/gen/graphics_object.rb +494 -0
  216. data/lib/wx/doc/gen/grid/event_list.rb +173 -0
  217. data/lib/wx/doc/gen/grid/grid_cell_activatable_editor.rb +33 -0
  218. data/lib/wx/doc/gen/grid/grid_cell_attr.rb +279 -0
  219. data/lib/wx/doc/gen/grid/grid_cell_auto_wrap_string_editor.rb +31 -0
  220. data/lib/wx/doc/gen/grid/grid_cell_auto_wrap_string_renderer.rb +32 -0
  221. data/lib/wx/doc/gen/grid/grid_cell_bool_editor.rb +44 -0
  222. data/lib/wx/doc/gen/grid/grid_cell_bool_renderer.rb +31 -0
  223. data/lib/wx/doc/gen/grid/grid_cell_choice_editor.rb +48 -0
  224. data/lib/wx/doc/gen/grid/grid_cell_date_editor.rb +33 -0
  225. data/lib/wx/doc/gen/grid/grid_cell_date_renderer.rb +40 -0
  226. data/lib/wx/doc/gen/grid/grid_cell_date_time_renderer.rb +35 -0
  227. data/lib/wx/doc/gen/grid/grid_cell_editor.rb +181 -0
  228. data/lib/wx/doc/gen/grid/grid_cell_enum_editor.rb +34 -0
  229. data/lib/wx/doc/gen/grid/grid_cell_enum_renderer.rb +39 -0
  230. data/lib/wx/doc/gen/grid/grid_cell_float_editor.rb +41 -0
  231. data/lib/wx/doc/gen/grid/grid_cell_float_renderer.rb +74 -0
  232. data/lib/wx/doc/gen/grid/grid_cell_number_editor.rb +41 -0
  233. data/lib/wx/doc/gen/grid/grid_cell_number_renderer.rb +31 -0
  234. data/lib/wx/doc/gen/grid/grid_cell_renderer.rb +98 -0
  235. data/lib/wx/doc/gen/grid/grid_cell_string_renderer.rb +31 -0
  236. data/lib/wx/doc/gen/grid/grid_cell_text_editor.rb +45 -0
  237. data/lib/wx/doc/gen/grid/grid_ctrl.rb +2381 -0
  238. data/lib/wx/doc/gen/grid/grid_editor_created_event.rb +87 -0
  239. data/lib/wx/doc/gen/grid/grid_event.rb +96 -0
  240. data/lib/wx/doc/gen/grid/grid_range_select_event.rb +96 -0
  241. data/lib/wx/doc/gen/grid/grid_size_event.rb +71 -0
  242. data/lib/wx/doc/gen/grid/grid_string_table.rb +130 -0
  243. data/lib/wx/doc/gen/grid/grid_table_base.rb +288 -0
  244. data/lib/wx/doc/gen/grid/grid_table_message.rb +73 -0
  245. data/lib/wx/doc/gen/grid_bag_sizer.rb +298 -0
  246. data/lib/wx/doc/gen/grid_sizer.rb +135 -0
  247. data/lib/wx/doc/gen/help_controller.rb +136 -0
  248. data/lib/wx/doc/gen/help_provider.rb +80 -0
  249. data/lib/wx/doc/gen/html/event_list.rb +46 -0
  250. data/lib/wx/doc/gen/html/html_cell.rb +441 -0
  251. data/lib/wx/doc/gen/html/html_cell_event.rb +62 -0
  252. data/lib/wx/doc/gen/html/html_easy_printing.rb +169 -0
  253. data/lib/wx/doc/gen/html/html_help_controller.rb +256 -0
  254. data/lib/wx/doc/gen/html/html_help_data.rb +144 -0
  255. data/lib/wx/doc/gen/html/html_help_frame.rb +112 -0
  256. data/lib/wx/doc/gen/html/html_help_window.rb +230 -0
  257. data/lib/wx/doc/gen/html/html_link_event.rb +36 -0
  258. data/lib/wx/doc/gen/html/html_list_box.rb +150 -0
  259. data/lib/wx/doc/gen/html/html_printout.rb +87 -0
  260. data/lib/wx/doc/gen/html/html_window.rb +386 -0
  261. data/lib/wx/doc/gen/icon.rb +267 -0
  262. data/lib/wx/doc/gen/icon_location.rb +38 -0
  263. data/lib/wx/doc/gen/image.rb +1144 -0
  264. data/lib/wx/doc/gen/image_list.rb +181 -0
  265. data/lib/wx/doc/gen/keyboard_state.rb +124 -0
  266. data/lib/wx/doc/gen/list_box.rb +260 -0
  267. data/lib/wx/doc/gen/list_ctrl.rb +1542 -0
  268. data/lib/wx/doc/gen/list_event.rb +177 -0
  269. data/lib/wx/doc/gen/listbook.rb +100 -0
  270. data/lib/wx/doc/gen/locale.rb +4143 -0
  271. data/lib/wx/doc/gen/log.rb +505 -0
  272. data/lib/wx/doc/gen/mdi_client_window.rb +38 -0
  273. data/lib/wx/doc/gen/mdi_frame.rb +235 -0
  274. data/lib/wx/doc/gen/media_ctrl.rb +225 -0
  275. data/lib/wx/doc/gen/media_event.rb +109 -0
  276. data/lib/wx/doc/gen/memory_dc.rb +95 -0
  277. data/lib/wx/doc/gen/menu.rb +493 -0
  278. data/lib/wx/doc/gen/menu_bar.rb +247 -0
  279. data/lib/wx/doc/gen/menu_item.rb +333 -0
  280. data/lib/wx/doc/gen/message_dialog.rb +195 -0
  281. data/lib/wx/doc/gen/mini_frame.rb +72 -0
  282. data/lib/wx/doc/gen/mirror_dc.rb +29 -0
  283. data/lib/wx/doc/gen/mouse_state.rb +108 -0
  284. data/lib/wx/doc/gen/multi_choice_dialog.rb +58 -0
  285. data/lib/wx/doc/gen/non_owned_window.rb +46 -0
  286. data/lib/wx/doc/gen/notebook.rb +220 -0
  287. data/lib/wx/doc/gen/number_entry_dialog.rb +75 -0
  288. data/lib/wx/doc/gen/object.rb +69 -0
  289. data/lib/wx/doc/gen/paint_dc.rb +34 -0
  290. data/lib/wx/doc/gen/palette.rb +90 -0
  291. data/lib/wx/doc/gen/panel.rb +96 -0
  292. data/lib/wx/doc/gen/pen.rb +484 -0
  293. data/lib/wx/doc/gen/pg/event_list.rb +102 -0
  294. data/lib/wx/doc/gen/pg/numeric_property_validator.rb +47 -0
  295. data/lib/wx/doc/gen/pg/pg_array_editor_dialog.rb +295 -0
  296. data/lib/wx/doc/gen/pg/pg_cell.rb +166 -0
  297. data/lib/wx/doc/gen/pg/pg_editor.rb +569 -0
  298. data/lib/wx/doc/gen/pg/pg_multi_button.rb +161 -0
  299. data/lib/wx/doc/gen/pg/pg_properties.rb +2193 -0
  300. data/lib/wx/doc/gen/pg/pg_property.rb +1852 -0
  301. data/lib/wx/doc/gen/pg/pg_validation_info.rb +327 -0
  302. data/lib/wx/doc/gen/pg/property_grid.rb +619 -0
  303. data/lib/wx/doc/gen/pg/property_grid_event.rb +135 -0
  304. data/lib/wx/doc/gen/pg/property_grid_interface.rb +847 -0
  305. data/lib/wx/doc/gen/pg/property_grid_manager.rb +349 -0
  306. data/lib/wx/doc/gen/pg/property_grid_page.rb +265 -0
  307. data/lib/wx/doc/gen/pg/property_grid_page_state.rb +155 -0
  308. data/lib/wx/doc/gen/picker_base.rb +143 -0
  309. data/lib/wx/doc/gen/platform_info.rb +379 -0
  310. data/lib/wx/doc/gen/popup_window.rb +93 -0
  311. data/lib/wx/doc/gen/progress_dialog.rb +106 -0
  312. data/lib/wx/doc/gen/property_sheet_dialog.rb +185 -0
  313. data/lib/wx/doc/gen/prt/event_list.rb +13 -0
  314. data/lib/wx/doc/gen/prt/page_setup_dialog.rb +38 -0
  315. data/lib/wx/doc/gen/prt/post_script_dc.rb +32 -0
  316. data/lib/wx/doc/gen/prt/preview_frame.rb +39 -0
  317. data/lib/wx/doc/gen/prt/print_abort_dialog.rb +127 -0
  318. data/lib/wx/doc/gen/prt/print_data.rb +598 -0
  319. data/lib/wx/doc/gen/prt/print_dialog.rb +47 -0
  320. data/lib/wx/doc/gen/prt/printer.rb +428 -0
  321. data/lib/wx/doc/gen/prt/printer_dc.rb +35 -0
  322. data/lib/wx/doc/gen/query_layout_info_event.rb +98 -0
  323. data/lib/wx/doc/gen/radio_box.rb +258 -0
  324. data/lib/wx/doc/gen/radio_button.rb +128 -0
  325. data/lib/wx/doc/gen/rbn/event_list.rb +132 -0
  326. data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +1652 -0
  327. data/lib/wx/doc/gen/rbn/ribbon_bar.rb +227 -0
  328. data/lib/wx/doc/gen/rbn/ribbon_bar_event.rb +40 -0
  329. data/lib/wx/doc/gen/rbn/ribbon_button_bar.rb +400 -0
  330. data/lib/wx/doc/gen/rbn/ribbon_button_bar_event.rb +58 -0
  331. data/lib/wx/doc/gen/rbn/ribbon_control.rb +116 -0
  332. data/lib/wx/doc/gen/rbn/ribbon_gallery.rb +208 -0
  333. data/lib/wx/doc/gen/rbn/ribbon_gallery_event.rb +51 -0
  334. data/lib/wx/doc/gen/rbn/ribbon_page.rb +129 -0
  335. data/lib/wx/doc/gen/rbn/ribbon_panel.rb +232 -0
  336. data/lib/wx/doc/gen/rbn/ribbon_panel_event.rb +41 -0
  337. data/lib/wx/doc/gen/rbn/ribbon_tool_bar.rb +321 -0
  338. data/lib/wx/doc/gen/rbn/ribbon_tool_bar_event.rb +36 -0
  339. data/lib/wx/doc/gen/region.rb +299 -0
  340. data/lib/wx/doc/gen/rtc/event_list.rb +121 -0
  341. data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +2052 -0
  342. data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +2031 -0
  343. data/lib/wx/doc/gen/rtc/rich_text_event.rb +146 -0
  344. data/lib/wx/doc/gen/rtc/rich_text_file_handler.rb +171 -0
  345. data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +180 -0
  346. data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +104 -0
  347. data/lib/wx/doc/gen/rtc/rich_text_printing.rb +241 -0
  348. data/lib/wx/doc/gen/rtc/rich_text_xml_handler.rb +55 -0
  349. data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +153 -0
  350. data/lib/wx/doc/gen/sash_event.rb +133 -0
  351. data/lib/wx/doc/gen/sash_layout_window.rb +203 -0
  352. data/lib/wx/doc/gen/sash_window.rb +154 -0
  353. data/lib/wx/doc/gen/screen_dc.rb +27 -0
  354. data/lib/wx/doc/gen/scrolled_canvas.rb +317 -0
  355. data/lib/wx/doc/gen/scrolled_control.rb +317 -0
  356. data/lib/wx/doc/gen/scrolled_window.rb +337 -0
  357. data/lib/wx/doc/gen/simplebook.rb +93 -0
  358. data/lib/wx/doc/gen/single_choice_dialog.rb +74 -0
  359. data/lib/wx/doc/gen/sizer.rb +847 -0
  360. data/lib/wx/doc/gen/sizer_item.rb +227 -0
  361. data/lib/wx/doc/gen/slider.rb +316 -0
  362. data/lib/wx/doc/gen/spin_button.rb +124 -0
  363. data/lib/wx/doc/gen/spin_ctrl.rb +170 -0
  364. data/lib/wx/doc/gen/spin_event.rb +47 -0
  365. data/lib/wx/doc/gen/splash_screen.rb +83 -0
  366. data/lib/wx/doc/gen/splitter_event.rb +87 -0
  367. data/lib/wx/doc/gen/splitter_window.rb +357 -0
  368. data/lib/wx/doc/gen/static_bitmap.rb +126 -0
  369. data/lib/wx/doc/gen/static_box.rb +123 -0
  370. data/lib/wx/doc/gen/static_box_sizer.rb +67 -0
  371. data/lib/wx/doc/gen/static_line.rb +66 -0
  372. data/lib/wx/doc/gen/static_text.rb +98 -0
  373. data/lib/wx/doc/gen/status_bar.rb +203 -0
  374. data/lib/wx/doc/gen/stc/event_list.rb +217 -0
  375. data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +4000 -0
  376. data/lib/wx/doc/gen/stc/styled_text_event.rb +7319 -0
  377. data/lib/wx/doc/gen/std_dialog_button_sizer.rb +74 -0
  378. data/lib/wx/doc/gen/svg_file_dc.rb +153 -0
  379. data/lib/wx/doc/gen/system_options.rb +109 -0
  380. data/lib/wx/doc/gen/system_settings.rb +481 -0
  381. data/lib/wx/doc/gen/task_bar_icon.rb +94 -0
  382. data/lib/wx/doc/gen/task_bar_icon_event.rb +86 -0
  383. data/lib/wx/doc/gen/text_attr.rb +645 -0
  384. data/lib/wx/doc/gen/text_ctrl.rb +841 -0
  385. data/lib/wx/doc/gen/text_entry.rb +389 -0
  386. data/lib/wx/doc/gen/text_entry_dialog.rb +170 -0
  387. data/lib/wx/doc/gen/text_validator.rb +212 -0
  388. data/lib/wx/doc/gen/time_picker_ctrl.rb +103 -0
  389. data/lib/wx/doc/gen/timer.rb +103 -0
  390. data/lib/wx/doc/gen/timer_event.rb +73 -0
  391. data/lib/wx/doc/gen/tip_provider.rb +60 -0
  392. data/lib/wx/doc/gen/toggle_button.rb +84 -0
  393. data/lib/wx/doc/gen/tool_bar.rb +744 -0
  394. data/lib/wx/doc/gen/tool_tip.rb +73 -0
  395. data/lib/wx/doc/gen/toolbook.rb +103 -0
  396. data/lib/wx/doc/gen/top_level_window.rb +462 -0
  397. data/lib/wx/doc/gen/tree_ctrl.rb +863 -0
  398. data/lib/wx/doc/gen/tree_event.rb +101 -0
  399. data/lib/wx/doc/gen/treebook.rb +154 -0
  400. data/lib/wx/doc/gen/utils.rb +257 -0
  401. data/lib/wx/doc/gen/v_list_box.rb +224 -0
  402. data/lib/wx/doc/gen/v_scrolled_window.rb +224 -0
  403. data/lib/wx/doc/gen/validator.rb +73 -0
  404. data/lib/wx/doc/gen/variant.rb +340 -0
  405. data/lib/wx/doc/gen/window.rb +2414 -0
  406. data/lib/wx/doc/gen/window_dc.rb +35 -0
  407. data/lib/wx/doc/gen/window_disabler.rb +24 -0
  408. data/lib/wx/doc/gen/with_images.rb +73 -0
  409. data/lib/wx/doc/gen/wizard.rb +197 -0
  410. data/lib/wx/doc/gen/wizard_event.rb +105 -0
  411. data/lib/wx/doc/gen/wizard_page.rb +61 -0
  412. data/lib/wx/doc/gen/wizard_page_simple.rb +72 -0
  413. data/lib/wx/doc/gen/xml_node.rb +282 -0
  414. data/lib/wx/doc/gen/xml_resource.rb +304 -0
  415. data/lib/wx/doc/grid/grid.rb +20 -0
  416. data/lib/wx/doc/help_controller.rb +14 -0
  417. data/lib/wx/doc/html/html_help_controller.rb +8 -0
  418. data/lib/wx/doc/pg/events.rb +15 -0
  419. data/lib/wx/doc/pg/pg_property.rb +8 -0
  420. data/lib/wx/doc/pg/pgeditor.rb +21 -0
  421. data/lib/wx/doc/pg/property_grid.rb +48 -0
  422. data/lib/wx/doc/pg/property_grid_interface.rb +64 -0
  423. data/lib/wx/doc/prt/page_setup_dialog.rb +15 -0
  424. data/lib/wx/doc/prt/print_data.rb +9 -0
  425. data/lib/wx/doc/prt/print_dialog.rb +26 -0
  426. data/lib/wx/doc/prt/printer.rb +15 -0
  427. data/lib/wx/doc/rbn/ribbon_bar.rb +9 -0
  428. data/lib/wx/doc/rbn/ribbon_button_bar.rb +9 -0
  429. data/lib/wx/doc/rbn/ribbon_gallery.rb +9 -0
  430. data/lib/wx/doc/rbn/ribbon_tool_bar.rb +9 -0
  431. data/lib/wx/doc/rtc/richtext_printing.rb +14 -0
  432. data/lib/wx/doc/screen_dc.rb +10 -0
  433. data/lib/wx/doc/stock_objects.rb +98 -0
  434. data/lib/wx/doc/stream.rb +38 -0
  435. data/lib/wx/doc/system_settings.rb +29 -0
  436. data/lib/wx/doc/treebook.rb +9 -0
  437. data/lib/wx/doc/variant.rb +163 -0
  438. data/lib/wx/doc/xml_resource.rb +19 -0
  439. data/lib/wx/global_const.rb +84 -0
  440. data/lib/wx/grid/events/evt_list.rb +156 -0
  441. data/lib/wx/grid/grid.rb +7 -0
  442. data/lib/wx/grid/keyword_defs.rb +10 -0
  443. data/lib/wx/grid/require.rb +9 -0
  444. data/lib/wx/grid.rb +14 -0
  445. data/lib/wx/helpers.rb +65 -0
  446. data/lib/wx/html/events/evt_list.rb +37 -0
  447. data/lib/wx/html/htmlhelpcontroller.rb +6 -0
  448. data/lib/wx/html/htmlwindow.rb +19 -0
  449. data/lib/wx/html/keyword_defs.rb +22 -0
  450. data/lib/wx/html/require.rb +10 -0
  451. data/lib/wx/html.rb +15 -0
  452. data/lib/wx/keyword_ctors.rb +226 -0
  453. data/lib/wx/keyword_defs.rb +487 -0
  454. data/lib/wx/pg/events/evt_list.rb +73 -0
  455. data/lib/wx/pg/events.rb +14 -0
  456. data/lib/wx/pg/keyword_defs.rb +15 -0
  457. data/lib/wx/pg/pg_editor.rb +13 -0
  458. data/lib/wx/pg/pg_properties.rb +24 -0
  459. data/lib/wx/pg/pg_property.rb +27 -0
  460. data/lib/wx/pg/property_grid.rb +71 -0
  461. data/lib/wx/pg/property_grid_interface.rb +46 -0
  462. data/lib/wx/pg/require.rb +12 -0
  463. data/lib/wx/pg.rb +14 -0
  464. data/lib/wx/prt/keyword_defs.rb +8 -0
  465. data/lib/wx/prt/page_setup_dialog.rb +15 -0
  466. data/lib/wx/prt/previewframe.rb +13 -0
  467. data/lib/wx/prt/require.rb +8 -0
  468. data/lib/wx/prt.rb +14 -0
  469. data/lib/wx/rbn/events/evt_list.rb +102 -0
  470. data/lib/wx/rbn/events.rb +4 -0
  471. data/lib/wx/rbn/keyword_defs.rb +43 -0
  472. data/lib/wx/rbn/require.rb +12 -0
  473. data/lib/wx/rbn/ribbon_art_provider.rb +10 -0
  474. data/lib/wx/rbn/ribbon_bar.rb +12 -0
  475. data/lib/wx/rbn/ribbon_button_bar.rb +26 -0
  476. data/lib/wx/rbn/ribbon_control.rb +25 -0
  477. data/lib/wx/rbn/ribbon_gallery.rb +26 -0
  478. data/lib/wx/rbn/ribbon_page.rb +15 -0
  479. data/lib/wx/rbn/ribbon_panel.rb +15 -0
  480. data/lib/wx/rbn/ribbon_tool_bar.rb +26 -0
  481. data/lib/wx/rbn.rb +14 -0
  482. data/lib/wx/rtc/events/evt_list.rb +98 -0
  483. data/lib/wx/rtc/ext/rich_text_ctrl.rb +24 -0
  484. data/lib/wx/rtc/ext.rb +15 -0
  485. data/lib/wx/rtc/keyword_defs.rb +17 -0
  486. data/lib/wx/rtc/require.rb +8 -0
  487. data/lib/wx/rtc.rb +15 -0
  488. data/lib/wx/stc/events/evt_list.rb +178 -0
  489. data/lib/wx/stc/keyword_defs.rb +8 -0
  490. data/lib/wx/stc/require.rb +7 -0
  491. data/lib/wx/stc.rb +14 -0
  492. data/lib/wx/version.rb +3 -0
  493. data/lib/wx/wxruby/base.rb +87 -0
  494. data/lib/wx/wxruby/cmd/sampler.rb +68 -0
  495. data/lib/wx/wxruby/cmd/test.rb +27 -0
  496. data/lib/wx.rb +14 -0
  497. data/lib/wxruby_aui.so +0 -0
  498. data/lib/wxruby_core.so +0 -0
  499. data/lib/wxruby_grid.so +0 -0
  500. data/lib/wxruby_html.so +0 -0
  501. data/lib/wxruby_pg.so +0 -0
  502. data/lib/wxruby_prt.so +0 -0
  503. data/lib/wxruby_rbn.so +0 -0
  504. data/lib/wxruby_rtc.so +0 -0
  505. data/lib/wxruby_stc.so +0 -0
  506. data/rakelib/install.rb +220 -0
  507. data/rakelib/lib/config/cygwin.rb +6 -0
  508. data/rakelib/lib/config/linux.rb +78 -0
  509. data/rakelib/lib/config/macosx.rb +6 -0
  510. data/rakelib/lib/config/mingw.rb +133 -0
  511. data/rakelib/lib/config/netbsd.rb +6 -0
  512. data/rakelib/lib/config/unixish.rb +187 -0
  513. data/rakelib/lib/config.rb +673 -0
  514. data/rakelib/lib/ext/enum_chain.rb +22 -0
  515. data/rakelib/prepost.rake +91 -0
  516. data/rakelib/prepost.rb +26 -0
  517. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +7 -0
  518. data/rakelib/yard/templates/default/layout/html/setup.rb +5 -0
  519. data/rakelib/yard/yard/relative_markdown_links/version.rb +8 -0
  520. data/rakelib/yard/yard/relative_markdown_links.rb +39 -0
  521. data/rakelib/yard/yard-custom-templates.rb +2 -0
  522. data/rakelib/yard/yard-relative_markdown_links.rb +4 -0
  523. data/samples/art/wxruby-128x128.png +0 -0
  524. data/samples/art/wxruby-256x256.png +0 -0
  525. data/samples/art/wxruby-64x64.png +0 -0
  526. data/samples/art/wxruby.ico +0 -0
  527. data/samples/art/wxruby.png +0 -0
  528. data/samples/aui/aui.rb +1321 -0
  529. data/samples/aui/tn_aui.png +0 -0
  530. data/samples/bigdemo/About.rbw +39 -0
  531. data/samples/bigdemo/ColorPanel.rbw +23 -0
  532. data/samples/bigdemo/GridSimple.rbw +78 -0
  533. data/samples/bigdemo/MDIDemo.rbw +57 -0
  534. data/samples/bigdemo/PopupMenu.rbw +146 -0
  535. data/samples/bigdemo/ShapedWindow.rbw +128 -0
  536. data/samples/bigdemo/Sizers.rbw +541 -0
  537. data/samples/bigdemo/bigdemo.rb +810 -0
  538. data/samples/bigdemo/demoTemplate.rbw +33 -0
  539. data/samples/bigdemo/helpfile.htb +0 -0
  540. data/samples/bigdemo/icons/Test 015.jpg +0 -0
  541. data/samples/bigdemo/icons/Test 015.png +0 -0
  542. data/samples/bigdemo/icons/choice.bmp +0 -0
  543. data/samples/bigdemo/icons/choice.xpm +27 -0
  544. data/samples/bigdemo/icons/combo.bmp +0 -0
  545. data/samples/bigdemo/icons/combo.xpm +27 -0
  546. data/samples/bigdemo/icons/copy.xpm +25 -0
  547. data/samples/bigdemo/icons/cut.xpm +24 -0
  548. data/samples/bigdemo/icons/gauge.bmp +0 -0
  549. data/samples/bigdemo/icons/gauge.xpm +27 -0
  550. data/samples/bigdemo/icons/help.xpm +25 -0
  551. data/samples/bigdemo/icons/list.bmp +0 -0
  552. data/samples/bigdemo/icons/list.xpm +27 -0
  553. data/samples/bigdemo/icons/mondrian.ico +0 -0
  554. data/samples/bigdemo/icons/mondrian.xpm +44 -0
  555. data/samples/bigdemo/icons/new.xpm +24 -0
  556. data/samples/bigdemo/icons/ogl.ico +0 -0
  557. data/samples/bigdemo/icons/ogl.xpm +45 -0
  558. data/samples/bigdemo/icons/open.xpm +26 -0
  559. data/samples/bigdemo/icons/paste.bmp +0 -0
  560. data/samples/bigdemo/icons/paste.xpm +38 -0
  561. data/samples/bigdemo/icons/pointy.png +0 -0
  562. data/samples/bigdemo/icons/preview.xpm +26 -0
  563. data/samples/bigdemo/icons/print.xpm +26 -0
  564. data/samples/bigdemo/icons/radio.bmp +0 -0
  565. data/samples/bigdemo/icons/radio.xpm +27 -0
  566. data/samples/bigdemo/icons/robert.xpm +415 -0
  567. data/samples/bigdemo/icons/sashtest.ico +0 -0
  568. data/samples/bigdemo/icons/save.xpm +25 -0
  569. data/samples/bigdemo/icons/smiles.bmp +0 -0
  570. data/samples/bigdemo/icons/smiles.xpm +39 -0
  571. data/samples/bigdemo/icons/smiley.ico +0 -0
  572. data/samples/bigdemo/icons/smiley.xpm +42 -0
  573. data/samples/bigdemo/icons/stattext.xpm +24 -0
  574. data/samples/bigdemo/icons/test2.bmp +0 -0
  575. data/samples/bigdemo/icons/test2.png +0 -0
  576. data/samples/bigdemo/icons/test2.xpm +79 -0
  577. data/samples/bigdemo/icons/text.bmp +0 -0
  578. data/samples/bigdemo/icons/text.xpm +27 -0
  579. data/samples/bigdemo/icons/tog1.bmp +0 -0
  580. data/samples/bigdemo/icons/tog1.xpm +38 -0
  581. data/samples/bigdemo/icons/tog2.bmp +0 -0
  582. data/samples/bigdemo/icons/tog2.xpm +38 -0
  583. data/samples/bigdemo/icons/wxruby-128x128.png +0 -0
  584. data/samples/bigdemo/icons/wxwin.ico +0 -0
  585. data/samples/bigdemo/icons/wxwin16x16.png +0 -0
  586. data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
  587. data/samples/bigdemo/icons/wxwin32x32.png +0 -0
  588. data/samples/bigdemo/icons/wxwin48x48.png +0 -0
  589. data/samples/bigdemo/run.rb +91 -0
  590. data/samples/bigdemo/tips.txt +7 -0
  591. data/samples/bigdemo/utils.rb +12 -0
  592. data/samples/bigdemo/wxArtProvider.rbw +281 -0
  593. data/samples/bigdemo/wxBitmapButton.rbw +65 -0
  594. data/samples/bigdemo/wxButton.rbw +64 -0
  595. data/samples/bigdemo/wxCalendarCtrl.rbw +59 -0
  596. data/samples/bigdemo/wxCheckBox.rbw +50 -0
  597. data/samples/bigdemo/wxCheckListBox.rbw +65 -0
  598. data/samples/bigdemo/wxChoice.rbw +47 -0
  599. data/samples/bigdemo/wxChoicebook.rbw +78 -0
  600. data/samples/bigdemo/wxColourDialog.rbw +33 -0
  601. data/samples/bigdemo/wxComboBox.rbw +77 -0
  602. data/samples/bigdemo/wxCursor.rbw +136 -0
  603. data/samples/bigdemo/wxDialog.rbw +74 -0
  604. data/samples/bigdemo/wxDirDialog.rbw +29 -0
  605. data/samples/bigdemo/wxDragImage.rbw +70 -0
  606. data/samples/bigdemo/wxFileDialog.rbw +37 -0
  607. data/samples/bigdemo/wxFileDialog_Save.rbw +35 -0
  608. data/samples/bigdemo/wxFindReplaceDialog.rbw +82 -0
  609. data/samples/bigdemo/wxFontDialog.rbw +200 -0
  610. data/samples/bigdemo/wxFrame.rbw +53 -0
  611. data/samples/bigdemo/wxGauge.rbw +65 -0
  612. data/samples/bigdemo/wxGenericDirCtrl.rbw +74 -0
  613. data/samples/bigdemo/wxGrid.rbw +66 -0
  614. data/samples/bigdemo/wxHtmlHelpController.rbw +52 -0
  615. data/samples/bigdemo/wxListBox.rbw +140 -0
  616. data/samples/bigdemo/wxListCtrl_virtual.rbw +112 -0
  617. data/samples/bigdemo/wxMDIWindows.rbw +50 -0
  618. data/samples/bigdemo/wxMenu.rbw +247 -0
  619. data/samples/bigdemo/wxMessageDialog.rbw +27 -0
  620. data/samples/bigdemo/wxMiniFrame.rbw +70 -0
  621. data/samples/bigdemo/wxMultipleChoiceDialog.rbw +29 -0
  622. data/samples/bigdemo/wxNotebook.rbw +136 -0
  623. data/samples/bigdemo/wxProgressDialog.rbw +43 -0
  624. data/samples/bigdemo/wxRadioBox.rbw +72 -0
  625. data/samples/bigdemo/wxRadioButton.rbw +125 -0
  626. data/samples/bigdemo/wxSashWindow.rbw +141 -0
  627. data/samples/bigdemo/wxScrolledMessageDialog.rbw +57 -0
  628. data/samples/bigdemo/wxScrolledWindow.rbw +199 -0
  629. data/samples/bigdemo/wxSingleChoiceDialog.rbw +33 -0
  630. data/samples/bigdemo/wxSlider.rbw +42 -0
  631. data/samples/bigdemo/wxSpinButton.rbw +50 -0
  632. data/samples/bigdemo/wxSpinCtrl.rbw +51 -0
  633. data/samples/bigdemo/wxSplitterWindow.rbw +63 -0
  634. data/samples/bigdemo/wxStaticBitmap.rbw +47 -0
  635. data/samples/bigdemo/wxStaticText.rbw +55 -0
  636. data/samples/bigdemo/wxStatusBar.rbw +126 -0
  637. data/samples/bigdemo/wxTextCtrl.rbw +149 -0
  638. data/samples/bigdemo/wxTextEntryDialog.rbw +31 -0
  639. data/samples/bigdemo/wxToggleButton.rbw +49 -0
  640. data/samples/bigdemo/wxToolBar.rbw +131 -0
  641. data/samples/bigdemo/wxTreeCtrl.rbw +191 -0
  642. data/samples/calendar/calendar.rb +363 -0
  643. data/samples/calendar/tn_calendar.png +0 -0
  644. data/samples/caret/caret.rb +293 -0
  645. data/samples/caret/mondrian.xpm +44 -0
  646. data/samples/caret/tn_caret.png +0 -0
  647. data/samples/controls/books.rb +183 -0
  648. data/samples/controls/choice.xpm +27 -0
  649. data/samples/controls/combo.xpm +27 -0
  650. data/samples/controls/controls.rb +1143 -0
  651. data/samples/controls/gauge.xpm +27 -0
  652. data/samples/controls/get_item_sample.rb +117 -0
  653. data/samples/controls/list.xpm +27 -0
  654. data/samples/controls/mondrian.ico +0 -0
  655. data/samples/controls/mondrian.xpm +44 -0
  656. data/samples/controls/radio.xpm +27 -0
  657. data/samples/controls/stattext.xpm +24 -0
  658. data/samples/controls/test2.bmp +0 -0
  659. data/samples/controls/text.xpm +27 -0
  660. data/samples/controls/tn_books.png +0 -0
  661. data/samples/controls/tn_controls.png +0 -0
  662. data/samples/controls/tn_get_item_sample.png +0 -0
  663. data/samples/dialogs/dialogs.rb +879 -0
  664. data/samples/dialogs/tips.txt +18 -0
  665. data/samples/dialogs/tn_dialogs.png +0 -0
  666. data/samples/dialogs/tn_wizard.png +0 -0
  667. data/samples/dialogs/wizard.rb +89 -0
  668. data/samples/dragdrop/dragdrop.rb +200 -0
  669. data/samples/dragdrop/tn_dragdrop.png +0 -0
  670. data/samples/drawing/SVGlogo24.xpm +310 -0
  671. data/samples/drawing/bitmap.rb +76 -0
  672. data/samples/drawing/bitmap_image.rb +131 -0
  673. data/samples/drawing/graphics_drawing.rb +257 -0
  674. data/samples/drawing/maths_images.rb +327 -0
  675. data/samples/drawing/rmagic_bitmap_image.rb +139 -0
  676. data/samples/drawing/ruby-logo.jpg +0 -0
  677. data/samples/drawing/svgtest.rb +373 -0
  678. data/samples/drawing/tn_bitmap.png +0 -0
  679. data/samples/drawing/tn_bitmap_image.png +0 -0
  680. data/samples/drawing/tn_graphics_drawing.png +0 -0
  681. data/samples/drawing/tn_maths_images.png +0 -0
  682. data/samples/drawing/tn_rmagic_bitmap_image.png +0 -0
  683. data/samples/drawing/tn_svgtest.png +0 -0
  684. data/samples/etc/choice.rb +82 -0
  685. data/samples/etc/miniframe.rb +92 -0
  686. data/samples/etc/sash.rb +140 -0
  687. data/samples/etc/scrollwin.rb +120 -0
  688. data/samples/etc/system_settings.rb +263 -0
  689. data/samples/etc/tn_choice.png +0 -0
  690. data/samples/etc/tn_miniframe.png +0 -0
  691. data/samples/etc/tn_sash.png +0 -0
  692. data/samples/etc/tn_scrollwin.png +0 -0
  693. data/samples/etc/tn_system_settings.png +0 -0
  694. data/samples/event/activation.rb +129 -0
  695. data/samples/event/event.rb +220 -0
  696. data/samples/event/threaded.rb +141 -0
  697. data/samples/event/tn_activation.png +0 -0
  698. data/samples/event/tn_event.png +0 -0
  699. data/samples/event/tn_threaded.png +0 -0
  700. data/samples/event/tn_update_ui_event.png +0 -0
  701. data/samples/event/update_ui_event.rb +91 -0
  702. data/samples/grid/grid.rb +224 -0
  703. data/samples/grid/gridtablebase.rb +178 -0
  704. data/samples/grid/tn_grid.png +0 -0
  705. data/samples/grid/tn_gridtablebase.png +0 -0
  706. data/samples/html/8859_2.htm +14 -0
  707. data/samples/html/cp1250.htm +19 -0
  708. data/samples/html/foo.png +0 -0
  709. data/samples/html/html.rb +278 -0
  710. data/samples/html/i18n.gif +0 -0
  711. data/samples/html/imagemap.htm +20 -0
  712. data/samples/html/imagemap.png +0 -0
  713. data/samples/html/listtest.htm +28 -0
  714. data/samples/html/pic.png +0 -0
  715. data/samples/html/pic2.bmp +0 -0
  716. data/samples/html/regres.htm +20 -0
  717. data/samples/html/subsup.html +42 -0
  718. data/samples/html/tables.htm +255 -0
  719. data/samples/html/test.htm +375 -0
  720. data/samples/html/tn_html.png +0 -0
  721. data/samples/mdi/mdi.rb +118 -0
  722. data/samples/mdi/tn_mdi.png +0 -0
  723. data/samples/minimal/minimal.rb +95 -0
  724. data/samples/minimal/mondrian.ico +0 -0
  725. data/samples/minimal/mondrian.png +0 -0
  726. data/samples/minimal/nothing.rb +38 -0
  727. data/samples/minimal/tn_minimal.png +0 -0
  728. data/samples/minimal/tn_nothing.png +0 -0
  729. data/samples/printing/mondrian.ico +0 -0
  730. data/samples/printing/mondrian.xpm +44 -0
  731. data/samples/printing/printing.rb +499 -0
  732. data/samples/printing/printing2.rb +251 -0
  733. data/samples/printing/sample-text.txt +213 -0
  734. data/samples/printing/tn_printing.png +0 -0
  735. data/samples/printing/tn_printing2.png +0 -0
  736. data/samples/propgrid/propgrid.rb +2711 -0
  737. data/samples/propgrid/propgrid_minimal.rb +107 -0
  738. data/samples/propgrid/sample_props.rb +434 -0
  739. data/samples/propgrid/tn_propgrid.png +0 -0
  740. data/samples/propgrid/tn_propgrid_minimal.png +0 -0
  741. data/samples/ribbon/align_center.xpm +21 -0
  742. data/samples/ribbon/align_left.xpm +21 -0
  743. data/samples/ribbon/align_right.xpm +21 -0
  744. data/samples/ribbon/aui_style.xpm +53 -0
  745. data/samples/ribbon/auto_crop_selection.xpm +55 -0
  746. data/samples/ribbon/auto_crop_selection_small.xpm +33 -0
  747. data/samples/ribbon/circle.xpm +38 -0
  748. data/samples/ribbon/circle_small.xpm +22 -0
  749. data/samples/ribbon/colours.xpm +25 -0
  750. data/samples/ribbon/cross.xpm +38 -0
  751. data/samples/ribbon/empty.xpm +23 -0
  752. data/samples/ribbon/expand_selection_h.xpm +46 -0
  753. data/samples/ribbon/expand_selection_v.xpm +46 -0
  754. data/samples/ribbon/eye.xpm +26 -0
  755. data/samples/ribbon/hexagon.xpm +38 -0
  756. data/samples/ribbon/msw_style.xpm +65 -0
  757. data/samples/ribbon/position_left.xpm +22 -0
  758. data/samples/ribbon/position_top.xpm +22 -0
  759. data/samples/ribbon/ribbon.rb +900 -0
  760. data/samples/ribbon/ribbon.xpm +54 -0
  761. data/samples/ribbon/selection_panel.xpm +23 -0
  762. data/samples/ribbon/square.xpm +38 -0
  763. data/samples/ribbon/tn_ribbon.png +0 -0
  764. data/samples/ribbon/triangle.xpm +38 -0
  765. data/samples/sample.xpm +475 -0
  766. data/samples/sampler/back.xpm +21 -0
  767. data/samples/sampler/copy.xpm +44 -0
  768. data/samples/sampler/cut.xpm +46 -0
  769. data/samples/sampler/editor.rb +560 -0
  770. data/samples/sampler/ext.rb +51 -0
  771. data/samples/sampler/filesave.xpm +42 -0
  772. data/samples/sampler/find.xpm +62 -0
  773. data/samples/sampler/findrepl.xpm +63 -0
  774. data/samples/sampler/forward.xpm +21 -0
  775. data/samples/sampler/paste.xpm +46 -0
  776. data/samples/sampler/play.xpm +24 -0
  777. data/samples/sampler/redo.xpm +58 -0
  778. data/samples/sampler/sample.rb +347 -0
  779. data/samples/sampler/stc_editor.rb +321 -0
  780. data/samples/sampler/txt_editor.rb +130 -0
  781. data/samples/sampler/undo.xpm +58 -0
  782. data/samples/sampler.rb +394 -0
  783. data/samples/splash/mobile.xpm +1835 -0
  784. data/samples/splash/splash.png +0 -0
  785. data/samples/splash/splash.rb +164 -0
  786. data/samples/splash/tn_splash.png +0 -0
  787. data/samples/text/document-open.png +0 -0
  788. data/samples/text/document-save.png +0 -0
  789. data/samples/text/edit-copy.png +0 -0
  790. data/samples/text/edit-cut.png +0 -0
  791. data/samples/text/edit-paste.png +0 -0
  792. data/samples/text/edit-redo.png +0 -0
  793. data/samples/text/edit-undo.png +0 -0
  794. data/samples/text/format-text-bold.png +0 -0
  795. data/samples/text/format-text-italic.png +0 -0
  796. data/samples/text/format-text-underline.png +0 -0
  797. data/samples/text/mondrian.ico +0 -0
  798. data/samples/text/mondrian.xpm +44 -0
  799. data/samples/text/preferences-desktop-font.png +0 -0
  800. data/samples/text/rich_textctrl.rb +326 -0
  801. data/samples/text/scintilla.rb +179 -0
  802. data/samples/text/textctrl.rb +124 -0
  803. data/samples/text/tn_rich_textctrl.png +0 -0
  804. data/samples/text/tn_scintilla.png +0 -0
  805. data/samples/text/tn_textctrl.png +0 -0
  806. data/samples/text/tn_unicode.png +0 -0
  807. data/samples/text/unicode.rb +238 -0
  808. data/samples/text/utf8.txt +15 -0
  809. data/samples/treectrl/checked.xpm +54 -0
  810. data/samples/treectrl/icon1.xpm +79 -0
  811. data/samples/treectrl/icon2.xpm +53 -0
  812. data/samples/treectrl/icon3.xpm +79 -0
  813. data/samples/treectrl/icon4.xpm +43 -0
  814. data/samples/treectrl/icon5.xpm +79 -0
  815. data/samples/treectrl/state1.xpm +145 -0
  816. data/samples/treectrl/state2.xpm +144 -0
  817. data/samples/treectrl/state3.xpm +142 -0
  818. data/samples/treectrl/state4.xpm +145 -0
  819. data/samples/treectrl/state5.xpm +85 -0
  820. data/samples/treectrl/tn_treectrl.png +0 -0
  821. data/samples/treectrl/treectrl.rb +1720 -0
  822. data/samples/treectrl/unchecked.xpm +30 -0
  823. data/samples/xrc/custom_dialog.xrc +46 -0
  824. data/samples/xrc/custom_xrc_sample.rb +84 -0
  825. data/samples/xrc/samples.xrc +46 -0
  826. data/samples/xrc/tn_xrc_sample.png +0 -0
  827. data/samples/xrc/xrc_sample.rb +86 -0
  828. data/tests/test_basic.rb +20 -0
  829. data/tests/test_clipboard.rb +241 -0
  830. data/tests/test_dialog.rb +28 -0
  831. data/tests/test_event_handling.rb +103 -0
  832. data/tests/test_events.rb +45 -0
  833. data/tests/test_geometry.rb +141 -0
  834. data/tests/test_intl.rb +107 -0
  835. data/tests/test_item_data.rb +120 -0
  836. data/tests/test_variant.rb +151 -0
  837. data/tests/testapp.rb +40 -0
  838. data/tests/testapp_noframe.rb +28 -0
  839. metadata +930 -0
@@ -0,0 +1,2711 @@
1
+ ###
2
+ # PropertyGrid extended sample
3
+ # Copyright (c) M.J.N. Corino, The Netherlands
4
+ ###
5
+
6
+ require 'wx'
7
+
8
+ require_relative './propgrid_minimal'
9
+
10
+ # -----------------------------------------------------------------------
11
+ # WxSampleMultiButtonEditor
12
+ # A sample editor class that has multiple buttons.
13
+ # -----------------------------------------------------------------------
14
+
15
+ class WxSampleMultiButtonEditor < Wx::PG::PGTextCtrlEditor
16
+
17
+ def initialize
18
+ super
19
+ end
20
+
21
+ def create_controls(propGrid, property, pos, sz)
22
+ # Create and populate buttons-subwindow
23
+ buttons = Wx::PG::PGMultiButton.new(propGrid, sz)
24
+
25
+ # Add two regular buttons
26
+ buttons.add('...')
27
+ buttons.add('A')
28
+ # Add a bitmap button
29
+ buttons.add(Wx::ArtProvider::get_bitmap(Wx::ART_FOLDER))
30
+
31
+ # Create the 'primary' editor control (textctrl in this case)
32
+ primary, _ = super(propGrid, property, pos, buttons.primary_size)
33
+
34
+ # Finally, move buttons-subwindow to correct position and make sure
35
+ # returned Wx::PG::PGWindowList contains our custom button list.
36
+ buttons.finalize(propGrid, pos)
37
+
38
+ [primary, buttons]
39
+ end
40
+
41
+ def on_event(propGrid, property, ctrl, event)
42
+ if event.event_type == Wx::EVT_BUTTON
43
+ buttons = propGrid.get_editor_control_secondary
44
+
45
+ if event.id == buttons.button_id(0)
46
+
47
+ # Do something when the first button is pressed
48
+ Wx::log_info('First button pressed')
49
+ return false # Return false since value did not change
50
+ end
51
+ if event.id == buttons.get_button_id(1)
52
+
53
+ # Do something when the second button is pressed
54
+ Wx.message_box('Second button pressed')
55
+ return false # Return false since value did not change
56
+ end
57
+ if event.id == buttons.button_id(2)
58
+ # Do something when the third button is pressed
59
+ Wx.message_box('Third button pressed')
60
+ return false # Return false since value did not change
61
+ end
62
+ end
63
+ super(propGrid, property, ctrl, event)
64
+ end
65
+
66
+ end # class WxSampleMultiButtonEditor
67
+
68
+ if Wx.has_feature?(:USE_VALIDATORS)
69
+
70
+ class WxInvalidWordValidator < Wx::Validator
71
+
72
+ def initialize(invalidWord)
73
+ super()
74
+ @invalidWord = invalidWord
75
+ end
76
+
77
+ def clone
78
+ return WxInvalidWordValidator.new(@invalidWord)
79
+ end
80
+
81
+ def validate(parent_)
82
+ tc = get_window
83
+ raise 'validator window must be wxTextCtrl' unless Wx::TextCtrl === tc
84
+
85
+ val = tc.value
86
+
87
+ return true unless val.index(@invalidWord)
88
+
89
+ Wx.message_box("%s is not allowed word" % @invalidWord,
90
+ "Validation Failure")
91
+ false
92
+ end
93
+
94
+ end # class WxInvalidWordValidator
95
+
96
+ end
97
+
98
+ # -----------------------------------------------------------------------
99
+ # WxVectorProperty
100
+ # -----------------------------------------------------------------------
101
+
102
+ class WxVectorProperty < Wx::PG::PGProperty
103
+
104
+ WxVector3f = Struct.new(:x, :y, :z) do |klass|
105
+ def initialize
106
+ self.x = self.y = self.z = 0.0
107
+ end
108
+ end
109
+
110
+ def initialize(label = Wx::PG::PG_LABEL, name = Wx::PG::PG_LABEL, value = WxVector3f.new)
111
+ super(label, name)
112
+ self.value = value
113
+ add_private_child(Wx::PG::FloatProperty.new("X",Wx::PG::PG_LABEL, value.x))
114
+ add_private_child(Wx::PG::FloatProperty.new("Y",Wx::PG::PG_LABEL, value.y))
115
+ add_private_child(Wx::PG::FloatProperty.new("Z",Wx::PG::PG_LABEL, value.z))
116
+ end
117
+
118
+ def child_changed(thisValue, childIndex, childValue)
119
+ vector = thisValue.object;
120
+ case childIndex
121
+ when 0
122
+ vector.x = childValue.to_f
123
+ when 1
124
+ vector.y = childValue.to_f
125
+ when 2
126
+ vector.z = childValue.to_f
127
+ end
128
+ Wx::Variant.new(vector)
129
+ end
130
+
131
+ def refresh_children
132
+ return if get_child_count == 0
133
+ vector = self.value_.object
134
+ item(0).value = vector.x
135
+ item(1).value = vector.y
136
+ item(2).value = vector.z
137
+ end
138
+
139
+ end # class WxVectorProperty
140
+
141
+ # -----------------------------------------------------------------------
142
+ # Wx::PG::TriangleProperty
143
+ # -----------------------------------------------------------------------
144
+
145
+ class WxTriangleProperty < Wx::PG::PGProperty
146
+
147
+ WxTriangle = Struct.new(:a, :b, :c) do |klass|
148
+ def initialize
149
+ self.a = WxVectorProperty::WxVector3f.new
150
+ self.b = WxVectorProperty::WxVector3f.new
151
+ self.c = WxVectorProperty::WxVector3f.new
152
+ end
153
+ end
154
+
155
+ def initialize(label = Wx::PG::PG_LABEL, name = Wx::PG::PG_LABEL, value = WxTriangle.new)
156
+ super(label, name)
157
+ self.value = value
158
+ add_private_child(WxVectorProperty.new("A", Wx::PG::PG_LABEL, value.a.dup))
159
+ add_private_child(WxVectorProperty.new("B", Wx::PG::PG_LABEL, value.b.dup))
160
+ add_private_child(WxVectorProperty.new("C", Wx::PG::PG_LABEL, value.c.dup))
161
+ end
162
+
163
+ def child_changed(thisValue, childIndex, childValue)
164
+ triangle = thisValue.object.dup
165
+ vector = childValue.object.dup
166
+ case childIndex
167
+ when 0
168
+ triangle.a = vector
169
+ when 1
170
+ triangle.b = vector
171
+ when 2
172
+ triangle.c = vector
173
+ end
174
+ Wx::Variant.new(triangle)
175
+ end
176
+
177
+ def refresh_children
178
+ return if get_child_count == 0
179
+ triangle = self.value_.object
180
+ item(0).value = triangle.a
181
+ item(1).value = triangle.b
182
+ item(2).value = triangle.c
183
+ end
184
+
185
+ end # class WxTriangleProperty
186
+
187
+
188
+ # -----------------------------------------------------------------------
189
+ # wxSingleChoiceDialogAdapter (Wx::PG::PGEditorDialogAdapter sample)
190
+ # -----------------------------------------------------------------------
191
+
192
+ class WxSingleChoiceDialogAdapter < Wx::PG::PGEditorDialogAdapter
193
+
194
+ def initialize(choices)
195
+ super()
196
+ @choices = choices
197
+ end
198
+
199
+ def do_show_dialog(propGrid_, property_)
200
+ s = Wx.get_single_choice("Message",
201
+ "Caption",
202
+ @choices.labels)
203
+ unless s.empty?
204
+ value = s
205
+ return true
206
+ end
207
+
208
+ return false
209
+ end
210
+
211
+ end # class WxSingleChoiceDialogAdapter
212
+
213
+ class WxSingleChoiceProperty < Wx::PG::StringProperty
214
+
215
+ def initialize(label, name = Wx::PG::PG_LABEL, value = '')
216
+ super(label, name, value)
217
+ # Prepare choices
218
+ @choices = Wx::PG::PGChoices.new
219
+ @choices.add("Cat")
220
+ @choices.add("Dog")
221
+ @choices.add("Gibbon")
222
+ @choices.add("Otter")
223
+ end
224
+
225
+ # Set editor to have button
226
+ def do_get_editor_class
227
+ Wx::PG::PG_EDITOR_TEXT_CTRL_AND_BUTTON
228
+ end
229
+
230
+ # Set what happens on button click
231
+ def get_editor_dialog
232
+ WxSingleChoiceDialogAdapter.new(@choices)
233
+ end
234
+
235
+ end # class SingleChoiceProperty
236
+
237
+ #
238
+ # Test customizing wxColourProperty via subclassing
239
+ #
240
+ # * Includes custom colour entry.
241
+ # * Includes extra custom entry.
242
+ #
243
+ class MyColourProperty < Wx::PG::ColourProperty
244
+
245
+ def initialize(label = Wx::PG::PG_LABEL,
246
+ name = Wx::PG::PG_LABEL,
247
+ value = Wx::WHITE )
248
+ super(label, name, value)
249
+ self.choices = Wx::PG::PGChoices.new(%w[White Black Red Green Blue Custom None])
250
+ set_index(0)
251
+ self.value = value
252
+ end
253
+
254
+ def get_colour(index)
255
+ case index
256
+ when 0
257
+ return Wx::WHITE
258
+ when 1
259
+ return Wx::BLACK
260
+ when 2
261
+ return Wx::RED
262
+ when 3
263
+ return Wx::GREEN
264
+ when 4
265
+ return Wx::BLUE
266
+ when 5
267
+ # Return current colour for the custom entry
268
+ if get_index == get_custom_colour_index
269
+ return self.value_.colour unless self.value_.null?
270
+ else
271
+ return Wx::WHITE
272
+ end
273
+ end
274
+ Wx::Colour.new
275
+ end
276
+
277
+ def colour_to_string(col, index, argFlags = 0)
278
+ return '' if index == (self.choices.get_count-1)
279
+
280
+ super(col, index, argFlags)
281
+ end
282
+
283
+ def get_custom_colour_index
284
+ self.choices.get_count-2
285
+ end
286
+ end
287
+
288
+ module ID
289
+ %i[
290
+ PGID
291
+ ABOUT
292
+ QUIT
293
+ APPENDPROP
294
+ APPENDCAT
295
+ INSERTPROP
296
+ INSERTCAT
297
+ ENABLE
298
+ SETREADONLY
299
+ HIDE
300
+ BOOL_CHECKBOX
301
+ DELETE
302
+ DELETER
303
+ DELETEALL
304
+ UNSPECIFY
305
+ ITERATE1
306
+ ITERATE2
307
+ ITERATE3
308
+ ITERATE4
309
+ CLEARMODIF
310
+ FREEZE
311
+ DUMPLIST
312
+ COLOURSCHEME1
313
+ COLOURSCHEME2
314
+ COLOURSCHEME3
315
+ CATCOLOURS
316
+ SETBGCOLOUR
317
+ SETBGCOLOURRECUR
318
+ STATICLAYOUT
319
+ POPULATE1
320
+ POPULATE2
321
+ COLLAPSE
322
+ COLLAPSEALL
323
+ GETVALUES
324
+ SETVALUES
325
+ SETVALUES2
326
+ RUNTESTFULL
327
+ RUNTESTPARTIAL
328
+ FITCOLUMNS
329
+ CHANGEFLAGSITEMS
330
+ TESTINSERTCHOICE
331
+ TESTDELETECHOICE
332
+ INSERTPAGE
333
+ REMOVEPAGE
334
+ SETSPINCTRLEDITOR
335
+ SETPROPERTYVALUE
336
+ TESTREPLACE
337
+ SETCOLUMNS
338
+ SETVIRTWIDTH
339
+ SETPGDISABLED
340
+ TESTXRC
341
+ ENABLECOMMONVALUES
342
+ SELECTSTYLE
343
+ SAVESTATE
344
+ RESTORESTATE
345
+ RUNMINIMAL
346
+ ENABLELABELEDITING
347
+ VETOCOLDRAG
348
+ ONEXTENDEDKEYNAV
349
+ SHOWPOPUP
350
+ POPUPGRID
351
+ ].each_with_index { |sym, ix| self.const_set(sym, ix+1) }
352
+
353
+ if Wx.has_feature?(:USE_HEADERCTRL)
354
+ SHOWHEADER = POPUPGRID+1
355
+ end
356
+
357
+ COLOURSCHEME4 = 100
358
+ end
359
+
360
+ #
361
+ # Handle events of the third page here.
362
+ class WxMyPropertyGridPage < Wx::PG::PropertyGridPage
363
+
364
+ def initialize
365
+ super
366
+ evt_pg_selected(Wx::ID_ANY, :on_property_select)
367
+ evt_pg_changing(Wx::ID_ANY, :on_property_changing)
368
+ evt_pg_changed(Wx::ID_ANY, :on_property_change)
369
+ evt_pg_page_changed(Wx::ID_ANY, :on_page_change)
370
+ end
371
+
372
+ # Return false here to indicate unhandled events should be
373
+ # propagated to manager's parent, as normal.
374
+ def is_handling_all_events; false; end
375
+
376
+ def do_insert(parent, index, property)
377
+ super(parent,index,property)
378
+ end
379
+
380
+ def on_property_select(event)
381
+ Wx.log_debug("WxMyPropertyGridPage#on_property_select('%s' is %s",
382
+ event.property.get_name,
383
+ (property_selected?(event.property) ? "selected": "unselected"))
384
+ end
385
+ def on_property_changing(event)
386
+ Wx.log_verbose("WxMyPropertyGridPage#on_property_change('%s', to value '%s')",
387
+ event.property.get_name,
388
+ event.property.get_displayed_string)
389
+ end
390
+ def on_property_change(event)
391
+ Wx.log_verbose("WxMyPropertyGridPage#on_property_changing('%s', to value '%s')",
392
+ event.property.get_name,
393
+ event.value.to_s)
394
+ end
395
+ def on_page_change(event)
396
+ Wx.log_debug("WxMyPropertyGridPage#on_page_change()")
397
+ end
398
+
399
+ end # class WxMyPropertyGridPage
400
+
401
+
402
+ class WxPGKeyHandler < Wx::EvtHandler
403
+
404
+ def initialize
405
+ super
406
+ evt_key_down :on_key_event
407
+ end
408
+
409
+ def on_key_event(event)
410
+ Wx.message_box("%i" % event.get_key_code)
411
+ event.skip
412
+ end
413
+
414
+ end
415
+
416
+ class PropertyGridPopup < Wx::PopupWindow
417
+
418
+ private def get_real_root(grid)
419
+ property = grid.root
420
+ property ? grid.get_first_child(property) : nil
421
+ end
422
+
423
+ private def get_column_widths(grid, root)
424
+ state = grid.get_state
425
+
426
+ width = [0,0,0]
427
+ minWidths = [ state.get_column_min_width(0),
428
+ state.get_column_min_width(1),
429
+ state.get_column_min_width(2) ]
430
+ root.child_count.times do |ii|
431
+ p = root.item(ii)
432
+
433
+ width[0] = [width[0], state.get_column_full_width(p, 0)].max
434
+ width[1] = [width[1], state.get_column_full_width(p, 1)].max
435
+ width[2] = [width[2], state.get_column_full_width(p, 2)].max
436
+ end
437
+ root.child_count.times do |ii|
438
+ p = root.item(ii)
439
+ if p.is_expanded
440
+ w = get_column_widths(grid, p)
441
+ width[0] = [width[0], w[0]].max
442
+ width[1] = [width[1], w[1]].max
443
+ width[2] = [width[2], w[2]].max
444
+ end
445
+ end
446
+
447
+ width[0] = [width[0], minWidths[0]].max
448
+ width[1] = [width[1], minWidths[1]].max
449
+ width[2] = [width[2], minWidths[2]].max
450
+ width
451
+ end
452
+
453
+ private def set_popup_min_size(grid)
454
+ p = get_real_root(grid)
455
+ first = grid.get_first(Wx::PG::PG_ITERATE_ALL)
456
+ last = grid.get_last_item(Wx::PG::PG_ITERATE_DEFAULT)
457
+ rect = grid.get_property_rect(first, last)
458
+ height = rect.height + 2 * grid.get_vertical_spacing
459
+
460
+ # add some height when the root item is collapsed,
461
+ # this is needed to prevent the vertical scroll from showing
462
+ unless grid.is_property_expanded(p)
463
+ height += 2 * grid.get_vertical_spacing
464
+ end
465
+
466
+ width = get_column_widths(grid, grid.root)
467
+ rect.width = width.sum
468
+
469
+ minWidth = (Wx::SystemSettings.get_metric(Wx::SYS_SCREEN_X, grid.get_parent)*3)/2
470
+ minHeight = (Wx::SystemSettings.get_metric(Wx::SYS_SCREEN_Y, grid.get_parent)*3)/2
471
+
472
+ size = [[minWidth, rect.width + grid.get_margin_width].min, [minHeight, height].min]
473
+ grid.set_min_size(size)
474
+
475
+ proportions = [ (100.0*width[0]/size[0]).round,
476
+ (100.0*width[1]/size[0]).round ]
477
+ proportions << [100 - proportions[0] - proportions[1], 0].max
478
+ grid.set_column_proportion(0, proportions[0])
479
+ grid.set_column_proportion(1, proportions[1])
480
+ grid.set_column_proportion(2, proportions[2])
481
+ grid.reset_column_sizes(true)
482
+ end
483
+
484
+ def initialize(parent)
485
+ super(parent, Wx::BORDER_NONE|Wx::WANTS_CHARS|Wx::PU_CONTAINS_CONTROLS)
486
+ @panel = Wx::ScrolledWindow.new(self, Wx::ID_ANY, size: Wx::Size.new(200, 200))
487
+ @grid = Wx::PG::PropertyGrid.new(@panel, ID::POPUPGRID, size: [400,400], style: Wx::PG::PG_SPLITTER_AUTO_CENTER)
488
+ @grid.set_column_count(3)
489
+
490
+ prop = @grid.append(Wx::PG::StringProperty.new("test_name", Wx::PG::PG_LABEL, "test_value"))
491
+ @grid.set_property_attribute(prop, Wx::PG::PG_ATTR_UNITS, "type")
492
+ prop1 = @grid.append_in(prop, Wx::PG::StringProperty.new("sub_name1", Wx::PG::PG_LABEL, "sub_value1"))
493
+
494
+ @grid.append_in(prop1, Wx::PG::SystemColourProperty.new("Cell Colour", Wx::PG::PG_LABEL, @grid.grid.get_cell_background_colour))
495
+ prop2 = @grid.append_in(prop, Wx::PG::StringProperty.new("sub_name2", Wx::PG::PG_LABEL, "sub_value2"))
496
+ @grid.append_in(prop2, Wx::PG::StringProperty.new("sub_name21", Wx::PG::PG_LABEL, "sub_value21"))
497
+
498
+ arrdbl = [-1.0, -0.5, 0.0, 0.5, 1.0]
499
+ @grid.append_in(prop, WxArrayDoubleProperty.new("ArrayDoubleProperty", Wx::PG::PG_LABEL, arrdbl))
500
+ @grid.append_in(prop, Wx::PG::FontProperty.new("Font", Wx::PG::PG_LABEL))
501
+ @grid.append_in(prop2, Wx::PG::StringProperty.new("sub_name22", Wx::PG::PG_LABEL, "sub_value22"))
502
+ @grid.append_in(prop2, Wx::PG::StringProperty.new("sub_name23", Wx::PG::PG_LABEL, "sub_value23"))
503
+ prop2.set_expanded(false)
504
+
505
+ set_popup_min_size(@grid)
506
+
507
+ @sizer = Wx::BoxSizer.new(Wx::VERTICAL)
508
+ @sizer.add(@grid, Wx::SizerFlags.new(0).expand.border(Wx::ALL, 0))
509
+ @panel.set_auto_layout(true)
510
+ @panel.set_sizer(@sizer)
511
+ @sizer.fit(@panel)
512
+ @sizer.fit(self)
513
+
514
+ evt_pg_item_collapsed ID::POPUPGRID, :on_collapse
515
+ evt_pg_item_expanded ID::POPUPGRID, :on_expand
516
+ end
517
+
518
+ def on_collapse(event)
519
+ Wx.log_message("OnCollapse")
520
+ fit
521
+ end
522
+
523
+ def on_expand(event)
524
+ Wx.log_message("OnExpand")
525
+ fit
526
+ end
527
+
528
+ def fit
529
+ set_popup_min_size(@grid)
530
+ @sizer.fit(@panel)
531
+ pos = get_screen_position
532
+ size = @panel.get_screen_rect.size
533
+ set_size(pos.x, pos.y, size.width, size.height)
534
+ end
535
+
536
+ end
537
+
538
+ class FormMain < Wx::Frame
539
+
540
+ FS_WINDOWSTYLE_LABELS = %w[
541
+ wxSIMPLE_BORDER wxDOUBLE_BORDER wxSUNKEN_BORDER wxRAISED_BORDER wxNO_BORDER
542
+ wxTRANSPARENT_WINDOW wxTAB_TRAVERSAL wxWANTS_CHARS wxVSCROLL wxALWAYS_SHOW_SB
543
+ wxCLIP_CHILDREN wxFULL_REPAINT_ON_RESIZE]
544
+
545
+ FS_WINDOWSTYLE_VALUES = [
546
+ Wx::SIMPLE_BORDER,
547
+ Wx::DOUBLE_BORDER,
548
+ Wx::SUNKEN_BORDER,
549
+ Wx::RAISED_BORDER,
550
+ Wx::NO_BORDER,
551
+ Wx::TRANSPARENT_WINDOW,
552
+ Wx::TAB_TRAVERSAL,
553
+ Wx::WANTS_CHARS,
554
+ Wx::VSCROLL,
555
+ Wx::ALWAYS_SHOW_SB,
556
+ Wx::CLIP_CHILDREN,
557
+ Wx::FULL_REPAINT_ON_RESIZE
558
+ ]
559
+
560
+ FS_FRAMESTYLE_LABELS = %w[
561
+ wxCAPTION wxMINIMIZE wxMAXIMIZE wxCLOSE_BOX wxSTAY_ON_TOP wxSYSTEM_MENU
562
+ wxRESIZE_BORDER wxFRAME_TOOL_WINDOW wxFRAME_NO_TASKBAR
563
+ wxFRAME_FLOAT_ON_PARENT wxFRAME_SHAPED]
564
+
565
+ FS_FRAMESTYLE_VALUES = [
566
+ Wx::CAPTION,
567
+ Wx::MINIMIZE,
568
+ Wx::MAXIMIZE,
569
+ Wx::CLOSE_BOX,
570
+ Wx::STAY_ON_TOP,
571
+ Wx::SYSTEM_MENU,
572
+ Wx::RESIZE_BORDER,
573
+ Wx::FRAME_TOOL_WINDOW,
574
+ Wx::FRAME_NO_TASKBAR,
575
+ Wx::FRAME_FLOAT_ON_PARENT,
576
+ Wx::FRAME_SHAPED
577
+ ]
578
+
579
+ def initialize(title, pos, size)
580
+ super(nil, title: title, pos: pos, size: size,
581
+ style: (Wx::MINIMIZE_BOX|Wx::MAXIMIZE_BOX|Wx::RESIZE_BORDER|Wx::SYSTEM_MENU|
582
+ Wx::CAPTION|Wx::TAB_TRAVERSAL|Wx::CLOSE_BOX))
583
+ @propGridManager = nil
584
+ @propGrid = nil
585
+ @hasHeader = false
586
+ @labelEditingEnabled = false
587
+ @combinedFlags = Wx::PG::PGChoices.new
588
+
589
+ self.icon = Wx::Icon.new(local_icon_file('../sample.xpm'))
590
+ centre
591
+
592
+ # This is default in wxRuby
593
+ # if Wx.has_feature?(:USE_IMAGE)
594
+ # # This is here to really test the Wx::PG::ImageFileProperty.
595
+ # wxInitAllImageHandlers()
596
+ # end
597
+
598
+ # Create menu bar
599
+ menuFile = Wx::Menu.new('', Wx::MENU_TEAROFF)
600
+ menuTry = Wx::Menu.new
601
+ menuTools1 = Wx::Menu.new
602
+ menuTools2 = Wx::Menu.new
603
+ menuHelp = Wx::Menu.new
604
+
605
+ menuHelp.append(ID::ABOUT, '&About', 'Show about dialog')
606
+
607
+ menuTools1.append(ID::APPENDPROP, 'Append New Property')
608
+ menuTools1.append(ID::APPENDCAT, "Append New Category\tCtrl-S")
609
+ menuTools1.append_separator
610
+ menuTools1.append(ID::INSERTPROP, "Insert New Property\tCtrl-I")
611
+ menuTools1.append(ID::INSERTCAT, "Insert New Category\tCtrl-W")
612
+ menuTools1.append_separator
613
+ menuTools1.append(ID::DELETE, 'Delete Selected')
614
+ menuTools1.append(ID::DELETER, 'Delete Random')
615
+ menuTools1.append(ID::DELETEALL, 'Delete All')
616
+ menuTools1.append_separator
617
+ menuTools1.append(ID::POPULATE1, 'Populate with Standard Items')
618
+ menuTools1.append(ID::POPULATE2, 'Populate with Library Configuration')
619
+ menuTools1.append_separator
620
+ menuTools1.append(ID::SETBGCOLOUR, 'Set Bg Colour')
621
+ menuTools1.append(ID::SETBGCOLOURRECUR, 'Set Bg Colour (Recursively)')
622
+ menuTools1.append(ID::UNSPECIFY, 'Set Value to Unspecified')
623
+ menuTools1.append_separator
624
+ @itemEnable = menuTools1.append(ID::ENABLE, 'Enable',
625
+ 'Toggles item\'s enabled state.')
626
+ @itemEnable.enable(false)
627
+ menuTools1.append(ID::HIDE, 'Hide', 'Hides a property')
628
+ menuTools1.append(ID::SETREADONLY, 'Set as Read-Only',
629
+ 'Set property as read-only')
630
+
631
+ menuTools2.append(ID::ITERATE1, 'Iterate Over Properties')
632
+ menuTools2.append(ID::ITERATE2, 'Iterate Over Visible Items')
633
+ menuTools2.append(ID::ITERATE3, 'Reverse Iterate Over Properties')
634
+ menuTools2.append(ID::ITERATE4, 'Iterate Over Categories')
635
+ menuTools2.append_separator
636
+ menuTools2.append(ID::ONEXTENDEDKEYNAV, 'Extend Keyboard Navigation',
637
+ 'This will set Enter to navigate to next property, '+
638
+ 'and allows arrow keys to navigate even when in '+
639
+ 'editor control.')
640
+ menuTools2.append_separator
641
+ menuTools2.append(ID::SETPROPERTYVALUE, 'Set Property Value')
642
+ menuTools2.append(ID::CLEARMODIF, 'Clear Modified Status', 'Clears Wx::PG::PG_MODIFIED flag from all properties.')
643
+ menuTools2.append_separator
644
+ @itemFreeze = menuTools2.append_check_item(ID::FREEZE, 'Freeze',
645
+ 'Disables painting, auto-sorting, etc.')
646
+ menuTools2.append_separator
647
+ menuTools2.append(ID::DUMPLIST, 'Display Values as wxVariant List', 'Tests GetAllValues method and wxVariant conversion.')
648
+ menuTools2.append_separator
649
+ menuTools2.append(ID::GETVALUES, 'Get Property Values', 'Stores all property values.')
650
+ menuTools2.append(ID::SETVALUES, 'Set Property Values', 'Reverts property values to those last stored.')
651
+ menuTools2.append(ID::SETVALUES2, 'Set Property Values 2', 'Adds property values that should not initially be as items (so new items are created).')
652
+ menuTools2.append_separator
653
+ menuTools2.append(ID::SAVESTATE, 'Save Editable State')
654
+ menuTools2.append(ID::RESTORESTATE, 'Restore Editable State')
655
+ menuTools2.append_separator
656
+ menuTools2.append(ID::ENABLECOMMONVALUES, 'Enable Common Value',
657
+ 'Enable values that are common to all properties, for selected property.')
658
+ menuTools2.append_separator
659
+ menuTools2.append(ID::COLLAPSE, 'Collapse Selected')
660
+ menuTools2.append(ID::COLLAPSEALL, 'Collapse All')
661
+ menuTools2.append_separator
662
+ menuTools2.append(ID::INSERTPAGE, 'Add Page')
663
+ menuTools2.append(ID::REMOVEPAGE, 'Remove Page')
664
+ menuTools2.append_separator
665
+ menuTools2.append(ID::FITCOLUMNS, 'Fit Columns')
666
+ @itemVetoDragging =
667
+ menuTools2.append_check_item(ID::VETOCOLDRAG,
668
+ 'Veto Column Dragging')
669
+ menuTools2.append_separator
670
+ menuTools2.append(ID::CHANGEFLAGSITEMS, 'Change Children of FlagsProp')
671
+ menuTools2.append_separator
672
+ menuTools2.append(ID::TESTINSERTCHOICE, 'Test InsertPropertyChoice')
673
+ menuTools2.append(ID::TESTDELETECHOICE, 'Test DeletePropertyChoice')
674
+ menuTools2.append_separator
675
+ menuTools2.append(ID::SETSPINCTRLEDITOR, 'Use SpinCtrl Editor')
676
+ menuTools2.append(ID::TESTREPLACE, 'Test ReplaceProperty')
677
+
678
+ menuTry.append(ID::SELECTSTYLE, 'Set Window Style',
679
+ 'Select window style flags used by the grid.')
680
+ menuTry.append_check_item(ID::ENABLELABELEDITING, 'Enable label editing',
681
+ 'This calls wxPropertyGrid::MakeColumnEditable(0)')
682
+ menuTry.check(ID::ENABLELABELEDITING, @labelEditingEnabled)
683
+ if Wx.has_feature?(:USE_HEADERCTRL)
684
+ menuTry.append_check_item(ID::SHOWHEADER,
685
+ 'Enable header',
686
+ 'This calls wxPropertyGridManager::ShowHeader()')
687
+ menuTry.check(ID::SHOWHEADER, @hasHeader)
688
+ end # USE_HEADERCTRL
689
+ menuTry.append_separator
690
+ menuTry.append_radio_item(ID::COLOURSCHEME1, 'Standard Colour Scheme')
691
+ menuTry.append_radio_item(ID::COLOURSCHEME2, 'White Colour Scheme')
692
+ menuTry.append_radio_item(ID::COLOURSCHEME3, '.NET Colour Scheme')
693
+ menuTry.append_radio_item(ID::COLOURSCHEME4, 'Cream Colour Scheme')
694
+ menuTry.append_separator
695
+ @itemCatColours = menuTry.append_check_item(ID::CATCOLOURS, 'Category Specific Colours',
696
+ 'Switches between category-specific cell colours and default scheme (actually done using SetPropertyTextColour and SetPropertyBackgroundColour).')
697
+ menuTry.append_separator
698
+ menuTry.append_check_item(ID::STATICLAYOUT, 'Static Layout',
699
+ 'Switches between user-modifiable and static layouts.')
700
+ menuTry.append_check_item(ID::BOOL_CHECKBOX, 'Render Boolean values as checkboxes',
701
+ 'Renders Boolean values as checkboxes')
702
+ menuTry.append(ID::SETCOLUMNS, 'Set Number of Columns')
703
+ menuTry.append(ID::SETVIRTWIDTH, 'Set Virtual Width')
704
+ menuTry.append_check_item(ID::SETPGDISABLED, 'Disable Grid')
705
+ menuTry.append_separator
706
+ menuTry.append(ID::TESTXRC, 'Display XRC sample')
707
+
708
+ menuFile.append(ID::RUNMINIMAL, 'Run Minimal Sample')
709
+ menuFile.append_separator
710
+ menuFile.append(ID::RUNTESTFULL, 'Run Tests (full)')
711
+ menuFile.append(ID::RUNTESTPARTIAL, 'Run Tests (fast)')
712
+ menuFile.append_separator
713
+ menuFile.append(ID::QUIT, "E&xit\tAlt-X", 'Quit this program')
714
+
715
+ # Now append the freshly created menu to the menu bar...
716
+ menuBar = Wx::MenuBar.new
717
+ menuBar.append(menuFile, '&File')
718
+ menuBar.append(menuTry, '&Try These!')
719
+ menuBar.append(menuTools1, '&Basic')
720
+ menuBar.append(menuTools2, '&Advanced')
721
+ menuBar.append(menuHelp, '&Help')
722
+
723
+ # ... and attach this menu bar to the frame
724
+ self.menu_bar = menuBar
725
+
726
+ if Wx.has_feature?(:USE_STATUSBAR)
727
+ # create a status bar
728
+ create_status_bar(1)
729
+ set_status_text('')
730
+ end # USE_STATUSBAR
731
+
732
+ # this is default with wxRuby
733
+ # Register all editors (SpinCtrl etc.)
734
+ # wxPropertyGridInterface::RegisterAdditionalEditors()
735
+
736
+ # Register our sample custom editors
737
+ @sampleMultiButtonEditor =
738
+ Wx::PG::PropertyGrid.register_editor_class(WxSampleMultiButtonEditor.new)
739
+
740
+ @panel = Wx::Panel.new(self, Wx::ID_ANY, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::TAB_TRAVERSAL)
741
+
742
+ style = Wx::PG::PG_BOLD_MODIFIED |
743
+ Wx::PG::PG_SPLITTER_AUTO_CENTER |
744
+ Wx::PG::PG_AUTO_SORT |
745
+ #Wx::PG::PG_HIDE_MARGIN|Wx::PG::PG_STATIC_SPLITTER |
746
+ #Wx::PG::PG_TOOLTIPS |
747
+ #Wx::PG::PG_HIDE_CATEGORIES |
748
+ #Wx::PG::PG_LIMITED_EDITING |
749
+ Wx::PG::PG_TOOLBAR |
750
+ Wx::PG::PG_DESCRIPTION
751
+ # extra style
752
+ xtra_style = Wx::PG::PG_EX_MODE_BUTTONS |
753
+ Wx::PG::PG_EX_MULTIPLE_SELECTION
754
+ #| Wx::PG::PG_EX_AUTO_UNSPECIFIED_VALUES
755
+ #| Wx::PG::PG_EX_GREY_LABEL_WHEN_DISABLED
756
+ #| Wx::PG::PG_EX_HELP_AS_TOOLTIPS
757
+ if Wx.has_feature?(:ALWAYS_NATIVE_DOUBLE_BUFFER)
758
+ xtra_style |= Wx::PG::PG_EX_NATIVE_DOUBLE_BUFFERING
759
+ end # ALWAYS_NATIVE_DOUBLE_BUFFER
760
+
761
+ create_grid(style, xtra_style)
762
+
763
+ @topSizer = Wx::BoxSizer.new(Wx::VERTICAL)
764
+
765
+ @topSizer.add(@propGridManager, Wx::SizerFlags.new(1).expand)
766
+
767
+ # Button for tab traversal testing
768
+ btnSizer = Wx::BoxSizer.new(Wx::HORIZONTAL)
769
+ btnSizer.add(Wx::Button.new(@panel, Wx::ID_ANY,
770
+ 'Should be able to move here with Tab'),
771
+ Wx::SizerFlags.new(1).border(Wx::ALL, 10))
772
+ btnSizer.add(Wx::Button.new(@panel, ID::SHOWPOPUP,
773
+ 'Show Popup'),
774
+ Wx::SizerFlags.new(1).border(Wx::ALL, 10))
775
+ @topSizer.add(btnSizer, Wx::SizerFlags.new(0).border(Wx::ALL, 5).expand)
776
+
777
+ @panel.set_sizer(@topSizer)
778
+ @topSizer.set_size_hints(@panel)
779
+
780
+ @panel.layout
781
+
782
+ if Wx.has_feature?(:USE_LOGWINDOW)
783
+ # Create log window
784
+ @logWindow = Wx::LogWindow.new(self, 'Log Messages', false)
785
+ @logWindow.frame.move(position.x + size.width + 10,
786
+ position.y)
787
+ @logWindow.show
788
+ end
789
+
790
+ evt_idle :on_idle
791
+ evt_move :on_move
792
+ evt_size :on_resize
793
+
794
+ # This occurs when a property is selected
795
+ evt_pg_selected ID::PGID, :on_property_grid_select
796
+ # This occurs when a property value changes
797
+ evt_pg_changed ID::PGID, :on_property_grid_change
798
+ # This occurs just prior a property value is changed
799
+ evt_pg_changing ID::PGID, :on_property_grid_changing
800
+ # This occurs when a mouse moves over another property
801
+ evt_pg_highlighted ID::PGID, :on_property_grid_highlight
802
+ # This occurs when mouse is right-clicked.
803
+ evt_pg_right_click ID::PGID, :on_property_grid_item_right_click
804
+ # This occurs when mouse is double-clicked.
805
+ evt_pg_double_click ID::PGID, :on_property_grid_item_double_click
806
+ # This occurs when propgridmanager's page changes.
807
+ evt_pg_page_changed ID::PGID, :on_property_grid_page_change
808
+ # This occurs when user starts editing a property label
809
+ evt_pg_label_edit_begin ID::PGID, :on_property_grid_label_edit_begin
810
+ # This occurs when user stops editing a property label
811
+ evt_pg_label_edit_ending ID::PGID, :on_property_grid_label_edit_ending
812
+ # This occurs when property's editor button (if any) is clicked.
813
+ evt_button ID::PGID, :on_property_grid_button_click
814
+
815
+ evt_pg_item_collapsed ID::PGID, :on_property_grid_item_collapse
816
+ evt_pg_item_expanded ID::PGID, :on_property_grid_item_expand
817
+
818
+ evt_pg_col_begin_drag ID::PGID, :on_property_grid_col_begin_drag
819
+ evt_pg_col_dragging ID::PGID, :on_property_grid_col_dragging
820
+ evt_pg_col_end_drag ID::PGID, :on_property_grid_col_end_drag
821
+
822
+ evt_text ID::PGID, :on_property_grid_text_update
823
+
824
+ #
825
+ # Rest of the events are not property grid specific
826
+ evt_key_down :on_property_grid_key_event
827
+ evt_key_up :on_property_grid_key_event
828
+
829
+ evt_menu ID::APPENDPROP, :on_append_prop_click
830
+ evt_menu ID::APPENDCAT, :on_append_cat_click
831
+ evt_menu ID::INSERTPROP, :on_insert_prop_click
832
+ evt_menu ID::INSERTCAT, :on_insert_cat_click
833
+ evt_menu ID::DELETE, :on_del_prop_click
834
+ evt_menu ID::DELETER, :on_del_prop_r_click
835
+ evt_menu ID::UNSPECIFY, :on_misc
836
+ evt_menu ID::DELETEALL, :on_clear_click
837
+ evt_menu ID::ENABLE, :on_enable_disable
838
+ evt_menu ID::SETREADONLY, :on_set_read_only
839
+ evt_menu ID::HIDE, :on_hide
840
+ evt_menu ID::BOOL_CHECKBOX, :on_bool_checkbox
841
+
842
+ evt_menu ID::ITERATE1, :on_iterate1_click
843
+ evt_menu ID::ITERATE2, :on_iterate2_click
844
+ evt_menu ID::ITERATE3, :on_iterate3_click
845
+ evt_menu ID::ITERATE4, :on_iterate4_click
846
+ evt_menu ID::ONEXTENDEDKEYNAV, :on_extended_key_nav
847
+ evt_menu ID::SETBGCOLOUR, :on_set_background_colour
848
+ evt_menu ID::SETBGCOLOURRECUR, :on_set_background_colour
849
+ evt_menu ID::CLEARMODIF, :on_clear_modify_status_click
850
+ evt_menu ID::FREEZE, :on_freeze_click
851
+ evt_menu ID::ENABLELABELEDITING, :on_enable_label_editing
852
+ if Wx.has_feature? :USE_HEADERCTRL
853
+ evt_menu ID::SHOWHEADER, :on_show_header
854
+ end
855
+ evt_menu ID::DUMPLIST, :on_dump_list
856
+
857
+ evt_menu ID::COLOURSCHEME1, :on_colour_scheme
858
+ evt_menu ID::COLOURSCHEME2, :on_colour_scheme
859
+ evt_menu ID::COLOURSCHEME3, :on_colour_scheme
860
+ evt_menu ID::COLOURSCHEME4, :on_colour_scheme
861
+
862
+ evt_menu ID::ABOUT, :on_about
863
+ evt_menu ID::QUIT, :on_close_click
864
+
865
+ evt_menu ID::CATCOLOURS, :on_cat_colours
866
+ evt_menu ID::SETCOLUMNS, :on_set_columns
867
+ evt_menu ID::SETVIRTWIDTH, :on_set_virtual_width
868
+ evt_menu ID::SETPGDISABLED, :on_set_grid_disabled
869
+ evt_menu ID::TESTXRC, :on_test_xrc
870
+ evt_menu ID::ENABLECOMMONVALUES, :on_enable_common_values
871
+ evt_menu ID::SELECTSTYLE, :on_select_style
872
+
873
+ evt_menu ID::STATICLAYOUT, :on_misc
874
+ evt_menu ID::COLLAPSE, :on_misc
875
+ evt_menu ID::COLLAPSEALL, :on_misc
876
+
877
+ evt_menu ID::POPULATE1, :on_populate_click
878
+ evt_menu ID::POPULATE2, :on_populate_click
879
+
880
+ evt_menu ID::GETVALUES, :on_misc
881
+ evt_menu ID::SETVALUES, :on_misc
882
+ evt_menu ID::SETVALUES2, :on_misc
883
+
884
+ evt_menu ID::FITCOLUMNS, :on_fit_columns_click
885
+
886
+ evt_menu ID::CHANGEFLAGSITEMS, :on_change_flags_prop_items_click
887
+
888
+ evt_menu ID::RUNTESTFULL, :on_misc
889
+ evt_menu ID::RUNTESTPARTIAL, :on_misc
890
+
891
+ evt_menu ID::TESTINSERTCHOICE, :on_insert_choice
892
+ evt_menu ID::TESTDELETECHOICE, :on_delete_choice
893
+
894
+ evt_menu ID::INSERTPAGE, :on_insert_page
895
+ evt_menu ID::REMOVEPAGE, :on_remove_page
896
+
897
+ evt_menu ID::SAVESTATE, :on_save_state
898
+ evt_menu ID::RESTORESTATE, :on_restore_state
899
+
900
+ evt_menu ID::SETSPINCTRLEDITOR, :on_set_spin_ctrl_editor_click
901
+ evt_menu ID::TESTREPLACE, :on_test_replace_click
902
+ evt_menu ID::SETPROPERTYVALUE, :on_set_property_value
903
+
904
+ evt_menu ID::RUNMINIMAL, :on_run_minimal_click
905
+
906
+ evt_update_ui ID::CATCOLOURS, :on_cat_colours_update_ui
907
+
908
+ evt_context_menu :on_context_menu
909
+ evt_button ID::SHOWPOPUP, :on_show_popup
910
+
911
+ end
912
+
913
+ #
914
+ # Normally, wxPropertyGrid does not check whether item with identical
915
+ # label already exists. However, since in this sample we use labels for
916
+ # identifying properties, we have to be sure not to generate identical
917
+ # labels.
918
+ #
919
+ def self.generate_unique_property_label(pg, base_label)
920
+ count = -1;
921
+
922
+ if pg.get_property_by_label(base_label)
923
+ while true
924
+ count += 1
925
+ new_label = "%s %i" % [base_label,count]
926
+ break unless pg.get_property_by_label(new_label)
927
+ end
928
+ end
929
+
930
+ base_label = new_label if count >= 0
931
+
932
+ base_label
933
+ end
934
+
935
+ # utility function to find an icon relative to this ruby script
936
+ def local_icon_file(icon_name)
937
+ File.join(File.dirname(__FILE__), icon_name)
938
+ end
939
+
940
+ def create_grid(style, extraStyle)
941
+ #
942
+ # This function (re)creates the property grid in our sample
943
+ #
944
+
945
+ if style == -1
946
+ # default style
947
+ style = Wx::PG::PG_BOLD_MODIFIED |
948
+ Wx::PG::PG_SPLITTER_AUTO_CENTER |
949
+ Wx::PG::PG_AUTO_SORT |
950
+ #Wx::PG::PG_HIDE_MARGIN|Wx::PG::PG_STATIC_SPLITTER |
951
+ #Wx::PG::PG_TOOLTIPS |
952
+ #Wx::PG::PG_HIDE_CATEGORIES |
953
+ #Wx::PG::PG_LIMITED_EDITING |
954
+ Wx::PG::PG_TOOLBAR |
955
+ Wx::PG::PG_DESCRIPTION
956
+ end
957
+ if extraStyle == -1
958
+ # default extra style
959
+ extraStyle = Wx::PG::PG_EX_MODE_BUTTONS |
960
+ Wx::PG::PG_EX_MULTIPLE_SELECTION
961
+ #| Wx::PG::PG_EX_AUTO_UNSPECIFIED_VALUES
962
+ #| Wx::PG::PG_EX_GREY_LABEL_WHEN_DISABLED
963
+ #| Wx::PG::PG_EX_HELP_AS_TOOLTIPS
964
+ if Wx.has_feature?(:ALWAYS_NATIVE_DOUBLE_BUFFER)
965
+ extraStyle |= Wx::PG::PG_EX_NATIVE_DOUBLE_BUFFERING
966
+ end # ALWAYS_NATIVE_DOUBLE_BUFFER
967
+ end
968
+
969
+ #
970
+ # This shows how to combine two static choice descriptors
971
+ @combinedFlags.add(FS_WINDOWSTYLE_LABELS, FS_WINDOWSTYLE_VALUES)
972
+ @combinedFlags.add(FS_FRAMESTYLE_LABELS, FS_FRAMESTYLE_VALUES)
973
+
974
+ pgman = @propGridManager =
975
+ Wx::PG::PropertyGridManager.new(@panel,
976
+ # Don't change this into wxID_ANY in the sample, or the
977
+ # event handling will obviously be broken.
978
+ ID::PGID, # wxID_ANY
979
+ Wx::DEFAULT_POSITION,
980
+ Wx::DEFAULT_SIZE,
981
+ style)
982
+
983
+ @propGrid = pgman.grid
984
+
985
+ pgman.set_extra_style(extraStyle)
986
+
987
+ # This is the default validation failure behaviour
988
+ @propGridManager.set_validation_failure_behavior(Wx::PG::PG_VFB_MARK_CELL|Wx::PG::PG_VFB_SHOW_MESSAGEBOX)
989
+
990
+ @propGridManager.grid.set_vertical_spacing(2)
991
+
992
+ #
993
+ # Set somewhat different unspecified value appearance
994
+ cell = Wx::PG::PGCell.new
995
+ cell.text = 'Unspecified'
996
+ cell.set_fg_col(Wx::LIGHT_GREY)
997
+ @propGrid.set_unspecified_value_appearance(cell)
998
+
999
+ populate_grid
1000
+
1001
+ @propGrid.make_column_editable(0, @labelEditingEnabled)
1002
+ @propGridManager.show_header(@hasHeader)
1003
+ @propGridManager.set_column_title(2, 'Units') if @hasHeader
1004
+ end
1005
+
1006
+ def replace_grid(style, extraStyle)
1007
+ pgmanOld = @propGridManager;
1008
+ create_grid(style, extraStyle)
1009
+ @topSizer.replace(pgmanOld, @propGridManager)
1010
+ pgmanOld.destroy
1011
+ @propGridManager.set_focus
1012
+ @panel.layout
1013
+ end
1014
+
1015
+ # These are used in CreateGrid(), and in tests to compose
1016
+ # grids for testing purposes.
1017
+ def populate_grid
1018
+ pgman = @propGridManager;
1019
+ pgman.add_page('Standard Items')
1020
+
1021
+ populate_with_standard_items
1022
+
1023
+ pgman.add_page('wxWidgets Library Config')
1024
+
1025
+ populate_with_library_config
1026
+
1027
+ myPage = WxMyPropertyGridPage.new
1028
+ myPage.append(Wx::PG::IntProperty.new("IntProperty", Wx::PG::PG_LABEL, 12345678))
1029
+
1030
+ # Use WxMyPropertyGridPage (see above) to test the
1031
+ # custom wxPropertyGridPage feature.
1032
+ pgman.add_page("Examples", Wx::BitmapBundle.new, myPage)
1033
+
1034
+ populate_with_examples
1035
+ end
1036
+
1037
+ def populate_with_standard_items
1038
+ pgman = @propGridManager
1039
+ pg = pgman.get_page("Standard Items")
1040
+
1041
+ # Append is ideal way to add items to wxPropertyGrid.
1042
+ pg.append(Wx::PG::PropertyCategory.new("Appearance", Wx::PG::PG_LABEL))
1043
+
1044
+ pg.append(Wx::PG::StringProperty.new("Label", Wx::PG::PG_LABEL, get_title))
1045
+ pg.append(Wx::PG::FontProperty.new("Font", Wx::PG::PG_LABEL))
1046
+ pg.set_property_help_string("Font", "Editing this will change font used in the property grid.")
1047
+
1048
+ pg.append(Wx::PG::SystemColourProperty.new("Margin Colour",Wx::PG::PG_LABEL,
1049
+ Wx::PG::ColourPropertyValue.new(pg.get_grid.get_margin_colour)))
1050
+
1051
+ pg.append(Wx::PG::SystemColourProperty.new("Cell Colour",Wx::PG::PG_LABEL,
1052
+ pg.grid.get_cell_background_colour))
1053
+ pg.append(Wx::PG::SystemColourProperty.new("Cell Text Colour",Wx::PG::PG_LABEL,
1054
+ pg.grid.get_cell_text_colour))
1055
+ pg.append(Wx::PG::SystemColourProperty.new("Line Colour",Wx::PG::PG_LABEL,
1056
+ pg.grid.get_line_colour))
1057
+ pg.append(Wx::PG::FlagsProperty.new("Window Styles",Wx::PG::PG_LABEL,
1058
+ @combinedFlags, get_window_style))
1059
+
1060
+ pg.append(Wx::PG::CursorProperty.new("Cursor",Wx::PG::PG_LABEL))
1061
+
1062
+ pg.append(Wx::PG::PropertyCategory.new("Position","PositionCategory"))
1063
+ pg.set_property_help_string("PositionCategory", "Change in items in this category will cause respective changes in frame.")
1064
+
1065
+ # Let's demonstrate 'Units' attribute here
1066
+
1067
+ # Note that we use many attribute constants instead of strings here
1068
+ # (for instance, Wx::PG::PG_ATTR_MIN, instead of "min").
1069
+ # Using constant may reduce binary size.
1070
+
1071
+ pg.append(Wx::PG::IntProperty.new("Height",Wx::PG::PG_LABEL,480))
1072
+ pg.set_property_attribute("Height", Wx::PG::PG_ATTR_MIN, 10)
1073
+ pg.set_property_attribute("Height", Wx::PG::PG_ATTR_MAX, 2048)
1074
+ pg.set_property_attribute("Height", Wx::PG::PG_ATTR_UNITS, "Pixels")
1075
+
1076
+ # Set value to unspecified so that Hint attribute will be demonstrated
1077
+ pg.set_property_value_unspecified("Height")
1078
+ pg.set_property_attribute("Height", Wx::PG::PG_ATTR_HINT,
1079
+ "Enter new height for window")
1080
+
1081
+ # Difference between hint and help string is that the hint is shown in
1082
+ # an empty value cell, while help string is shown either in the
1083
+ # description text box, as a tool tip, or on the status bar.
1084
+ pg.set_property_help_string("Height",
1085
+ "This property uses attributes \"Units\" and \"Hint\".")
1086
+
1087
+ pg.append(Wx::PG::IntProperty.new("Width",Wx::PG::PG_LABEL,640))
1088
+ pg.set_property_attribute("Width", Wx::PG::PG_ATTR_MIN, 10)
1089
+ pg.set_property_attribute("Width", Wx::PG::PG_ATTR_MAX, 2048)
1090
+ pg.set_property_attribute("Width", Wx::PG::PG_ATTR_UNITS, "Pixels")
1091
+
1092
+ pg.set_property_value_unspecified("Width")
1093
+ pg.set_property_attribute("Width", Wx::PG::PG_ATTR_HINT,
1094
+ "Enter new width for window")
1095
+ pg.set_property_help_string("Width",
1096
+ "This property uses attributes \"Units\" and \"Hint\".")
1097
+
1098
+ pg.append(Wx::PG::IntProperty.new("X",Wx::PG::PG_LABEL,10))
1099
+ pg.set_property_attribute("X", Wx::PG::PG_ATTR_UNITS, "Pixels")
1100
+ pg.set_property_help_string("X", "This property uses \"Units\" attribute.")
1101
+
1102
+ pg.append Wx::PG::IntProperty.new("Y",Wx::PG::PG_LABEL,10)
1103
+ pg.set_property_attribute("Y", Wx::PG::PG_ATTR_UNITS, "Pixels")
1104
+ pg.set_property_help_string("Y", "This property uses \"Units\" attribute.")
1105
+
1106
+ disabledHelpString = "This property is simply disabled. In order to have label disabled as well, "+
1107
+ "you need to set Wx::PG::PG_EX_GREY_LABEL_WHEN_DISABLED using SetExtraStyle."
1108
+
1109
+ pg.append(Wx::PG::PropertyCategory.new("Environment",Wx::PG::PG_LABEL))
1110
+ pg.append(Wx::PG::StringProperty.new("Operating System",Wx::PG::PG_LABEL, Wx.get_os_description))
1111
+
1112
+ pg.append(Wx::PG::StringProperty.new("User Id",Wx::PG::PG_LABEL, Wx.get_user_id))
1113
+ pg.append(Wx::PG::DirProperty.new("User Home",Wx::PG::PG_LABEL, Wx.get_user_home))
1114
+ pg.append(Wx::PG::StringProperty.new("User Name",Wx::PG::PG_LABEL, Wx.get_user_name))
1115
+
1116
+ # Disable some of them
1117
+ pg.disable_property("Operating System")
1118
+ pg.disable_property("User Id")
1119
+ pg.disable_property("User Name")
1120
+
1121
+ pg.set_property_help_string("Operating System", disabledHelpString)
1122
+ pg.set_property_help_string("User Id", disabledHelpString)
1123
+ pg.set_property_help_string("User Name", disabledHelpString)
1124
+
1125
+ pg.append(Wx::PG::PropertyCategory.new("More Examples",Wx::PG::PG_LABEL))
1126
+
1127
+ pg.append(WxFontDataProperty.new("FontDataProperty", Wx::PG::PG_LABEL))
1128
+ pg.set_property_help_string("FontDataProperty",
1129
+ "This demonstrates Wx::PG::FontDataProperty class defined in this sample app. "+
1130
+ "It is exactly like Wx::PG::FontProperty from the library, but also has colour sub-property.")
1131
+
1132
+ pg.append(WxDirsProperty.new("DirsProperty",Wx::PG::PG_LABEL))
1133
+ pg.set_property_help_string("DirsProperty",
1134
+ "This demonstrates Wx::PG::DirsProperty class defined in this sample app. "+
1135
+ "It is built with WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY_WITH_VALIDATOR macro, "+
1136
+ "with custom action (dir dialog popup) defined.")
1137
+
1138
+ arrdbl = [
1139
+ -1.0,
1140
+ -0.5,
1141
+ 0.0,
1142
+ 0.5,
1143
+ 1.0
1144
+ ]
1145
+
1146
+ pg.append(WxArrayDoubleProperty.new("ArrayDoubleProperty",Wx::PG::PG_LABEL,arrdbl))
1147
+ pg.set_property_attribute("ArrayDoubleProperty",Wx::PG::PG_FLOAT_PRECISION,2)
1148
+ pg.set_property_help_string("ArrayDoubleProperty",
1149
+ "This demonstrates Wx::PG::ArrayDoubleProperty class defined in this sample app. "+
1150
+ "It is an example of a custom list editor property.")
1151
+
1152
+ pg.append(Wx::PG::LongStringProperty.new("Information",Wx::PG::PG_LABEL,
1153
+ "Editing properties will have immediate effect on this window, "+
1154
+ "and vice versa (at least in most cases, that is)."))
1155
+ pg.set_property_help_string("Information",
1156
+ "This property is read-only.")
1157
+
1158
+ pg.set_property_read_only("Information", true)
1159
+
1160
+ #
1161
+ # Set test information for cells in columns 3 and 4
1162
+ # (reserve column 2 for displaying units)
1163
+ bmp = Wx::ArtProvider.get_bitmap(Wx::ART_FOLDER)
1164
+
1165
+ pg.grid.each_property do |p|
1166
+ continue if p.category?
1167
+
1168
+ pg.set_property_cell(p, 3, "Cell 3", bmp)
1169
+ pg.set_property_cell(p, 4, "Cell 4", Wx::BitmapBundle.new, Wx::WHITE, Wx::BLACK)
1170
+ end
1171
+ end
1172
+
1173
+ def populate_with_examples
1174
+ pgman = @propGridManager
1175
+ pg = pgman.get_page("Examples")
1176
+
1177
+ if Wx.has_feature?(:USE_SPINBTN)
1178
+ pg.append(Wx::PG::IntProperty.new("SpinCtrl", Wx::PG::PG_LABEL, 0))
1179
+
1180
+ pg.set_property_editor("SpinCtrl", Wx::PG::PG_EDITOR_SPIN_CTRL)
1181
+ pg.set_property_attribute("SpinCtrl", Wx::PG::PG_ATTR_MIN, -2) # Use constants instead of string
1182
+ pg.set_property_attribute("SpinCtrl", Wx::PG::PG_ATTR_MAX, 16384) # for reduced binary size.
1183
+ pg.set_property_attribute("SpinCtrl", Wx::PG::PG_ATTR_SPINCTRL_STEP, 2)
1184
+ pg.set_property_attribute("SpinCtrl", Wx::PG::PG_ATTR_SPINCTRL_MOTION, true)
1185
+ pg.set_property_attribute("SpinCtrl", Wx::PG::PG_ATTR_SPINCTRL_WRAP, true)
1186
+
1187
+ pg.set_property_help_string("SpinCtrl",
1188
+ "This is regular Wx::PG::IntProperty, which editor has been "+
1189
+ "changed to Wx::PG::PGEditor_SpinCtrl. Note however that "+
1190
+ "static wxPropertyGrid::RegisterAdditionalEditors() "+
1191
+ "needs to be called prior to using it.")
1192
+ end
1193
+
1194
+ # Add bool property
1195
+ pg.append(Wx::PG::BoolProperty.new("BoolProperty", Wx::PG::PG_LABEL, false))
1196
+
1197
+ # Add bool property with check box
1198
+ pg.append(Wx::PG::BoolProperty.new("BoolProperty with CheckBox", Wx::PG::PG_LABEL, false))
1199
+ pg.set_property_attribute("BoolProperty with CheckBox",
1200
+ Wx::PG::PG_BOOL_USE_CHECKBOX,
1201
+ true)
1202
+
1203
+ pg.set_property_help_string("BoolProperty with CheckBox",
1204
+ "Property attribute Wx::PG::PG_BOOL_USE_CHECKBOX has been set to true.")
1205
+
1206
+ prop = pg.append(Wx::PG::FloatProperty.new("FloatProperty",
1207
+ Wx::PG::PG_LABEL,
1208
+ 1234500.23))
1209
+ prop.set_attribute(Wx::PG::PG_ATTR_MIN, -100.12)
1210
+
1211
+ # A string property that can be edited in a separate editor dialog.
1212
+ pg.append(Wx::PG::LongStringProperty.new("LongStringProperty", "LongStringProp",
1213
+ "This is much longer string than the first one. Edit it by clicking the button."))
1214
+
1215
+ # A property that edits a wxArrayString.
1216
+ example_array = [
1217
+ "String 1",
1218
+ "String 2",
1219
+ "String 3"
1220
+ ]
1221
+ pg.append(Wx::PG::ArrayStringProperty.new("ArrayStringProperty", Wx::PG::PG_LABEL,
1222
+ example_array))
1223
+
1224
+ # A file selector property. Note that argument between name
1225
+ # and initial value is wildcard (format same as in wxFileDialog).
1226
+ prop = Wx::PG::FileProperty.new("FileProperty", "TextFile")
1227
+ pg.append(prop)
1228
+
1229
+ prop.set_attribute(Wx::PG::PG_FILE_WILDCARD,"Text Files (*.txt)|*.txt")
1230
+ prop.set_attribute(Wx::PG::PG_DIALOG_TITLE,"Custom File Dialog Title")
1231
+ prop.set_attribute(Wx::PG::PG_FILE_SHOW_FULL_PATH,false)
1232
+
1233
+ if Wx::PLATFORM == 'WXMSW'
1234
+ prop.set_attribute(Wx::PG::PG_FILE_SHOW_RELATIVE_PATH,"C:\\Windows")
1235
+ pg.set_property_value(prop,"C:\\Windows\\System32\\msvcrt71.dll")
1236
+ end
1237
+
1238
+ if Wx.has_feature? :USE_IMAGE
1239
+ # An image file property. Arguments are just like for FileProperty, but
1240
+ # wildcard is missing (it is autogenerated from supported image formats).
1241
+ # If you really need to override it, create property separately, and call
1242
+ # its SetWildcard method.
1243
+ pg.append(Wx::PG::ImageFileProperty.new("ImageFile", Wx::PG::PG_LABEL))
1244
+ end
1245
+
1246
+ pid = pg.append(Wx::PG::ColourProperty.new("ColourProperty",Wx::PG::PG_LABEL,Wx::RED))
1247
+ pg.set_property_editor("ColourProperty", Wx::PG::PG_EDITOR_COMBO_BOX)
1248
+ pg.get_property("ColourProperty").set_auto_unspecified(true)
1249
+ pg.set_property_help_string("ColourProperty",
1250
+ "wxPropertyGrid::SetPropertyEditor method has been used to change "+
1251
+ "editor of this property to Wx::PG::PGEditor_ComboBox)")
1252
+
1253
+ pid = pg.append(Wx::PG::ColourProperty.new("ColourPropertyWithAlpha",
1254
+ Wx::PG::PG_LABEL,
1255
+ Wx::Colour.new(15, 200, 95, 128)))
1256
+ pg.set_property_attribute("ColourPropertyWithAlpha", Wx::PG::PG_COLOUR_HAS_ALPHA, true)
1257
+ pg.set_property_help_string("ColourPropertyWithAlpha",
1258
+ "Attribute \"HasAlpha\" is set to true for this property.")
1259
+
1260
+ #
1261
+ # This demonstrates using alternative editor for colour property
1262
+ # to trigger colour dialog directly from button.
1263
+ pg.append(Wx::PG::ColourProperty.new("ColourProperty2",Wx::PG::PG_LABEL,Wx::GREEN))
1264
+
1265
+ #
1266
+ # Wx::PG::EnumProperty does not store strings or even list of strings
1267
+ # (so that's why they are static in function).
1268
+ enum_prop_labels = [
1269
+ "One Item",
1270
+ "Another Item",
1271
+ "One More",
1272
+ "This Is Last" ]
1273
+
1274
+ # this value array would be optional if values matched string indexes
1275
+ enum_prop_values = [ 40, 80, 120, 160 ]
1276
+
1277
+ # note that the initial value (the last argument) is the actual value,
1278
+ # not index or anything like that. Thus, our value selects "Another Item".
1279
+ pg.append(Wx::PG::EnumProperty.new("EnumProperty",Wx::PG::PG_LABEL,
1280
+ enum_prop_labels, enum_prop_values, 80))
1281
+
1282
+ soc = Wx::PG::PGChoices.new
1283
+
1284
+ # use basic table from our previous example
1285
+ # can also set/add wxArrayStrings and wxArrayInts directly.
1286
+ soc.set(enum_prop_labels, enum_prop_values)
1287
+
1288
+ # add extra items
1289
+ soc.add("Look, it continues", 200)
1290
+ soc.add("Even More", 240)
1291
+ soc.add("And More", 280)
1292
+ soc.add('', 300)
1293
+ soc.add("True End of the List", 320)
1294
+
1295
+ # Test custom colours ([] operator of Wx::PG::PGChoices returns
1296
+ # references to Wx::PG::PGChoiceEntry).
1297
+ soc[1].set_fg_col(Wx::RED)
1298
+ soc[1].set_bg_col(Wx::LIGHT_GREY)
1299
+ soc[2].set_fg_col(Wx::GREEN)
1300
+ soc[2].set_bg_col(Wx::LIGHT_GREY)
1301
+ soc[3].set_fg_col(Wx::BLUE)
1302
+ soc[3].set_bg_col(Wx::LIGHT_GREY)
1303
+ soc[4].set_bitmap(Wx::ArtProvider.get_bitmap(Wx::ART_FOLDER))
1304
+
1305
+ pg.append(Wx::PG::EnumProperty.new("EnumProperty 2",
1306
+ Wx::PG::PG_LABEL,
1307
+ soc,
1308
+ 240))
1309
+ pg.get_property("EnumProperty 2").add_choice("Testing Extra", 360)
1310
+
1311
+ # Here we only display the original 'soc' choices
1312
+ pg.append(Wx::PG::EnumProperty.new("EnumProperty 3",Wx::PG::PG_LABEL,
1313
+ soc, 240))
1314
+
1315
+ # Test Hint attribute in EnumProperty
1316
+ pg.get_property("EnumProperty 3").set_attribute(Wx::PG::PG_ATTR_HINT, "Dummy Hint")
1317
+
1318
+ pg.set_property_help_string("EnumProperty 3",
1319
+ "This property uses \"Hint\" attribute.")
1320
+
1321
+ # 'soc' plus one exclusive extra choice "4th only"
1322
+ pg.append(Wx::PG::EnumProperty.new("EnumProperty 4",Wx::PG::PG_LABEL,
1323
+ soc, 240))
1324
+ pg.get_property("EnumProperty 4").add_choice("4th only", 360)
1325
+
1326
+ pg.set_property_help_string("EnumProperty 4",
1327
+ "Should have one extra item when compared to EnumProperty 3")
1328
+
1329
+ # Plus property value bitmap
1330
+ pg.append(Wx::PG::EnumProperty.new("EnumProperty With Bitmap", "EnumProperty 5",
1331
+ soc, 280))
1332
+ pg.set_property_help_string("EnumProperty 5",
1333
+ "Should have bitmap in front of the displayed value")
1334
+ bmpVal = Wx::ArtProvider.get_bitmap(Wx::ART_REMOVABLE)
1335
+ pg.set_property_image("EnumProperty 5", bmpVal)
1336
+
1337
+ # Password property example.
1338
+ pg.append(Wx::PG::StringProperty.new("Password",Wx::PG::PG_LABEL, "password"))
1339
+ pg.set_property_attribute("Password", Wx::PG::PG_STRING_PASSWORD, true)
1340
+ pg.set_property_help_string("Password",
1341
+ "Has attribute Wx::PG::PG_STRING_PASSWORD set to true")
1342
+
1343
+ # String editor with dir selector button. Uses wxEmptyString as name, which
1344
+ # is allowed (naturally, in this case property cannot be accessed by name).
1345
+ pg.append(Wx::PG::DirProperty.new("DirProperty", Wx::PG::PG_LABEL, Wx.get_user_home))
1346
+ pg.set_property_attribute("DirProperty",
1347
+ Wx::PG::PG_DIALOG_TITLE,
1348
+ "This is a custom dir dialog title")
1349
+
1350
+ # Add string property - first arg is label, second name, and third initial value
1351
+ pg.append(Wx::PG::StringProperty.new("StringProperty", Wx::PG::PG_LABEL))
1352
+ pg.set_property_max_length("StringProperty", 6)
1353
+ pg.set_property_help_string("StringProperty",
1354
+ "Max length of this text has been limited to 6, using wxPropertyGrid::SetPropertyMaxLength.")
1355
+
1356
+ # Set value after limiting so that it will be applied
1357
+ pg.set_property_value("StringProperty", "some text")
1358
+
1359
+ #
1360
+ # Demonstrate "AutoComplete" attribute
1361
+ pg.append(Wx::PG::StringProperty.new("StringProperty AutoComplete",
1362
+ Wx::PG::PG_LABEL))
1363
+
1364
+ autoCompleteStrings = [
1365
+ "One choice",
1366
+ "Another choice",
1367
+ "Another choice, yeah",
1368
+ "Yet another choice",
1369
+ "Yet another choice, bear with me"
1370
+ ]
1371
+ pg.set_property_attribute("StringProperty AutoComplete",
1372
+ Wx::PG::PG_ATTR_AUTOCOMPLETE,
1373
+ autoCompleteStrings)
1374
+
1375
+ pg.set_property_help_string("StringProperty AutoComplete",
1376
+ "AutoComplete attribute has been set for this property "+
1377
+ "(try writing something beginning with 'a', 'o' or 'y').")
1378
+
1379
+
1380
+ # Add string property with arbitrarily wide bitmap in front of it. We
1381
+ # intentionally lower-than-typical row height here so that the ugly
1382
+ # scaling code won't be run.
1383
+ pg.append(Wx::PG::StringProperty.new("StringPropertyWithBitmap",
1384
+ Wx::PG::PG_LABEL,
1385
+ "Test Text"))
1386
+ myTestBitmap1x = Wx::Bitmap.new(60, 15, 32)
1387
+ mdc = Wx::MemoryDC.new(myTestBitmap1x)
1388
+ mdc.set_background(Wx::WHITE_BRUSH)
1389
+ mdc.clear
1390
+ mdc.set_pen(Wx::BLACK_PEN)
1391
+ mdc.set_brush(Wx::WHITE_BRUSH)
1392
+ mdc.draw_rectangle(0, 0, 60, 15)
1393
+ mdc.draw_line(0, 0, 59, 14)
1394
+ mdc.set_text_foreground(Wx::BLACK)
1395
+ mdc.draw_text("x1", 0, 0)
1396
+
1397
+ myTestBitmap2x = Wx::Bitmap.new(120, 30, 32)
1398
+ mdc = Wx::MemoryDC.new(myTestBitmap2x)
1399
+ mdc.set_background(Wx::WHITE_BRUSH)
1400
+ mdc.clear
1401
+ mdc.set_pen(Wx::Pen.new(Wx::BLUE, 2))
1402
+ mdc.set_brush(Wx::WHITE_BRUSH)
1403
+ mdc.draw_rectangle(0, 0, 120, 30)
1404
+ mdc.draw_line(0, 0, 119, 31)
1405
+ mdc.set_text_foreground(Wx::BLUE)
1406
+ f = mdc.font
1407
+ f.set_pixel_size(f.get_pixel_size * 2)
1408
+ mdc.set_font(f)
1409
+ mdc.draw_text("x2", 0, 0)
1410
+
1411
+ myTestBitmap2x.set_scale_factor(2)
1412
+ pg.set_property_image("StringPropertyWithBitmap", Wx::BitmapBundle.from_bitmaps(myTestBitmap1x, myTestBitmap2x))
1413
+
1414
+ # Multi choice dialog.
1415
+ tchoices = %w[Cabbage Carrot Onion Potato Strawberry]
1416
+
1417
+ tchoicesValues = %w[Carrot Potato]
1418
+
1419
+ pg.append(Wx::PG::EnumProperty.new("EnumProperty X",Wx::PG::PG_LABEL, tchoices))
1420
+
1421
+ pg.append(Wx::PG::MultiChoiceProperty.new("MultiChoiceProperty", Wx::PG::PG_LABEL,
1422
+ tchoices, tchoicesValues))
1423
+ pg.set_property_attribute("MultiChoiceProperty", Wx::PG::PG_ATTR_MULTICHOICE_USERSTRINGMODE, 1)
1424
+
1425
+ pg.append(WxSizeProperty.new("SizeProperty", "Size", get_size))
1426
+ pg.append(WxPointProperty.new("PointProperty", "Position", get_position))
1427
+
1428
+ # UInt samples
1429
+ pg.append(Wx::PG::UIntProperty.new("UIntProperty", Wx::PG::PG_LABEL, 0xFEEEFEEEFEEE))
1430
+ pg.set_property_attribute("UIntProperty", Wx::PG::PG_UINT_PREFIX, Wx::PG::PG_PREFIX_NONE)
1431
+ pg.set_property_attribute("UIntProperty", Wx::PG::PG_UINT_BASE, Wx::PG::PG_BASE_HEX)
1432
+ #pg.set_property_attribute("UIntProperty", Wx::PG::PG_UINT_PREFIX, Wx::PG::PG_PREFIX_NONE)
1433
+ #pg.set_property_attribute("UIntProperty", Wx::PG::PG_UINT_BASE, Wx::PG::PG_BASE_OCT)
1434
+
1435
+ #
1436
+ # Wx::PG::EditEnumProperty
1437
+ eech = Wx::PG::PGChoices.new([
1438
+ "Choice 1",
1439
+ "Choice 2",
1440
+ "Choice 3"
1441
+ ])
1442
+ pg.append(Wx::PG::EditEnumProperty.new("EditEnumProperty",
1443
+ Wx::PG::PG_LABEL,
1444
+ eech,
1445
+ "Choice not in the list"))
1446
+
1447
+ # Test Hint attribute in EditEnumProperty
1448
+ pg.get_property("EditEnumProperty").set_attribute(Wx::PG::PG_ATTR_HINT, "Dummy Hint")
1449
+
1450
+ #wxString v_;
1451
+ #wxTextValidator validator1(wxFILTER_NUMERIC,&v_)
1452
+ #pg.SetPropertyValidator("EditEnumProperty", validator1)
1453
+
1454
+ if Wx.has_feature? :USE_DATETIME
1455
+ #
1456
+ # Wx::PG::DateTimeProperty
1457
+ pg.append(Wx::PG::DateProperty.new("DateProperty", Wx::PG::PG_LABEL, Time.now))
1458
+
1459
+ if Wx.has_feature? :USE_DATEPICKCTRL
1460
+ pg.set_property_attribute("DateProperty", Wx::PG::PG_DATE_PICKER_STYLE,
1461
+ Wx::DP_DROPDOWN|Wx::DP_SHOWCENTURY|Wx::DP_ALLOWNONE)
1462
+
1463
+ pg.set_property_help_string("DateProperty",
1464
+ "Attribute Wx::PG::PG_DATE_PICKER_STYLE has been set to (long)"+
1465
+ "(wxDP_DROPDOWN | wxDP_SHOWCENTURY | wxDP_ALLOWNONE).")
1466
+ end
1467
+
1468
+ end
1469
+
1470
+ #
1471
+ # Add Triangle properties as both Wx::PG::TriangleProperty and
1472
+ # a generic parent property (using Wx::PG::StringProperty).
1473
+ #
1474
+ topId = pg.append(Wx::PG::StringProperty.new("3D Object", Wx::PG::PG_LABEL, "<composed>"))
1475
+
1476
+ pid = pg.append_in(topId, Wx::PG::StringProperty.new("Triangle 1", "Triangle 1", "<composed>"))
1477
+ pg.append_in(pid, WxVectorProperty.new("A", Wx::PG::PG_LABEL))
1478
+ pg.append_in(pid, WxVectorProperty.new("B", Wx::PG::PG_LABEL))
1479
+ pg.append_in(pid, WxVectorProperty.new("C", Wx::PG::PG_LABEL))
1480
+
1481
+ pg.append_in(topId, WxTriangleProperty.new("Triangle 2", "Triangle 2"))
1482
+
1483
+ pg.set_property_help_string("3D Object",
1484
+ "3D Object is Wx::PG::StringProperty with value \"<composed>\". Two of its children are similar wxStringProperties with "+
1485
+ "three Wx::PG::VectorProperty children, and other two are custom wxTriangleProperties.")
1486
+
1487
+ pid = pg.append_in(topId, Wx::PG::StringProperty.new("Triangle 3", "Triangle 3", "<composed>"))
1488
+ pg.append_in(pid, WxVectorProperty.new("A", Wx::PG::PG_LABEL))
1489
+ pg.append_in(pid, WxVectorProperty.new("B", Wx::PG::PG_LABEL))
1490
+ pg.append_in(pid, WxVectorProperty.new("C", Wx::PG::PG_LABEL))
1491
+
1492
+ pg.append_in(topId, WxTriangleProperty.new("Triangle 4", "Triangle 4"))
1493
+
1494
+ #
1495
+ # This snippet is a doc sample test
1496
+ #
1497
+ carProp = pg.append(Wx::PG::StringProperty.new("Car",
1498
+ Wx::PG::PG_LABEL,
1499
+ "<composed>"))
1500
+
1501
+ pg.append_in(carProp, Wx::PG::StringProperty.new("Model",
1502
+ Wx::PG::PG_LABEL,
1503
+ "Lamborghini Diablo SV"))
1504
+
1505
+ pg.append_in(carProp, Wx::PG::IntProperty.new("Engine Size (cc)",
1506
+ Wx::PG::PG_LABEL,
1507
+ 5707))
1508
+
1509
+ speedsProp = pg.append_in(carProp,
1510
+ Wx::PG::StringProperty.new("Speeds",
1511
+ Wx::PG::PG_LABEL,
1512
+ "<composed>"))
1513
+
1514
+ pg.append_in(speedsProp, Wx::PG::IntProperty.new("Max. Speed (mph)",
1515
+ Wx::PG::PG_LABEL,290))
1516
+ pg.append_in(speedsProp, Wx::PG::FloatProperty.new("0-100 mph (sec)",
1517
+ Wx::PG::PG_LABEL,3.9))
1518
+ pg.append_in(speedsProp, Wx::PG::FloatProperty.new("1/4 mile (sec)",
1519
+ Wx::PG::PG_LABEL,8.6))
1520
+
1521
+ # This is how child property can be referred to by name
1522
+ pg.set_property_value("Car.Speeds.Max. Speed (mph)", 300)
1523
+
1524
+ pg.append_in(carProp, Wx::PG::IntProperty.new("Price ($)",
1525
+ Wx::PG::PG_LABEL,
1526
+ 300000))
1527
+
1528
+ pg.append_in(carProp, Wx::PG::BoolProperty.new("Convertible",
1529
+ Wx::PG::PG_LABEL,
1530
+ false))
1531
+
1532
+ # Displayed value of "Car" property is now very close to this:
1533
+ # "Lamborghini Diablo SV; 5707 [300; 3.9; 8.6] 300000"
1534
+
1535
+ #
1536
+ # Test wxSampleMultiButtonEditor
1537
+ pg.append(Wx::PG::LongStringProperty.new("MultipleButtons", Wx::PG::PG_LABEL))
1538
+ pg.set_property_editor("MultipleButtons", @sampleMultiButtonEditor)
1539
+
1540
+ # Test SingleChoiceProperty
1541
+ pg.append(WxSingleChoiceProperty.new("SingleChoiceProperty"))
1542
+
1543
+ #
1544
+ # Test adding variable height bitmaps in Wx::PG::PGChoices
1545
+ bc = Wx::PG::PGChoices.new
1546
+ bc.add("Wee",
1547
+ Wx::ArtProvider.get_bitmap(Wx::ART_CDROM, Wx::ART_OTHER, [16, 16]))
1548
+ bc.add("Not so wee",
1549
+ Wx::ArtProvider.get_bitmap(Wx::ART_FLOPPY, Wx::ART_OTHER, [32, 32]))
1550
+ bc.add("Friggin' huge",
1551
+ Wx::ArtProvider.get_bitmap(Wx::ART_HARDDISK, Wx::ART_OTHER, [64, 64]))
1552
+
1553
+ pg.append(Wx::PG::EnumProperty.new("Variable Height Bitmaps",
1554
+ Wx::PG::PG_LABEL,
1555
+ bc,
1556
+ 0))
1557
+
1558
+ #
1559
+ # Test how non-editable composite strings appear
1560
+ pid = Wx::PG::StringProperty.new("wxRuby Traits", Wx::PG::PG_LABEL, "<composed>")
1561
+ pg.set_property_read_only(pid)
1562
+
1563
+ #
1564
+ # For testing purposes, combine two methods of adding children
1565
+ #
1566
+
1567
+ pid.append_child(Wx::PG::StringProperty.new("Latest Release",
1568
+ Wx::PG::PG_LABEL,
1569
+ "3.0.0"))
1570
+ pid.append_child(Wx::PG::BoolProperty.new("Win API",
1571
+ Wx::PG::PG_LABEL,
1572
+ true))
1573
+
1574
+ pg.append(pid)
1575
+
1576
+ pg.append_in(pid, Wx::PG::BoolProperty.new("QT", Wx::PG::PG_LABEL, true))
1577
+ pg.append_in(pid, Wx::PG::BoolProperty.new("Cocoa", Wx::PG::PG_LABEL, true))
1578
+ pg.append_in(pid, Wx::PG::BoolProperty.new("Haiku", Wx::PG::PG_LABEL, false))
1579
+ pg.append_in(pid, Wx::PG::StringProperty.new("Trunk Version", Wx::PG::PG_LABEL, Wx::WXRUBY_VERSION))
1580
+ pg.append_in(pid, Wx::PG::BoolProperty.new("GTK+", Wx::PG::PG_LABEL, true))
1581
+ pg.append_in(pid, Wx::PG::BoolProperty.new("Android", Wx::PG::PG_LABEL, false))
1582
+
1583
+ add_test_properties(pg)
1584
+ end
1585
+
1586
+ def populate_with_library_config
1587
+ pgman = @propGridManager;
1588
+ pg = pgman.get_page("wxWidgets Library Config")
1589
+
1590
+ # Set custom column proportions (here in the sample app we need
1591
+ # to check if the grid has wxPG_SPLITTER_AUTO_CENTER style. You usually
1592
+ # need not to do it in your application).
1593
+ if pgman.has_flag(Wx::PG::PG_SPLITTER_AUTO_CENTER)
1594
+ pg.set_column_proportion(0, 3)
1595
+ pg.set_column_proportion(1, 1)
1596
+ end
1597
+
1598
+ bmp = Wx::ArtProvider.get_bitmap(Wx::ART_REPORT_VIEW)
1599
+
1600
+ italicFont = pgman.grid.get_caption_font
1601
+ italicFont.set_style(Wx::FONTSTYLE_ITALIC)
1602
+
1603
+ italicFontHelp = "Font of this property's wxPGCell has " +
1604
+ "been modified. Obtain property's cell " +
1605
+ "with wxPGProperty::" +
1606
+ "GetOrCreateCell(column)."
1607
+
1608
+ pid = pg.append(Wx::PG::PropertyCategory.new("wxWidgets Library Configuration" ))
1609
+ pg.set_property_cell(pid, 0, Wx::PG::PG_LABEL, bmp)
1610
+
1611
+ # Both of following lines would set a label for the second column
1612
+ pg.set_property_cell(pid, 1, "Is Enabled")
1613
+ pid.set_value("Is Enabled")
1614
+
1615
+ _ADD_WX_LIB_CONF_GROUP = ->(label) {
1616
+ cat = pg.append_in(pid, Wx::PG::PropertyCategory.new(label))
1617
+ pg.set_property_cell(cat, 0, Wx::PG::PG_LABEL, bmp)
1618
+ cat.get_cell(0).set_font(italicFont)
1619
+ cat.set_help_string(italicFontHelp)
1620
+ }
1621
+
1622
+ _ADD_WX_LIB_CONF = ->(sym) {
1623
+ pg.append(Wx::PG::BoolProperty.new(sym.to_s, Wx::PG::PG_LABEL, Wx.has_feature?(sym)))
1624
+ }
1625
+
1626
+ _ADD_WX_LIB_CONF_NODEF = ->(sym) {
1627
+ pg.append(Wx::PG::BoolProperty.new(sym.to_s, Wx::PG::PG_LABEL, Wx.has_feature?(sym)))
1628
+ pg.disable_property(sym.to_s) unless Wx.has_feature?(sym)
1629
+ }
1630
+
1631
+ _ADD_WX_LIB_CONF_GROUP.call("Global Settings")
1632
+ _ADD_WX_LIB_CONF.call(:USE_GUI)
1633
+
1634
+ _ADD_WX_LIB_CONF_GROUP.call("Compatibility Settings")
1635
+ if Wx.has_feature?(:WXWIN_COMPATIBILITY_3_0)
1636
+ _ADD_WX_LIB_CONF.call(:WXWIN_COMPATIBILITY_3_0)
1637
+ end
1638
+ _ADD_WX_LIB_CONF_NODEF.call(:FONT_SIZE_COMPATIBILITY)
1639
+ _ADD_WX_LIB_CONF_NODEF.call(:DIALOG_UNIT_COMPATIBILITY)
1640
+
1641
+ _ADD_WX_LIB_CONF_GROUP.call("Debugging Settings")
1642
+ _ADD_WX_LIB_CONF.call(:USE_DEBUG_CONTEXT)
1643
+ _ADD_WX_LIB_CONF.call(:USE_MEMORY_TRACING)
1644
+ _ADD_WX_LIB_CONF.call(:USE_GLOBAL_MEMORY_OPERATORS)
1645
+ _ADD_WX_LIB_CONF.call(:USE_DEBUG_NEW_ALWAYS)
1646
+ _ADD_WX_LIB_CONF.call(:USE_ON_FATAL_EXCEPTION)
1647
+
1648
+ _ADD_WX_LIB_CONF_GROUP.call("Unicode Support")
1649
+ # From wxWidgets 3.3.0 Unicode is the fixed default and the setup macro 'wxUSE_UNICODE' removed
1650
+ if Wx::WXWIDGETS_VERSION < '3.3.0'
1651
+ _ADD_WX_LIB_CONF.call(:USE_UNICODE)
1652
+ end
1653
+ _ADD_WX_LIB_CONF.call(:USE_UNICODE_UTF8)
1654
+
1655
+ _ADD_WX_LIB_CONF_GROUP.call("Global Features")
1656
+ _ADD_WX_LIB_CONF.call(:USE_EXCEPTIONS)
1657
+ _ADD_WX_LIB_CONF.call(:USE_EXTENDED_RTTI)
1658
+ _ADD_WX_LIB_CONF.call(:USE_STL)
1659
+ _ADD_WX_LIB_CONF.call(:USE_LOG)
1660
+ _ADD_WX_LIB_CONF.call(:USE_LOGWINDOW)
1661
+ _ADD_WX_LIB_CONF.call(:USE_LOGGUI)
1662
+ _ADD_WX_LIB_CONF.call(:USE_LOG_DIALOG)
1663
+ _ADD_WX_LIB_CONF.call(:USE_CMDLINE_PARSER)
1664
+ _ADD_WX_LIB_CONF.call(:USE_THREADS)
1665
+ _ADD_WX_LIB_CONF.call(:USE_STREAMS)
1666
+ _ADD_WX_LIB_CONF.call(:USE_STD_IOSTREAM)
1667
+
1668
+ _ADD_WX_LIB_CONF_GROUP.call("Non-GUI Features")
1669
+ _ADD_WX_LIB_CONF.call(:USE_LONGLONG)
1670
+ _ADD_WX_LIB_CONF.call(:USE_FILE)
1671
+ _ADD_WX_LIB_CONF.call(:USE_FFILE)
1672
+ _ADD_WX_LIB_CONF.call(:USE_FSVOLUME)
1673
+ _ADD_WX_LIB_CONF.call(:USE_TEXTBUFFER)
1674
+ _ADD_WX_LIB_CONF.call(:USE_TEXTFILE)
1675
+ _ADD_WX_LIB_CONF.call(:USE_INTL)
1676
+ _ADD_WX_LIB_CONF.call(:USE_DATETIME)
1677
+ _ADD_WX_LIB_CONF.call(:USE_TIMER)
1678
+ _ADD_WX_LIB_CONF.call(:USE_STOPWATCH)
1679
+ _ADD_WX_LIB_CONF.call(:USE_CONFIG)
1680
+ _ADD_WX_LIB_CONF_NODEF.call(:USE_CONFIG_NATIVE)
1681
+ _ADD_WX_LIB_CONF.call(:USE_DIALUP_MANAGER)
1682
+ _ADD_WX_LIB_CONF.call(:USE_DYNLIB_CLASS)
1683
+ _ADD_WX_LIB_CONF.call(:USE_DYNAMIC_LOADER)
1684
+ _ADD_WX_LIB_CONF.call(:USE_SOCKETS)
1685
+ _ADD_WX_LIB_CONF.call(:USE_FILESYSTEM)
1686
+ _ADD_WX_LIB_CONF.call(:USE_FS_ZIP)
1687
+ _ADD_WX_LIB_CONF.call(:USE_FS_INET)
1688
+ _ADD_WX_LIB_CONF.call(:USE_ZIPSTREAM)
1689
+ _ADD_WX_LIB_CONF.call(:USE_ZLIB)
1690
+ _ADD_WX_LIB_CONF.call(:USE_APPLE_IEEE)
1691
+ _ADD_WX_LIB_CONF.call(:USE_JOYSTICK)
1692
+ _ADD_WX_LIB_CONF.call(:USE_FONTMAP)
1693
+ _ADD_WX_LIB_CONF.call(:USE_MIMETYPE)
1694
+ _ADD_WX_LIB_CONF.call(:USE_PROTOCOL)
1695
+ _ADD_WX_LIB_CONF.call(:USE_PROTOCOL_FILE)
1696
+ _ADD_WX_LIB_CONF.call(:USE_PROTOCOL_FTP)
1697
+ _ADD_WX_LIB_CONF.call(:USE_PROTOCOL_HTTP)
1698
+ _ADD_WX_LIB_CONF.call(:USE_URL)
1699
+ _ADD_WX_LIB_CONF_NODEF.call(:USE_URL_NATIVE)
1700
+ _ADD_WX_LIB_CONF.call(:USE_REGEX)
1701
+ _ADD_WX_LIB_CONF.call(:USE_SYSTEM_OPTIONS)
1702
+ _ADD_WX_LIB_CONF.call(:USE_SOUND)
1703
+ _ADD_WX_LIB_CONF_NODEF.call(:USE_XRC)
1704
+ _ADD_WX_LIB_CONF.call(:USE_XML)
1705
+
1706
+ # Set them to use check box.
1707
+ pg.set_property_attribute(pid, Wx::PG::PG_BOOL_USE_CHECKBOX, true, Wx::PG::PG_RECURSE)
1708
+ end
1709
+
1710
+ def on_close_click(event)
1711
+ close(false)
1712
+ end
1713
+
1714
+ def on_colour_scheme(event)
1715
+ id = event.id
1716
+ if id == ID::COLOURSCHEME1
1717
+ @propGridManager.grid.reset_colours
1718
+ elsif id == ID::COLOURSCHEME2
1719
+ # white
1720
+ my_grey_1 = Wx::Colour.new(212,208,200)
1721
+ my_grey_3 = Wx::Colour.new(113,111,100)
1722
+ @propGridManager.freeze
1723
+ @propGridManager.grid.set_margin_colour(Wx::WHITE)
1724
+ @propGridManager.grid.set_caption_background_colour(Wx::WHITE)
1725
+ @propGridManager.grid.set_cell_background_colour(Wx::WHITE)
1726
+ @propGridManager.grid.set_cell_text_colour(my_grey_3)
1727
+ @propGridManager.grid.set_line_colour(my_grey_1)
1728
+ @propGridManager.thaw
1729
+ elsif id == ID::COLOURSCHEME3
1730
+ # .NET
1731
+ my_grey_1 = Wx::Colour.new(212,208,200)
1732
+ my_grey_2 = Wx::Colour.new(236,233,216)
1733
+ @propGridManager.freeze
1734
+ @propGridManager.grid.set_margin_colour(my_grey_1)
1735
+ @propGridManager.grid.set_caption_background_colour(my_grey_1)
1736
+ @propGridManager.grid.set_line_colour(my_grey_1)
1737
+ @propGridManager.thaw
1738
+ elsif id == ID::COLOURSCHEME4
1739
+ # cream
1740
+ my_grey_1 = Wx::Colour.new(212,208,200)
1741
+ my_grey_2 = Wx::Colour.new(241,239,226)
1742
+ my_grey_3 = Wx::Colour.new(113,111,100)
1743
+ @propGridManager.freeze
1744
+ @propGridManager.grid.set_margin_colour(Wx::WHITE)
1745
+ @propGridManager.grid.set_caption_background_colour(Wx::WHITE)
1746
+ @propGridManager.grid.set_cell_background_colour(my_grey_2)
1747
+ @propGridManager.grid.set_cell_background_colour(my_grey_2)
1748
+ @propGridManager.grid.set_cell_text_colour(my_grey_3)
1749
+ @propGridManager.grid.set_line_colour(my_grey_1)
1750
+ @propGridManager.thaw
1751
+ end
1752
+ end
1753
+
1754
+ def on_insert_prop_click(event)
1755
+ if @propGridManager.grid.root.get_child_count == 0
1756
+ Wx.message_box("No items to relate - first add some with Append.")
1757
+ return
1758
+ end
1759
+
1760
+ id = @propGridManager.grid.get_selection
1761
+ unless id
1762
+ Wx.message_box("First select a property - new one will be inserted right before that.")
1763
+ return
1764
+ end
1765
+
1766
+ propLabel = FormMain.generate_unique_property_label(@propGridManager, 'Property')
1767
+
1768
+ @propGridManager.insert(@propGridManager.get_property_parent(id),
1769
+ id.get_index_in_parent,
1770
+ Wx::PG::StringProperty.new(propLabel))
1771
+ end
1772
+
1773
+ def on_append_prop_click(event)
1774
+ propLabel = FormMain.generate_unique_property_label(@propGridManager, 'Property')
1775
+
1776
+ @propGridManager.append(Wx::PG::StringProperty.new(propLabel))
1777
+
1778
+ @propGridManager.refresh
1779
+ end
1780
+
1781
+ def on_clear_click(event)
1782
+ @propGridManager.grid.clear
1783
+ end
1784
+
1785
+ def on_append_cat_click(event)
1786
+ propLabel = FormMain.generate_unique_property_label(@propGridManager, 'Category')
1787
+
1788
+ @propGridManager.append(Wx::PG::PropertyCategory.new(propLabel))
1789
+
1790
+ @propGridManager.refresh
1791
+ end
1792
+
1793
+ def on_insert_cat_click(event)
1794
+ if @propGridManager.grid.root.get_child_count == 0
1795
+ Wx.message_box("No items to relate - first add some with Append.")
1796
+ return
1797
+ end
1798
+
1799
+ id = @propGridManager.grid.get_selection
1800
+ unless id
1801
+ Wx.message_box("First select a property - new one will be inserted right before that.")
1802
+ return
1803
+ end
1804
+
1805
+ propLabel = FormMain.generate_unique_property_label(@propGridManager, 'Category')
1806
+
1807
+ @propGridManager.insert(@propGridManager.get_property_parent(id),
1808
+ id.get_index_in_parent,
1809
+ Wx::PG::PropertyCategory.new(propLabel))
1810
+ end
1811
+
1812
+ def on_del_prop_click(event)
1813
+ id = @propGridManager.grid.get_selection
1814
+ unless id
1815
+ Wx.message_box("First select a property.")
1816
+ return
1817
+ end
1818
+
1819
+ @propGridManager.delete_property(id)
1820
+ end
1821
+
1822
+ def on_del_prop_r_click(event)
1823
+ # Delete random property
1824
+ p = @propGridManager.grid.root
1825
+
1826
+ while true
1827
+ break if p.get_child_count == 0
1828
+
1829
+ n = rand(p.get_child_count)
1830
+ p = p.item(n)
1831
+
1832
+ if !p.category?
1833
+ label = p.get_label
1834
+ @propGridManager.delete_property(p)
1835
+ Wx.log_message("Property deleted: %s", label)
1836
+ break
1837
+ end
1838
+ end
1839
+ end
1840
+
1841
+ def on_context_menu(event)
1842
+ Wx.log_debug("FormMain::OnContextMenu(%i,%i)",
1843
+ event.get_position.x,event.get_position.y)
1844
+ end
1845
+
1846
+ def on_enable_disable(event)
1847
+ id = @propGridManager.grid.get_selection
1848
+ unless id
1849
+ Wx.message_box("First select a property.")
1850
+ return
1851
+ end
1852
+
1853
+ if @propGridManager.is_property_enabled(id)
1854
+ @propGridManager.disable_property(id)
1855
+ @itemEnable.set_item_label("Enable")
1856
+ else
1857
+ @propGridManager.enable_property(id)
1858
+ @itemEnable.set_item_label("Disable")
1859
+ end
1860
+ end
1861
+
1862
+ def on_set_read_only(event)
1863
+ id = @propGridManager.grid.get_selection
1864
+ unless id
1865
+ Wx.message_box("First select a property.")
1866
+ return
1867
+ end
1868
+ @propGridManager.set_property_read_only(id)
1869
+ end
1870
+
1871
+ def on_hide(event)
1872
+ id = @propGridManager.grid.get_selection
1873
+ unless id
1874
+ Wx.message_box("First select a property.")
1875
+ return
1876
+ end
1877
+ @propGridManager.hide_property(id, true)
1878
+ end
1879
+
1880
+ def on_bool_checkbox(evt)
1881
+ @propGridManager.set_property_attribute_all(Wx::PG::PG_BOOL_USE_CHECKBOX, evt.checked?)
1882
+ end
1883
+
1884
+ def on_set_background_colour(event)
1885
+ pg = @propGridManager.grid
1886
+ prop = pg.get_selection
1887
+ unless prop
1888
+ Wx.message_box("First select a property.")
1889
+ return
1890
+ end
1891
+
1892
+ col = Wx.get_colour_from_user(self, Wx::WHITE, "Choose colour")
1893
+
1894
+ if col.ok?
1895
+ flags = (event.id==ID::SETBGCOLOURRECUR) ? Wx::PG::PG_RECURSE : 0
1896
+ pg.set_property_background_colour(prop, col, flags)
1897
+ end
1898
+ end
1899
+
1900
+ def on_clear_modify_status_click(event)
1901
+ @propGridManager.clear_modified_status
1902
+ @propGridManager.refresh
1903
+ end
1904
+
1905
+ def on_freeze_click(event)
1906
+ return unless @propGridManager
1907
+
1908
+ if event.checked?
1909
+ unless @propGridManager.is_frozen
1910
+ @propGridManager.freeze
1911
+ end
1912
+ else
1913
+ if @propGridManager.frozen?
1914
+ @propGridManager.thaw
1915
+ @propGridManager.refresh
1916
+ end
1917
+ end
1918
+ end
1919
+
1920
+ def on_enable_label_editing(event)
1921
+ @labelEditingEnabled = event.checked?
1922
+ @propGrid.make_column_editable(0, @labelEditingEnabled)
1923
+ end
1924
+
1925
+ if Wx.has_feature?(:USE_HEADERCTRL)
1926
+ def on_show_header(event)
1927
+ @hasHeader = event.checked?
1928
+ @propGridManager.show_header(@hasHeader)
1929
+ if @hasHeader
1930
+ @propGridManager.set_column_title(2, "Units")
1931
+ end
1932
+ end
1933
+ end
1934
+
1935
+ def on_dump_list(event)
1936
+ values = @propGridManager.get_property_values("list", nil, Wx::PG::PG_INC_ATTRIBUTES)
1937
+ text = "This only tests that wxVariant related routines do not crash.\n"
1938
+
1939
+ Wx.Dialog(self, Wx::ID_ANY,"wxVariant Test",
1940
+ Wx::DEFAULT_POSITION,Wx::DEFAULT_SIZE,Wx::DEFAULT_DIALOG_STYLE|Wx::RESIZE_BORDER) do |dlg|
1941
+ values.get_count.times do |i|
1942
+ v = values[i]
1943
+
1944
+ strValue = v.to_s
1945
+
1946
+ if v.name.end_with?("@attr")
1947
+ text << "Attributes:\n"
1948
+
1949
+ v.count.times do |n|
1950
+ a = v[n]
1951
+
1952
+ t = " attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n" % [n , a.name, a.type, a.to_s]
1953
+ text << t
1954
+ end
1955
+ else
1956
+ t = "%i: name=\"%s\" type=\"%s\" value=\"%s\"\n" % [i, v.name, v.type, strValue]
1957
+ text << t
1958
+ end
1959
+ end
1960
+
1961
+ # multi-line text editor dialog
1962
+ spacing = 8;
1963
+ topsizer = Wx::BoxSizer.new(Wx::VERTICAL)
1964
+ rowsizer = Wx::BoxSizer.new(Wx::HORIZONTAL)
1965
+ ed = Wx::TextCtrl.new(dlg, Wx::ID_ANY, text, style: Wx::TE_MULTILINE|Wx::TE_READONLY)
1966
+ rowsizer.add(ed, Wx::SizerFlags.new(1).expand.border(Wx::ALL, spacing))
1967
+ topsizer.add(rowsizer, Wx::SizerFlags.new(1).expand)
1968
+ rowsizer = Wx::BoxSizer.new(Wx::HORIZONTAL)
1969
+ rowsizer.add(Wx::Button.new(dlg, Wx::ID_OK, "Ok"),
1970
+ Wx::SizerFlags.new.centre_horizontal.centre_vertical.border(Wx::Direction::BOTTOM|Wx::LEFT|Wx::RIGHT, spacing))
1971
+ topsizer.add(rowsizer, Wx::SizerFlags.new.right)
1972
+
1973
+ dlg.set_sizer(topsizer)
1974
+ topsizer.set_size_hints(dlg)
1975
+
1976
+ dlg.set_size([400,300])
1977
+ dlg.centre
1978
+ dlg.show_modal
1979
+ end
1980
+ end
1981
+
1982
+ def on_cat_colours_update_ui(event)
1983
+ # Prevent menu item from being checked
1984
+ # if it is selected from improper page.
1985
+ pg = @propGridManager.grid
1986
+ @itemCatColours.enable(
1987
+ !!(pg.get_property_by_name("Appearance") &&
1988
+ pg.get_property_by_name("PositionCategory") &&
1989
+ pg.get_property_by_name("Environment") &&
1990
+ pg.get_property_by_name("More Examples"))
1991
+ )
1992
+ end
1993
+
1994
+ def on_cat_colours(event)
1995
+ pg = @propGridManager.grid
1996
+ unless !!(pg.get_property_by_name("Appearance") &&
1997
+ pg.get_property_by_name("PositionCategory") &&
1998
+ pg.get_property_by_name("Environment") &&
1999
+ pg.get_property_by_name("More Examples"))
2000
+ Wx.message_box("First switch to 'Standard Items' page!")
2001
+ return
2002
+ end
2003
+
2004
+ @propGridManager.freeze
2005
+
2006
+ if event.checked?
2007
+ # Set custom colours.
2008
+ pg.set_property_text_colour("Appearance", Wx::Colour.new(255,0,0), Wx::PG::PG_DONT_RECURSE)
2009
+ pg.set_property_background_colour("Appearance", Wx::Colour.new(255,255,183))
2010
+ pg.set_property_text_colour("Appearance", Wx::Colour.new(255,0,183))
2011
+ pg.set_property_text_colour("PositionCategory", Wx::Colour.new(0,255,0), Wx::PG::PG_DONT_RECURSE)
2012
+ pg.set_property_background_colour("PositionCategory", Wx::Colour.new(255,226,190))
2013
+ pg.set_property_text_colour("PositionCategory", Wx::Colour.new(255,0,190))
2014
+ pg.set_property_text_colour("Environment", Wx::Colour.new(0,0,255), Wx::PG::PG_DONT_RECURSE)
2015
+ pg.set_property_background_colour("Environment", Wx::Colour.new(208,240,175))
2016
+ pg.set_property_text_colour("Environment", Wx::Colour.new(255,255,255))
2017
+ pg.set_property_background_colour("More Examples", Wx::Colour.new(172,237,255))
2018
+ pg.set_property_text_colour("More Examples", Wx::Colour.new(172,0,255))
2019
+ else
2020
+ # Revert to original.
2021
+ pg.set_property_colours_to_default("Appearance")
2022
+ pg.set_property_colours_to_default("Appearance", Wx::PG::PG_RECURSE)
2023
+ pg.set_property_colours_to_default("PositionCategory")
2024
+ pg.set_property_colours_to_default("PositionCategory", Wx::PG::PG_RECURSE)
2025
+ pg.set_property_colours_to_default("Environment")
2026
+ pg.set_property_colours_to_default("Environment", Wx::PG::PG_RECURSE)
2027
+ pg.set_property_colours_to_default("More Examples", Wx::PG::PG_RECURSE)
2028
+ end
2029
+ @propGridManager.thaw
2030
+ @propGridManager.refresh
2031
+ end
2032
+
2033
+ def on_set_columns(event)
2034
+ colCount = Wx::get_number_from_user("Enter number of columns (2-20).","Columns:",
2035
+ "Change Columns", @propGridManager.get_column_count,
2036
+ 2,20)
2037
+
2038
+ if colCount != @propGridManager.column_count
2039
+ @propGridManager.set_column_count(colCount)
2040
+ end
2041
+ end
2042
+
2043
+ def on_set_virtual_width(evt)
2044
+ oldWidth = @propGridManager.current_page.get_virtual_width
2045
+ newWidth = oldWidth
2046
+ Wx.NumberEntryDialog(self, "Enter virtual width (-1-2000).", "Width:",
2047
+ "Change Virtual Width", oldWidth, -1, 2000) do |dlg|
2048
+ newWidth = dlg.value if dlg.show_modal == Wx::ID_OK
2049
+ end
2050
+ if newWidth != oldWidth
2051
+ @propGridManager.grid.set_virtual_width(newWidth)
2052
+ end
2053
+ end
2054
+
2055
+ def on_set_grid_disabled(evt)
2056
+ @propGridManager.enable(!evt.is_checked)
2057
+ end
2058
+
2059
+ def on_misc(event)
2060
+ case event.id
2061
+ when ID::STATICLAYOUT
2062
+ wsf = @propGridManager.get_window_style_flag
2063
+ if event.is_checked
2064
+ @propGridManager.set_window_style_flag(wsf|Wx::PG::PG_STATIC_LAYOUT)
2065
+ else
2066
+ @propGridManager.set_window_style_flag(wsf&~(Wx::PG::PG_STATIC_LAYOUT))
2067
+ end
2068
+ when ID::COLLAPSEALL
2069
+ pg = @propGridManager.grid
2070
+ pg.each_property(Wx::PG::PG_ITERATE_ALL) { |p| p.set_expanded(false) }
2071
+ pg.refresh_grid
2072
+ when ID::GETVALUES
2073
+ @storedValues = @propGridManager.grid.get_property_values("Test",
2074
+ @propGridManager.grid.root,
2075
+ Wx::PG::PG_KEEP_STRUCTURE|Wx::PG::PG_INC_ATTRIBUTES)
2076
+ when ID::SETVALUES
2077
+ if @storedValues && @storedValues.is_type("list")
2078
+ @propGridManager.grid.set_property_values(@storedValues)
2079
+ else
2080
+ Wx.message_box("First use Get Property Values.")
2081
+ end
2082
+ when ID::SETVALUES2
2083
+ list = Wx::Variant.new([ Wx::Variant.new(1234, "VariantLong"),
2084
+ Wx::Variant.new(true,"VariantBool") ])
2085
+ list.append(Wx::Variant.new("Test Text", "VariantString"))
2086
+ @propGridManager.grid.set_property_values(list)
2087
+ when ID::COLLAPSE
2088
+ # Collapses selected.
2089
+ selProp = @propGridManager.selection
2090
+ @propGridManager.collapse(selProp) if selProp
2091
+ when ID::RUNTESTFULL
2092
+ # Runs a regression test.
2093
+ run_tests(true)
2094
+ when ID::RUNTESTPARTIAL
2095
+ # Runs a regression test.
2096
+ run_tests(false)
2097
+ when ID::UNSPECIFY
2098
+ prop = @propGridManager.selection
2099
+ if prop
2100
+ @propGridManager.set_property_value_unspecified(prop)
2101
+ prop.refresh_editor
2102
+ end
2103
+ end
2104
+ end
2105
+
2106
+ def on_populate_click(event)
2107
+ id = event.id
2108
+ @propGrid.clear
2109
+ @propGrid.freeze
2110
+ if id == ID::POPULATE1
2111
+ populate_with_standard_items
2112
+ elsif id == ID::POPULATE2
2113
+ populate_with_library_config
2114
+ end
2115
+ @propGrid.thaw
2116
+ end
2117
+
2118
+ def on_set_spin_ctrl_editor_click(event)
2119
+ if Wx.has_feature? :USE_SPINBTN
2120
+ pgId = @propGridManager.get_selection
2121
+ if pgId
2122
+ @propGridManager.set_property_editor(pgId, Wx::PG::PG_EDITOR_SPIN_CTRL)
2123
+ else
2124
+ Wx.message_box("First select a property")
2125
+ end
2126
+ end
2127
+ end
2128
+
2129
+ def on_test_replace_click(event)
2130
+ pgId = @propGridManager.selection
2131
+ if pgId
2132
+ choices = Wx::PG::PGChoices.new
2133
+ choices.add("Flag 0", 0x0001)
2134
+ choices.add("Flag 1", 0x0002)
2135
+ choices.add("Flag 2", 0x0004)
2136
+ choices.add("Flag 3", 0x0008)
2137
+ maxVal = 0x000F
2138
+ # Look for unused property name
2139
+ propName = "ReplaceFlagsProperty"
2140
+ idx = 0;
2141
+ while @propGridManager.get_property_by_name(propName)
2142
+ propName = "ReplaceFlagsProperty %i" % (idx += 1)
2143
+ end
2144
+ # Replace property and select new one
2145
+ # with random value in range [1..maxVal]
2146
+ propVal = Time.now.to_i % maxVal + 1
2147
+ newId = @propGridManager.replace_property(pgId, Wx::FlagsProperty.new(propName, Wx::PG::PG_LABEL,
2148
+ choices, propVal))
2149
+ @propGridManager.set_property_attribute(newId, Wx::PG::PG_BOOL_USE_CHECKBOX,
2150
+ true, Wx::PG::PG_RECURSE)
2151
+ @propGridManager.select_property(newId)
2152
+ else
2153
+ Wx.message_box("First select a property")
2154
+ end
2155
+ end
2156
+
2157
+ def on_test_xrc(event)
2158
+ Wx.message_box("Sorry, not yet implemented")
2159
+ end
2160
+
2161
+ def on_enable_common_values(event)
2162
+ prop = @propGridManager.selection
2163
+ if prop
2164
+ prop.enable_common_value
2165
+ else
2166
+ Wx.message_box("First select a property")
2167
+ end
2168
+ end
2169
+
2170
+ def on_select_style(event)
2171
+ extraStyle = style = 0
2172
+ names, values = %w[
2173
+ PG_HIDE_CATEGORIES
2174
+ PG_AUTO_SORT
2175
+ PG_BOLD_MODIFIED
2176
+ PG_SPLITTER_AUTO_CENTER
2177
+ PG_TOOLTIPS
2178
+ PG_STATIC_SPLITTER
2179
+ PG_HIDE_MARGIN
2180
+ PG_LIMITED_EDITING
2181
+ PG_TOOLBAR
2182
+ PG_DESCRIPTION
2183
+ PG_NO_INTERNAL_BORDER
2184
+ ].inject([[],[]]) { |set, name| set[0] << "Wx::PG::#{name}"; set[1] << Wx::PG.const_get(name); set }
2185
+ flags = @propGridManager.get_window_style
2186
+ Wx.MultiChoiceDialog(self, "Select window styles to use",
2187
+ "wxPropertyGrid Window Style", names) do |dlg|
2188
+ sel = []
2189
+ values.each_with_index { |val, ix| sel << ix if (flags & val) == val }
2190
+ dlg.set_selections(sel)
2191
+ return if dlg.show_modal == Wx::ID_CANCEL
2192
+
2193
+ flags = 0
2194
+ sel = dlg.selections
2195
+ sel.each { |ix| flags |= values[ix] }
2196
+ style = flags
2197
+ end
2198
+
2199
+ names, values = %w[
2200
+ PG_EX_INIT_NOCAT
2201
+ PG_EX_NO_FLAT_TOOLBAR
2202
+ PG_EX_MODE_BUTTONS
2203
+ PG_EX_HELP_AS_TOOLTIPS
2204
+ PG_EX_NATIVE_DOUBLE_BUFFERING
2205
+ PG_EX_AUTO_UNSPECIFIED_VALUES
2206
+ PG_EX_WRITEONLY_BUILTIN_ATTRIBUTES
2207
+ PG_EX_HIDE_PAGE_BUTTONS
2208
+ PG_EX_MULTIPLE_SELECTION
2209
+ PG_EX_ENABLE_TLP_TRACKING
2210
+ PG_EX_NO_TOOLBAR_DIVIDER
2211
+ PG_EX_TOOLBAR_SEPARATOR
2212
+ PG_EX_ALWAYS_ALLOW_FOCUS
2213
+ ].inject([[],[]]) { |set, name| set[0] << "Wx::PG::#{name}"; set[1] << Wx::PG.const_get(name); set }
2214
+ flags = @propGridManager.get_extra_style
2215
+ Wx.MultiChoiceDialog(self, "Select extra window styles to use",
2216
+ "wxPropertyGrid Extra Style", names) do |dlg|
2217
+ sel = []
2218
+ values.each_with_index { |val, ix| sel << ix if (flags & val) == val }
2219
+ dlg.set_selections(sel)
2220
+ return if dlg.show_modal == Wx::ID_CANCEL
2221
+
2222
+ flags = 0
2223
+ sel = dlg.selections
2224
+ sel.each { |ix| flags |= values[ix] }
2225
+ extraStyle = flags
2226
+ end
2227
+
2228
+ replace_grid(style, extraStyle)
2229
+ end
2230
+
2231
+ def on_fit_columns_click(event)
2232
+ page = @propGridManager.get_current_page
2233
+
2234
+ # Remove auto-centering
2235
+ @propGridManager.set_window_style(@propGridManager.get_window_style & ~Wx::PG::PG_SPLITTER_AUTO_CENTER)
2236
+
2237
+ # Grow manager size just prior fit - otherwise
2238
+ # column information may be lost.
2239
+ oldGridSize = @propGridManager.grid.get_client_size
2240
+ oldFullSize = self.size
2241
+ self.size = ([1000, oldFullSize.height])
2242
+
2243
+ newSz = page.fit_columns
2244
+
2245
+ dx = oldFullSize.width - oldGridSize.width;
2246
+ dy = oldFullSize.height - oldGridSize.height;
2247
+
2248
+ newSz.inc_by(dx, dy)
2249
+
2250
+ self.size = newSz
2251
+ end
2252
+
2253
+ def on_change_flags_prop_items_click(event)
2254
+ p = @propGridManager.get_property_by_name("Window Styles")
2255
+
2256
+ newChoices = Wx::PG::PGChoices.new
2257
+ newChoices.add("Fast",0x1)
2258
+ newChoices.add("Powerful",0x2)
2259
+ newChoices.add("Safe",0x4)
2260
+ newChoices.add("Sleek",0x8)
2261
+
2262
+ p.set_choices(newChoices)
2263
+ end
2264
+
2265
+ # def on_save_to_file_click(event) end
2266
+
2267
+ # def on_load_from_file_click(event) end
2268
+
2269
+ def on_set_property_value(event)
2270
+ pg = @propGridManager.grid
2271
+ selected = pg.selection
2272
+
2273
+ if selected
2274
+ value = Wx.get_text_from_user("Enter new value:")
2275
+ pg.set_property_value(selected, value)
2276
+ end
2277
+ end
2278
+
2279
+ def on_insert_choice(event)
2280
+ pg = @propGridManager.grid
2281
+ selected = pg.selection
2282
+
2283
+ if selected
2284
+ choices = selected.choices
2285
+
2286
+ if choices.ok?
2287
+ # Insert new choice to the center of list
2288
+ pos = choices.count / 2
2289
+ selected.insert_choice("New Choice", pos)
2290
+ return
2291
+ end
2292
+ end
2293
+
2294
+ Wx.message_box("First select a property with some choices.")
2295
+ end
2296
+
2297
+ def on_delete_choice(event)
2298
+ pg = @propGridManager.grid
2299
+ selected = pg.selection
2300
+
2301
+ if selected
2302
+ choices = selected.choices
2303
+
2304
+ if choices.ok?
2305
+ # Deletes choice from the center of list
2306
+ pos = choices.count / 2
2307
+ selected.delete_choice(pos)
2308
+ return
2309
+ end
2310
+ end
2311
+
2312
+ Wx.message_box("First select a property with some choices.")
2313
+ end
2314
+
2315
+ def on_insert_page(event)
2316
+ @propGridManager.add_page("New Page")
2317
+ end
2318
+
2319
+ def on_remove_page(event)
2320
+ @propGridManager.remove_page(@propGridManager.get_selected_page)
2321
+ end
2322
+
2323
+ def on_save_state(event)
2324
+ @savedState = @propGridManager.save_editable_state
2325
+ Wx.log_debug("Saved editable state string: \"%s\"", @savedState)
2326
+ end
2327
+
2328
+ def on_restore_state(event)
2329
+ @propGridManager.restore_editable_state(@savedState) if @savedState
2330
+ end
2331
+
2332
+ def on_run_minimal_click(event)
2333
+ display_minimal_frame(self)
2334
+ end
2335
+
2336
+ def iterate_message(prop)
2337
+ s = "\"%s\" class = %s, valuetype = %s" % [prop.label, prop.class.name, prop.value_type]
2338
+
2339
+ Wx.message_box(s, "Iterating... (press CANCEL to end)", Wx::OK|Wx::CANCEL)
2340
+ end
2341
+ private :iterate_message
2342
+
2343
+ def on_iterate1_click(event)
2344
+ @propGridManager.get_current_page.each_property do |p|
2345
+ break if iterate_message(p) == Wx::CANCEL
2346
+ end
2347
+ end
2348
+
2349
+ def on_iterate2_click(event)
2350
+ @propGridManager.get_current_page.each_property(Wx::PG::PG_ITERATE_VISIBLE) do |p|
2351
+ break if iterate_message(p) == Wx::CANCEL
2352
+ end
2353
+ end
2354
+
2355
+ def on_iterate3_click(event)
2356
+ @propGridManager.get_current_page.properties_reversed(Wx::PG::PG_ITERATE_DEFAULT).each do |p|
2357
+ break if iterate_message(p) == Wx::CANCEL
2358
+ end
2359
+ end
2360
+
2361
+ def on_iterate4_click(event)
2362
+ @propGridManager.get_current_page.each_property(Wx::PG::PG_ITERATE_CATEGORIES) do |p|
2363
+ break if iterate_message(p) == Wx::CANCEL
2364
+ end
2365
+ end
2366
+
2367
+ def on_extended_key_nav(event)
2368
+ # Use AddActionTrigger() and DedicateKey() to set up Enter,
2369
+ # Up, and Down keys for navigating between properties.
2370
+ propGrid = @propGridManager.grid
2371
+
2372
+ propGrid.add_action_trigger(Wx::PG::PG_ACTION_NEXT_PROPERTY,
2373
+ Wx::K_RETURN)
2374
+ propGrid.dedicate_key(Wx::K_RETURN)
2375
+
2376
+ # Up and Down keys are already associated with navigation,
2377
+ # but we must also prevent them from being eaten by
2378
+ # editor controls.
2379
+ propGrid.dedicate_key(Wx::K_UP)
2380
+ propGrid.dedicate_key(Wx::K_DOWN)
2381
+ end
2382
+
2383
+ def on_property_grid_change(event)
2384
+ property = event.property
2385
+
2386
+ name = property.name
2387
+
2388
+ # Properties store values internally as wxVariants, but it is preferred
2389
+ # to use the more modern wxAny at the interface level in C++
2390
+ # wxRuby however does not support wxAny and does not need to as Variants map
2391
+ # pretty seamless to Ruby
2392
+ value = property.value
2393
+
2394
+ # Don't handle 'unspecified' values
2395
+ return if value.null?
2396
+
2397
+ # Some settings are disabled outside Windows platform
2398
+ if name == "X"
2399
+ set_size(value.to_i, -1, -1, -1, Wx::SIZE_USE_EXISTING)
2400
+ elsif name == "Y"
2401
+ set_size(-1, value.to_i, -1, -1, Wx::SIZE_USE_EXISTING)
2402
+ elsif ( name == "Width" )
2403
+ set_size(-1, -1, value.to_i, -1, Wx::SIZE_USE_EXISTING)
2404
+ elsif name == "Height"
2405
+ set_size( -1, -1, -1, value.to_i, Wx::SIZE_USE_EXISTING)
2406
+ elsif name == "Label"
2407
+ set_title(value.to_s)
2408
+ elsif name == "Font"
2409
+ font = value.font
2410
+ unless font.ok?
2411
+ Wx.message_box('Invalid font!')
2412
+ return
2413
+ end
2414
+ @propGridManager.set_font(font)
2415
+ elsif name == "Margin Colour"
2416
+ cpv = value.colour_property_value
2417
+ @propGridManager.grid.set_margin_colour(cpv.colour_)
2418
+ elsif name == "Cell Colour"
2419
+ cpv = value.colour_property_value
2420
+ @propGridManager.grid.set_cell_background_colour(cpv.colour_)
2421
+ elsif name == "Line Colour"
2422
+ cpv = value.colour_property_value
2423
+ @propGridManager.grid.set_line_colour(cpv.colour_)
2424
+ elsif name == "Cell Text Colour"
2425
+ cpv = value.colour_property_value
2426
+ @propGridManager.grid.set_cell_text_colour(cpv.colour_)
2427
+ end
2428
+ end
2429
+
2430
+ def on_property_grid_changing(event)
2431
+ p = event.property
2432
+
2433
+ if p.name == "Font"
2434
+ res = Wx.message_box("'%s' is about to change (to variant of type '%s')\n\nAllow or deny?" %
2435
+ [p.name, event.value.type],
2436
+ "Testing wxEVT_PG_CHANGING", Wx::YES_NO, @propGridManager)
2437
+ if res == Wx::NO
2438
+ Kernel.raise 'Must be able to Veto event' unless event.can_veto?
2439
+
2440
+ event.veto
2441
+
2442
+ # Since we ask a question, it is better if we omit any validation
2443
+ # failure behaviour.
2444
+ event.set_validation_failure_behavior(0)
2445
+ end
2446
+ end
2447
+ end
2448
+
2449
+ def on_property_grid_select(event)
2450
+ property = event.property
2451
+ if property
2452
+ @itemEnable.enable(true)
2453
+ if property.enabled?
2454
+ @itemEnable.set_item_label("Disable")
2455
+ else
2456
+ @itemEnable.set_item_label("Enable")
2457
+ end
2458
+ else
2459
+ @itemEnable.enable(false)
2460
+ end
2461
+
2462
+ if Wx.has_feature? :USE_STATUSBAR
2463
+ prop = event.property
2464
+ sb = self.status_bar
2465
+ if prop
2466
+ text = "Selected: "
2467
+ text << @propGridManager.get_property_label(prop)
2468
+ sb.set_status_text(text)
2469
+ end
2470
+ end
2471
+ end
2472
+
2473
+ def on_property_grid_highlight(event)
2474
+ end
2475
+
2476
+ def on_property_grid_item_right_click(event)
2477
+ if Wx.has_feature? :USE_STATUSBAR
2478
+ prop = event.property
2479
+ sb = self.status_bar
2480
+ if prop
2481
+ text = "Right-clicked: "
2482
+ text << prop.label
2483
+ text << ", name=";
2484
+ text << @propGridManager.get_property_name(prop)
2485
+ sb.set_status_text(text)
2486
+ else
2487
+ sb.set_status_text('')
2488
+ end
2489
+ end
2490
+ end
2491
+
2492
+ def on_property_grid_item_double_click(event)
2493
+ if Wx.has_feature? :USE_STATUSBAR
2494
+ prop = event.property
2495
+ sb = self.status_bar
2496
+ if prop
2497
+ text = "Double-clicked: "
2498
+ text << prop.label
2499
+ text << ", name="
2500
+ text << @propGridManager.get_property_name(prop)
2501
+ sb.set_status_text(text)
2502
+ else
2503
+ sb.set_status_text('')
2504
+ end
2505
+ end
2506
+ end
2507
+
2508
+ def on_property_grid_page_change(event)
2509
+ if Wx.has_feature? :USE_STATUSBAR
2510
+ sb = self.status_bar
2511
+ text = "Page Changed: "
2512
+ text << @propGridManager.get_page_name(@propGridManager.get_selected_page)
2513
+ sb.set_status_text(text)
2514
+ end
2515
+ end
2516
+
2517
+ def on_property_grid_button_click(event)
2518
+ if Wx.has_feature? :USE_STATUSBAR
2519
+ prop = @propGridManager.selection
2520
+ sb = self.status_bar
2521
+ if prop
2522
+ text = "Button clicked: "
2523
+ text << @propGridManager.get_property_label(prop)
2524
+ text << ", name="
2525
+ text << @propGridManager.get_property_name(prop)
2526
+ sb.set_status_text(text)
2527
+ else
2528
+ Wx.message_box("SHOULD NOT HAPPEN!!!")
2529
+ end
2530
+ end
2531
+ end
2532
+
2533
+ def on_property_grid_text_update(event)
2534
+ event.skip
2535
+ end
2536
+
2537
+ def on_property_grid_key_event(event)
2538
+ end
2539
+
2540
+ def on_property_grid_item_collapse(event)
2541
+ Wx.log_message("Item was Collapsed")
2542
+ end
2543
+
2544
+ def on_property_grid_item_expand(event)
2545
+ Wx.log_message("Item was Expanded")
2546
+ end
2547
+
2548
+ def on_property_grid_label_edit_begin(event)
2549
+ Wx.log_message("PG_EVT_LABEL_EDIT_BEGIN(%s)", event.property.label)
2550
+ end
2551
+
2552
+ def on_property_grid_label_edit_ending(event)
2553
+ Wx.log_message("PG_EVT_LABEL_EDIT_ENDING(%s)", event.property.label)
2554
+ end
2555
+
2556
+ def on_property_grid_col_begin_drag(event)
2557
+ if @itemVetoDragging.is_checked
2558
+ Wx.log_message("Splitter %i resize was vetoed", event.column)
2559
+ event.veto
2560
+ else
2561
+ Wx.log_debug("Splitter %i resize began", event.column)
2562
+ end
2563
+ end
2564
+
2565
+ def on_property_grid_col_dragging(event)
2566
+ end
2567
+
2568
+ def on_property_grid_col_end_drag(event)
2569
+ Wx.log_debug("Splitter %i resize ended", event.column)
2570
+ end
2571
+
2572
+ def on_about(event)
2573
+ toolkit = "%s %i.%i.%i" % [Wx::PlatformInfo.get_port_id_name,
2574
+ Wx::PlatformInfo.get_toolkit_major_version,
2575
+ Wx::PlatformInfo.get_toolkit_minor_version,
2576
+ Wx::PlatformInfo.get_toolkit_micro_version]
2577
+ msg = ("wxRuby PropertyGrid Sample" +
2578
+ if Wx::WXWIDGETS_VERSION >= '3.3.0' || Wx.has_feature?(:USE_UNICODE)
2579
+ if Wx.has_feature?(:USE_UNICODE_UTF8) && Wx.has_feature?(:USE_UNICODE_UTF8)
2580
+ " <utf-8>"
2581
+ else
2582
+ " <unicode>"
2583
+ end
2584
+ else
2585
+ " <ansi>"
2586
+ end +
2587
+ if Wx::DEBUG
2588
+ " <debug>"
2589
+ else
2590
+ " <release>"
2591
+ end +
2592
+ "\n\n" +
2593
+ "Programmed by %s\n\n" +
2594
+ "Using wxRuby %s (wxWidgets %s; %s)\n\n") %
2595
+ ["Martin Corino (C++ original by Jaakko Salli)", Wx::WXRUBY_VERSION, Wx::WXWIDGETS_VERSION, toolkit]
2596
+
2597
+ Wx.message_box(msg, "About", Wx::OK | Wx::ICON_INFORMATION, self)
2598
+ end
2599
+
2600
+ def on_move(event)
2601
+ unless @propGridManager
2602
+ # this check is here so the frame layout can be tested
2603
+ # without creating propertygrid
2604
+ event.skip
2605
+ return
2606
+ end
2607
+
2608
+ # Update position properties
2609
+ pos = get_position
2610
+
2611
+ # Must check if properties exist (as they may be deleted).
2612
+
2613
+ # Using m_pPropGridManager, we can scan all pages automatically.
2614
+ id = @propGridManager.get_property_by_name("X")
2615
+ @propGridManager.set_property_value(id, pos.x) if id
2616
+
2617
+ id = @propGridManager.get_property_by_name("Y")
2618
+ @propGridManager.set_property_value( id, pos.y) if id
2619
+
2620
+ id = @propGridManager.get_property_by_name("Position")
2621
+ @propGridManager.set_property_value(id, pos) if id
2622
+
2623
+ # Should always call event.skip in frame's MoveEvent handler
2624
+ event.skip
2625
+ end
2626
+
2627
+ def on_resize(event)
2628
+ unless @propGridManager
2629
+ # this check is here so the frame layout can be tested
2630
+ # without creating propertygrid
2631
+ event.skip
2632
+ return
2633
+ end
2634
+
2635
+ # Update size properties
2636
+ sz = get_size
2637
+
2638
+ # Must check if properties exist (as they may be deleted).
2639
+
2640
+ # Using m_pPropGridManager, we can scan all pages automatically.
2641
+ p = @propGridManager.get_property_by_name("Width")
2642
+ @propGridManager.set_property_value(p, sz.width) if p && !p.is_value_unspecified
2643
+
2644
+ p = @propGridManager.get_property_by_name("Height")
2645
+ @propGridManager.set_property_value(p, sz.height) if p && !p.is_value_unspecified
2646
+
2647
+ id = @propGridManager.get_property_by_name("Size")
2648
+ @propGridManager.set_property_value(id, sz) if id
2649
+
2650
+ # Should always call event.skip in frame's SizeEvent handler
2651
+ event.skip
2652
+ end
2653
+
2654
+ def on_idle(event)
2655
+ event.skip
2656
+ end
2657
+
2658
+ def on_show_popup(event)
2659
+ if @popup
2660
+ @popup.destroy
2661
+ @popup = nil
2662
+ return
2663
+ end
2664
+
2665
+ @popup = PropertyGridPopup.new(self)
2666
+ pt = Wx.get_mouse_position
2667
+ @popup.position(pt, [0, 0])
2668
+ @popup.show
2669
+ end
2670
+
2671
+ def add_test_properties(pg)
2672
+ pg.append(MyColourProperty.new("CustomColourProperty", Wx::PG::PG_LABEL, Wx::GREEN))
2673
+ pg.get_property("CustomColourProperty").set_auto_unspecified(true)
2674
+ pg.set_property_editor("CustomColourProperty", Wx::PG::PG_EDITOR_COMBO_BOX)
2675
+
2676
+ pg.set_property_help_string("CustomColourProperty",
2677
+ "This is a MyColourProperty from the sample app. "+
2678
+ "It is built by subclassing wxColourProperty.")
2679
+ end
2680
+
2681
+ def run_tests(fullTest, interactive = false) end
2682
+
2683
+ end
2684
+
2685
+ module PropgridSample
2686
+
2687
+ include WxRuby::Sample if defined? WxRuby::Sample
2688
+
2689
+ def self.describe
2690
+ { file: __FILE__,
2691
+ summary: 'wxRuby PropGrid example.',
2692
+ description: 'wxRuby PropGrid example displaying frame showcasing PropgridManager.' }
2693
+ end
2694
+
2695
+ def self.activate
2696
+ frameSize = Wx::Size.new((Wx::SystemSettings.get_metric(Wx::SYS_SCREEN_X) / 10) * 4,
2697
+ (Wx::SystemSettings.get_metric(Wx::SYS_SCREEN_Y) / 10) * 8)
2698
+ frameSize.width = 500 if frameSize.width > 500
2699
+ frame = FormMain.new("wxPropertyGrid Sample", [0,0], frameSize)
2700
+ frame.show(true)
2701
+ frame
2702
+ end
2703
+
2704
+ if $0 == __FILE__
2705
+ Wx::App.run do
2706
+ gc_stress
2707
+ PropgridSample.activate
2708
+ end
2709
+ end
2710
+
2711
+ end