wxruby3 0.9.0.pre.beta.1-x64-mingw-ucrt-3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (822) 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 +138 -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/lib/wx/accessors.rb +63 -0
  11. data/lib/wx/aui/auimanager.rb +17 -0
  12. data/lib/wx/aui/auinotebook.rb +9 -0
  13. data/lib/wx/aui/events/evt_list.rb +143 -0
  14. data/lib/wx/aui/require.rb +9 -0
  15. data/lib/wx/aui.rb +14 -0
  16. data/lib/wx/core/acceleratortable.rb +28 -0
  17. data/lib/wx/core/animation.rb +18 -0
  18. data/lib/wx/core/app.rb +89 -0
  19. data/lib/wx/core/artprovider.rb +31 -0
  20. data/lib/wx/core/bitmap.rb +59 -0
  21. data/lib/wx/core/busycursor.rb +12 -0
  22. data/lib/wx/core/choice.rb +4 -0
  23. data/lib/wx/core/choicedlg.rb +54 -0
  24. data/lib/wx/core/clientdc.rb +13 -0
  25. data/lib/wx/core/clipboard.rb +56 -0
  26. data/lib/wx/core/collapsible_pane.rb +12 -0
  27. data/lib/wx/core/colour.rb +34 -0
  28. data/lib/wx/core/combobox.rb +4 -0
  29. data/lib/wx/core/controlwithitems.rb +10 -0
  30. data/lib/wx/core/data_object.rb +10 -0
  31. data/lib/wx/core/dataformat.rb +26 -0
  32. data/lib/wx/core/dc.rb +68 -0
  33. data/lib/wx/core/dialog.rb +50 -0
  34. data/lib/wx/core/event.rb +16 -0
  35. data/lib/wx/core/events/evt_list.rb +1378 -0
  36. data/lib/wx/core/evthandler.rb +240 -0
  37. data/lib/wx/core/ext.rb +58 -0
  38. data/lib/wx/core/font/encoding.rb +113 -0
  39. data/lib/wx/core/font.rb +22 -0
  40. data/lib/wx/core/functions.rb +44 -0
  41. data/lib/wx/core/gauge.rb +12 -0
  42. data/lib/wx/core/genericdirctrl.rb +36 -0
  43. data/lib/wx/core/hboxsizer.rb +6 -0
  44. data/lib/wx/core/helpcontroller.rb +5 -0
  45. data/lib/wx/core/helpcontrollerhelpprovider.rb +24 -0
  46. data/lib/wx/core/helpprovider.rb +15 -0
  47. data/lib/wx/core/icon.rb +40 -0
  48. data/lib/wx/core/image.rb +68 -0
  49. data/lib/wx/core/imagelist.rb +3 -0
  50. data/lib/wx/core/listbox.rb +4 -0
  51. data/lib/wx/core/listctrl.rb +33 -0
  52. data/lib/wx/core/locale.rb +73 -0
  53. data/lib/wx/core/log.rb +20 -0
  54. data/lib/wx/core/menu.rb +78 -0
  55. data/lib/wx/core/menu_bar.rb +20 -0
  56. data/lib/wx/core/menuitem.rb +7 -0
  57. data/lib/wx/core/notebook.rb +9 -0
  58. data/lib/wx/core/object.rb +14 -0
  59. data/lib/wx/core/pen_info.rb +11 -0
  60. data/lib/wx/core/platform_info.rb +13 -0
  61. data/lib/wx/core/point.rb +92 -0
  62. data/lib/wx/core/real_point.rb +92 -0
  63. data/lib/wx/core/rect.rb +57 -0
  64. data/lib/wx/core/simplehelpprovider.rb +38 -0
  65. data/lib/wx/core/size.rb +86 -0
  66. data/lib/wx/core/sizer.rb +43 -0
  67. data/lib/wx/core/splash_screen.rb +44 -0
  68. data/lib/wx/core/textctrl.rb +8 -0
  69. data/lib/wx/core/timer.rb +105 -0
  70. data/lib/wx/core/toolbar.rb +37 -0
  71. data/lib/wx/core/toolbartool.rb +4 -0
  72. data/lib/wx/core/treectrl.rb +46 -0
  73. data/lib/wx/core/validator.rb +8 -0
  74. data/lib/wx/core/variant.rb +62 -0
  75. data/lib/wx/core/vboxsizer.rb +6 -0
  76. data/lib/wx/core/window.rb +95 -0
  77. data/lib/wx/core/window_update_locker.rb +12 -0
  78. data/lib/wx/core/xmlresource.rb +56 -0
  79. data/lib/wx/core.rb +61 -0
  80. data/lib/wx/doc/aui/auimanager.rb +12 -0
  81. data/lib/wx/doc/aui/auinotebook.rb +9 -0
  82. data/lib/wx/doc/colour_dialog.rb +15 -0
  83. data/lib/wx/doc/dc.rb +49 -0
  84. data/lib/wx/doc/enum.rb +66 -0
  85. data/lib/wx/doc/evthandler.rb +84 -0
  86. data/lib/wx/doc/extra/00_starting.md +154 -0
  87. data/lib/wx/doc/extra/01_packages.md +179 -0
  88. data/lib/wx/doc/extra/02_lifecycles.md +116 -0
  89. data/lib/wx/doc/extra/03_dialogs.md +57 -0
  90. data/lib/wx/doc/extra/04_enums.md +143 -0
  91. data/lib/wx/doc/extra/05_event-handling.md +166 -0
  92. data/lib/wx/doc/extra/06_geometry.md +56 -0
  93. data/lib/wx/doc/extra/07_colour_and_font.md +52 -0
  94. data/lib/wx/doc/extra/08_extensions.md +144 -0
  95. data/lib/wx/doc/extra/09_exceptions.md +54 -0
  96. data/lib/wx/doc/functions.rb +221 -0
  97. data/lib/wx/doc/gdi_common.rb +181 -0
  98. data/lib/wx/doc/gen/about_dialog_info.rb +315 -0
  99. data/lib/wx/doc/gen/accelerator.rb +172 -0
  100. data/lib/wx/doc/gen/accessible.rb +817 -0
  101. data/lib/wx/doc/gen/animation.rb +253 -0
  102. data/lib/wx/doc/gen/animation_ctrl.rb +129 -0
  103. data/lib/wx/doc/gen/any_button.rb +170 -0
  104. data/lib/wx/doc/gen/app.rb +363 -0
  105. data/lib/wx/doc/gen/art_provider.rb +497 -0
  106. data/lib/wx/doc/gen/aui/aui_dock_art.rb +421 -0
  107. data/lib/wx/doc/gen/aui/aui_floating_frame.rb +39 -0
  108. data/lib/wx/doc/gen/aui/aui_manager.rb +323 -0
  109. data/lib/wx/doc/gen/aui/aui_manager_event.rb +112 -0
  110. data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +163 -0
  111. data/lib/wx/doc/gen/aui/aui_mdi_client_window.rb +46 -0
  112. data/lib/wx/doc/gen/aui/aui_mdi_parent_frame.rb +109 -0
  113. data/lib/wx/doc/gen/aui/aui_notebook.rb +329 -0
  114. data/lib/wx/doc/gen/aui/aui_notebook_event.rb +179 -0
  115. data/lib/wx/doc/gen/aui/aui_pane_info.rb +665 -0
  116. data/lib/wx/doc/gen/aui/aui_tab_art.rb +372 -0
  117. data/lib/wx/doc/gen/aui/aui_tab_ctrl.rb +147 -0
  118. data/lib/wx/doc/gen/aui/aui_tool_bar.rb +437 -0
  119. data/lib/wx/doc/gen/aui/aui_tool_bar_art.rb +272 -0
  120. data/lib/wx/doc/gen/aui/aui_tool_bar_event.rb +195 -0
  121. data/lib/wx/doc/gen/aui/aui_tool_bar_item.rb +224 -0
  122. data/lib/wx/doc/gen/aui/event_list.rb +162 -0
  123. data/lib/wx/doc/gen/auto_buffered_paint_dc.rb +47 -0
  124. data/lib/wx/doc/gen/bitmap.rb +638 -0
  125. data/lib/wx/doc/gen/bitmap_button.rb +91 -0
  126. data/lib/wx/doc/gen/book_ctrl_base.rb +240 -0
  127. data/lib/wx/doc/gen/book_ctrl_event.rb +60 -0
  128. data/lib/wx/doc/gen/box_sizer.rb +66 -0
  129. data/lib/wx/doc/gen/brush.rb +219 -0
  130. data/lib/wx/doc/gen/buffered_dc.rb +95 -0
  131. data/lib/wx/doc/gen/buffered_paint_dc.rb +55 -0
  132. data/lib/wx/doc/gen/busy_info.rb +141 -0
  133. data/lib/wx/doc/gen/button.rb +133 -0
  134. data/lib/wx/doc/gen/calculate_layout_event.rb +59 -0
  135. data/lib/wx/doc/gen/calendar_ctrl.rb +236 -0
  136. data/lib/wx/doc/gen/calendar_date_attr.rb +137 -0
  137. data/lib/wx/doc/gen/calendar_event.rb +150 -0
  138. data/lib/wx/doc/gen/caret.rb +99 -0
  139. data/lib/wx/doc/gen/check_box.rb +145 -0
  140. data/lib/wx/doc/gen/check_list_box.rb +96 -0
  141. data/lib/wx/doc/gen/choice.rb +143 -0
  142. data/lib/wx/doc/gen/choicebook.rb +100 -0
  143. data/lib/wx/doc/gen/client_dc.rb +49 -0
  144. data/lib/wx/doc/gen/clipboard.rb +128 -0
  145. data/lib/wx/doc/gen/collapsible_pane.rb +120 -0
  146. data/lib/wx/doc/gen/collapsible_pane_event.rb +45 -0
  147. data/lib/wx/doc/gen/colour.rb +289 -0
  148. data/lib/wx/doc/gen/colour_data.rb +96 -0
  149. data/lib/wx/doc/gen/colour_dialog.rb +84 -0
  150. data/lib/wx/doc/gen/colour_picker_ctrl.rb +89 -0
  151. data/lib/wx/doc/gen/colour_picker_event.rb +74 -0
  152. data/lib/wx/doc/gen/combo_box.rb +228 -0
  153. data/lib/wx/doc/gen/context_help_button.rb +34 -0
  154. data/lib/wx/doc/gen/control.rb +245 -0
  155. data/lib/wx/doc/gen/control_with_items.rb +339 -0
  156. data/lib/wx/doc/gen/core.rb +42 -0
  157. data/lib/wx/doc/gen/cursor.rb +127 -0
  158. data/lib/wx/doc/gen/data_format.rb +94 -0
  159. data/lib/wx/doc/gen/data_object.rb +439 -0
  160. data/lib/wx/doc/gen/date_event.rb +48 -0
  161. data/lib/wx/doc/gen/date_picker_ctrl.rb +127 -0
  162. data/lib/wx/doc/gen/dc.rb +1278 -0
  163. data/lib/wx/doc/gen/defs.rb +2832 -0
  164. data/lib/wx/doc/gen/dialog.rb +426 -0
  165. data/lib/wx/doc/gen/dir_dialog.rb +134 -0
  166. data/lib/wx/doc/gen/dir_filter_list_ctrl.rb +80 -0
  167. data/lib/wx/doc/gen/dir_picker_ctrl.rb +103 -0
  168. data/lib/wx/doc/gen/drag_drop.rb +292 -0
  169. data/lib/wx/doc/gen/drag_image.rb +123 -0
  170. data/lib/wx/doc/gen/editable_list_box.rb +89 -0
  171. data/lib/wx/doc/gen/event.rb +911 -0
  172. data/lib/wx/doc/gen/event_list.rb +1512 -0
  173. data/lib/wx/doc/gen/events.rb +2499 -0
  174. data/lib/wx/doc/gen/evt_handler.rb +224 -0
  175. data/lib/wx/doc/gen/ext_help_controller.rb +100 -0
  176. data/lib/wx/doc/gen/file_dialog.rb +294 -0
  177. data/lib/wx/doc/gen/file_dir_picker_event.rb +98 -0
  178. data/lib/wx/doc/gen/file_picker_ctrl.rb +107 -0
  179. data/lib/wx/doc/gen/find_dialog_event.rb +119 -0
  180. data/lib/wx/doc/gen/find_replace_data.rb +59 -0
  181. data/lib/wx/doc/gen/find_replace_dialog.rb +44 -0
  182. data/lib/wx/doc/gen/flex_grid_sizer.rb +145 -0
  183. data/lib/wx/doc/gen/font.rb +1282 -0
  184. data/lib/wx/doc/gen/font_data.rb +132 -0
  185. data/lib/wx/doc/gen/font_dialog.rb +71 -0
  186. data/lib/wx/doc/gen/font_picker_ctrl.rb +120 -0
  187. data/lib/wx/doc/gen/font_picker_event.rb +64 -0
  188. data/lib/wx/doc/gen/frame.rb +276 -0
  189. data/lib/wx/doc/gen/fs_file.rb +269 -0
  190. data/lib/wx/doc/gen/functions.rb +10 -0
  191. data/lib/wx/doc/gen/gauge.rb +127 -0
  192. data/lib/wx/doc/gen/gb_sizer_item.rb +78 -0
  193. data/lib/wx/doc/gen/gcdc.rb +61 -0
  194. data/lib/wx/doc/gen/gdi_common.rb +1108 -0
  195. data/lib/wx/doc/gen/gdi_object.rb +29 -0
  196. data/lib/wx/doc/gen/generic_dir_ctrl.rb +198 -0
  197. data/lib/wx/doc/gen/graphics_context.rb +764 -0
  198. data/lib/wx/doc/gen/graphics_object.rb +494 -0
  199. data/lib/wx/doc/gen/grid/event_list.rb +173 -0
  200. data/lib/wx/doc/gen/grid/grid_cell_activatable_editor.rb +33 -0
  201. data/lib/wx/doc/gen/grid/grid_cell_attr.rb +279 -0
  202. data/lib/wx/doc/gen/grid/grid_cell_auto_wrap_string_editor.rb +31 -0
  203. data/lib/wx/doc/gen/grid/grid_cell_auto_wrap_string_renderer.rb +32 -0
  204. data/lib/wx/doc/gen/grid/grid_cell_bool_editor.rb +44 -0
  205. data/lib/wx/doc/gen/grid/grid_cell_bool_renderer.rb +31 -0
  206. data/lib/wx/doc/gen/grid/grid_cell_choice_editor.rb +48 -0
  207. data/lib/wx/doc/gen/grid/grid_cell_date_editor.rb +33 -0
  208. data/lib/wx/doc/gen/grid/grid_cell_date_renderer.rb +40 -0
  209. data/lib/wx/doc/gen/grid/grid_cell_date_time_renderer.rb +35 -0
  210. data/lib/wx/doc/gen/grid/grid_cell_editor.rb +181 -0
  211. data/lib/wx/doc/gen/grid/grid_cell_enum_editor.rb +34 -0
  212. data/lib/wx/doc/gen/grid/grid_cell_enum_renderer.rb +39 -0
  213. data/lib/wx/doc/gen/grid/grid_cell_float_editor.rb +41 -0
  214. data/lib/wx/doc/gen/grid/grid_cell_float_renderer.rb +74 -0
  215. data/lib/wx/doc/gen/grid/grid_cell_number_editor.rb +41 -0
  216. data/lib/wx/doc/gen/grid/grid_cell_number_renderer.rb +31 -0
  217. data/lib/wx/doc/gen/grid/grid_cell_renderer.rb +98 -0
  218. data/lib/wx/doc/gen/grid/grid_cell_string_renderer.rb +31 -0
  219. data/lib/wx/doc/gen/grid/grid_cell_text_editor.rb +45 -0
  220. data/lib/wx/doc/gen/grid/grid_ctrl.rb +2381 -0
  221. data/lib/wx/doc/gen/grid/grid_editor_created_event.rb +87 -0
  222. data/lib/wx/doc/gen/grid/grid_event.rb +96 -0
  223. data/lib/wx/doc/gen/grid/grid_range_select_event.rb +96 -0
  224. data/lib/wx/doc/gen/grid/grid_size_event.rb +71 -0
  225. data/lib/wx/doc/gen/grid/grid_string_table.rb +130 -0
  226. data/lib/wx/doc/gen/grid/grid_table_base.rb +288 -0
  227. data/lib/wx/doc/gen/grid/grid_table_message.rb +73 -0
  228. data/lib/wx/doc/gen/grid_bag_sizer.rb +298 -0
  229. data/lib/wx/doc/gen/grid_sizer.rb +135 -0
  230. data/lib/wx/doc/gen/help_controller.rb +136 -0
  231. data/lib/wx/doc/gen/help_provider.rb +80 -0
  232. data/lib/wx/doc/gen/html/event_list.rb +46 -0
  233. data/lib/wx/doc/gen/html/html_cell.rb +441 -0
  234. data/lib/wx/doc/gen/html/html_cell_event.rb +62 -0
  235. data/lib/wx/doc/gen/html/html_easy_printing.rb +169 -0
  236. data/lib/wx/doc/gen/html/html_help_controller.rb +256 -0
  237. data/lib/wx/doc/gen/html/html_help_data.rb +144 -0
  238. data/lib/wx/doc/gen/html/html_help_frame.rb +112 -0
  239. data/lib/wx/doc/gen/html/html_help_window.rb +230 -0
  240. data/lib/wx/doc/gen/html/html_link_event.rb +36 -0
  241. data/lib/wx/doc/gen/html/html_list_box.rb +150 -0
  242. data/lib/wx/doc/gen/html/html_printout.rb +87 -0
  243. data/lib/wx/doc/gen/html/html_window.rb +386 -0
  244. data/lib/wx/doc/gen/icon.rb +267 -0
  245. data/lib/wx/doc/gen/icon_location.rb +38 -0
  246. data/lib/wx/doc/gen/image.rb +1144 -0
  247. data/lib/wx/doc/gen/image_list.rb +181 -0
  248. data/lib/wx/doc/gen/keyboard_state.rb +124 -0
  249. data/lib/wx/doc/gen/list_box.rb +260 -0
  250. data/lib/wx/doc/gen/list_ctrl.rb +1542 -0
  251. data/lib/wx/doc/gen/list_event.rb +177 -0
  252. data/lib/wx/doc/gen/listbook.rb +100 -0
  253. data/lib/wx/doc/gen/locale.rb +4143 -0
  254. data/lib/wx/doc/gen/log.rb +505 -0
  255. data/lib/wx/doc/gen/mdi_client_window.rb +38 -0
  256. data/lib/wx/doc/gen/mdi_frame.rb +235 -0
  257. data/lib/wx/doc/gen/media_ctrl.rb +225 -0
  258. data/lib/wx/doc/gen/media_event.rb +109 -0
  259. data/lib/wx/doc/gen/memory_dc.rb +95 -0
  260. data/lib/wx/doc/gen/menu.rb +493 -0
  261. data/lib/wx/doc/gen/menu_bar.rb +247 -0
  262. data/lib/wx/doc/gen/menu_item.rb +333 -0
  263. data/lib/wx/doc/gen/message_dialog.rb +195 -0
  264. data/lib/wx/doc/gen/mini_frame.rb +72 -0
  265. data/lib/wx/doc/gen/mirror_dc.rb +29 -0
  266. data/lib/wx/doc/gen/mouse_state.rb +108 -0
  267. data/lib/wx/doc/gen/multi_choice_dialog.rb +58 -0
  268. data/lib/wx/doc/gen/non_owned_window.rb +46 -0
  269. data/lib/wx/doc/gen/notebook.rb +220 -0
  270. data/lib/wx/doc/gen/number_entry_dialog.rb +75 -0
  271. data/lib/wx/doc/gen/object.rb +69 -0
  272. data/lib/wx/doc/gen/paint_dc.rb +34 -0
  273. data/lib/wx/doc/gen/palette.rb +90 -0
  274. data/lib/wx/doc/gen/panel.rb +96 -0
  275. data/lib/wx/doc/gen/pen.rb +484 -0
  276. data/lib/wx/doc/gen/pg/event_list.rb +102 -0
  277. data/lib/wx/doc/gen/pg/numeric_property_validator.rb +47 -0
  278. data/lib/wx/doc/gen/pg/pg_array_editor_dialog.rb +295 -0
  279. data/lib/wx/doc/gen/pg/pg_cell.rb +166 -0
  280. data/lib/wx/doc/gen/pg/pg_editor.rb +569 -0
  281. data/lib/wx/doc/gen/pg/pg_multi_button.rb +161 -0
  282. data/lib/wx/doc/gen/pg/pg_properties.rb +2193 -0
  283. data/lib/wx/doc/gen/pg/pg_property.rb +1852 -0
  284. data/lib/wx/doc/gen/pg/pg_validation_info.rb +327 -0
  285. data/lib/wx/doc/gen/pg/property_grid.rb +619 -0
  286. data/lib/wx/doc/gen/pg/property_grid_event.rb +135 -0
  287. data/lib/wx/doc/gen/pg/property_grid_interface.rb +847 -0
  288. data/lib/wx/doc/gen/pg/property_grid_manager.rb +349 -0
  289. data/lib/wx/doc/gen/pg/property_grid_page.rb +265 -0
  290. data/lib/wx/doc/gen/pg/property_grid_page_state.rb +155 -0
  291. data/lib/wx/doc/gen/picker_base.rb +143 -0
  292. data/lib/wx/doc/gen/platform_info.rb +379 -0
  293. data/lib/wx/doc/gen/popup_window.rb +93 -0
  294. data/lib/wx/doc/gen/progress_dialog.rb +106 -0
  295. data/lib/wx/doc/gen/property_sheet_dialog.rb +185 -0
  296. data/lib/wx/doc/gen/prt/event_list.rb +13 -0
  297. data/lib/wx/doc/gen/prt/page_setup_dialog.rb +38 -0
  298. data/lib/wx/doc/gen/prt/post_script_dc.rb +32 -0
  299. data/lib/wx/doc/gen/prt/preview_frame.rb +39 -0
  300. data/lib/wx/doc/gen/prt/print_abort_dialog.rb +127 -0
  301. data/lib/wx/doc/gen/prt/print_data.rb +598 -0
  302. data/lib/wx/doc/gen/prt/print_dialog.rb +47 -0
  303. data/lib/wx/doc/gen/prt/printer.rb +428 -0
  304. data/lib/wx/doc/gen/prt/printer_dc.rb +35 -0
  305. data/lib/wx/doc/gen/query_layout_info_event.rb +98 -0
  306. data/lib/wx/doc/gen/radio_box.rb +258 -0
  307. data/lib/wx/doc/gen/radio_button.rb +128 -0
  308. data/lib/wx/doc/gen/rbn/event_list.rb +132 -0
  309. data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +1652 -0
  310. data/lib/wx/doc/gen/rbn/ribbon_bar.rb +227 -0
  311. data/lib/wx/doc/gen/rbn/ribbon_bar_event.rb +40 -0
  312. data/lib/wx/doc/gen/rbn/ribbon_button_bar.rb +400 -0
  313. data/lib/wx/doc/gen/rbn/ribbon_button_bar_event.rb +58 -0
  314. data/lib/wx/doc/gen/rbn/ribbon_control.rb +116 -0
  315. data/lib/wx/doc/gen/rbn/ribbon_gallery.rb +208 -0
  316. data/lib/wx/doc/gen/rbn/ribbon_gallery_event.rb +51 -0
  317. data/lib/wx/doc/gen/rbn/ribbon_page.rb +129 -0
  318. data/lib/wx/doc/gen/rbn/ribbon_panel.rb +232 -0
  319. data/lib/wx/doc/gen/rbn/ribbon_panel_event.rb +41 -0
  320. data/lib/wx/doc/gen/rbn/ribbon_tool_bar.rb +321 -0
  321. data/lib/wx/doc/gen/rbn/ribbon_tool_bar_event.rb +36 -0
  322. data/lib/wx/doc/gen/region.rb +299 -0
  323. data/lib/wx/doc/gen/rtc/event_list.rb +121 -0
  324. data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +2052 -0
  325. data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +2031 -0
  326. data/lib/wx/doc/gen/rtc/rich_text_event.rb +146 -0
  327. data/lib/wx/doc/gen/rtc/rich_text_file_handler.rb +171 -0
  328. data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +180 -0
  329. data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +104 -0
  330. data/lib/wx/doc/gen/rtc/rich_text_printing.rb +241 -0
  331. data/lib/wx/doc/gen/rtc/rich_text_xml_handler.rb +55 -0
  332. data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +153 -0
  333. data/lib/wx/doc/gen/sash_event.rb +133 -0
  334. data/lib/wx/doc/gen/sash_layout_window.rb +203 -0
  335. data/lib/wx/doc/gen/sash_window.rb +154 -0
  336. data/lib/wx/doc/gen/screen_dc.rb +27 -0
  337. data/lib/wx/doc/gen/scrolled_canvas.rb +317 -0
  338. data/lib/wx/doc/gen/scrolled_control.rb +317 -0
  339. data/lib/wx/doc/gen/scrolled_window.rb +337 -0
  340. data/lib/wx/doc/gen/simplebook.rb +93 -0
  341. data/lib/wx/doc/gen/single_choice_dialog.rb +74 -0
  342. data/lib/wx/doc/gen/sizer.rb +847 -0
  343. data/lib/wx/doc/gen/sizer_item.rb +227 -0
  344. data/lib/wx/doc/gen/slider.rb +316 -0
  345. data/lib/wx/doc/gen/spin_button.rb +124 -0
  346. data/lib/wx/doc/gen/spin_ctrl.rb +170 -0
  347. data/lib/wx/doc/gen/spin_event.rb +47 -0
  348. data/lib/wx/doc/gen/splash_screen.rb +83 -0
  349. data/lib/wx/doc/gen/splitter_event.rb +87 -0
  350. data/lib/wx/doc/gen/splitter_window.rb +357 -0
  351. data/lib/wx/doc/gen/static_bitmap.rb +126 -0
  352. data/lib/wx/doc/gen/static_box.rb +123 -0
  353. data/lib/wx/doc/gen/static_box_sizer.rb +67 -0
  354. data/lib/wx/doc/gen/static_line.rb +66 -0
  355. data/lib/wx/doc/gen/static_text.rb +98 -0
  356. data/lib/wx/doc/gen/status_bar.rb +203 -0
  357. data/lib/wx/doc/gen/stc/event_list.rb +217 -0
  358. data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +4000 -0
  359. data/lib/wx/doc/gen/stc/styled_text_event.rb +7319 -0
  360. data/lib/wx/doc/gen/std_dialog_button_sizer.rb +74 -0
  361. data/lib/wx/doc/gen/svg_file_dc.rb +153 -0
  362. data/lib/wx/doc/gen/system_options.rb +109 -0
  363. data/lib/wx/doc/gen/system_settings.rb +481 -0
  364. data/lib/wx/doc/gen/task_bar_icon.rb +94 -0
  365. data/lib/wx/doc/gen/task_bar_icon_event.rb +86 -0
  366. data/lib/wx/doc/gen/text_attr.rb +645 -0
  367. data/lib/wx/doc/gen/text_ctrl.rb +841 -0
  368. data/lib/wx/doc/gen/text_entry.rb +389 -0
  369. data/lib/wx/doc/gen/text_entry_dialog.rb +170 -0
  370. data/lib/wx/doc/gen/text_validator.rb +212 -0
  371. data/lib/wx/doc/gen/time_picker_ctrl.rb +103 -0
  372. data/lib/wx/doc/gen/timer.rb +103 -0
  373. data/lib/wx/doc/gen/timer_event.rb +73 -0
  374. data/lib/wx/doc/gen/tip_provider.rb +60 -0
  375. data/lib/wx/doc/gen/toggle_button.rb +84 -0
  376. data/lib/wx/doc/gen/tool_bar.rb +744 -0
  377. data/lib/wx/doc/gen/tool_tip.rb +73 -0
  378. data/lib/wx/doc/gen/toolbook.rb +103 -0
  379. data/lib/wx/doc/gen/top_level_window.rb +462 -0
  380. data/lib/wx/doc/gen/tree_ctrl.rb +863 -0
  381. data/lib/wx/doc/gen/tree_event.rb +101 -0
  382. data/lib/wx/doc/gen/treebook.rb +154 -0
  383. data/lib/wx/doc/gen/utils.rb +257 -0
  384. data/lib/wx/doc/gen/v_list_box.rb +224 -0
  385. data/lib/wx/doc/gen/v_scrolled_window.rb +224 -0
  386. data/lib/wx/doc/gen/validator.rb +73 -0
  387. data/lib/wx/doc/gen/variant.rb +340 -0
  388. data/lib/wx/doc/gen/window.rb +2414 -0
  389. data/lib/wx/doc/gen/window_dc.rb +35 -0
  390. data/lib/wx/doc/gen/window_disabler.rb +24 -0
  391. data/lib/wx/doc/gen/with_images.rb +73 -0
  392. data/lib/wx/doc/gen/wizard.rb +197 -0
  393. data/lib/wx/doc/gen/wizard_event.rb +105 -0
  394. data/lib/wx/doc/gen/wizard_page.rb +61 -0
  395. data/lib/wx/doc/gen/wizard_page_simple.rb +72 -0
  396. data/lib/wx/doc/gen/xml_node.rb +282 -0
  397. data/lib/wx/doc/gen/xml_resource.rb +304 -0
  398. data/lib/wx/doc/grid/grid.rb +20 -0
  399. data/lib/wx/doc/help_controller.rb +14 -0
  400. data/lib/wx/doc/html/html_help_controller.rb +8 -0
  401. data/lib/wx/doc/pg/events.rb +15 -0
  402. data/lib/wx/doc/pg/pg_property.rb +8 -0
  403. data/lib/wx/doc/pg/pgeditor.rb +21 -0
  404. data/lib/wx/doc/pg/property_grid.rb +48 -0
  405. data/lib/wx/doc/pg/property_grid_interface.rb +64 -0
  406. data/lib/wx/doc/prt/page_setup_dialog.rb +15 -0
  407. data/lib/wx/doc/prt/print_data.rb +9 -0
  408. data/lib/wx/doc/prt/print_dialog.rb +26 -0
  409. data/lib/wx/doc/prt/printer.rb +15 -0
  410. data/lib/wx/doc/rbn/ribbon_bar.rb +9 -0
  411. data/lib/wx/doc/rbn/ribbon_button_bar.rb +9 -0
  412. data/lib/wx/doc/rbn/ribbon_gallery.rb +9 -0
  413. data/lib/wx/doc/rbn/ribbon_tool_bar.rb +9 -0
  414. data/lib/wx/doc/rtc/richtext_printing.rb +14 -0
  415. data/lib/wx/doc/screen_dc.rb +10 -0
  416. data/lib/wx/doc/stock_objects.rb +98 -0
  417. data/lib/wx/doc/stream.rb +38 -0
  418. data/lib/wx/doc/system_settings.rb +29 -0
  419. data/lib/wx/doc/treebook.rb +9 -0
  420. data/lib/wx/doc/variant.rb +163 -0
  421. data/lib/wx/doc/xml_resource.rb +19 -0
  422. data/lib/wx/global_const.rb +84 -0
  423. data/lib/wx/grid/events/evt_list.rb +156 -0
  424. data/lib/wx/grid/grid.rb +7 -0
  425. data/lib/wx/grid/keyword_defs.rb +10 -0
  426. data/lib/wx/grid/require.rb +9 -0
  427. data/lib/wx/grid.rb +14 -0
  428. data/lib/wx/helpers.rb +65 -0
  429. data/lib/wx/html/events/evt_list.rb +37 -0
  430. data/lib/wx/html/htmlhelpcontroller.rb +6 -0
  431. data/lib/wx/html/htmlwindow.rb +19 -0
  432. data/lib/wx/html/keyword_defs.rb +22 -0
  433. data/lib/wx/html/require.rb +10 -0
  434. data/lib/wx/html.rb +15 -0
  435. data/lib/wx/keyword_ctors.rb +226 -0
  436. data/lib/wx/keyword_defs.rb +487 -0
  437. data/lib/wx/pg/events/evt_list.rb +73 -0
  438. data/lib/wx/pg/events.rb +14 -0
  439. data/lib/wx/pg/keyword_defs.rb +15 -0
  440. data/lib/wx/pg/pg_editor.rb +13 -0
  441. data/lib/wx/pg/pg_properties.rb +24 -0
  442. data/lib/wx/pg/pg_property.rb +26 -0
  443. data/lib/wx/pg/property_grid.rb +56 -0
  444. data/lib/wx/pg/property_grid_interface.rb +33 -0
  445. data/lib/wx/pg/require.rb +12 -0
  446. data/lib/wx/pg.rb +14 -0
  447. data/lib/wx/prt/keyword_defs.rb +8 -0
  448. data/lib/wx/prt/page_setup_dialog.rb +15 -0
  449. data/lib/wx/prt/previewframe.rb +13 -0
  450. data/lib/wx/prt/require.rb +8 -0
  451. data/lib/wx/prt.rb +14 -0
  452. data/lib/wx/rbn/events/evt_list.rb +102 -0
  453. data/lib/wx/rbn/events.rb +4 -0
  454. data/lib/wx/rbn/keyword_defs.rb +43 -0
  455. data/lib/wx/rbn/require.rb +12 -0
  456. data/lib/wx/rbn/ribbon_art_provider.rb +10 -0
  457. data/lib/wx/rbn/ribbon_bar.rb +12 -0
  458. data/lib/wx/rbn/ribbon_button_bar.rb +26 -0
  459. data/lib/wx/rbn/ribbon_control.rb +25 -0
  460. data/lib/wx/rbn/ribbon_gallery.rb +26 -0
  461. data/lib/wx/rbn/ribbon_page.rb +15 -0
  462. data/lib/wx/rbn/ribbon_panel.rb +15 -0
  463. data/lib/wx/rbn/ribbon_tool_bar.rb +26 -0
  464. data/lib/wx/rbn.rb +14 -0
  465. data/lib/wx/rtc/events/evt_list.rb +98 -0
  466. data/lib/wx/rtc/ext/rich_text_ctrl.rb +24 -0
  467. data/lib/wx/rtc/ext.rb +15 -0
  468. data/lib/wx/rtc/keyword_defs.rb +17 -0
  469. data/lib/wx/rtc/require.rb +8 -0
  470. data/lib/wx/rtc.rb +15 -0
  471. data/lib/wx/stc/events/evt_list.rb +178 -0
  472. data/lib/wx/stc/keyword_defs.rb +8 -0
  473. data/lib/wx/stc/require.rb +7 -0
  474. data/lib/wx/stc.rb +14 -0
  475. data/lib/wx/version.rb +3 -0
  476. data/lib/wx/wxruby/base.rb +87 -0
  477. data/lib/wx/wxruby/cmd/sampler.rb +68 -0
  478. data/lib/wx/wxruby/cmd/test.rb +27 -0
  479. data/lib/wx.rb +14 -0
  480. data/lib/wxruby_aui.so +0 -0
  481. data/lib/wxruby_core.so +0 -0
  482. data/lib/wxruby_grid.so +0 -0
  483. data/lib/wxruby_html.so +0 -0
  484. data/lib/wxruby_pg.so +0 -0
  485. data/lib/wxruby_prt.so +0 -0
  486. data/lib/wxruby_rbn.so +0 -0
  487. data/lib/wxruby_rtc.so +0 -0
  488. data/lib/wxruby_stc.so +0 -0
  489. data/rakelib/install.rb +220 -0
  490. data/rakelib/lib/config/cygwin.rb +6 -0
  491. data/rakelib/lib/config/linux.rb +78 -0
  492. data/rakelib/lib/config/macosx.rb +6 -0
  493. data/rakelib/lib/config/mingw.rb +133 -0
  494. data/rakelib/lib/config/netbsd.rb +6 -0
  495. data/rakelib/lib/config/unixish.rb +187 -0
  496. data/rakelib/lib/config.rb +673 -0
  497. data/rakelib/lib/ext/enum_chain.rb +22 -0
  498. data/rakelib/prepost.rake +91 -0
  499. data/rakelib/prepost.rb +26 -0
  500. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +7 -0
  501. data/rakelib/yard/templates/default/layout/html/setup.rb +5 -0
  502. data/rakelib/yard/yard/relative_markdown_links/version.rb +8 -0
  503. data/rakelib/yard/yard/relative_markdown_links.rb +39 -0
  504. data/rakelib/yard/yard-custom-templates.rb +2 -0
  505. data/rakelib/yard/yard-relative_markdown_links.rb +4 -0
  506. data/samples/art/wxruby-128x128.png +0 -0
  507. data/samples/art/wxruby-256x256.png +0 -0
  508. data/samples/art/wxruby-64x64.png +0 -0
  509. data/samples/art/wxruby.ico +0 -0
  510. data/samples/art/wxruby.png +0 -0
  511. data/samples/aui/aui.rb +1321 -0
  512. data/samples/aui/tn_aui.png +0 -0
  513. data/samples/bigdemo/About.rbw +39 -0
  514. data/samples/bigdemo/ColorPanel.rbw +23 -0
  515. data/samples/bigdemo/GridSimple.rbw +78 -0
  516. data/samples/bigdemo/MDIDemo.rbw +57 -0
  517. data/samples/bigdemo/PopupMenu.rbw +146 -0
  518. data/samples/bigdemo/ShapedWindow.rbw +128 -0
  519. data/samples/bigdemo/Sizers.rbw +541 -0
  520. data/samples/bigdemo/bigdemo.rb +810 -0
  521. data/samples/bigdemo/demoTemplate.rbw +33 -0
  522. data/samples/bigdemo/helpfile.htb +0 -0
  523. data/samples/bigdemo/icons/Test 015.jpg +0 -0
  524. data/samples/bigdemo/icons/Test 015.png +0 -0
  525. data/samples/bigdemo/icons/choice.bmp +0 -0
  526. data/samples/bigdemo/icons/choice.xpm +27 -0
  527. data/samples/bigdemo/icons/combo.bmp +0 -0
  528. data/samples/bigdemo/icons/combo.xpm +27 -0
  529. data/samples/bigdemo/icons/copy.xpm +25 -0
  530. data/samples/bigdemo/icons/cut.xpm +24 -0
  531. data/samples/bigdemo/icons/gauge.bmp +0 -0
  532. data/samples/bigdemo/icons/gauge.xpm +27 -0
  533. data/samples/bigdemo/icons/help.xpm +25 -0
  534. data/samples/bigdemo/icons/list.bmp +0 -0
  535. data/samples/bigdemo/icons/list.xpm +27 -0
  536. data/samples/bigdemo/icons/mondrian.ico +0 -0
  537. data/samples/bigdemo/icons/mondrian.xpm +44 -0
  538. data/samples/bigdemo/icons/new.xpm +24 -0
  539. data/samples/bigdemo/icons/ogl.ico +0 -0
  540. data/samples/bigdemo/icons/ogl.xpm +45 -0
  541. data/samples/bigdemo/icons/open.xpm +26 -0
  542. data/samples/bigdemo/icons/paste.bmp +0 -0
  543. data/samples/bigdemo/icons/paste.xpm +38 -0
  544. data/samples/bigdemo/icons/pointy.png +0 -0
  545. data/samples/bigdemo/icons/preview.xpm +26 -0
  546. data/samples/bigdemo/icons/print.xpm +26 -0
  547. data/samples/bigdemo/icons/radio.bmp +0 -0
  548. data/samples/bigdemo/icons/radio.xpm +27 -0
  549. data/samples/bigdemo/icons/robert.xpm +415 -0
  550. data/samples/bigdemo/icons/sashtest.ico +0 -0
  551. data/samples/bigdemo/icons/save.xpm +25 -0
  552. data/samples/bigdemo/icons/smiles.bmp +0 -0
  553. data/samples/bigdemo/icons/smiles.xpm +39 -0
  554. data/samples/bigdemo/icons/smiley.ico +0 -0
  555. data/samples/bigdemo/icons/smiley.xpm +42 -0
  556. data/samples/bigdemo/icons/stattext.xpm +24 -0
  557. data/samples/bigdemo/icons/test2.bmp +0 -0
  558. data/samples/bigdemo/icons/test2.png +0 -0
  559. data/samples/bigdemo/icons/test2.xpm +79 -0
  560. data/samples/bigdemo/icons/text.bmp +0 -0
  561. data/samples/bigdemo/icons/text.xpm +27 -0
  562. data/samples/bigdemo/icons/tog1.bmp +0 -0
  563. data/samples/bigdemo/icons/tog1.xpm +38 -0
  564. data/samples/bigdemo/icons/tog2.bmp +0 -0
  565. data/samples/bigdemo/icons/tog2.xpm +38 -0
  566. data/samples/bigdemo/icons/wxruby-128x128.png +0 -0
  567. data/samples/bigdemo/icons/wxwin.ico +0 -0
  568. data/samples/bigdemo/icons/wxwin16x16.png +0 -0
  569. data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
  570. data/samples/bigdemo/icons/wxwin32x32.png +0 -0
  571. data/samples/bigdemo/icons/wxwin48x48.png +0 -0
  572. data/samples/bigdemo/run.rb +91 -0
  573. data/samples/bigdemo/tips.txt +7 -0
  574. data/samples/bigdemo/utils.rb +12 -0
  575. data/samples/bigdemo/wxArtProvider.rbw +281 -0
  576. data/samples/bigdemo/wxBitmapButton.rbw +65 -0
  577. data/samples/bigdemo/wxButton.rbw +64 -0
  578. data/samples/bigdemo/wxCalendarCtrl.rbw +59 -0
  579. data/samples/bigdemo/wxCheckBox.rbw +50 -0
  580. data/samples/bigdemo/wxCheckListBox.rbw +65 -0
  581. data/samples/bigdemo/wxChoice.rbw +47 -0
  582. data/samples/bigdemo/wxChoicebook.rbw +78 -0
  583. data/samples/bigdemo/wxColourDialog.rbw +33 -0
  584. data/samples/bigdemo/wxComboBox.rbw +77 -0
  585. data/samples/bigdemo/wxCursor.rbw +136 -0
  586. data/samples/bigdemo/wxDialog.rbw +74 -0
  587. data/samples/bigdemo/wxDirDialog.rbw +29 -0
  588. data/samples/bigdemo/wxDragImage.rbw +70 -0
  589. data/samples/bigdemo/wxFileDialog.rbw +37 -0
  590. data/samples/bigdemo/wxFileDialog_Save.rbw +35 -0
  591. data/samples/bigdemo/wxFindReplaceDialog.rbw +82 -0
  592. data/samples/bigdemo/wxFontDialog.rbw +200 -0
  593. data/samples/bigdemo/wxFrame.rbw +53 -0
  594. data/samples/bigdemo/wxGauge.rbw +65 -0
  595. data/samples/bigdemo/wxGenericDirCtrl.rbw +74 -0
  596. data/samples/bigdemo/wxGrid.rbw +66 -0
  597. data/samples/bigdemo/wxHtmlHelpController.rbw +52 -0
  598. data/samples/bigdemo/wxListBox.rbw +140 -0
  599. data/samples/bigdemo/wxListCtrl_virtual.rbw +112 -0
  600. data/samples/bigdemo/wxMDIWindows.rbw +50 -0
  601. data/samples/bigdemo/wxMenu.rbw +247 -0
  602. data/samples/bigdemo/wxMessageDialog.rbw +27 -0
  603. data/samples/bigdemo/wxMiniFrame.rbw +70 -0
  604. data/samples/bigdemo/wxMultipleChoiceDialog.rbw +29 -0
  605. data/samples/bigdemo/wxNotebook.rbw +136 -0
  606. data/samples/bigdemo/wxProgressDialog.rbw +43 -0
  607. data/samples/bigdemo/wxRadioBox.rbw +72 -0
  608. data/samples/bigdemo/wxRadioButton.rbw +125 -0
  609. data/samples/bigdemo/wxSashWindow.rbw +141 -0
  610. data/samples/bigdemo/wxScrolledMessageDialog.rbw +57 -0
  611. data/samples/bigdemo/wxScrolledWindow.rbw +199 -0
  612. data/samples/bigdemo/wxSingleChoiceDialog.rbw +33 -0
  613. data/samples/bigdemo/wxSlider.rbw +42 -0
  614. data/samples/bigdemo/wxSpinButton.rbw +50 -0
  615. data/samples/bigdemo/wxSpinCtrl.rbw +51 -0
  616. data/samples/bigdemo/wxSplitterWindow.rbw +63 -0
  617. data/samples/bigdemo/wxStaticBitmap.rbw +47 -0
  618. data/samples/bigdemo/wxStaticText.rbw +55 -0
  619. data/samples/bigdemo/wxStatusBar.rbw +126 -0
  620. data/samples/bigdemo/wxTextCtrl.rbw +149 -0
  621. data/samples/bigdemo/wxTextEntryDialog.rbw +31 -0
  622. data/samples/bigdemo/wxToggleButton.rbw +49 -0
  623. data/samples/bigdemo/wxToolBar.rbw +131 -0
  624. data/samples/bigdemo/wxTreeCtrl.rbw +191 -0
  625. data/samples/calendar/calendar.rb +363 -0
  626. data/samples/calendar/tn_calendar.png +0 -0
  627. data/samples/caret/caret.rb +293 -0
  628. data/samples/caret/mondrian.xpm +44 -0
  629. data/samples/caret/tn_caret.png +0 -0
  630. data/samples/controls/books.rb +183 -0
  631. data/samples/controls/controls.rb +1143 -0
  632. data/samples/controls/get_item_sample.rb +117 -0
  633. data/samples/controls/icons/choice.xpm +27 -0
  634. data/samples/controls/icons/combo.xpm +27 -0
  635. data/samples/controls/icons/gauge.xpm +27 -0
  636. data/samples/controls/icons/list.xpm +27 -0
  637. data/samples/controls/icons/radio.xpm +27 -0
  638. data/samples/controls/icons/stattext.xpm +24 -0
  639. data/samples/controls/icons/text.xpm +27 -0
  640. data/samples/controls/mondrian.ico +0 -0
  641. data/samples/controls/mondrian.xpm +44 -0
  642. data/samples/controls/test2.bmp +0 -0
  643. data/samples/controls/tn_books.png +0 -0
  644. data/samples/controls/tn_controls.png +0 -0
  645. data/samples/controls/tn_get_item_sample.png +0 -0
  646. data/samples/dialogs/dialogs.rb +879 -0
  647. data/samples/dialogs/tips.txt +18 -0
  648. data/samples/dialogs/tn_dialogs.png +0 -0
  649. data/samples/dialogs/tn_wizard.png +0 -0
  650. data/samples/dialogs/wizard.rb +89 -0
  651. data/samples/dragdrop/dragdrop.rb +200 -0
  652. data/samples/dragdrop/tn_dragdrop.png +0 -0
  653. data/samples/drawing/SVGlogo24.xpm +310 -0
  654. data/samples/drawing/bitmap.rb +76 -0
  655. data/samples/drawing/bitmap_image.rb +131 -0
  656. data/samples/drawing/graphics_drawing.rb +257 -0
  657. data/samples/drawing/maths_images.rb +327 -0
  658. data/samples/drawing/rmagic_bitmap_image.rb +139 -0
  659. data/samples/drawing/ruby-logo.jpg +0 -0
  660. data/samples/drawing/svgtest.rb +373 -0
  661. data/samples/drawing/tn_bitmap.png +0 -0
  662. data/samples/drawing/tn_bitmap_image.png +0 -0
  663. data/samples/drawing/tn_graphics_drawing.png +0 -0
  664. data/samples/drawing/tn_maths_images.png +0 -0
  665. data/samples/drawing/tn_rmagic_bitmap_image.png +0 -0
  666. data/samples/drawing/tn_svgtest.png +0 -0
  667. data/samples/etc/choice.rb +82 -0
  668. data/samples/etc/miniframe.rb +92 -0
  669. data/samples/etc/sash.rb +140 -0
  670. data/samples/etc/scrollwin.rb +120 -0
  671. data/samples/etc/system_settings.rb +263 -0
  672. data/samples/etc/tn_choice.png +0 -0
  673. data/samples/etc/tn_miniframe.png +0 -0
  674. data/samples/etc/tn_sash.png +0 -0
  675. data/samples/etc/tn_scrollwin.png +0 -0
  676. data/samples/etc/tn_system_settings.png +0 -0
  677. data/samples/event/activation.rb +129 -0
  678. data/samples/event/event.rb +220 -0
  679. data/samples/event/threaded.rb +141 -0
  680. data/samples/event/tn_activation.png +0 -0
  681. data/samples/event/tn_event.png +0 -0
  682. data/samples/event/tn_threaded.png +0 -0
  683. data/samples/event/tn_update_ui_event.png +0 -0
  684. data/samples/event/update_ui_event.rb +91 -0
  685. data/samples/grid/grid.rb +224 -0
  686. data/samples/grid/gridtablebase.rb +178 -0
  687. data/samples/grid/tn_grid.png +0 -0
  688. data/samples/grid/tn_gridtablebase.png +0 -0
  689. data/samples/html/8859_2.htm +14 -0
  690. data/samples/html/cp1250.htm +19 -0
  691. data/samples/html/foo.png +0 -0
  692. data/samples/html/html.rb +278 -0
  693. data/samples/html/i18n.gif +0 -0
  694. data/samples/html/imagemap.htm +20 -0
  695. data/samples/html/imagemap.png +0 -0
  696. data/samples/html/listtest.htm +28 -0
  697. data/samples/html/pic.png +0 -0
  698. data/samples/html/pic2.bmp +0 -0
  699. data/samples/html/regres.htm +20 -0
  700. data/samples/html/subsup.html +42 -0
  701. data/samples/html/tables.htm +255 -0
  702. data/samples/html/test.htm +375 -0
  703. data/samples/html/tn_html.png +0 -0
  704. data/samples/mdi/mdi.rb +118 -0
  705. data/samples/mdi/tn_mdi.png +0 -0
  706. data/samples/minimal/minimal.rb +95 -0
  707. data/samples/minimal/mondrian.ico +0 -0
  708. data/samples/minimal/mondrian.png +0 -0
  709. data/samples/minimal/nothing.rb +38 -0
  710. data/samples/minimal/tn_minimal.png +0 -0
  711. data/samples/minimal/tn_nothing.png +0 -0
  712. data/samples/printing/mondrian.ico +0 -0
  713. data/samples/printing/mondrian.xpm +44 -0
  714. data/samples/printing/printing.rb +499 -0
  715. data/samples/printing/printing2.rb +251 -0
  716. data/samples/printing/sample-text.txt +213 -0
  717. data/samples/printing/tn_printing.png +0 -0
  718. data/samples/printing/tn_printing2.png +0 -0
  719. data/samples/propgrid/propgrid.rb +2707 -0
  720. data/samples/propgrid/propgrid_minimal.rb +106 -0
  721. data/samples/propgrid/sample_props.rb +434 -0
  722. data/samples/propgrid/tn_propgrid.png +0 -0
  723. data/samples/propgrid/tn_propgrid_minimal.png +0 -0
  724. data/samples/ribbon/align_center.xpm +21 -0
  725. data/samples/ribbon/align_left.xpm +21 -0
  726. data/samples/ribbon/align_right.xpm +21 -0
  727. data/samples/ribbon/aui_style.xpm +53 -0
  728. data/samples/ribbon/auto_crop_selection.xpm +55 -0
  729. data/samples/ribbon/auto_crop_selection_small.xpm +33 -0
  730. data/samples/ribbon/circle.xpm +38 -0
  731. data/samples/ribbon/circle_small.xpm +22 -0
  732. data/samples/ribbon/colours.xpm +25 -0
  733. data/samples/ribbon/cross.xpm +38 -0
  734. data/samples/ribbon/empty.xpm +23 -0
  735. data/samples/ribbon/expand_selection_h.xpm +46 -0
  736. data/samples/ribbon/expand_selection_v.xpm +46 -0
  737. data/samples/ribbon/eye.xpm +26 -0
  738. data/samples/ribbon/hexagon.xpm +38 -0
  739. data/samples/ribbon/msw_style.xpm +65 -0
  740. data/samples/ribbon/position_left.xpm +22 -0
  741. data/samples/ribbon/position_top.xpm +22 -0
  742. data/samples/ribbon/ribbon.rb +900 -0
  743. data/samples/ribbon/ribbon.xpm +54 -0
  744. data/samples/ribbon/selection_panel.xpm +23 -0
  745. data/samples/ribbon/square.xpm +38 -0
  746. data/samples/ribbon/tn_ribbon.png +0 -0
  747. data/samples/ribbon/triangle.xpm +38 -0
  748. data/samples/sample.xpm +475 -0
  749. data/samples/sampler/back.xpm +21 -0
  750. data/samples/sampler/copy.xpm +44 -0
  751. data/samples/sampler/cut.xpm +46 -0
  752. data/samples/sampler/editor.rb +534 -0
  753. data/samples/sampler/ext.rb +51 -0
  754. data/samples/sampler/filesave.xpm +42 -0
  755. data/samples/sampler/find.xpm +62 -0
  756. data/samples/sampler/findrepl.xpm +63 -0
  757. data/samples/sampler/forward.xpm +21 -0
  758. data/samples/sampler/paste.xpm +46 -0
  759. data/samples/sampler/play.xpm +24 -0
  760. data/samples/sampler/redo.xpm +58 -0
  761. data/samples/sampler/sample.rb +337 -0
  762. data/samples/sampler/stc_editor.rb +326 -0
  763. data/samples/sampler/txt_editor.rb +135 -0
  764. data/samples/sampler/undo.xpm +58 -0
  765. data/samples/sampler.rb +401 -0
  766. data/samples/splash/mobile.xpm +1835 -0
  767. data/samples/splash/splash.png +0 -0
  768. data/samples/splash/splash.rb +164 -0
  769. data/samples/splash/tn_splash.png +0 -0
  770. data/samples/text/document-open.png +0 -0
  771. data/samples/text/document-save.png +0 -0
  772. data/samples/text/edit-copy.png +0 -0
  773. data/samples/text/edit-cut.png +0 -0
  774. data/samples/text/edit-paste.png +0 -0
  775. data/samples/text/edit-redo.png +0 -0
  776. data/samples/text/edit-undo.png +0 -0
  777. data/samples/text/format-text-bold.png +0 -0
  778. data/samples/text/format-text-italic.png +0 -0
  779. data/samples/text/format-text-underline.png +0 -0
  780. data/samples/text/mondrian.ico +0 -0
  781. data/samples/text/mondrian.xpm +44 -0
  782. data/samples/text/preferences-desktop-font.png +0 -0
  783. data/samples/text/rich_textctrl.rb +326 -0
  784. data/samples/text/scintilla.rb +179 -0
  785. data/samples/text/textctrl.rb +124 -0
  786. data/samples/text/tn_rich_textctrl.png +0 -0
  787. data/samples/text/tn_scintilla.png +0 -0
  788. data/samples/text/tn_textctrl.png +0 -0
  789. data/samples/text/tn_unicode.png +0 -0
  790. data/samples/text/unicode.rb +238 -0
  791. data/samples/text/utf8.txt +15 -0
  792. data/samples/treectrl/checked.xpm +54 -0
  793. data/samples/treectrl/icon1.xpm +79 -0
  794. data/samples/treectrl/icon2.xpm +53 -0
  795. data/samples/treectrl/icon3.xpm +79 -0
  796. data/samples/treectrl/icon4.xpm +43 -0
  797. data/samples/treectrl/icon5.xpm +79 -0
  798. data/samples/treectrl/state1.xpm +145 -0
  799. data/samples/treectrl/state2.xpm +144 -0
  800. data/samples/treectrl/state3.xpm +142 -0
  801. data/samples/treectrl/state4.xpm +145 -0
  802. data/samples/treectrl/state5.xpm +85 -0
  803. data/samples/treectrl/tn_treectrl.png +0 -0
  804. data/samples/treectrl/treectrl.rb +1720 -0
  805. data/samples/treectrl/unchecked.xpm +30 -0
  806. data/samples/xrc/custom_dialog.xrc +46 -0
  807. data/samples/xrc/custom_xrc_sample.rb +84 -0
  808. data/samples/xrc/samples.xrc +46 -0
  809. data/samples/xrc/tn_xrc_sample.png +0 -0
  810. data/samples/xrc/xrc_sample.rb +86 -0
  811. data/tests/test_basic.rb +20 -0
  812. data/tests/test_clipboard.rb +241 -0
  813. data/tests/test_dialog.rb +28 -0
  814. data/tests/test_event_handling.rb +103 -0
  815. data/tests/test_events.rb +45 -0
  816. data/tests/test_geometry.rb +141 -0
  817. data/tests/test_intl.rb +107 -0
  818. data/tests/test_item_data.rb +120 -0
  819. data/tests/test_variant.rb +151 -0
  820. data/tests/testapp.rb +40 -0
  821. data/tests/testapp_noframe.rb +28 -0
  822. metadata +912 -0
@@ -0,0 +1,2707 @@
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
+ _ADD_WX_LIB_CONF.call(:USE_UNICODE)
1650
+
1651
+ _ADD_WX_LIB_CONF_GROUP.call("Global Features")
1652
+ _ADD_WX_LIB_CONF.call(:USE_EXCEPTIONS)
1653
+ _ADD_WX_LIB_CONF.call(:USE_EXTENDED_RTTI)
1654
+ _ADD_WX_LIB_CONF.call(:USE_STL)
1655
+ _ADD_WX_LIB_CONF.call(:USE_LOG)
1656
+ _ADD_WX_LIB_CONF.call(:USE_LOGWINDOW)
1657
+ _ADD_WX_LIB_CONF.call(:USE_LOGGUI)
1658
+ _ADD_WX_LIB_CONF.call(:USE_LOG_DIALOG)
1659
+ _ADD_WX_LIB_CONF.call(:USE_CMDLINE_PARSER)
1660
+ _ADD_WX_LIB_CONF.call(:USE_THREADS)
1661
+ _ADD_WX_LIB_CONF.call(:USE_STREAMS)
1662
+ _ADD_WX_LIB_CONF.call(:USE_STD_IOSTREAM)
1663
+
1664
+ _ADD_WX_LIB_CONF_GROUP.call("Non-GUI Features")
1665
+ _ADD_WX_LIB_CONF.call(:USE_LONGLONG)
1666
+ _ADD_WX_LIB_CONF.call(:USE_FILE)
1667
+ _ADD_WX_LIB_CONF.call(:USE_FFILE)
1668
+ _ADD_WX_LIB_CONF.call(:USE_FSVOLUME)
1669
+ _ADD_WX_LIB_CONF.call(:USE_TEXTBUFFER)
1670
+ _ADD_WX_LIB_CONF.call(:USE_TEXTFILE)
1671
+ _ADD_WX_LIB_CONF.call(:USE_INTL)
1672
+ _ADD_WX_LIB_CONF.call(:USE_DATETIME)
1673
+ _ADD_WX_LIB_CONF.call(:USE_TIMER)
1674
+ _ADD_WX_LIB_CONF.call(:USE_STOPWATCH)
1675
+ _ADD_WX_LIB_CONF.call(:USE_CONFIG)
1676
+ _ADD_WX_LIB_CONF_NODEF.call(:USE_CONFIG_NATIVE)
1677
+ _ADD_WX_LIB_CONF.call(:USE_DIALUP_MANAGER)
1678
+ _ADD_WX_LIB_CONF.call(:USE_DYNLIB_CLASS)
1679
+ _ADD_WX_LIB_CONF.call(:USE_DYNAMIC_LOADER)
1680
+ _ADD_WX_LIB_CONF.call(:USE_SOCKETS)
1681
+ _ADD_WX_LIB_CONF.call(:USE_FILESYSTEM)
1682
+ _ADD_WX_LIB_CONF.call(:USE_FS_ZIP)
1683
+ _ADD_WX_LIB_CONF.call(:USE_FS_INET)
1684
+ _ADD_WX_LIB_CONF.call(:USE_ZIPSTREAM)
1685
+ _ADD_WX_LIB_CONF.call(:USE_ZLIB)
1686
+ _ADD_WX_LIB_CONF.call(:USE_APPLE_IEEE)
1687
+ _ADD_WX_LIB_CONF.call(:USE_JOYSTICK)
1688
+ _ADD_WX_LIB_CONF.call(:USE_FONTMAP)
1689
+ _ADD_WX_LIB_CONF.call(:USE_MIMETYPE)
1690
+ _ADD_WX_LIB_CONF.call(:USE_PROTOCOL)
1691
+ _ADD_WX_LIB_CONF.call(:USE_PROTOCOL_FILE)
1692
+ _ADD_WX_LIB_CONF.call(:USE_PROTOCOL_FTP)
1693
+ _ADD_WX_LIB_CONF.call(:USE_PROTOCOL_HTTP)
1694
+ _ADD_WX_LIB_CONF.call(:USE_URL)
1695
+ _ADD_WX_LIB_CONF_NODEF.call(:USE_URL_NATIVE)
1696
+ _ADD_WX_LIB_CONF.call(:USE_REGEX)
1697
+ _ADD_WX_LIB_CONF.call(:USE_SYSTEM_OPTIONS)
1698
+ _ADD_WX_LIB_CONF.call(:USE_SOUND)
1699
+ _ADD_WX_LIB_CONF_NODEF.call(:USE_XRC)
1700
+ _ADD_WX_LIB_CONF.call(:USE_XML)
1701
+
1702
+ # Set them to use check box.
1703
+ pg.set_property_attribute(pid, Wx::PG::PG_BOOL_USE_CHECKBOX, true, Wx::PG::PG_RECURSE)
1704
+ end
1705
+
1706
+ def on_close_click(event)
1707
+ close(false)
1708
+ end
1709
+
1710
+ def on_colour_scheme(event)
1711
+ id = event.id
1712
+ if id == ID::COLOURSCHEME1
1713
+ @propGridManager.grid.reset_colours
1714
+ elsif id == ID::COLOURSCHEME2
1715
+ # white
1716
+ my_grey_1 = Wx::Colour.new(212,208,200)
1717
+ my_grey_3 = Wx::Colour.new(113,111,100)
1718
+ @propGridManager.freeze
1719
+ @propGridManager.grid.set_margin_colour(Wx::WHITE)
1720
+ @propGridManager.grid.set_caption_background_colour(Wx::WHITE)
1721
+ @propGridManager.grid.set_cell_background_colour(Wx::WHITE)
1722
+ @propGridManager.grid.set_cell_text_colour(my_grey_3)
1723
+ @propGridManager.grid.set_line_colour(my_grey_1)
1724
+ @propGridManager.thaw
1725
+ elsif id == ID::COLOURSCHEME3
1726
+ # .NET
1727
+ my_grey_1 = Wx::Colour.new(212,208,200)
1728
+ my_grey_2 = Wx::Colour.new(236,233,216)
1729
+ @propGridManager.freeze
1730
+ @propGridManager.grid.set_margin_colour(my_grey_1)
1731
+ @propGridManager.grid.set_caption_background_colour(my_grey_1)
1732
+ @propGridManager.grid.set_line_colour(my_grey_1)
1733
+ @propGridManager.thaw
1734
+ elsif id == ID::COLOURSCHEME4
1735
+ # cream
1736
+ my_grey_1 = Wx::Colour.new(212,208,200)
1737
+ my_grey_2 = Wx::Colour.new(241,239,226)
1738
+ my_grey_3 = Wx::Colour.new(113,111,100)
1739
+ @propGridManager.freeze
1740
+ @propGridManager.grid.set_margin_colour(Wx::WHITE)
1741
+ @propGridManager.grid.set_caption_background_colour(Wx::WHITE)
1742
+ @propGridManager.grid.set_cell_background_colour(my_grey_2)
1743
+ @propGridManager.grid.set_cell_background_colour(my_grey_2)
1744
+ @propGridManager.grid.set_cell_text_colour(my_grey_3)
1745
+ @propGridManager.grid.set_line_colour(my_grey_1)
1746
+ @propGridManager.thaw
1747
+ end
1748
+ end
1749
+
1750
+ def on_insert_prop_click(event)
1751
+ if @propGridManager.grid.root.get_child_count == 0
1752
+ Wx.message_box("No items to relate - first add some with Append.")
1753
+ return
1754
+ end
1755
+
1756
+ id = @propGridManager.grid.get_selection
1757
+ unless id
1758
+ Wx.message_box("First select a property - new one will be inserted right before that.")
1759
+ return
1760
+ end
1761
+
1762
+ propLabel = FormMain.generate_unique_property_label(@propGridManager, 'Property')
1763
+
1764
+ @propGridManager.insert(@propGridManager.get_property_parent(id),
1765
+ id.get_index_in_parent,
1766
+ Wx::PG::StringProperty.new(propLabel))
1767
+ end
1768
+
1769
+ def on_append_prop_click(event)
1770
+ propLabel = FormMain.generate_unique_property_label(@propGridManager, 'Property')
1771
+
1772
+ @propGridManager.append(Wx::PG::StringProperty.new(propLabel))
1773
+
1774
+ @propGridManager.refresh
1775
+ end
1776
+
1777
+ def on_clear_click(event)
1778
+ @propGridManager.grid.clear
1779
+ end
1780
+
1781
+ def on_append_cat_click(event)
1782
+ propLabel = FormMain.generate_unique_property_label(@propGridManager, 'Category')
1783
+
1784
+ @propGridManager.append(Wx::PG::PropertyCategory.new(propLabel))
1785
+
1786
+ @propGridManager.refresh
1787
+ end
1788
+
1789
+ def on_insert_cat_click(event)
1790
+ if @propGridManager.grid.root.get_child_count == 0
1791
+ Wx.message_box("No items to relate - first add some with Append.")
1792
+ return
1793
+ end
1794
+
1795
+ id = @propGridManager.grid.get_selection
1796
+ unless id
1797
+ Wx.message_box("First select a property - new one will be inserted right before that.")
1798
+ return
1799
+ end
1800
+
1801
+ propLabel = FormMain.generate_unique_property_label(@propGridManager, 'Category')
1802
+
1803
+ @propGridManager.insert(@propGridManager.get_property_parent(id),
1804
+ id.get_index_in_parent,
1805
+ Wx::PG::PropertyCategory.new(propLabel))
1806
+ end
1807
+
1808
+ def on_del_prop_click(event)
1809
+ id = @propGridManager.grid.get_selection
1810
+ unless id
1811
+ Wx.message_box("First select a property.")
1812
+ return
1813
+ end
1814
+
1815
+ @propGridManager.delete_property(id)
1816
+ end
1817
+
1818
+ def on_del_prop_r_click(event)
1819
+ # Delete random property
1820
+ p = @propGridManager.grid.root
1821
+
1822
+ while true
1823
+ break if p.get_child_count == 0
1824
+
1825
+ n = rand(p.get_child_count)
1826
+ p = p.item(n)
1827
+
1828
+ if !p.category?
1829
+ label = p.get_label
1830
+ @propGridManager.delete_property(p)
1831
+ Wx.log_message("Property deleted: %s", label)
1832
+ break
1833
+ end
1834
+ end
1835
+ end
1836
+
1837
+ def on_context_menu(event)
1838
+ Wx.log_debug("FormMain::OnContextMenu(%i,%i)",
1839
+ event.get_position.x,event.get_position.y)
1840
+ end
1841
+
1842
+ def on_enable_disable(event)
1843
+ id = @propGridManager.grid.get_selection
1844
+ unless id
1845
+ Wx.message_box("First select a property.")
1846
+ return
1847
+ end
1848
+
1849
+ if @propGridManager.is_property_enabled(id)
1850
+ @propGridManager.disable_property(id)
1851
+ @itemEnable.set_item_label("Enable")
1852
+ else
1853
+ @propGridManager.enable_property(id)
1854
+ @itemEnable.set_item_label("Disable")
1855
+ end
1856
+ end
1857
+
1858
+ def on_set_read_only(event)
1859
+ id = @propGridManager.grid.get_selection
1860
+ unless id
1861
+ Wx.message_box("First select a property.")
1862
+ return
1863
+ end
1864
+ @propGridManager.set_property_read_only(id)
1865
+ end
1866
+
1867
+ def on_hide(event)
1868
+ id = @propGridManager.grid.get_selection
1869
+ unless id
1870
+ Wx.message_box("First select a property.")
1871
+ return
1872
+ end
1873
+ @propGridManager.hide_property(id, true)
1874
+ end
1875
+
1876
+ def on_bool_checkbox(evt)
1877
+ @propGridManager.set_property_attribute_all(Wx::PG::PG_BOOL_USE_CHECKBOX, evt.checked?)
1878
+ end
1879
+
1880
+ def on_set_background_colour(event)
1881
+ pg = @propGridManager.grid
1882
+ prop = pg.get_selection
1883
+ unless prop
1884
+ Wx.message_box("First select a property.")
1885
+ return
1886
+ end
1887
+
1888
+ col = Wx.get_colour_from_user(self, Wx::WHITE, "Choose colour")
1889
+
1890
+ if col.ok?
1891
+ flags = (event.id==ID::SETBGCOLOURRECUR) ? Wx::PG::PG_RECURSE : 0
1892
+ pg.set_property_background_colour(prop, col, flags)
1893
+ end
1894
+ end
1895
+
1896
+ def on_clear_modify_status_click(event)
1897
+ @propGridManager.clear_modified_status
1898
+ @propGridManager.refresh
1899
+ end
1900
+
1901
+ def on_freeze_click(event)
1902
+ return unless @propGridManager
1903
+
1904
+ if event.checked?
1905
+ unless @propGridManager.is_frozen
1906
+ @propGridManager.freeze
1907
+ end
1908
+ else
1909
+ if @propGridManager.frozen?
1910
+ @propGridManager.thaw
1911
+ @propGridManager.refresh
1912
+ end
1913
+ end
1914
+ end
1915
+
1916
+ def on_enable_label_editing(event)
1917
+ @labelEditingEnabled = event.checked?
1918
+ @propGrid.make_column_editable(0, @labelEditingEnabled)
1919
+ end
1920
+
1921
+ if Wx.has_feature?(:USE_HEADERCTRL)
1922
+ def on_show_header(event)
1923
+ @hasHeader = event.checked?
1924
+ @propGridManager.show_header(@hasHeader)
1925
+ if @hasHeader
1926
+ @propGridManager.set_column_title(2, "Units")
1927
+ end
1928
+ end
1929
+ end
1930
+
1931
+ def on_dump_list(event)
1932
+ values = @propGridManager.get_property_values("list", nil, Wx::PG::PG_INC_ATTRIBUTES)
1933
+ text = "This only tests that wxVariant related routines do not crash.\n"
1934
+
1935
+ Wx.Dialog(self, Wx::ID_ANY,"wxVariant Test",
1936
+ Wx::DEFAULT_POSITION,Wx::DEFAULT_SIZE,Wx::DEFAULT_DIALOG_STYLE|Wx::RESIZE_BORDER) do |dlg|
1937
+ values.get_count.times do |i|
1938
+ v = values[i]
1939
+
1940
+ strValue = v.to_s
1941
+
1942
+ if v.name.end_with?("@attr")
1943
+ text << "Attributes:\n"
1944
+
1945
+ v.count.times do |n|
1946
+ a = v[n]
1947
+
1948
+ t = " attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n" % [n , a.name, a.type, a.to_s]
1949
+ text << t
1950
+ end
1951
+ else
1952
+ t = "%i: name=\"%s\" type=\"%s\" value=\"%s\"\n" % [i, v.name, v.type, strValue]
1953
+ text << t
1954
+ end
1955
+ end
1956
+
1957
+ # multi-line text editor dialog
1958
+ spacing = 8;
1959
+ topsizer = Wx::BoxSizer.new(Wx::VERTICAL)
1960
+ rowsizer = Wx::BoxSizer.new(Wx::HORIZONTAL)
1961
+ ed = Wx::TextCtrl.new(dlg, Wx::ID_ANY, text, style: Wx::TE_MULTILINE|Wx::TE_READONLY)
1962
+ rowsizer.add(ed, Wx::SizerFlags.new(1).expand.border(Wx::ALL, spacing))
1963
+ topsizer.add(rowsizer, Wx::SizerFlags.new(1).expand)
1964
+ rowsizer = Wx::BoxSizer.new(Wx::HORIZONTAL)
1965
+ rowsizer.add(Wx::Button.new(dlg, Wx::ID_OK, "Ok"),
1966
+ Wx::SizerFlags.new.centre_horizontal.centre_vertical.border(Wx::Direction::BOTTOM|Wx::LEFT|Wx::RIGHT, spacing))
1967
+ topsizer.add(rowsizer, Wx::SizerFlags.new.right)
1968
+
1969
+ dlg.set_sizer(topsizer)
1970
+ topsizer.set_size_hints(dlg)
1971
+
1972
+ dlg.set_size([400,300])
1973
+ dlg.centre
1974
+ dlg.show_modal
1975
+ end
1976
+ end
1977
+
1978
+ def on_cat_colours_update_ui(event)
1979
+ # Prevent menu item from being checked
1980
+ # if it is selected from improper page.
1981
+ pg = @propGridManager.grid
1982
+ @itemCatColours.enable(
1983
+ !!(pg.get_property_by_name("Appearance") &&
1984
+ pg.get_property_by_name("PositionCategory") &&
1985
+ pg.get_property_by_name("Environment") &&
1986
+ pg.get_property_by_name("More Examples"))
1987
+ )
1988
+ end
1989
+
1990
+ def on_cat_colours(event)
1991
+ pg = @propGridManager.grid
1992
+ unless !!(pg.get_property_by_name("Appearance") &&
1993
+ pg.get_property_by_name("PositionCategory") &&
1994
+ pg.get_property_by_name("Environment") &&
1995
+ pg.get_property_by_name("More Examples"))
1996
+ Wx.message_box("First switch to 'Standard Items' page!")
1997
+ return
1998
+ end
1999
+
2000
+ @propGridManager.freeze
2001
+
2002
+ if event.checked?
2003
+ # Set custom colours.
2004
+ pg.set_property_text_colour("Appearance", Wx::Colour.new(255,0,0), Wx::PG::PG_DONT_RECURSE)
2005
+ pg.set_property_background_colour("Appearance", Wx::Colour.new(255,255,183))
2006
+ pg.set_property_text_colour("Appearance", Wx::Colour.new(255,0,183))
2007
+ pg.set_property_text_colour("PositionCategory", Wx::Colour.new(0,255,0), Wx::PG::PG_DONT_RECURSE)
2008
+ pg.set_property_background_colour("PositionCategory", Wx::Colour.new(255,226,190))
2009
+ pg.set_property_text_colour("PositionCategory", Wx::Colour.new(255,0,190))
2010
+ pg.set_property_text_colour("Environment", Wx::Colour.new(0,0,255), Wx::PG::PG_DONT_RECURSE)
2011
+ pg.set_property_background_colour("Environment", Wx::Colour.new(208,240,175))
2012
+ pg.set_property_text_colour("Environment", Wx::Colour.new(255,255,255))
2013
+ pg.set_property_background_colour("More Examples", Wx::Colour.new(172,237,255))
2014
+ pg.set_property_text_colour("More Examples", Wx::Colour.new(172,0,255))
2015
+ else
2016
+ # Revert to original.
2017
+ pg.set_property_colours_to_default("Appearance")
2018
+ pg.set_property_colours_to_default("Appearance", Wx::PG::PG_RECURSE)
2019
+ pg.set_property_colours_to_default("PositionCategory")
2020
+ pg.set_property_colours_to_default("PositionCategory", Wx::PG::PG_RECURSE)
2021
+ pg.set_property_colours_to_default("Environment")
2022
+ pg.set_property_colours_to_default("Environment", Wx::PG::PG_RECURSE)
2023
+ pg.set_property_colours_to_default("More Examples", Wx::PG::PG_RECURSE)
2024
+ end
2025
+ @propGridManager.thaw
2026
+ @propGridManager.refresh
2027
+ end
2028
+
2029
+ def on_set_columns(event)
2030
+ colCount = Wx::get_number_from_user("Enter number of columns (2-20).","Columns:",
2031
+ "Change Columns", @propGridManager.get_column_count,
2032
+ 2,20)
2033
+
2034
+ if colCount != @propGridManager.column_count
2035
+ @propGridManager.set_column_count(colCount)
2036
+ end
2037
+ end
2038
+
2039
+ def on_set_virtual_width(evt)
2040
+ oldWidth = @propGridManager.current_page.get_virtual_width
2041
+ newWidth = oldWidth
2042
+ Wx.NumberEntryDialog(self, "Enter virtual width (-1-2000).", "Width:",
2043
+ "Change Virtual Width", oldWidth, -1, 2000) do |dlg|
2044
+ newWidth = dlg.value if dlg.show_modal == Wx::ID_OK
2045
+ end
2046
+ if newWidth != oldWidth
2047
+ @propGridManager.grid.set_virtual_width(newWidth)
2048
+ end
2049
+ end
2050
+
2051
+ def on_set_grid_disabled(evt)
2052
+ @propGridManager.enable(!evt.is_checked)
2053
+ end
2054
+
2055
+ def on_misc(event)
2056
+ case event.id
2057
+ when ID::STATICLAYOUT
2058
+ wsf = @propGridManager.get_window_style_flag
2059
+ if event.is_checked
2060
+ @propGridManager.set_window_style_flag(wsf|Wx::PG::PG_STATIC_LAYOUT)
2061
+ else
2062
+ @propGridManager.set_window_style_flag(wsf&~(Wx::PG::PG_STATIC_LAYOUT))
2063
+ end
2064
+ when ID::COLLAPSEALL
2065
+ pg = @propGridManager.grid
2066
+ pg.each_property(Wx::PG::PG_ITERATE_ALL) { |p| p.set_expanded(false) }
2067
+ pg.refresh_grid
2068
+ when ID::GETVALUES
2069
+ @storedValues = @propGridManager.grid.get_property_values("Test",
2070
+ @propGridManager.grid.root,
2071
+ Wx::PG::PG_KEEP_STRUCTURE|Wx::PG::PG_INC_ATTRIBUTES)
2072
+ when ID::SETVALUES
2073
+ if @storedValues && @storedValues.is_type("list")
2074
+ @propGridManager.grid.set_property_values(@storedValues)
2075
+ else
2076
+ Wx.message_box("First use Get Property Values.")
2077
+ end
2078
+ when ID::SETVALUES2
2079
+ list = Wx::Variant.new([ Wx::Variant.new(1234, "VariantLong"),
2080
+ Wx::Variant.new(true,"VariantBool") ])
2081
+ list.append(Wx::Variant.new("Test Text", "VariantString"))
2082
+ @propGridManager.grid.set_property_values(list)
2083
+ when ID::COLLAPSE
2084
+ # Collapses selected.
2085
+ selProp = @propGridManager.selection
2086
+ @propGridManager.collapse(selProp) if selProp
2087
+ when ID::RUNTESTFULL
2088
+ # Runs a regression test.
2089
+ run_tests(true)
2090
+ when ID::RUNTESTPARTIAL
2091
+ # Runs a regression test.
2092
+ run_tests(false)
2093
+ when ID::UNSPECIFY
2094
+ prop = @propGridManager.selection
2095
+ if prop
2096
+ @propGridManager.set_property_value_unspecified(prop)
2097
+ prop.refresh_editor
2098
+ end
2099
+ end
2100
+ end
2101
+
2102
+ def on_populate_click(event)
2103
+ id = event.id
2104
+ @propGrid.clear
2105
+ @propGrid.freeze
2106
+ if id == ID::POPULATE1
2107
+ populate_with_standard_items
2108
+ elsif id == ID::POPULATE2
2109
+ populate_with_library_config
2110
+ end
2111
+ @propGrid.thaw
2112
+ end
2113
+
2114
+ def on_set_spin_ctrl_editor_click(event)
2115
+ if Wx.has_feature? :USE_SPINBTN
2116
+ pgId = @propGridManager.get_selection
2117
+ if pgId
2118
+ @propGridManager.set_property_editor(pgId, Wx::PG::PG_EDITOR_SPIN_CTRL)
2119
+ else
2120
+ Wx.message_box("First select a property")
2121
+ end
2122
+ end
2123
+ end
2124
+
2125
+ def on_test_replace_click(event)
2126
+ pgId = @propGridManager.selection
2127
+ if pgId
2128
+ choices = Wx::PG::PGChoices.new
2129
+ choices.add("Flag 0", 0x0001)
2130
+ choices.add("Flag 1", 0x0002)
2131
+ choices.add("Flag 2", 0x0004)
2132
+ choices.add("Flag 3", 0x0008)
2133
+ maxVal = 0x000F
2134
+ # Look for unused property name
2135
+ propName = "ReplaceFlagsProperty"
2136
+ idx = 0;
2137
+ while @propGridManager.get_property_by_name(propName)
2138
+ propName = "ReplaceFlagsProperty %i" % (idx += 1)
2139
+ end
2140
+ # Replace property and select new one
2141
+ # with random value in range [1..maxVal]
2142
+ propVal = Time.now.to_i % maxVal + 1
2143
+ newId = @propGridManager.replace_property(pgId, Wx::FlagsProperty.new(propName, Wx::PG::PG_LABEL,
2144
+ choices, propVal))
2145
+ @propGridManager.set_property_attribute(newId, Wx::PG::PG_BOOL_USE_CHECKBOX,
2146
+ true, Wx::PG::PG_RECURSE)
2147
+ @propGridManager.select_property(newId)
2148
+ else
2149
+ Wx.message_box("First select a property")
2150
+ end
2151
+ end
2152
+
2153
+ def on_test_xrc(event)
2154
+ Wx.message_box("Sorry, not yet implemented")
2155
+ end
2156
+
2157
+ def on_enable_common_values(event)
2158
+ prop = @propGridManager.selection
2159
+ if prop
2160
+ prop.enable_common_value
2161
+ else
2162
+ Wx.message_box("First select a property")
2163
+ end
2164
+ end
2165
+
2166
+ def on_select_style(event)
2167
+ extraStyle = style = 0
2168
+ names, values = %w[
2169
+ PG_HIDE_CATEGORIES
2170
+ PG_AUTO_SORT
2171
+ PG_BOLD_MODIFIED
2172
+ PG_SPLITTER_AUTO_CENTER
2173
+ PG_TOOLTIPS
2174
+ PG_STATIC_SPLITTER
2175
+ PG_HIDE_MARGIN
2176
+ PG_LIMITED_EDITING
2177
+ PG_TOOLBAR
2178
+ PG_DESCRIPTION
2179
+ PG_NO_INTERNAL_BORDER
2180
+ ].inject([[],[]]) { |set, name| set[0] << "Wx::PG::#{name}"; set[1] << Wx::PG.const_get(name); set }
2181
+ flags = @propGridManager.get_window_style
2182
+ Wx.MultiChoiceDialog(self, "Select window styles to use",
2183
+ "wxPropertyGrid Window Style", names) do |dlg|
2184
+ sel = []
2185
+ values.each_with_index { |val, ix| sel << ix if (flags & val) == val }
2186
+ dlg.set_selections(sel)
2187
+ return if dlg.show_modal == Wx::ID_CANCEL
2188
+
2189
+ flags = 0
2190
+ sel = dlg.selections
2191
+ sel.each { |ix| flags |= values[ix] }
2192
+ style = flags
2193
+ end
2194
+
2195
+ names, values = %w[
2196
+ PG_EX_INIT_NOCAT
2197
+ PG_EX_NO_FLAT_TOOLBAR
2198
+ PG_EX_MODE_BUTTONS
2199
+ PG_EX_HELP_AS_TOOLTIPS
2200
+ PG_EX_NATIVE_DOUBLE_BUFFERING
2201
+ PG_EX_AUTO_UNSPECIFIED_VALUES
2202
+ PG_EX_WRITEONLY_BUILTIN_ATTRIBUTES
2203
+ PG_EX_HIDE_PAGE_BUTTONS
2204
+ PG_EX_MULTIPLE_SELECTION
2205
+ PG_EX_ENABLE_TLP_TRACKING
2206
+ PG_EX_NO_TOOLBAR_DIVIDER
2207
+ PG_EX_TOOLBAR_SEPARATOR
2208
+ PG_EX_ALWAYS_ALLOW_FOCUS
2209
+ ].inject([[],[]]) { |set, name| set[0] << "Wx::PG::#{name}"; set[1] << Wx::PG.const_get(name); set }
2210
+ flags = @propGridManager.get_extra_style
2211
+ Wx.MultiChoiceDialog(self, "Select extra window styles to use",
2212
+ "wxPropertyGrid Extra Style", names) do |dlg|
2213
+ sel = []
2214
+ values.each_with_index { |val, ix| sel << ix if (flags & val) == val }
2215
+ dlg.set_selections(sel)
2216
+ return if dlg.show_modal == Wx::ID_CANCEL
2217
+
2218
+ flags = 0
2219
+ sel = dlg.selections
2220
+ sel.each { |ix| flags |= values[ix] }
2221
+ extraStyle = flags
2222
+ end
2223
+
2224
+ replace_grid(style, extraStyle)
2225
+ end
2226
+
2227
+ def on_fit_columns_click(event)
2228
+ page = @propGridManager.get_current_page
2229
+
2230
+ # Remove auto-centering
2231
+ @propGridManager.set_window_style(@propGridManager.get_window_style & ~Wx::PG::PG_SPLITTER_AUTO_CENTER)
2232
+
2233
+ # Grow manager size just prior fit - otherwise
2234
+ # column information may be lost.
2235
+ oldGridSize = @propGridManager.grid.get_client_size
2236
+ oldFullSize = self.size
2237
+ self.size = ([1000, oldFullSize.height])
2238
+
2239
+ newSz = page.fit_columns
2240
+
2241
+ dx = oldFullSize.width - oldGridSize.width;
2242
+ dy = oldFullSize.height - oldGridSize.height;
2243
+
2244
+ newSz.inc_by(dx, dy)
2245
+
2246
+ self.size = newSz
2247
+ end
2248
+
2249
+ def on_change_flags_prop_items_click(event)
2250
+ p = @propGridManager.get_property_by_name("Window Styles")
2251
+
2252
+ newChoices = Wx::PG::PGChoices.new
2253
+ newChoices.add("Fast",0x1)
2254
+ newChoices.add("Powerful",0x2)
2255
+ newChoices.add("Safe",0x4)
2256
+ newChoices.add("Sleek",0x8)
2257
+
2258
+ p.set_choices(newChoices)
2259
+ end
2260
+
2261
+ # def on_save_to_file_click(event) end
2262
+
2263
+ # def on_load_from_file_click(event) end
2264
+
2265
+ def on_set_property_value(event)
2266
+ pg = @propGridManager.grid
2267
+ selected = pg.selection
2268
+
2269
+ if selected
2270
+ value = Wx.get_text_from_user("Enter new value:")
2271
+ pg.set_property_value(selected, value)
2272
+ end
2273
+ end
2274
+
2275
+ def on_insert_choice(event)
2276
+ pg = @propGridManager.grid
2277
+ selected = pg.selection
2278
+
2279
+ if selected
2280
+ choices = selected.choices
2281
+
2282
+ if choices.ok?
2283
+ # Insert new choice to the center of list
2284
+ pos = choices.count / 2
2285
+ selected.insert_choice("New Choice", pos)
2286
+ return
2287
+ end
2288
+ end
2289
+
2290
+ Wx.message_box("First select a property with some choices.")
2291
+ end
2292
+
2293
+ def on_delete_choice(event)
2294
+ pg = @propGridManager.grid
2295
+ selected = pg.selection
2296
+
2297
+ if selected
2298
+ choices = selected.choices
2299
+
2300
+ if choices.ok?
2301
+ # Deletes choice from the center of list
2302
+ pos = choices.count / 2
2303
+ selected.delete_choice(pos)
2304
+ return
2305
+ end
2306
+ end
2307
+
2308
+ Wx.message_box("First select a property with some choices.")
2309
+ end
2310
+
2311
+ def on_insert_page(event)
2312
+ @propGridManager.add_page("New Page")
2313
+ end
2314
+
2315
+ def on_remove_page(event)
2316
+ @propGridManager.remove_page(@propGridManager.get_selected_page)
2317
+ end
2318
+
2319
+ def on_save_state(event)
2320
+ @savedState = @propGridManager.save_editable_state
2321
+ Wx.log_debug("Saved editable state string: \"%s\"", @savedState)
2322
+ end
2323
+
2324
+ def on_restore_state(event)
2325
+ @propGridManager.restore_editable_state(@savedState) if @savedState
2326
+ end
2327
+
2328
+ def on_run_minimal_click(event)
2329
+ display_minimal_frame(self)
2330
+ end
2331
+
2332
+ def iterate_message(prop)
2333
+ s = "\"%s\" class = %s, valuetype = %s" % [prop.label, prop.class.name, prop.value_type]
2334
+
2335
+ Wx.message_box(s, "Iterating... (press CANCEL to end)", Wx::OK|Wx::CANCEL)
2336
+ end
2337
+ private :iterate_message
2338
+
2339
+ def on_iterate1_click(event)
2340
+ @propGridManager.get_current_page.each_property do |p|
2341
+ break if iterate_message(p) == Wx::CANCEL
2342
+ end
2343
+ end
2344
+
2345
+ def on_iterate2_click(event)
2346
+ @propGridManager.get_current_page.each_property(Wx::PG::PG_ITERATE_VISIBLE) do |p|
2347
+ break if iterate_message(p) == Wx::CANCEL
2348
+ end
2349
+ end
2350
+
2351
+ def on_iterate3_click(event)
2352
+ @propGridManager.get_current_page.properties_reversed(Wx::PG::PG_ITERATE_DEFAULT).each do |p|
2353
+ break if iterate_message(p) == Wx::CANCEL
2354
+ end
2355
+ end
2356
+
2357
+ def on_iterate4_click(event)
2358
+ @propGridManager.get_current_page.each_property(Wx::PG::PG_ITERATE_CATEGORIES) do |p|
2359
+ break if iterate_message(p) == Wx::CANCEL
2360
+ end
2361
+ end
2362
+
2363
+ def on_extended_key_nav(event)
2364
+ # Use AddActionTrigger() and DedicateKey() to set up Enter,
2365
+ # Up, and Down keys for navigating between properties.
2366
+ propGrid = @propGridManager.grid
2367
+
2368
+ propGrid.add_action_trigger(Wx::PG::PG_ACTION_NEXT_PROPERTY,
2369
+ Wx::K_RETURN)
2370
+ propGrid.dedicate_key(Wx::K_RETURN)
2371
+
2372
+ # Up and Down keys are already associated with navigation,
2373
+ # but we must also prevent them from being eaten by
2374
+ # editor controls.
2375
+ propGrid.dedicate_key(Wx::K_UP)
2376
+ propGrid.dedicate_key(Wx::K_DOWN)
2377
+ end
2378
+
2379
+ def on_property_grid_change(event)
2380
+ property = event.property
2381
+
2382
+ name = property.name
2383
+
2384
+ # Properties store values internally as wxVariants, but it is preferred
2385
+ # to use the more modern wxAny at the interface level in C++
2386
+ # wxRuby however does not support wxAny and does not need to as Variants map
2387
+ # pretty seamless to Ruby
2388
+ value = property.value
2389
+
2390
+ # Don't handle 'unspecified' values
2391
+ return if value.null?
2392
+
2393
+ # Some settings are disabled outside Windows platform
2394
+ if name == "X"
2395
+ set_size(value.to_i, -1, -1, -1, Wx::SIZE_USE_EXISTING)
2396
+ elsif name == "Y"
2397
+ set_size(-1, value.to_i, -1, -1, Wx::SIZE_USE_EXISTING)
2398
+ elsif ( name == "Width" )
2399
+ set_size(-1, -1, value.to_i, -1, Wx::SIZE_USE_EXISTING)
2400
+ elsif name == "Height"
2401
+ set_size( -1, -1, -1, value.to_i, Wx::SIZE_USE_EXISTING)
2402
+ elsif name == "Label"
2403
+ set_title(value.to_s)
2404
+ elsif name == "Font"
2405
+ font = value.font
2406
+ unless font.ok?
2407
+ Wx.message_box('Invalid font!')
2408
+ return
2409
+ end
2410
+ @propGridManager.set_font(font)
2411
+ elsif name == "Margin Colour"
2412
+ cpv = value.colour_property_value
2413
+ @propGridManager.grid.set_margin_colour(cpv.colour_)
2414
+ elsif name == "Cell Colour"
2415
+ cpv = value.colour_property_value
2416
+ @propGridManager.grid.set_cell_background_colour(cpv.colour_)
2417
+ elsif name == "Line Colour"
2418
+ cpv = value.colour_property_value
2419
+ @propGridManager.grid.set_line_colour(cpv.colour_)
2420
+ elsif name == "Cell Text Colour"
2421
+ cpv = value.colour_property_value
2422
+ @propGridManager.grid.set_cell_text_colour(cpv.colour_)
2423
+ end
2424
+ end
2425
+
2426
+ def on_property_grid_changing(event)
2427
+ p = event.property
2428
+
2429
+ if p.name == "Font"
2430
+ res = Wx.message_box("'%s' is about to change (to variant of type '%s')\n\nAllow or deny?" %
2431
+ [p.name, event.value.type],
2432
+ "Testing wxEVT_PG_CHANGING", Wx::YES_NO, @propGridManager)
2433
+ if res == Wx::NO
2434
+ Kernel.raise 'Must be able to Veto event' unless event.can_veto?
2435
+
2436
+ event.veto
2437
+
2438
+ # Since we ask a question, it is better if we omit any validation
2439
+ # failure behaviour.
2440
+ event.set_validation_failure_behavior(0)
2441
+ end
2442
+ end
2443
+ end
2444
+
2445
+ def on_property_grid_select(event)
2446
+ property = event.property
2447
+ if property
2448
+ @itemEnable.enable(true)
2449
+ if property.enabled?
2450
+ @itemEnable.set_item_label("Disable")
2451
+ else
2452
+ @itemEnable.set_item_label("Enable")
2453
+ end
2454
+ else
2455
+ @itemEnable.enable(false)
2456
+ end
2457
+
2458
+ if Wx.has_feature? :USE_STATUSBAR
2459
+ prop = event.property
2460
+ sb = self.status_bar
2461
+ if prop
2462
+ text = "Selected: "
2463
+ text << @propGridManager.get_property_label(prop)
2464
+ sb.set_status_text(text)
2465
+ end
2466
+ end
2467
+ end
2468
+
2469
+ def on_property_grid_highlight(event)
2470
+ end
2471
+
2472
+ def on_property_grid_item_right_click(event)
2473
+ if Wx.has_feature? :USE_STATUSBAR
2474
+ prop = event.property
2475
+ sb = self.status_bar
2476
+ if prop
2477
+ text = "Right-clicked: "
2478
+ text << prop.label
2479
+ text << ", name=";
2480
+ text << @propGridManager.get_property_name(prop)
2481
+ sb.set_status_text(text)
2482
+ else
2483
+ sb.set_status_text('')
2484
+ end
2485
+ end
2486
+ end
2487
+
2488
+ def on_property_grid_item_double_click(event)
2489
+ if Wx.has_feature? :USE_STATUSBAR
2490
+ prop = event.property
2491
+ sb = self.status_bar
2492
+ if prop
2493
+ text = "Double-clicked: "
2494
+ text << prop.label
2495
+ text << ", name="
2496
+ text << @propGridManager.get_property_name(prop)
2497
+ sb.set_status_text(text)
2498
+ else
2499
+ sb.set_status_text('')
2500
+ end
2501
+ end
2502
+ end
2503
+
2504
+ def on_property_grid_page_change(event)
2505
+ if Wx.has_feature? :USE_STATUSBAR
2506
+ sb = self.status_bar
2507
+ text = "Page Changed: "
2508
+ text << @propGridManager.get_page_name(@propGridManager.get_selected_page)
2509
+ sb.set_status_text(text)
2510
+ end
2511
+ end
2512
+
2513
+ def on_property_grid_button_click(event)
2514
+ if Wx.has_feature? :USE_STATUSBAR
2515
+ prop = @propGridManager.selection
2516
+ sb = self.status_bar
2517
+ if prop
2518
+ text = "Button clicked: "
2519
+ text << @propGridManager.get_property_label(prop)
2520
+ text << ", name="
2521
+ text << @propGridManager.get_property_name(prop)
2522
+ sb.set_status_text(text)
2523
+ else
2524
+ Wx.message_box("SHOULD NOT HAPPEN!!!")
2525
+ end
2526
+ end
2527
+ end
2528
+
2529
+ def on_property_grid_text_update(event)
2530
+ event.skip
2531
+ end
2532
+
2533
+ def on_property_grid_key_event(event)
2534
+ end
2535
+
2536
+ def on_property_grid_item_collapse(event)
2537
+ Wx.log_message("Item was Collapsed")
2538
+ end
2539
+
2540
+ def on_property_grid_item_expand(event)
2541
+ Wx.log_message("Item was Expanded")
2542
+ end
2543
+
2544
+ def on_property_grid_label_edit_begin(event)
2545
+ Wx.log_message("PG_EVT_LABEL_EDIT_BEGIN(%s)", event.property.label)
2546
+ end
2547
+
2548
+ def on_property_grid_label_edit_ending(event)
2549
+ Wx.log_message("PG_EVT_LABEL_EDIT_ENDING(%s)", event.property.label)
2550
+ end
2551
+
2552
+ def on_property_grid_col_begin_drag(event)
2553
+ if @itemVetoDragging.is_checked
2554
+ Wx.log_message("Splitter %i resize was vetoed", event.column)
2555
+ event.veto
2556
+ else
2557
+ Wx.log_debug("Splitter %i resize began", event.column)
2558
+ end
2559
+ end
2560
+
2561
+ def on_property_grid_col_dragging(event)
2562
+ end
2563
+
2564
+ def on_property_grid_col_end_drag(event)
2565
+ Wx.log_debug("Splitter %i resize ended", event.column)
2566
+ end
2567
+
2568
+ def on_about(event)
2569
+ toolkit = "%s %i.%i.%i" % [Wx::PlatformInfo.get_port_id_name,
2570
+ Wx::PlatformInfo.get_toolkit_major_version,
2571
+ Wx::PlatformInfo.get_toolkit_minor_version,
2572
+ Wx::PlatformInfo.get_toolkit_micro_version]
2573
+ msg = ("wxRuby PropertyGrid Sample" +
2574
+ if Wx.has_feature? :USE_UNICODE
2575
+ if Wx.has_feature?(:USE_UNICODE_UTF8) && Wx.has_feature?(:USE_UNICODE_UTF8)
2576
+ " <utf-8>"
2577
+ else
2578
+ " <unicode>"
2579
+ end
2580
+ else
2581
+ " <ansi>"
2582
+ end +
2583
+ if Wx::RB_DEBUG
2584
+ " <debug>"
2585
+ else
2586
+ " <release>"
2587
+ end +
2588
+ "\n\n" +
2589
+ "Programmed by %s\n\n" +
2590
+ "Using wxRuby %s (wxWidgets %s; %s)\n\n") %
2591
+ ["Martin Corino (C++ original by Jaakko Salli)", Wx::WXRUBY_VERSION, Wx::WXWIDGETS_VERSION, toolkit]
2592
+
2593
+ Wx.message_box(msg, "About", Wx::OK | Wx::ICON_INFORMATION, self)
2594
+ end
2595
+
2596
+ def on_move(event)
2597
+ unless @propGridManager
2598
+ # this check is here so the frame layout can be tested
2599
+ # without creating propertygrid
2600
+ event.skip
2601
+ return
2602
+ end
2603
+
2604
+ # Update position properties
2605
+ pos = get_position
2606
+
2607
+ # Must check if properties exist (as they may be deleted).
2608
+
2609
+ # Using m_pPropGridManager, we can scan all pages automatically.
2610
+ id = @propGridManager.get_property_by_name("X")
2611
+ @propGridManager.set_property_value(id, pos.x) if id
2612
+
2613
+ id = @propGridManager.get_property_by_name("Y")
2614
+ @propGridManager.set_property_value( id, pos.y) if id
2615
+
2616
+ id = @propGridManager.get_property_by_name("Position")
2617
+ @propGridManager.set_property_value(id, pos) if id
2618
+
2619
+ # Should always call event.skip in frame's MoveEvent handler
2620
+ event.skip
2621
+ end
2622
+
2623
+ def on_resize(event)
2624
+ unless @propGridManager
2625
+ # this check is here so the frame layout can be tested
2626
+ # without creating propertygrid
2627
+ event.skip
2628
+ return
2629
+ end
2630
+
2631
+ # Update size properties
2632
+ sz = get_size
2633
+
2634
+ # Must check if properties exist (as they may be deleted).
2635
+
2636
+ # Using m_pPropGridManager, we can scan all pages automatically.
2637
+ p = @propGridManager.get_property_by_name("Width")
2638
+ @propGridManager.set_property_value(p, sz.width) if p && !p.is_value_unspecified
2639
+
2640
+ p = @propGridManager.get_property_by_name("Height")
2641
+ @propGridManager.set_property_value(p, sz.height) if p && !p.is_value_unspecified
2642
+
2643
+ id = @propGridManager.get_property_by_name("Size")
2644
+ @propGridManager.set_property_value(id, sz) if id
2645
+
2646
+ # Should always call event.skip in frame's SizeEvent handler
2647
+ event.skip
2648
+ end
2649
+
2650
+ def on_idle(event)
2651
+ event.skip
2652
+ end
2653
+
2654
+ def on_show_popup(event)
2655
+ if @popup
2656
+ @popup.destroy
2657
+ @popup = nil
2658
+ return
2659
+ end
2660
+
2661
+ @popup = PropertyGridPopup.new(self)
2662
+ pt = Wx.get_mouse_position
2663
+ @popup.position(pt, [0, 0])
2664
+ @popup.show
2665
+ end
2666
+
2667
+ def add_test_properties(pg)
2668
+ pg.append(MyColourProperty.new("CustomColourProperty", Wx::PG::PG_LABEL, Wx::GREEN))
2669
+ pg.get_property("CustomColourProperty").set_auto_unspecified(true)
2670
+ pg.set_property_editor("CustomColourProperty", Wx::PG::PG_EDITOR_COMBO_BOX)
2671
+
2672
+ pg.set_property_help_string("CustomColourProperty",
2673
+ "This is a MyColourProperty from the sample app. "+
2674
+ "It is built by subclassing wxColourProperty.")
2675
+ end
2676
+
2677
+ def run_tests(fullTest, interactive = false) end
2678
+
2679
+ end
2680
+
2681
+ module PropgridSample
2682
+
2683
+ include WxRuby::Sample if defined? WxRuby::Sample
2684
+
2685
+ def self.describe
2686
+ { file: __FILE__,
2687
+ summary: 'wxRuby PropGrid example.',
2688
+ description: 'wxRuby PropGrid example displaying frame showcasing PropgridManager.' }
2689
+ end
2690
+
2691
+ def self.activate
2692
+ frameSize = Wx::Size.new((Wx::SystemSettings.get_metric(Wx::SYS_SCREEN_X) / 10) * 4,
2693
+ (Wx::SystemSettings.get_metric(Wx::SYS_SCREEN_Y) / 10) * 8)
2694
+ frameSize.width = 500 if frameSize.width > 500
2695
+ frame = FormMain.new("wxPropertyGrid Sample", [0,0], frameSize)
2696
+ frame.show(true)
2697
+ frame
2698
+ end
2699
+
2700
+ if $0 == __FILE__
2701
+ Wx::App.run do
2702
+ gc_stress
2703
+ PropgridSample.activate
2704
+ end
2705
+ end
2706
+
2707
+ end