wxruby3 0.9.1-x64-mingw-ucrt → 0.9.3-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/INSTALL.md +35 -29
- data/README.md +24 -15
- data/ext/wxbase32u_gcc_custom.dll +0 -0
- data/ext/wxbase32u_net_gcc_custom.dll +0 -0
- data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
- data/lib/wx/aui/aui_tab_ctrl.rb +18 -0
- data/lib/wx/aui/auinotebook.rb +6 -2
- data/lib/wx/aui/require.rb +1 -0
- data/lib/wx/core/app.rb +2 -2
- data/lib/wx/core/bitmap_combobox.rb +17 -21
- data/lib/wx/core/collapsible_pane.rb +1 -1
- data/lib/wx/core/combobox.rb +13 -3
- data/lib/wx/core/controlwithitems.rb +40 -128
- data/lib/wx/core/enum.rb +17 -1
- data/lib/wx/core/event.rb +6 -1
- data/lib/wx/core/events/evt_list.rb +5 -4
- data/lib/wx/core/evthandler.rb +8 -2
- data/lib/wx/core/generic_validator.rb +312 -0
- data/lib/wx/core/listbox.rb +2 -2
- data/lib/wx/core/log.rb +1 -1
- data/lib/wx/core/menu.rb +10 -0
- data/lib/wx/core/notebook.rb +6 -2
- data/lib/wx/core/owner_drawn_combobox.rb +45 -0
- data/lib/wx/core/size.rb +4 -0
- data/lib/wx/core/sizer.rb +12 -2
- data/lib/wx/core/standard_paths.rb +22 -0
- data/lib/wx/core/task_bar_button.rb +19 -0
- data/lib/wx/core/text_entry.rb +4 -1
- data/lib/wx/core/textctrl.rb +11 -1
- data/lib/wx/core/{treectrl.rb → tree_ctrl.rb} +31 -12
- data/lib/wx/core/validator.rb +70 -5
- data/lib/wx/core/window.rb +13 -7
- data/lib/wx/doc/app.rb +48 -38
- data/lib/wx/doc/art_locator.rb +48 -43
- data/lib/wx/doc/aui/auimanager.rb +16 -8
- data/lib/wx/doc/aui/auinotebook.rb +20 -5
- data/lib/wx/doc/clipboard.rb +11 -7
- data/lib/wx/doc/colour_dialog.rb +14 -10
- data/lib/wx/doc/comboctrl.rb +18 -0
- data/lib/wx/doc/controlwithitems.rb +34 -8
- data/lib/wx/doc/data_object.rb +2 -2
- data/lib/wx/doc/date_picker_ctrl.rb +23 -0
- data/lib/wx/doc/editable_listbox.rb +44 -0
- data/lib/wx/doc/enum.rb +15 -0
- data/lib/wx/doc/event.rb +12 -0
- data/lib/wx/doc/evthandler.rb +113 -108
- data/lib/wx/doc/extra/12_client_data.md +89 -0
- data/lib/wx/doc/extra/13_validators.md +139 -0
- data/lib/wx/doc/font.rb +1 -0
- data/lib/wx/doc/gc_dc.rb +6 -1
- data/lib/wx/doc/gdi_common.rb +4 -0
- data/lib/wx/doc/gen/about_dialog_info.rb +26 -2
- data/lib/wx/doc/gen/accelerator.rb +19 -4
- data/lib/wx/doc/gen/accessible.rb +48 -47
- data/lib/wx/doc/gen/activity_indicator.rb +10 -4
- data/lib/wx/doc/gen/animation.rb +19 -3
- data/lib/wx/doc/gen/animation_ctrl.rb +16 -7
- data/lib/wx/doc/gen/any_button.rb +22 -1
- data/lib/wx/doc/gen/app.rb +41 -5
- data/lib/wx/doc/gen/app_traits.rb +65 -15
- data/lib/wx/doc/gen/art_provider.rb +33 -7
- data/lib/wx/doc/gen/aui/aui_dock_art.rb +18 -3
- data/lib/wx/doc/gen/aui/aui_floating_frame.rb +2 -0
- data/lib/wx/doc/gen/aui/aui_manager.rb +35 -8
- data/lib/wx/doc/gen/aui/aui_manager_event.rb +11 -4
- data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +4 -0
- data/lib/wx/doc/gen/aui/aui_mdi_client_window.rb +3 -0
- data/lib/wx/doc/gen/aui/aui_mdi_parent_frame.rb +8 -1
- data/lib/wx/doc/gen/aui/aui_notebook.rb +31 -7
- data/lib/wx/doc/gen/aui/aui_notebook_event.rb +5 -4
- data/lib/wx/doc/gen/aui/aui_pane_info.rb +38 -2
- data/lib/wx/doc/gen/aui/aui_tab_art.rb +9 -3
- data/lib/wx/doc/gen/aui/aui_tab_ctrl.rb +2 -1
- data/lib/wx/doc/gen/aui/aui_tool_bar.rb +20 -6
- data/lib/wx/doc/gen/aui/aui_tool_bar_art.rb +4 -2
- data/lib/wx/doc/gen/aui/aui_tool_bar_event.rb +5 -7
- data/lib/wx/doc/gen/aui/aui_tool_bar_item.rb +5 -1
- data/lib/wx/doc/gen/aui/event_list.rb +164 -160
- data/lib/wx/doc/gen/banner_window.rb +8 -1
- data/lib/wx/doc/gen/bitmap.rb +94 -16
- data/lib/wx/doc/gen/bitmap_button.rb +16 -8
- data/lib/wx/doc/gen/bitmap_combo_box.rb +20 -10
- data/lib/wx/doc/gen/book_ctrl_base.rb +31 -4
- data/lib/wx/doc/gen/book_ctrl_event.rb +9 -3
- data/lib/wx/doc/gen/box_sizer.rb +5 -1
- data/lib/wx/doc/gen/brush.rb +20 -2
- data/lib/wx/doc/gen/busy_info.rb +10 -2
- data/lib/wx/doc/gen/button.rb +31 -11
- data/lib/wx/doc/gen/calculate_layout_event.rb +5 -3
- data/lib/wx/doc/gen/calendar_ctrl.rb +38 -13
- data/lib/wx/doc/gen/calendar_date_attr.rb +2 -1
- data/lib/wx/doc/gen/calendar_event.rb +5 -2
- data/lib/wx/doc/gen/caret.rb +3 -1
- data/lib/wx/doc/gen/check_box.rb +17 -7
- data/lib/wx/doc/gen/check_list_box.rb +8 -6
- data/lib/wx/doc/gen/choice.rb +28 -9
- data/lib/wx/doc/gen/choicebook.rb +7 -7
- data/lib/wx/doc/gen/client_dc.rb +6 -2
- data/lib/wx/doc/gen/clipboard.rb +16 -3
- data/lib/wx/doc/gen/collapsible_pane.rb +9 -7
- data/lib/wx/doc/gen/collapsible_pane_event.rb +3 -3
- data/lib/wx/doc/gen/colour.rb +28 -4
- data/lib/wx/doc/gen/colour_dialog.rb +15 -7
- data/lib/wx/doc/gen/colour_picker_ctrl.rb +13 -10
- data/lib/wx/doc/gen/colour_picker_event.rb +5 -5
- data/lib/wx/doc/gen/combo_box.rb +36 -14
- data/lib/wx/doc/gen/combo_ctrl.rb +117 -295
- data/lib/wx/doc/gen/command_link_button.rb +12 -5
- data/lib/wx/doc/gen/context_help_button.rb +13 -3
- data/lib/wx/doc/gen/control.rb +22 -8
- data/lib/wx/doc/gen/control_with_items.rb +45 -10
- data/lib/wx/doc/gen/core.rb +4 -4
- data/lib/wx/doc/gen/cursor.rb +10 -8
- data/lib/wx/doc/gen/data_format.rb +7 -1
- data/lib/wx/doc/gen/data_object.rb +42 -18
- data/lib/wx/doc/gen/date_event.rb +3 -2
- data/lib/wx/doc/gen/date_picker_ctrl.rb +18 -8
- data/lib/wx/doc/gen/dc.rb +238 -36
- data/lib/wx/doc/gen/defs.rb +51 -51
- data/lib/wx/doc/gen/dial_up_event.rb +2 -1
- data/lib/wx/doc/gen/dial_up_manager.rb +25 -5
- data/lib/wx/doc/gen/dialog.rb +72 -13
- data/lib/wx/doc/gen/dir_dialog.rb +22 -5
- data/lib/wx/doc/gen/dir_filter_list_ctrl.rb +2 -0
- data/lib/wx/doc/gen/dir_picker_ctrl.rb +14 -10
- data/lib/wx/doc/gen/drag_drop.rb +28 -7
- data/lib/wx/doc/gen/drag_image.rb +13 -2
- data/lib/wx/doc/gen/editable_list_box.rb +7 -5
- data/lib/wx/doc/gen/event.rb +57 -26
- data/lib/wx/doc/gen/event_blocker.rb +2 -3
- data/lib/wx/doc/gen/event_filter.rb +3 -0
- data/lib/wx/doc/gen/event_list.rb +1656 -1652
- data/lib/wx/doc/gen/events.rb +305 -173
- data/lib/wx/doc/gen/evt_handler.rb +49 -3
- data/lib/wx/doc/gen/ext_help_controller.rb +10 -1
- data/lib/wx/doc/gen/file_ctrl.rb +28 -10
- data/lib/wx/doc/gen/file_ctrl_event.rb +7 -4
- data/lib/wx/doc/gen/file_dialog.rb +44 -14
- data/lib/wx/doc/gen/file_dialog_custom_control.rb +19 -0
- data/lib/wx/doc/gen/file_dialog_customize_hook.rb +11 -3
- data/lib/wx/doc/gen/file_dir_picker_event.rb +4 -4
- data/lib/wx/doc/gen/file_picker_ctrl.rb +12 -9
- data/lib/wx/doc/gen/file_system.rb +54 -15
- data/lib/wx/doc/gen/find_dialog_event.rb +6 -4
- data/lib/wx/doc/gen/find_replace_data.rb +2 -1
- data/lib/wx/doc/gen/find_replace_dialog.rb +4 -1
- data/lib/wx/doc/gen/flex_grid_sizer.rb +13 -1
- data/lib/wx/doc/gen/font.rb +103 -20
- data/lib/wx/doc/gen/font_data.rb +16 -3
- data/lib/wx/doc/gen/font_dialog.rb +6 -1
- data/lib/wx/doc/gen/font_picker_ctrl.rb +14 -7
- data/lib/wx/doc/gen/font_picker_event.rb +3 -3
- data/lib/wx/doc/gen/frame.rb +73 -15
- data/lib/wx/doc/gen/fs_file.rb +39 -10
- data/lib/wx/doc/gen/gauge.rb +19 -8
- data/lib/wx/doc/gen/gb_sizer_item.rb +5 -1
- data/lib/wx/doc/gen/gcdc.rb +3 -2
- data/lib/wx/doc/gen/gdi_common.rb +80 -11
- data/lib/wx/doc/gen/gdi_object.rb +1 -1
- data/lib/wx/doc/gen/generic_dir_ctrl.rb +13 -7
- data/lib/wx/doc/gen/graphics_context.rb +86 -10
- data/lib/wx/doc/gen/graphics_object.rb +35 -6
- data/lib/wx/doc/gen/grid/event_list.rb +168 -164
- data/lib/wx/doc/gen/grid/grid_cell_activatable_editor.rb +3 -0
- data/lib/wx/doc/gen/grid/grid_cell_attr.rb +16 -3
- data/lib/wx/doc/gen/grid/grid_cell_auto_wrap_string_editor.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_cell_auto_wrap_string_renderer.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_cell_bool_editor.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_cell_bool_renderer.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_cell_choice_editor.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_cell_date_editor.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_cell_date_renderer.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_cell_date_time_renderer.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_cell_editor.rb +10 -1
- data/lib/wx/doc/gen/grid/grid_cell_enum_editor.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_cell_enum_renderer.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_cell_float_editor.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_cell_float_renderer.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_cell_number_editor.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_cell_number_renderer.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_cell_renderer.rb +7 -1
- data/lib/wx/doc/gen/grid/grid_cell_string_renderer.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_cell_text_editor.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_ctrl.rb +256 -12
- data/lib/wx/doc/gen/grid/grid_editor_created_event.rb +6 -4
- data/lib/wx/doc/gen/grid/grid_event.rb +6 -4
- data/lib/wx/doc/gen/grid/grid_range_select_event.rb +4 -4
- data/lib/wx/doc/gen/grid/grid_size_event.rb +4 -4
- data/lib/wx/doc/gen/grid/grid_string_table.rb +8 -0
- data/lib/wx/doc/gen/grid/grid_table_base.rb +28 -3
- data/lib/wx/doc/gen/grid/grid_table_message.rb +2 -0
- data/lib/wx/doc/gen/grid_bag_sizer.rb +21 -7
- data/lib/wx/doc/gen/grid_sizer.rb +11 -1
- data/lib/wx/doc/gen/gui_event_loop.rb +13 -3
- data/lib/wx/doc/gen/header_ctrl.rb +110 -11
- data/lib/wx/doc/gen/header_ctrl_event.rb +4 -2
- data/lib/wx/doc/gen/help_controller.rb +14 -3
- data/lib/wx/doc/gen/help_provider.rb +22 -4
- data/lib/wx/doc/gen/html/event_list.rb +41 -37
- data/lib/wx/doc/gen/html/html_cell.rb +48 -6
- data/lib/wx/doc/gen/html/html_cell_event.rb +5 -4
- data/lib/wx/doc/gen/html/html_easy_printing.rb +20 -3
- data/lib/wx/doc/gen/html/html_help_controller.rb +26 -2
- data/lib/wx/doc/gen/html/html_help_data.rb +8 -1
- data/lib/wx/doc/gen/html/html_help_window.rb +9 -1
- data/lib/wx/doc/gen/html/html_link_event.rb +3 -3
- data/lib/wx/doc/gen/html/html_list_box.rb +54 -16
- data/lib/wx/doc/gen/html/html_printout.rb +7 -1
- data/lib/wx/doc/gen/html/html_window.rb +43 -6
- data/lib/wx/doc/gen/hyperlink_ctrl.rb +9 -8
- data/lib/wx/doc/gen/hyperlink_event.rb +3 -3
- data/lib/wx/doc/gen/icon.rb +23 -29
- data/lib/wx/doc/gen/icon_location.rb +1 -1
- data/lib/wx/doc/gen/image.rb +143 -20
- data/lib/wx/doc/gen/image_list.rb +25 -6
- data/lib/wx/doc/gen/info_bar.rb +14 -2
- data/lib/wx/doc/gen/keyboard_state.rb +11 -1
- data/lib/wx/doc/gen/list_box.rb +46 -17
- data/lib/wx/doc/gen/list_ctrl.rb +165 -29
- data/lib/wx/doc/gen/list_event.rb +13 -4
- data/lib/wx/doc/gen/listbook.rb +7 -7
- data/lib/wx/doc/gen/locale.rb +68 -4
- data/lib/wx/doc/gen/log.rb +58 -12
- data/lib/wx/doc/gen/mdi_client_window.rb +11 -2
- data/lib/wx/doc/gen/mdi_frame.rb +51 -7
- data/lib/wx/doc/gen/media_ctrl.rb +43 -18
- data/lib/wx/doc/gen/media_event.rb +6 -4
- data/lib/wx/doc/gen/memory_dc.rb +16 -6
- data/lib/wx/doc/gen/menu.rb +81 -26
- data/lib/wx/doc/gen/menu_bar.rb +74 -15
- data/lib/wx/doc/gen/menu_item.rb +67 -19
- data/lib/wx/doc/gen/message_dialog.rb +17 -8
- data/lib/wx/doc/gen/mini_frame.rb +14 -5
- data/lib/wx/doc/gen/mirror_dc.rb +1 -2
- data/lib/wx/doc/gen/mouse_state.rb +1 -1
- data/lib/wx/doc/gen/multi_choice_dialog.rb +9 -4
- data/lib/wx/doc/gen/non_owned_window.rb +4 -1
- data/lib/wx/doc/gen/notebook.rb +27 -9
- data/lib/wx/doc/gen/num_validator.rb +37 -0
- data/lib/wx/doc/gen/number_entry_dialog.rb +5 -1
- data/lib/wx/doc/gen/object.rb +3 -1
- data/lib/wx/doc/gen/owner_drawn_combo_box.rb +340 -0
- data/lib/wx/doc/gen/paint_dc.rb +1 -1
- data/lib/wx/doc/gen/palette.rb +5 -1
- data/lib/wx/doc/gen/panel.rb +25 -8
- data/lib/wx/doc/gen/pen.rb +46 -8
- data/lib/wx/doc/gen/pg/event_list.rb +97 -93
- data/lib/wx/doc/gen/pg/numeric_property_validator.rb +4 -1
- data/lib/wx/doc/gen/pg/pg_array_editor_dialog.rb +12 -1
- data/lib/wx/doc/gen/pg/pg_cell.rb +11 -3
- data/lib/wx/doc/gen/pg/pg_editor.rb +161 -16
- data/lib/wx/doc/gen/pg/pg_multi_button.rb +3 -2
- data/lib/wx/doc/gen/pg/pg_properties.rb +632 -83
- data/lib/wx/doc/gen/pg/pg_property.rb +381 -77
- data/lib/wx/doc/gen/pg/pg_validation_info.rb +11 -4
- data/lib/wx/doc/gen/pg/property_grid.rb +123 -20
- data/lib/wx/doc/gen/pg/property_grid_event.rb +41 -9
- data/lib/wx/doc/gen/pg/property_grid_interface.rb +273 -34
- data/lib/wx/doc/gen/pg/property_grid_manager.rb +62 -10
- data/lib/wx/doc/gen/pg/property_grid_page.rb +33 -8
- data/lib/wx/doc/gen/pg/property_grid_page_state.rb +18 -4
- data/lib/wx/doc/gen/picker_base.rb +22 -5
- data/lib/wx/doc/gen/platform_info.rb +35 -9
- data/lib/wx/doc/gen/popup_window.rb +7 -5
- data/lib/wx/doc/gen/progress_dialog.rb +5 -0
- data/lib/wx/doc/gen/property_sheet_dialog.rb +20 -4
- data/lib/wx/doc/gen/prt/event_list.rb +8 -4
- data/lib/wx/doc/gen/prt/page_setup_dialog.rb +3 -1
- data/lib/wx/doc/gen/prt/post_script_dc.rb +3 -2
- data/lib/wx/doc/gen/prt/preview_frame.rb +5 -1
- data/lib/wx/doc/gen/prt/print_abort_dialog.rb +4 -0
- data/lib/wx/doc/gen/prt/print_data.rb +31 -3
- data/lib/wx/doc/gen/prt/print_dialog.rb +5 -1
- data/lib/wx/doc/gen/prt/printer.rb +87 -11
- data/lib/wx/doc/gen/prt/printer_dc.rb +3 -1
- data/lib/wx/doc/gen/query_layout_info_event.rb +10 -3
- data/lib/wx/doc/gen/radio_box.rb +28 -10
- data/lib/wx/doc/gen/radio_button.rb +22 -9
- data/lib/wx/doc/gen/rbn/event_list.rb +127 -123
- data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +82 -3
- data/lib/wx/doc/gen/rbn/ribbon_bar.rb +26 -4
- data/lib/wx/doc/gen/rbn/ribbon_bar_event.rb +3 -2
- data/lib/wx/doc/gen/rbn/ribbon_button_bar.rb +50 -12
- data/lib/wx/doc/gen/rbn/ribbon_button_bar_event.rb +3 -2
- data/lib/wx/doc/gen/rbn/ribbon_control.rb +11 -1
- data/lib/wx/doc/gen/rbn/ribbon_gallery.rb +21 -11
- data/lib/wx/doc/gen/rbn/ribbon_gallery_event.rb +2 -2
- data/lib/wx/doc/gen/rbn/ribbon_page.rb +12 -1
- data/lib/wx/doc/gen/rbn/ribbon_panel.rb +16 -4
- data/lib/wx/doc/gen/rbn/ribbon_panel_event.rb +3 -3
- data/lib/wx/doc/gen/rbn/ribbon_tool_bar.rb +27 -3
- data/lib/wx/doc/gen/rbn/ribbon_tool_bar_event.rb +3 -1
- data/lib/wx/doc/gen/rearrange_ctrl.rb +5 -2
- data/lib/wx/doc/gen/rearrange_list.rb +12 -4
- data/lib/wx/doc/gen/region.rb +104 -17
- data/lib/wx/doc/gen/region_iterator.rb +1 -1
- data/lib/wx/doc/gen/rtc/event_list.rb +116 -112
- data/lib/wx/doc/gen/rtc/rich_text_box.rb +27 -9
- data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +45 -11
- data/lib/wx/doc/gen/rtc/rich_text_buffer_data_object.rb +1 -1
- data/lib/wx/doc/gen/rtc/rich_text_composite_object.rb +23 -14
- data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +84 -7
- data/lib/wx/doc/gen/rtc/rich_text_event.rb +8 -4
- data/lib/wx/doc/gen/rtc/rich_text_file_handler.rb +8 -2
- data/lib/wx/doc/gen/rtc/rich_text_formatting_dialog.rb +8 -3
- data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +4 -2
- data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +6 -3
- data/lib/wx/doc/gen/rtc/rich_text_image.rb +7 -2
- data/lib/wx/doc/gen/rtc/rich_text_object.rb +82 -17
- data/lib/wx/doc/gen/rtc/rich_text_paragraph_layout_box.rb +54 -11
- data/lib/wx/doc/gen/rtc/rich_text_printing.rb +15 -2
- data/lib/wx/doc/gen/rtc/rich_text_style_list_box.rb +14 -9
- data/lib/wx/doc/gen/rtc/rich_text_style_organiser_dialog.rb +4 -1
- data/lib/wx/doc/gen/rtc/rich_text_xml_handler.rb +4 -3
- data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +2 -2
- data/lib/wx/doc/gen/sash_event.rb +13 -4
- data/lib/wx/doc/gen/sash_layout_window.rb +21 -4
- data/lib/wx/doc/gen/sash_window.rb +6 -4
- data/lib/wx/doc/gen/screen_dc.rb +1 -1
- data/lib/wx/doc/gen/scroll_bar.rb +28 -10
- data/lib/wx/doc/gen/scrolled_canvas.rb +48 -10
- data/lib/wx/doc/gen/scrolled_control.rb +48 -10
- data/lib/wx/doc/gen/scrolled_window.rb +48 -10
- data/lib/wx/doc/gen/search_ctrl.rb +14 -9
- data/lib/wx/doc/gen/simplebook.rb +8 -1
- data/lib/wx/doc/gen/single_choice_dialog.rb +9 -4
- data/lib/wx/doc/gen/sizer.rb +91 -16
- data/lib/wx/doc/gen/sizer_item.rb +21 -4
- data/lib/wx/doc/gen/slider.rb +50 -17
- data/lib/wx/doc/gen/spin_button.rb +24 -10
- data/lib/wx/doc/gen/spin_ctrl.rb +35 -9
- data/lib/wx/doc/gen/spin_ctrl_double.rb +13 -7
- data/lib/wx/doc/gen/spin_double_event.rb +6 -4
- data/lib/wx/doc/gen/spin_event.rb +4 -3
- data/lib/wx/doc/gen/splash_screen.rb +3 -2
- data/lib/wx/doc/gen/splitter_event.rb +12 -4
- data/lib/wx/doc/gen/splitter_window.rb +100 -18
- data/lib/wx/doc/gen/static_bitmap.rb +109 -7
- data/lib/wx/doc/gen/static_box.rb +15 -7
- data/lib/wx/doc/gen/static_box_sizer.rb +3 -2
- data/lib/wx/doc/gen/static_line.rb +7 -4
- data/lib/wx/doc/gen/static_text.rb +10 -6
- data/lib/wx/doc/gen/status_bar.rb +32 -8
- data/lib/wx/doc/gen/stc/event_list.rb +212 -208
- data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +207 -13
- data/lib/wx/doc/gen/stc/styled_text_event.rb +31 -6
- data/lib/wx/doc/gen/std_dialog_button_sizer.rb +7 -1
- data/lib/wx/doc/gen/svg_file_dc.rb +15 -7
- data/lib/wx/doc/gen/system_options.rb +14 -6
- data/lib/wx/doc/gen/system_settings.rb +9 -3
- data/lib/wx/doc/gen/task_bar_button.rb +324 -0
- data/lib/wx/doc/gen/task_bar_icon.rb +26 -8
- data/lib/wx/doc/gen/task_bar_icon_event.rb +5 -3
- data/lib/wx/doc/gen/text_attr.rb +47 -5
- data/lib/wx/doc/gen/text_ctrl.rb +114 -25
- data/lib/wx/doc/gen/text_entry.rb +69 -11
- data/lib/wx/doc/gen/text_entry_dialog.rb +14 -2
- data/lib/wx/doc/gen/text_validator.rb +58 -9
- data/lib/wx/doc/gen/time_picker_ctrl.rb +11 -6
- data/lib/wx/doc/gen/timer.rb +14 -2
- data/lib/wx/doc/gen/timer_event.rb +2 -2
- data/lib/wx/doc/gen/tip_provider.rb +6 -1
- data/lib/wx/doc/gen/toggle_button.rb +73 -6
- data/lib/wx/doc/gen/tool_bar.rb +141 -25
- data/lib/wx/doc/gen/tool_tip.rb +41 -5
- data/lib/wx/doc/gen/toolbook.rb +6 -4
- data/lib/wx/doc/gen/top_level_window.rb +100 -23
- data/lib/wx/doc/gen/tree_ctrl.rb +89 -16
- data/lib/wx/doc/gen/tree_event.rb +9 -4
- data/lib/wx/doc/gen/treebook.rb +16 -4
- data/lib/wx/doc/gen/ui_action_simulator.rb +10 -2
- data/lib/wx/doc/gen/utils.rb +94 -7
- data/lib/wx/doc/gen/v_list_box.rb +27 -2
- data/lib/wx/doc/gen/v_scrolled_window.rb +21 -4
- data/lib/wx/doc/gen/validator.rb +10 -14
- data/lib/wx/doc/gen/variant.rb +7 -0
- data/lib/wx/doc/gen/window.rb +415 -57
- data/lib/wx/doc/gen/window_dc.rb +2 -1
- data/lib/wx/doc/gen/window_disabler.rb +6 -2
- data/lib/wx/doc/gen/with_images.rb +13 -2
- data/lib/wx/doc/gen/wizard.rb +22 -4
- data/lib/wx/doc/gen/wizard_event.rb +5 -4
- data/lib/wx/doc/gen/wizard_page.rb +7 -2
- data/lib/wx/doc/gen/wizard_page_simple.rb +5 -1
- data/lib/wx/doc/gen/wrap_sizer.rb +5 -1
- data/lib/wx/doc/gen/xml_node.rb +33 -4
- data/lib/wx/doc/gen/xml_resource.rb +40 -5
- data/lib/wx/doc/generic_validator.rb +95 -0
- data/lib/wx/doc/graphics_context.rb +1 -0
- data/lib/wx/doc/grid/grid.rb +22 -1
- data/lib/wx/doc/help_controller.rb +11 -7
- data/lib/wx/doc/html/html_help_controller.rb +12 -4
- data/lib/wx/doc/html/simple_html_listbox.rb +22 -0
- data/lib/wx/doc/list_ctrl.rb +33 -29
- data/lib/wx/doc/menu.rb +20 -0
- data/lib/wx/doc/notebook.rb +21 -0
- data/lib/wx/doc/num_validator.rb +387 -0
- data/lib/wx/doc/owner_drawn_combobox.rb +96 -0
- data/lib/wx/doc/pg/events.rb +13 -9
- data/lib/wx/doc/pg/numeric_property_validator.rb +33 -0
- data/lib/wx/doc/pg/pg_property.rb +18 -0
- data/lib/wx/doc/progress_dialog.rb +36 -32
- data/lib/wx/doc/prt/page_setup_dialog.rb +20 -12
- data/lib/wx/doc/prt/print_data.rb +13 -5
- data/lib/wx/doc/prt/print_dialog.rb +31 -23
- data/lib/wx/doc/prt/printer.rb +20 -12
- data/lib/wx/doc/radio_box.rb +19 -15
- data/lib/wx/doc/rbn/ribbon_bar.rb +13 -5
- data/lib/wx/doc/rbn/ribbon_button_bar.rb +13 -5
- data/lib/wx/doc/rbn/ribbon_gallery.rb +13 -5
- data/lib/wx/doc/rbn/ribbon_tool_bar.rb +13 -5
- data/lib/wx/doc/region_iterator.rb +32 -28
- data/lib/wx/doc/rtc/rich_text_composite_object.rb +24 -0
- data/lib/wx/doc/rtc/rich_text_ctrl.rb +24 -0
- data/lib/wx/doc/rtc/rich_text_paragraph.rb +24 -0
- data/lib/wx/doc/rtc/richtext_buffer.rb +27 -19
- data/lib/wx/doc/rtc/richtext_printing.rb +17 -9
- data/lib/wx/doc/rtc/richtext_style_sheet.rb +17 -9
- data/lib/wx/doc/sizer.rb +20 -0
- data/lib/wx/doc/static_bitmap.rb +25 -0
- data/lib/wx/doc/stc/styled_text_ctrl.rb +24 -0
- data/lib/wx/doc/stream.rb +39 -35
- data/lib/wx/doc/system_settings.rb +30 -26
- data/lib/wx/doc/text_validator.rb +23 -9
- data/lib/wx/doc/textctrl.rb +16 -0
- data/lib/wx/doc/tree_ctrl.rb +95 -0
- data/lib/wx/doc/treebook.rb +9 -5
- data/lib/wx/doc/v_list_box.rb +9 -5
- data/lib/wx/doc/validator.rb +113 -0
- data/lib/wx/doc/variant.rb +164 -160
- data/lib/wx/doc/window.rb +87 -47
- data/lib/wx/doc/window_disabler.rb +10 -6
- data/lib/wx/grid/grid.rb +27 -4
- data/lib/wx/html/events/evt_list.rb +0 -10
- data/lib/wx/html/simple_html_listbox.rb +24 -91
- data/lib/wx/keyword_defs.rb +34 -2
- data/lib/wx/pg/pg_property.rb +22 -0
- data/lib/wx/rbn/ribbon_gallery.rb +0 -21
- data/lib/wx/rtc/require.rb +3 -0
- data/lib/wx/rtc/rich_text_composite_object.rb +25 -0
- data/lib/wx/rtc/rich_text_ctrl.rb +25 -0
- data/lib/wx/rtc/rich_text_paragraph.rb +25 -0
- data/lib/wx/stc/require.rb +1 -0
- data/lib/wx/stc/styled_text_ctrl.rb +25 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby_aui.so +0 -0
- data/lib/wxruby_core.so +0 -0
- data/lib/wxruby_grid.so +0 -0
- data/lib/wxruby_html.so +0 -0
- data/lib/wxruby_pg.so +0 -0
- data/lib/wxruby_prt.so +0 -0
- data/lib/wxruby_rbn.so +0 -0
- data/lib/wxruby_rtc.so +0 -0
- data/lib/wxruby_stc.so +0 -0
- data/rakelib/lib/config/linux.rb +0 -3
- data/rakelib/lib/config/macosx.rb +2 -2
- data/rakelib/lib/config/mingw.rb +13 -1
- data/rakelib/lib/config/unixish.rb +1 -1
- data/rakelib/lib/config.rb +14 -4
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +74 -2
- data/rakelib/yard/templates/default/fulldoc/html/full_list.erb +38 -0
- data/rakelib/yard/templates/default/fulldoc/html/setup.rb +39 -0
- data/rakelib/yard/templates/default/tags/html/wxrb_require.erb +10 -0
- data/rakelib/yard/templates/default/tags/setup.rb +16 -0
- data/rakelib/yard/yard-custom-templates.rb +3 -0
- data/samples/aui/aui.rb +1237 -1233
- data/samples/calendar/calendar.rb +293 -289
- data/samples/controls/get_item_sample.rb +83 -79
- data/samples/controls/htlbox.rb +331 -327
- data/samples/dialogs/dialogs.rb +682 -694
- data/samples/dialogs/wizard.rb +52 -55
- data/samples/dragdrop/dragdrop.rb +146 -142
- data/samples/drawing/bitmap.rb +29 -26
- data/samples/drawing/bitmap_image.rb +84 -80
- data/samples/drawing/graphics_drawing.rb +209 -205
- data/samples/drawing/image_prt.rb +344 -340
- data/samples/drawing/maths_images.rb +18 -1
- data/samples/drawing/rmagic_bitmap_image.rb +88 -84
- data/samples/etc/caret.rb +306 -0
- data/samples/etc/miniframe.rb +65 -60
- data/samples/etc/sash.rb +109 -105
- data/samples/etc/scrollwin.rb +86 -80
- data/samples/etc/system_settings.rb +216 -209
- data/samples/event/activation.rb +72 -67
- data/samples/event/event.rb +160 -153
- data/samples/event/threaded.rb +8 -1
- data/samples/event/update_ui_event.rb +67 -60
- data/samples/grid/grid.rb +188 -181
- data/samples/grid/gridtablebase.rb +136 -129
- data/samples/html/html.rb +208 -204
- data/samples/mdi/mdi.rb +59 -54
- data/samples/minimal/minimal.rb +54 -51
- data/samples/minimal/nothing.rb +1 -0
- data/samples/printing/printing.rb +367 -377
- data/samples/printing/printing2.rb +203 -198
- data/samples/propgrid/propgrid.rb +2312 -2308
- data/samples/propgrid/propgrid_minimal.rb +57 -50
- data/samples/ribbon/ribbon.rb +780 -774
- data/samples/sampler/ext.rb +0 -33
- data/samples/sampler/sample.rb +4 -9
- data/samples/sampler.rb +1 -1
- data/samples/splash/splash.rb +118 -116
- data/samples/text/rich_textctrl.rb +207 -201
- data/samples/text/richtext.rb +1409 -1405
- data/samples/text/scintilla.rb +137 -128
- data/samples/text/textctrl.rb +89 -83
- data/samples/text/unicode.rb +175 -168
- data/samples/treectrl/treectrl.rb +1430 -1426
- data/samples/widgets/activityindicator.rb +95 -0
- data/samples/widgets/art/widgets/activityindicator.xpm +278 -0
- data/samples/widgets/art/widgets/bmpbtn.xpm +37 -0
- data/samples/widgets/art/widgets/bmpcombobox.xpm +54 -0
- data/samples/widgets/art/widgets/button.xpm +54 -0
- data/samples/widgets/art/widgets/checkbox.xpm +54 -0
- data/samples/{bigdemo/icons → widgets/art/widgets}/choice.xpm +1 -1
- data/samples/widgets/art/widgets/choicebk.xpm +54 -0
- data/samples/widgets/art/widgets/clrpicker.xpm +193 -0
- data/samples/widgets/art/widgets/combobox.xpm +54 -0
- data/samples/widgets/art/widgets/datepick.xpm +200 -0
- data/samples/widgets/art/widgets/dirctrl.xpm +54 -0
- data/samples/widgets/art/widgets/dirpicker.xpm +213 -0
- data/samples/widgets/art/widgets/filepicker.xpm +214 -0
- data/samples/widgets/art/widgets/fontpicker.xpm +185 -0
- data/samples/widgets/art/widgets/gauge.xpm +54 -0
- data/samples/widgets/art/widgets/header.xpm +54 -0
- data/samples/widgets/art/widgets/hyperlnk.xpm +54 -0
- data/samples/widgets/art/widgets/listbook.xpm +54 -0
- data/samples/widgets/art/widgets/listbox.xpm +54 -0
- data/samples/widgets/art/widgets/native.xpm +81 -0
- data/samples/widgets/art/widgets/notebook.xpm +54 -0
- data/samples/widgets/art/widgets/odcombobox.xpm +54 -0
- data/samples/widgets/art/widgets/radiobox.xpm +54 -0
- data/samples/widgets/art/widgets/scrolbar.xpm +54 -0
- data/samples/widgets/art/widgets/slider.xpm +54 -0
- data/samples/widgets/art/widgets/spinbtn.xpm +40 -0
- data/samples/widgets/art/widgets/statbmp.xpm +40 -0
- data/samples/widgets/art/widgets/statbox.xpm +54 -0
- data/samples/widgets/art/widgets/stattext.xpm +54 -0
- data/samples/widgets/art/widgets/text.xpm +54 -0
- data/samples/widgets/art/widgets/timepick.xpm +207 -0
- data/samples/widgets/art/widgets/toggle.xpm +54 -0
- data/samples/widgets/art/widgets/toucan.png +0 -0
- data/samples/widgets/bmpcombobox.rb +651 -0
- data/samples/widgets/button.rb +462 -0
- data/samples/widgets/checkbox.rb +211 -0
- data/samples/widgets/choice.rb +287 -0
- data/samples/widgets/clrpicker.rb +156 -0
- data/samples/widgets/combobox.rb +516 -0
- data/samples/widgets/datepick.rb +215 -0
- data/samples/widgets/dirctrl.rb +265 -0
- data/samples/widgets/dirpicker.rb +158 -0
- data/samples/widgets/editlbox.rb +122 -0
- data/samples/widgets/filectrl.rb +216 -0
- data/samples/widgets/filepicker.rb +214 -0
- data/samples/widgets/fontpicker.rb +135 -0
- data/samples/widgets/gauge.rb +311 -0
- data/samples/widgets/headerctrl.rb +236 -0
- data/samples/widgets/hyperlink.rb +203 -0
- data/samples/widgets/itemcontainer.rb +185 -0
- data/samples/widgets/listbox.rb +473 -0
- data/samples/widgets/notebook.rb +488 -0
- data/samples/widgets/odcombobox.rb +608 -0
- data/samples/widgets/radiobox.rb +328 -0
- data/samples/widgets/searchctrl.rb +159 -0
- data/samples/widgets/slider.rb +594 -0
- data/samples/widgets/spinbtn.rb +443 -0
- data/samples/widgets/statbmp.rb +130 -0
- data/samples/widgets/static.rb +436 -0
- data/samples/widgets/textctrl.rb +700 -0
- data/samples/widgets/timepick.rb +148 -0
- data/samples/widgets/tn_widgets.png +0 -0
- data/samples/widgets/toggle.rb +385 -0
- data/samples/widgets/widgets.rb +1233 -0
- data/samples/xrc/custom_xrc_sample.rb +47 -41
- data/samples/xrc/xrc_sample.rb +53 -47
- data/tests/media/beep_lo.wav +0 -0
- data/tests/test_event_handling.rb +52 -34
- data/tests/test_events.rb +7 -0
- data/tests/test_item_data.rb +24 -0
- data/tests/test_list_ctrl.rb +1 -1
- data/tests/test_media_ctrl.rb +38 -0
- data/tests/test_menu.rb +69 -0
- data/tests/test_pg.rb +27 -0
- data/tests/test_richtext.rb +45 -0
- data/tests/test_sizer.rb +59 -0
- data/tests/test_std_controls.rb +42 -1
- data/tests/test_styled_text_ctrl.rb +46 -0
- data/tests/test_tree_ctrl.rb +138 -0
- data/tests/test_validators.rb +805 -0
- data/tests/test_window.rb +12 -0
- data/tests/testapp_noframe.rb +1 -1
- metadata +113 -138
- data/lib/wx/core/choice.rb +0 -14
- data/lib/wx/core/combo_ctrl.rb +0 -110
- data/samples/bigdemo/About.rbw +0 -39
- data/samples/bigdemo/ColorPanel.rbw +0 -23
- data/samples/bigdemo/GridSimple.rbw +0 -78
- data/samples/bigdemo/MDIDemo.rbw +0 -57
- data/samples/bigdemo/PopupMenu.rbw +0 -146
- data/samples/bigdemo/ShapedWindow.rbw +0 -128
- data/samples/bigdemo/Sizers.rbw +0 -541
- data/samples/bigdemo/bigdemo.rb +0 -817
- data/samples/bigdemo/demoTemplate.rbw +0 -33
- data/samples/bigdemo/helpfile.htb +0 -0
- data/samples/bigdemo/icons/Test 015.jpg +0 -0
- data/samples/bigdemo/icons/Test 015.png +0 -0
- data/samples/bigdemo/icons/choice.bmp +0 -0
- data/samples/bigdemo/icons/combo.bmp +0 -0
- data/samples/bigdemo/icons/combo.xpm +0 -27
- data/samples/bigdemo/icons/copy.xpm +0 -25
- data/samples/bigdemo/icons/cut.xpm +0 -24
- data/samples/bigdemo/icons/gauge.bmp +0 -0
- data/samples/bigdemo/icons/gauge.xpm +0 -27
- data/samples/bigdemo/icons/help.xpm +0 -25
- data/samples/bigdemo/icons/list.bmp +0 -0
- data/samples/bigdemo/icons/list.xpm +0 -27
- data/samples/bigdemo/icons/mondrian.ico +0 -0
- data/samples/bigdemo/icons/mondrian.xpm +0 -44
- data/samples/bigdemo/icons/new.xpm +0 -24
- data/samples/bigdemo/icons/ogl.ico +0 -0
- data/samples/bigdemo/icons/ogl.xpm +0 -45
- data/samples/bigdemo/icons/open.xpm +0 -26
- data/samples/bigdemo/icons/paste.bmp +0 -0
- data/samples/bigdemo/icons/paste.xpm +0 -38
- data/samples/bigdemo/icons/pointy.png +0 -0
- data/samples/bigdemo/icons/preview.xpm +0 -26
- data/samples/bigdemo/icons/print.xpm +0 -26
- data/samples/bigdemo/icons/radio.bmp +0 -0
- data/samples/bigdemo/icons/radio.xpm +0 -27
- data/samples/bigdemo/icons/robert.xpm +0 -415
- data/samples/bigdemo/icons/sashtest.ico +0 -0
- data/samples/bigdemo/icons/save.xpm +0 -25
- data/samples/bigdemo/icons/smiles.bmp +0 -0
- data/samples/bigdemo/icons/smiles.xpm +0 -39
- data/samples/bigdemo/icons/smiley.ico +0 -0
- data/samples/bigdemo/icons/smiley.xpm +0 -42
- data/samples/bigdemo/icons/stattext.xpm +0 -24
- data/samples/bigdemo/icons/test2.bmp +0 -0
- data/samples/bigdemo/icons/test2.png +0 -0
- data/samples/bigdemo/icons/test2.xpm +0 -79
- data/samples/bigdemo/icons/text.bmp +0 -0
- data/samples/bigdemo/icons/text.xpm +0 -27
- data/samples/bigdemo/icons/tog1.bmp +0 -0
- data/samples/bigdemo/icons/tog1.xpm +0 -38
- data/samples/bigdemo/icons/tog2.bmp +0 -0
- data/samples/bigdemo/icons/tog2.xpm +0 -38
- data/samples/bigdemo/icons/wxruby-128x128.png +0 -0
- data/samples/bigdemo/icons/wxwin.ico +0 -0
- data/samples/bigdemo/icons/wxwin16x16.png +0 -0
- data/samples/bigdemo/icons/wxwin16x16.xpm +0 -25
- data/samples/bigdemo/icons/wxwin32x32.png +0 -0
- data/samples/bigdemo/icons/wxwin48x48.png +0 -0
- data/samples/bigdemo/run.rb +0 -98
- data/samples/bigdemo/tips.txt +0 -7
- data/samples/bigdemo/utils.rb +0 -20
- data/samples/bigdemo/wxArtProvider.rbw +0 -282
- data/samples/bigdemo/wxBitmapButton.rbw +0 -65
- data/samples/bigdemo/wxButton.rbw +0 -64
- data/samples/bigdemo/wxCalendarCtrl.rbw +0 -59
- data/samples/bigdemo/wxCheckBox.rbw +0 -50
- data/samples/bigdemo/wxCheckListBox.rbw +0 -65
- data/samples/bigdemo/wxChoice.rbw +0 -47
- data/samples/bigdemo/wxChoicebook.rbw +0 -78
- data/samples/bigdemo/wxColourDialog.rbw +0 -33
- data/samples/bigdemo/wxComboBox.rbw +0 -77
- data/samples/bigdemo/wxCursor.rbw +0 -136
- data/samples/bigdemo/wxDialog.rbw +0 -74
- data/samples/bigdemo/wxDirDialog.rbw +0 -29
- data/samples/bigdemo/wxDragImage.rbw +0 -70
- data/samples/bigdemo/wxFileDialog.rbw +0 -37
- data/samples/bigdemo/wxFileDialog_Save.rbw +0 -35
- data/samples/bigdemo/wxFindReplaceDialog.rbw +0 -82
- data/samples/bigdemo/wxFontDialog.rbw +0 -200
- data/samples/bigdemo/wxFrame.rbw +0 -53
- data/samples/bigdemo/wxGauge.rbw +0 -65
- data/samples/bigdemo/wxGenericDirCtrl.rbw +0 -74
- data/samples/bigdemo/wxGrid.rbw +0 -66
- data/samples/bigdemo/wxHtmlHelpController.rbw +0 -52
- data/samples/bigdemo/wxListBox.rbw +0 -140
- data/samples/bigdemo/wxListCtrl_virtual.rbw +0 -112
- data/samples/bigdemo/wxMDIWindows.rbw +0 -50
- data/samples/bigdemo/wxMenu.rbw +0 -247
- data/samples/bigdemo/wxMessageDialog.rbw +0 -27
- data/samples/bigdemo/wxMiniFrame.rbw +0 -70
- data/samples/bigdemo/wxMultipleChoiceDialog.rbw +0 -29
- data/samples/bigdemo/wxNotebook.rbw +0 -136
- data/samples/bigdemo/wxProgressDialog.rbw +0 -43
- data/samples/bigdemo/wxRadioBox.rbw +0 -72
- data/samples/bigdemo/wxRadioButton.rbw +0 -125
- data/samples/bigdemo/wxSashWindow.rbw +0 -141
- data/samples/bigdemo/wxScrolledMessageDialog.rbw +0 -57
- data/samples/bigdemo/wxScrolledWindow.rbw +0 -199
- data/samples/bigdemo/wxSingleChoiceDialog.rbw +0 -33
- data/samples/bigdemo/wxSlider.rbw +0 -42
- data/samples/bigdemo/wxSpinButton.rbw +0 -50
- data/samples/bigdemo/wxSpinCtrl.rbw +0 -51
- data/samples/bigdemo/wxSplitterWindow.rbw +0 -63
- data/samples/bigdemo/wxStaticBitmap.rbw +0 -47
- data/samples/bigdemo/wxStaticText.rbw +0 -55
- data/samples/bigdemo/wxStatusBar.rbw +0 -126
- data/samples/bigdemo/wxTextCtrl.rbw +0 -149
- data/samples/bigdemo/wxTextEntryDialog.rbw +0 -31
- data/samples/bigdemo/wxToggleButton.rbw +0 -49
- data/samples/bigdemo/wxToolBar.rbw +0 -131
- data/samples/bigdemo/wxTreeCtrl.rbw +0 -191
- data/samples/caret/caret.rb +0 -298
- data/samples/caret/mondrian.xpm +0 -44
- data/samples/controls/books.rb +0 -189
- data/samples/controls/choice.xpm +0 -27
- data/samples/controls/combo.xpm +0 -27
- data/samples/controls/controls.rb +0 -1099
- data/samples/controls/gauge.xpm +0 -27
- data/samples/controls/list.xpm +0 -27
- data/samples/controls/mondrian.ico +0 -0
- data/samples/controls/mondrian.xpm +0 -44
- data/samples/controls/radio.xpm +0 -27
- data/samples/controls/stattext.xpm +0 -24
- data/samples/controls/test2.bmp +0 -0
- data/samples/controls/text.xpm +0 -27
- data/samples/controls/tn_books.png +0 -0
- data/samples/controls/tn_controls.png +0 -0
- data/samples/etc/choice.rb +0 -87
- data/samples/etc/tn_choice.png +0 -0
- data/samples/text/mondrian.ico +0 -0
- data/samples/text/mondrian.xpm +0 -44
- /data/samples/{caret → etc}/tn_caret.png +0 -0
@@ -17,1693 +17,1697 @@ require 'wx'
|
|
17
17
|
# Also, some items remain to be implemented - for example, setting item
|
18
18
|
# icons and item data.
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
attr_accessor :alternate_images, :alternate_states, :reverse_sort
|
135
|
-
|
136
|
-
def reset_broken_state_images
|
137
|
-
count = self.state_image_list.get_image_count
|
138
|
-
state = count > 0 ? count - 1 : Wx::TREE_ITEMSTATE_NONE
|
139
|
-
do_reset_broken_state_images(self.root_item, nil, state)
|
140
|
-
end
|
141
|
-
|
142
|
-
def do_reset_broken_state_images(parent, cookie, state)
|
143
|
-
unless cookie
|
144
|
-
id, cookie = get_first_child(parent)
|
145
|
-
else
|
146
|
-
id, cookie = get_next_child(parent, cookie)
|
20
|
+
module TreeCtrl
|
21
|
+
|
22
|
+
# Just some event ids for the numerous menu items
|
23
|
+
TreeTest_TogButtons,
|
24
|
+
TreeTest_TogTwist,
|
25
|
+
TreeTest_TogLines,
|
26
|
+
TreeTest_TogEdit,
|
27
|
+
TreeTest_TogHideRoot,
|
28
|
+
TreeTest_TogRootLines,
|
29
|
+
TreeTest_TogBorder,
|
30
|
+
TreeTest_TogFullHighlight,
|
31
|
+
TreeTest_SetFgColour,
|
32
|
+
TreeTest_SetBgColour,
|
33
|
+
TreeTest_ResetStyle,
|
34
|
+
TreeTest_Highlight,
|
35
|
+
TreeTest_Dump,
|
36
|
+
TreeTest_DumpSelected,
|
37
|
+
TreeTest_Count,
|
38
|
+
TreeTest_CountRec,
|
39
|
+
TreeTest_Sort,
|
40
|
+
TreeTest_SortRev,
|
41
|
+
TreeTest_SetBold,
|
42
|
+
TreeTest_ClearBold,
|
43
|
+
TreeTest_Rename,
|
44
|
+
TreeTest_Delete,
|
45
|
+
TreeTest_DeleteChildren,
|
46
|
+
TreeTest_DeleteAll,
|
47
|
+
TreeTest_SelectRoot,
|
48
|
+
TreeTest_SetFocusedRoot,
|
49
|
+
TreeTest_ClearFocused,
|
50
|
+
TreeTest_FreezeThaw,
|
51
|
+
TreeTest_Recreate,
|
52
|
+
TreeTest_ToggleImages,
|
53
|
+
TreeTest_ToggleStates,
|
54
|
+
TreeTest_ToggleBell,
|
55
|
+
TreeTest_ToggleAlternateImages,
|
56
|
+
TreeTest_ToggleAlternateStates,
|
57
|
+
TreeTest_ToggleButtons,
|
58
|
+
TreeTest_SetImageSize,
|
59
|
+
TreeTest_ToggleSel,
|
60
|
+
TreeTest_CollapseAndReset,
|
61
|
+
TreeTest_EnsureVisible,
|
62
|
+
TreeTest_SetFocus,
|
63
|
+
TreeTest_AddItem,
|
64
|
+
TreeTest_AddManyItems,
|
65
|
+
TreeTest_InsertItem,
|
66
|
+
TreeTest_IncIndent,
|
67
|
+
TreeTest_DecIndent,
|
68
|
+
TreeTest_IncSpacing,
|
69
|
+
TreeTest_DecSpacing,
|
70
|
+
TreeTest_ToggleIcon,
|
71
|
+
TreeTest_ToggleState,
|
72
|
+
TreeTest_ShowFirstVisible,
|
73
|
+
TreeTest_ShowLastVisible,
|
74
|
+
TreeTest_ShowNextVisible,
|
75
|
+
TreeTest_ShowPrevVisible,
|
76
|
+
TreeTest_ShowParent,
|
77
|
+
TreeTest_ShowPrevSibling,
|
78
|
+
TreeTest_ShowNextSibling,
|
79
|
+
TreeTest_ScrollTo,
|
80
|
+
TreeTest_SelectLast,
|
81
|
+
TreeTest_Select,
|
82
|
+
TreeTest_Unselect,
|
83
|
+
TreeTest_SelectChildren = (Wx::ID_HIGHEST..Wx::ID_HIGHEST + 61).to_a
|
84
|
+
|
85
|
+
TreeCtrlIcon_File,
|
86
|
+
TreeCtrlIcon_FileSelected,
|
87
|
+
TreeCtrlIcon_Folder,
|
88
|
+
TreeCtrlIcon_FolderSelected,
|
89
|
+
TreeCtrlIcon_FolderOpened = 0, 1, 2, 3, 4
|
90
|
+
|
91
|
+
class MyTreeCtrl < Wx::TreeCtrl
|
92
|
+
def initialize(parent, *args)
|
93
|
+
super(parent, *args)
|
94
|
+
|
95
|
+
@alternate_images = false
|
96
|
+
@alternate_states = false
|
97
|
+
@reverse_sort = false
|
98
|
+
|
99
|
+
create_image_list(16)
|
100
|
+
create_state_imageList
|
101
|
+
|
102
|
+
# add some items to the tree
|
103
|
+
add_test_items_to_tree(5, 2)
|
104
|
+
|
105
|
+
# TreeCtrl supports a large number of different events...
|
106
|
+
evt_tree_begin_drag self, :on_begin_drag
|
107
|
+
evt_tree_begin_rdrag self, :on_begin_rdrag
|
108
|
+
evt_tree_end_drag self, :on_end_drag
|
109
|
+
evt_tree_begin_label_edit self, :on_begin_label_edit
|
110
|
+
evt_tree_end_label_edit self, :on_end_label_edit
|
111
|
+
evt_tree_delete_item self, :on_delete_item
|
112
|
+
#evt_tree_set_info self, :on_set_info
|
113
|
+
evt_tree_item_expanded self, :on_item_expanded
|
114
|
+
evt_tree_item_expanding self, :on_item_expanding
|
115
|
+
evt_tree_item_collapsed self, :on_item_collapsed
|
116
|
+
evt_tree_item_collapsing self, :on_item_collapsing
|
117
|
+
evt_tree_sel_changed self, :on_sel_changed
|
118
|
+
evt_tree_sel_changing self, :on_sel_changing
|
119
|
+
evt_tree_key_down self, :on_tree_key_down
|
120
|
+
evt_tree_item_activated self, :on_item_activated
|
121
|
+
evt_tree_state_image_click self, :on_item_state_clicked
|
122
|
+
|
123
|
+
# EVT_TREE_ITEM_MENU is the preferred event for creating context menus
|
124
|
+
# on a tree control, because it includes the point of the click or item,
|
125
|
+
# meaning that no additional placement calculations are required.
|
126
|
+
evt_tree_item_menu self, :on_item_menu
|
127
|
+
evt_tree_item_right_click self, :on_item_rclick
|
128
|
+
|
129
|
+
evt_context_menu :on_context_menu
|
130
|
+
|
131
|
+
evt_right_dclick :on_rmouse_dclick
|
132
|
+
evt_right_down :on_rmouse_down
|
133
|
+
evt_right_up :on_rmouse_up
|
147
134
|
end
|
148
135
|
|
149
|
-
|
150
|
-
|
151
|
-
curState = get_item_state(id)
|
136
|
+
attr_accessor :alternate_images, :alternate_states, :reverse_sort
|
152
137
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
end
|
159
|
-
|
160
|
-
def show_info(id)
|
161
|
-
Wx::log_message("Item '%s': %sselected, %sexpanded, %sbold,\n" +
|
162
|
-
"%d children (%d immediately under selected item).",
|
163
|
-
get_item_text(id),
|
164
|
-
bool_to_str(is_selected(id)),
|
165
|
-
bool_to_str(is_expanded(id)),
|
166
|
-
bool_to_str(is_bold(id)),
|
167
|
-
get_children_count(id),
|
168
|
-
get_children_count(id, false))
|
169
|
-
end
|
138
|
+
def reset_broken_state_images
|
139
|
+
count = self.state_image_list.get_image_count
|
140
|
+
state = count > 0 ? count - 1 : Wx::TREE_ITEMSTATE_NONE
|
141
|
+
do_reset_broken_state_images(self.root_item, nil, state)
|
142
|
+
end
|
170
143
|
|
171
|
-
|
172
|
-
|
173
|
-
|
144
|
+
def do_reset_broken_state_images(parent, cookie, state)
|
145
|
+
unless cookie
|
146
|
+
id, cookie = get_first_child(parent)
|
147
|
+
else
|
148
|
+
id, cookie = get_next_child(parent, cookie)
|
149
|
+
end
|
174
150
|
|
175
|
-
|
176
|
-
@reverse_sort = reverse
|
177
|
-
sort_children(item)
|
178
|
-
end
|
151
|
+
return unless id.ok?
|
179
152
|
|
180
|
-
|
181
|
-
ensure_visible(@last_item)
|
182
|
-
end
|
153
|
+
curState = get_item_state(id)
|
183
154
|
|
184
|
-
|
185
|
-
return @image_size
|
186
|
-
end
|
155
|
+
set_item_state(id, state) if curState != Wx::TREE_ITEMSTATE_NONE && curState > state
|
187
156
|
|
188
|
-
|
189
|
-
# the test item is the first child folder
|
190
|
-
return item_parent(item) == root_item && !prev_sibling(item)
|
191
|
-
end
|
157
|
+
do_reset_broken_state_images(id, nil, state) if item_has_children(id)
|
192
158
|
|
193
|
-
|
194
|
-
if size < 0
|
195
|
-
unset_image_list
|
196
|
-
return
|
197
|
-
elsif size == 0
|
198
|
-
size = @image_size
|
199
|
-
else
|
200
|
-
@image_size = size
|
201
|
-
end
|
202
|
-
|
203
|
-
Wx::BusyCursor.busy do
|
204
|
-
# should correspond to TreeCtrlIcon_xxx enum
|
205
|
-
icons = if @alternate_images
|
206
|
-
[Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon1.xpm'), Wx::BITMAP_TYPE_XPM),
|
207
|
-
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon2.xpm'), Wx::BITMAP_TYPE_XPM),
|
208
|
-
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon3.xpm'), Wx::BITMAP_TYPE_XPM),
|
209
|
-
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon4.xpm'), Wx::BITMAP_TYPE_XPM),
|
210
|
-
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon5.xpm'), Wx::BITMAP_TYPE_XPM),
|
211
|
-
]
|
212
|
-
else
|
213
|
-
icon_size = Wx::Size.new(@image_size, @image_size)
|
214
|
-
ic1 = Wx::ArtProvider::get_icon(Wx::ART_NORMAL_FILE, Wx::ART_LIST, icon_size)
|
215
|
-
ic2 = Wx::ArtProvider::get_icon(Wx::ART_FOLDER, Wx::ART_LIST, icon_size)
|
216
|
-
[ic1, ic1, ic2, ic2, ic2]
|
217
|
-
end
|
218
|
-
|
219
|
-
# Make an image list containing small icons
|
220
|
-
images = Wx::ImageList.new(@image_size, @image_size, true)
|
221
|
-
icons.each do |ic|
|
222
|
-
orig_size = ic.get_width
|
223
|
-
ic = if @image_size == orig_size
|
224
|
-
ic
|
225
|
-
else
|
226
|
-
Wx::Bitmap.new(ic.convert_to_image.rescale(@image_size, @image_size))
|
227
|
-
end
|
228
|
-
images.add(ic)
|
229
|
-
end
|
230
|
-
self.image_list = images
|
159
|
+
do_reset_broken_state_images(parent, cookie, state)
|
231
160
|
end
|
232
|
-
end
|
233
161
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
162
|
+
def show_info(id)
|
163
|
+
Wx::log_message("Item '%s': %sselected, %sexpanded, %sbold,\n" +
|
164
|
+
"%d children (%d immediately under selected item).",
|
165
|
+
get_item_text(id),
|
166
|
+
bool_to_str(is_selected(id)),
|
167
|
+
bool_to_str(is_expanded(id)),
|
168
|
+
bool_to_str(is_bold(id)),
|
169
|
+
get_children_count(id),
|
170
|
+
get_children_count(id, false))
|
242
171
|
end
|
243
172
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
Wx::Icon.new(File.join(File.dirname(__FILE__), 'state2.xpm'), Wx::BITMAP_TYPE_XPM),
|
248
|
-
Wx::Icon.new(File.join(File.dirname(__FILE__), 'state3.xpm'), Wx::BITMAP_TYPE_XPM),
|
249
|
-
Wx::Icon.new(File.join(File.dirname(__FILE__), 'state4.xpm'), Wx::BITMAP_TYPE_XPM),
|
250
|
-
Wx::Icon.new(File.join(File.dirname(__FILE__), 'state5.xpm'), Wx::BITMAP_TYPE_XPM)]
|
251
|
-
|
252
|
-
else
|
253
|
-
[Wx::Icon.new(File.join(File.dirname(__FILE__), 'unchecked.xpm'), Wx::BITMAP_TYPE_XPM),
|
254
|
-
Wx::Icon.new(File.join(File.dirname(__FILE__), 'checked.xpm'), Wx::BITMAP_TYPE_XPM)]
|
255
|
-
end
|
173
|
+
def bool_to_str(bool)
|
174
|
+
bool ? " " : "not "
|
175
|
+
end
|
256
176
|
|
257
|
-
|
258
|
-
|
177
|
+
def do_sort_children(item, reverse = false)
|
178
|
+
@reverse_sort = reverse
|
179
|
+
sort_children(item)
|
180
|
+
end
|
259
181
|
|
260
|
-
|
261
|
-
|
182
|
+
def do_ensure_visible
|
183
|
+
ensure_visible(@last_item)
|
184
|
+
end
|
262
185
|
|
263
|
-
|
186
|
+
def image_size
|
187
|
+
return @image_size
|
188
|
+
end
|
264
189
|
|
265
|
-
|
190
|
+
def is_test_item(item)
|
191
|
+
# the test item is the first child folder
|
192
|
+
return item_parent(item) == root_item && !prev_sibling(item)
|
266
193
|
end
|
267
|
-
end
|
268
194
|
|
269
|
-
|
270
|
-
unless Wx::PLATFORM == 'WXMSW'
|
195
|
+
def create_image_list(size)
|
271
196
|
if size < 0
|
272
|
-
|
197
|
+
unset_image_list
|
273
198
|
return
|
199
|
+
elsif size == 0
|
200
|
+
size = @image_size
|
201
|
+
else
|
202
|
+
@image_size = size
|
274
203
|
end
|
275
204
|
|
276
|
-
# Make an image list containing small icons
|
277
|
-
images = Wx::ImageList.new(size, size, true)
|
278
|
-
|
279
|
-
# should correspond to TreeCtrlIcon_xxx enum
|
280
205
|
Wx::BusyCursor.busy do
|
206
|
+
# should correspond to TreeCtrlIcon_xxx enum
|
281
207
|
icons = if @alternate_images
|
282
|
-
[Wx::Icon.new(File.join(File.dirname(__FILE__), '
|
208
|
+
[Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon1.xpm'), Wx::BITMAP_TYPE_XPM),
|
209
|
+
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon2.xpm'), Wx::BITMAP_TYPE_XPM),
|
283
210
|
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon3.xpm'), Wx::BITMAP_TYPE_XPM),
|
211
|
+
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon4.xpm'), Wx::BITMAP_TYPE_XPM),
|
284
212
|
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon5.xpm'), Wx::BITMAP_TYPE_XPM),
|
285
|
-
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon5.xpm'), Wx::BITMAP_TYPE_XPM)
|
286
213
|
]
|
287
214
|
else
|
288
215
|
icon_size = Wx::Size.new(@image_size, @image_size)
|
289
|
-
ic1 = Wx::ArtProvider::get_icon(Wx::
|
290
|
-
ic2 = Wx::ArtProvider::get_icon(Wx::
|
291
|
-
[ic1, ic1, ic2, ic2]
|
216
|
+
ic1 = Wx::ArtProvider::get_icon(Wx::ART_NORMAL_FILE, Wx::ART_LIST, icon_size)
|
217
|
+
ic2 = Wx::ArtProvider::get_icon(Wx::ART_FOLDER, Wx::ART_LIST, icon_size)
|
218
|
+
[ic1, ic1, ic2, ic2, ic2]
|
292
219
|
end
|
293
220
|
|
221
|
+
# Make an image list containing small icons
|
222
|
+
images = Wx::ImageList.new(@image_size, @image_size, true)
|
294
223
|
icons.each do |ic|
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
224
|
+
orig_size = ic.get_width
|
225
|
+
ic = if @image_size == orig_size
|
226
|
+
ic
|
227
|
+
else
|
228
|
+
Wx::Bitmap.new(ic.convert_to_image.rescale(@image_size, @image_size))
|
229
|
+
end
|
230
|
+
images.add(ic)
|
301
231
|
end
|
302
|
-
|
303
|
-
self.buttons_image_list = images
|
232
|
+
self.image_list = images
|
304
233
|
end
|
305
234
|
end
|
306
|
-
end
|
307
235
|
|
308
|
-
|
309
|
-
|
310
|
-
# just exchange 1st and 2nd items
|
311
|
-
return super(item2, item1)
|
312
|
-
else
|
313
|
-
return super(item1, item2)
|
236
|
+
def unset_image_list
|
237
|
+
self.image_list = nil
|
314
238
|
end
|
315
|
-
end
|
316
239
|
|
317
|
-
|
318
|
-
|
319
|
-
|
240
|
+
def create_state_imageList(del = false)
|
241
|
+
if del
|
242
|
+
self.state_image_list = nil
|
243
|
+
return
|
244
|
+
end
|
320
245
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
# here we pass to append_item normal and selected item images (we
|
329
|
-
# suppose that selected image follows the normal one in the enum)
|
330
|
-
if Wx::THE_APP.show_images
|
331
|
-
image = depth == 1 ? TreeCtrlIcon_File : TreeCtrlIcon_Folder
|
332
|
-
imageSel = image + 1
|
333
|
-
else
|
334
|
-
image = imageSel = -1
|
335
|
-
end
|
336
|
-
id = append_item(parent_id, str, image, imageSel)
|
246
|
+
Wx::BusyCursor.busy do
|
247
|
+
icons = if @alternate_states
|
248
|
+
[Wx::Icon.new(File.join(File.dirname(__FILE__), 'state1.xpm'), Wx::BITMAP_TYPE_XPM),
|
249
|
+
Wx::Icon.new(File.join(File.dirname(__FILE__), 'state2.xpm'), Wx::BITMAP_TYPE_XPM),
|
250
|
+
Wx::Icon.new(File.join(File.dirname(__FILE__), 'state3.xpm'), Wx::BITMAP_TYPE_XPM),
|
251
|
+
Wx::Icon.new(File.join(File.dirname(__FILE__), 'state4.xpm'), Wx::BITMAP_TYPE_XPM),
|
252
|
+
Wx::Icon.new(File.join(File.dirname(__FILE__), 'state5.xpm'), Wx::BITMAP_TYPE_XPM)]
|
337
253
|
|
338
|
-
|
254
|
+
else
|
255
|
+
[Wx::Icon.new(File.join(File.dirname(__FILE__), 'unchecked.xpm'), Wx::BITMAP_TYPE_XPM),
|
256
|
+
Wx::Icon.new(File.join(File.dirname(__FILE__), 'checked.xpm'), Wx::BITMAP_TYPE_XPM)]
|
257
|
+
end
|
339
258
|
|
340
|
-
|
341
|
-
|
342
|
-
set_item_image(id, TreeCtrlIcon_FolderOpened, Wx::TreeItemIcon_Expanded)
|
343
|
-
end
|
259
|
+
width = icons[0].width
|
260
|
+
height = icons[0].height
|
344
261
|
|
345
|
-
#
|
346
|
-
|
347
|
-
|
348
|
-
|
262
|
+
# Make a state image list containing small icons
|
263
|
+
states = Wx::ImageList.new(width, height, true)
|
264
|
+
|
265
|
+
icons.each { |ic| states.add(ic) }
|
349
266
|
|
350
|
-
|
267
|
+
self.state_image_list = states
|
351
268
|
end
|
352
269
|
end
|
353
|
-
end
|
354
270
|
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
271
|
+
def create_buttons_image_list(size)
|
272
|
+
unless Wx::PLATFORM == 'WXMSW'
|
273
|
+
if size < 0
|
274
|
+
self.buttons_image_list = nil
|
275
|
+
return
|
276
|
+
end
|
361
277
|
|
362
|
-
|
278
|
+
# Make an image list containing small icons
|
279
|
+
images = Wx::ImageList.new(size, size, true)
|
280
|
+
|
281
|
+
# should correspond to TreeCtrlIcon_xxx enum
|
282
|
+
Wx::BusyCursor.busy do
|
283
|
+
icons = if @alternate_images
|
284
|
+
[Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon3.xpm'), Wx::BITMAP_TYPE_XPM),
|
285
|
+
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon3.xpm'), Wx::BITMAP_TYPE_XPM),
|
286
|
+
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon5.xpm'), Wx::BITMAP_TYPE_XPM),
|
287
|
+
Wx::Icon.new(File.join(File.dirname(__FILE__), 'icon5.xpm'), Wx::BITMAP_TYPE_XPM)
|
288
|
+
]
|
289
|
+
else
|
290
|
+
icon_size = Wx::Size.new(@image_size, @image_size)
|
291
|
+
ic1 = Wx::ArtProvider::get_icon(Wx::ART_FOLDER, Wx::ART_LIST, icon_size)
|
292
|
+
ic2 = Wx::ArtProvider::get_icon(Wx::ART_FOLDER_OPEN, Wx::ART_LIST, icon_size)
|
293
|
+
[ic1, ic1, ic2, ic2]
|
294
|
+
end
|
295
|
+
|
296
|
+
icons.each do |ic|
|
297
|
+
if ic.width == size
|
298
|
+
images.add(ic)
|
299
|
+
else
|
300
|
+
resized = ic.convert_to_image.rescale(size, size)
|
301
|
+
images.add(Wx::Bitmap.new(resized))
|
302
|
+
end
|
303
|
+
end
|
363
304
|
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
# Wx::TR_HAS_VARIABLE_ROW_HEIGHT style was used in the constructor
|
368
|
-
if !self.has_flag(Wx::TR_HIDE_ROOT)
|
369
|
-
set_item_font(root_id, Wx::ITALIC_FONT)
|
305
|
+
self.buttons_image_list = images
|
306
|
+
end
|
307
|
+
end
|
370
308
|
end
|
371
309
|
|
372
|
-
|
310
|
+
def on_compare_items(item1, item2)
|
311
|
+
if @reverse_sort
|
312
|
+
# just exchange 1st and 2nd items
|
313
|
+
return super(item2, item1)
|
314
|
+
else
|
315
|
+
return super(item1, item2)
|
316
|
+
end
|
317
|
+
end
|
373
318
|
|
374
|
-
|
375
|
-
|
319
|
+
def add_items_recursively(parent_id, num_children, depth, folder)
|
320
|
+
if depth > 0
|
321
|
+
has_children = depth > 1
|
376
322
|
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
323
|
+
(0...num_children).each do |n|
|
324
|
+
# at depth 1 elements won't have any more children
|
325
|
+
if has_children
|
326
|
+
str = "Folder child #{n + 1}"
|
327
|
+
else
|
328
|
+
str = "File child #{folder}.#{n + 1}"
|
329
|
+
end
|
330
|
+
# here we pass to append_item normal and selected item images (we
|
331
|
+
# suppose that selected image follows the normal one in the enum)
|
332
|
+
if Wx::THE_APP.show_images
|
333
|
+
image = depth == 1 ? TreeCtrlIcon_File : TreeCtrlIcon_Folder
|
334
|
+
imageSel = image + 1
|
335
|
+
else
|
336
|
+
image = imageSel = -1
|
337
|
+
end
|
338
|
+
id = append_item(parent_id, str, image, imageSel)
|
381
339
|
|
382
|
-
|
383
|
-
item = self.root_item
|
384
|
-
while item.ok?
|
385
|
-
itemChild = get_last_child(item)
|
386
|
-
break unless itemChild.ok?
|
340
|
+
set_item_state(id, 0) if Wx::THE_APP.show_states
|
387
341
|
|
388
|
-
|
389
|
-
|
342
|
+
# and now we also set the expanded one (only for the folders)
|
343
|
+
if has_children && Wx::get_app.show_images
|
344
|
+
set_item_image(id, TreeCtrlIcon_FolderOpened, Wx::TreeItemIcon_Expanded)
|
345
|
+
end
|
390
346
|
|
391
|
-
|
392
|
-
|
393
|
-
|
347
|
+
# remember the last child for OnEnsureVisible()
|
348
|
+
if !has_children && n == num_children - 1
|
349
|
+
@last_item = id
|
350
|
+
end
|
394
351
|
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
else
|
399
|
-
id, cookie = get_next_child(parent_id, cookie)
|
400
|
-
end
|
401
|
-
unless id.ok?
|
402
|
-
return nil
|
352
|
+
add_items_recursively(id, num_children, depth - 1, n + 1)
|
353
|
+
end
|
354
|
+
end
|
403
355
|
end
|
404
356
|
|
405
|
-
|
406
|
-
|
357
|
+
def add_test_items_to_tree(num_children, depth)
|
358
|
+
image = Wx::THE_APP.show_images ? TreeCtrlIcon_Folder : -1
|
359
|
+
root_id = add_root("Root", image, image, 'Root item')
|
360
|
+
if !self.has_flag(Wx::TR_HIDE_ROOT) && image != -1
|
361
|
+
set_item_image(root_id, TreeCtrlIcon_FolderOpened, Wx::TreeItemIcon_Expanded)
|
362
|
+
end
|
407
363
|
|
408
|
-
|
409
|
-
get_items_recursively(id, -1)
|
410
|
-
end
|
411
|
-
get_items_recursively(parent_id, cookie)
|
412
|
-
end
|
364
|
+
add_items_recursively(root_id, num_children, depth, 0)
|
413
365
|
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
366
|
+
# set some colours/fonts for testing
|
367
|
+
# note that font sizes can also be varied, but only on platforms
|
368
|
+
# that use the generic TreeCtrl - OS X and GTK, and only if
|
369
|
+
# Wx::TR_HAS_VARIABLE_ROW_HEIGHT style was used in the constructor
|
370
|
+
if !self.has_flag(Wx::TR_HIDE_ROOT)
|
371
|
+
set_item_font(root_id, Wx::ITALIC_FONT)
|
372
|
+
end
|
421
373
|
|
422
|
-
|
374
|
+
ids = get_item_children(root_id)
|
423
375
|
|
424
|
-
|
425
|
-
|
426
|
-
new_img = TreeCtrlIcon_File
|
427
|
-
else
|
428
|
-
new_img = TreeCtrlIcon_Folder
|
429
|
-
end
|
376
|
+
# make the first item blue
|
377
|
+
set_item_text_colour(ids[0], Wx::BLUE)
|
430
378
|
|
431
|
-
|
432
|
-
|
379
|
+
# make the third item red on grey
|
380
|
+
set_item_text_colour(ids[2], Wx::RED)
|
381
|
+
set_item_background_colour(ids[2], Wx::LIGHT_GREY)
|
382
|
+
end
|
433
383
|
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
384
|
+
def get_last_tree_item
|
385
|
+
item = self.root_item
|
386
|
+
while item.ok?
|
387
|
+
itemChild = get_last_child(item)
|
388
|
+
break unless itemChild.ok?
|
438
389
|
|
439
|
-
|
440
|
-
|
390
|
+
item = itemChild
|
391
|
+
end
|
441
392
|
|
442
|
-
|
443
|
-
else
|
444
|
-
# we have only 2 checkbox states, so next state will be reversed
|
445
|
-
set_item_state(item, Wx::TREE_ITEMSTATE_NEXT)
|
393
|
+
item
|
446
394
|
end
|
447
|
-
|
395
|
+
alias :last_tree_item :get_last_tree_item
|
448
396
|
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
397
|
+
def get_items_recursively(parent_id, cookie)
|
398
|
+
if cookie == -1
|
399
|
+
id, cookie = get_first_child(parent_id)
|
400
|
+
else
|
401
|
+
id, cookie = get_next_child(parent_id, cookie)
|
402
|
+
end
|
403
|
+
unless id.ok?
|
404
|
+
return nil
|
405
|
+
end
|
453
406
|
|
454
|
-
|
455
|
-
|
456
|
-
event.skip
|
457
|
-
end
|
407
|
+
text = item_text(id)
|
408
|
+
Wx::log_message(text)
|
458
409
|
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
410
|
+
if item_has_children(id)
|
411
|
+
get_items_recursively(id, -1)
|
412
|
+
end
|
413
|
+
get_items_recursively(parent_id, cookie)
|
414
|
+
end
|
463
415
|
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
416
|
+
def do_toggle_icon(item)
|
417
|
+
old_img = get_item_image(item)
|
418
|
+
if old_img == TreeCtrlIcon_Folder
|
419
|
+
new_img = TreeCtrlIcon_File
|
420
|
+
else
|
421
|
+
new_img = TreeCtrlIcon_Folder
|
422
|
+
end
|
468
423
|
|
469
|
-
|
470
|
-
Wx::log_message("OnItemExpanded")
|
471
|
-
event.skip
|
472
|
-
end
|
424
|
+
set_item_image(item, new_img, Wx::TreeItemIcon_Normal)
|
473
425
|
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
426
|
+
old_img = get_item_image(item, Wx::TreeItemIcon_Selected)
|
427
|
+
if old_img == TreeCtrlIcon_Folder
|
428
|
+
new_img = TreeCtrlIcon_File
|
429
|
+
else
|
430
|
+
new_img = TreeCtrlIcon_Folder
|
431
|
+
end
|
478
432
|
|
479
|
-
|
480
|
-
|
481
|
-
event.skip
|
482
|
-
end
|
433
|
+
set_item_image(item, new_img, Wx::TreeItemIcon_Selected)
|
434
|
+
end
|
483
435
|
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
436
|
+
def do_toggle_state(item)
|
437
|
+
if @alternate_states
|
438
|
+
# sets random state unlike current
|
439
|
+
nState = state = get_item_state(item)
|
488
440
|
|
489
|
-
|
490
|
-
|
491
|
-
event.skip
|
492
|
-
end
|
441
|
+
nimg = state_image_list.image_count
|
442
|
+
nState = (rand(::Time.now.to_i) % nimg) until nState != state
|
493
443
|
|
494
|
-
|
495
|
-
keycode = event.key_code
|
496
|
-
|
497
|
-
case keycode
|
498
|
-
when Wx::K_BACK
|
499
|
-
key = "BACK"
|
500
|
-
when Wx::K_TAB
|
501
|
-
key = "TAB"
|
502
|
-
when Wx::K_RETURN
|
503
|
-
key = "RETURN"
|
504
|
-
when Wx::K_ESCAPE
|
505
|
-
key = "ESCAPE"
|
506
|
-
when Wx::K_SPACE
|
507
|
-
key = "SPACE"
|
508
|
-
when Wx::K_DELETE
|
509
|
-
key = "DELETE"
|
510
|
-
when Wx::K_START
|
511
|
-
key = "START"
|
512
|
-
when Wx::K_LBUTTON
|
513
|
-
key = "LBUTTON"
|
514
|
-
when Wx::K_RBUTTON
|
515
|
-
key = "RBUTTON"
|
516
|
-
when Wx::K_CANCEL
|
517
|
-
key = "CANCEL"
|
518
|
-
when Wx::K_MBUTTON
|
519
|
-
key = "MBUTTON"
|
520
|
-
when Wx::K_CLEAR
|
521
|
-
key = "CLEAR"
|
522
|
-
when Wx::K_SHIFT
|
523
|
-
key = "SHIFT"
|
524
|
-
when Wx::K_ALT
|
525
|
-
key = "ALT"
|
526
|
-
when Wx::K_CONTROL
|
527
|
-
key = "CONTROL"
|
528
|
-
when Wx::K_MENU
|
529
|
-
key = "MENU"
|
530
|
-
when Wx::K_PAUSE
|
531
|
-
key = "PAUSE"
|
532
|
-
when Wx::K_CAPITAL
|
533
|
-
key = "CAPITAL"
|
534
|
-
when Wx::K_END
|
535
|
-
key = "END"
|
536
|
-
when Wx::K_HOME
|
537
|
-
key = "HOME"
|
538
|
-
when Wx::K_LEFT
|
539
|
-
key = "LEFT"
|
540
|
-
when Wx::K_UP
|
541
|
-
key = "UP"
|
542
|
-
when Wx::K_RIGHT
|
543
|
-
key = "RIGHT"
|
544
|
-
when Wx::K_DOWN
|
545
|
-
key = "DOWN"
|
546
|
-
when Wx::K_SELECT
|
547
|
-
key = "SELECT"
|
548
|
-
when Wx::K_PRINT
|
549
|
-
key = "PRINT"
|
550
|
-
when Wx::K_EXECUTE
|
551
|
-
key = "EXECUTE"
|
552
|
-
when Wx::K_SNAPSHOT
|
553
|
-
key = "SNAPSHOT"
|
554
|
-
when Wx::K_INSERT
|
555
|
-
key = "INSERT"
|
556
|
-
when Wx::K_HELP
|
557
|
-
key = "HELP"
|
558
|
-
when Wx::K_NUMPAD0
|
559
|
-
key = "NUMPAD0"
|
560
|
-
when Wx::K_NUMPAD1
|
561
|
-
key = "NUMPAD1"
|
562
|
-
when Wx::K_NUMPAD2
|
563
|
-
key = "NUMPAD2"
|
564
|
-
when Wx::K_NUMPAD3
|
565
|
-
key = "NUMPAD3"
|
566
|
-
when Wx::K_NUMPAD4
|
567
|
-
key = "NUMPAD4"
|
568
|
-
when Wx::K_NUMPAD5
|
569
|
-
key = "NUMPAD5"
|
570
|
-
when Wx::K_NUMPAD6
|
571
|
-
key = "NUMPAD6"
|
572
|
-
when Wx::K_NUMPAD7
|
573
|
-
key = "NUMPAD7"
|
574
|
-
when Wx::K_NUMPAD8
|
575
|
-
key = "NUMPAD8"
|
576
|
-
when Wx::K_NUMPAD9
|
577
|
-
key = "NUMPAD9"
|
578
|
-
when Wx::K_MULTIPLY
|
579
|
-
key = "MULTIPLY"
|
580
|
-
when Wx::K_ADD
|
581
|
-
key = "ADD"
|
582
|
-
when Wx::K_SEPARATOR
|
583
|
-
key = "SEPARATOR"
|
584
|
-
when Wx::K_SUBTRACT
|
585
|
-
key = "SUBTRACT"
|
586
|
-
when Wx::K_DECIMAL
|
587
|
-
key = "DECIMAL"
|
588
|
-
when Wx::K_DIVIDE
|
589
|
-
key = "DIVIDE"
|
590
|
-
when Wx::K_F1
|
591
|
-
key = "F1"
|
592
|
-
when Wx::K_F2
|
593
|
-
key = "F2"
|
594
|
-
when Wx::K_F3
|
595
|
-
key = "F3"
|
596
|
-
when Wx::K_F4
|
597
|
-
key = "F4"
|
598
|
-
when Wx::K_F5
|
599
|
-
key = "F5"
|
600
|
-
when Wx::K_F6
|
601
|
-
key = "F6"
|
602
|
-
when Wx::K_F7
|
603
|
-
key = "F7"
|
604
|
-
when Wx::K_F8
|
605
|
-
key = "F8"
|
606
|
-
when Wx::K_F9
|
607
|
-
key = "F9"
|
608
|
-
when Wx::K_F10
|
609
|
-
key = "F10"
|
610
|
-
when Wx::K_F11
|
611
|
-
key = "F11"
|
612
|
-
when Wx::K_F12
|
613
|
-
key = "F12"
|
614
|
-
when Wx::K_F13
|
615
|
-
key = "F13"
|
616
|
-
when Wx::K_F14
|
617
|
-
key = "F14"
|
618
|
-
when Wx::K_F15
|
619
|
-
key = "F15"
|
620
|
-
when Wx::K_F16
|
621
|
-
key = "F16"
|
622
|
-
when Wx::K_F17
|
623
|
-
key = "F17"
|
624
|
-
when Wx::K_F18
|
625
|
-
key = "F18"
|
626
|
-
when Wx::K_F19
|
627
|
-
key = "F19"
|
628
|
-
when Wx::K_F20
|
629
|
-
key = "F20"
|
630
|
-
when Wx::K_F21
|
631
|
-
key = "F21"
|
632
|
-
when Wx::K_F22
|
633
|
-
key = "F22"
|
634
|
-
when Wx::K_F23
|
635
|
-
key = "F23"
|
636
|
-
when Wx::K_F24
|
637
|
-
key = "F24"
|
638
|
-
when Wx::K_NUMLOCK
|
639
|
-
key = "NUMLOCK"
|
640
|
-
when Wx::K_SCROLL
|
641
|
-
key = "SCROLL"
|
642
|
-
when Wx::K_PAGEUP
|
643
|
-
key = "PAGEUP"
|
644
|
-
when Wx::K_PAGEDOWN
|
645
|
-
key = "PAGEDOWN"
|
646
|
-
when Wx::K_NUMPAD_SPACE
|
647
|
-
key = "NUMPAD_SPACE"
|
648
|
-
when Wx::K_NUMPAD_TAB
|
649
|
-
key = "NUMPAD_TAB"
|
650
|
-
when Wx::K_NUMPAD_ENTER
|
651
|
-
key = "NUMPAD_ENTER"
|
652
|
-
when Wx::K_NUMPAD_F1
|
653
|
-
key = "NUMPAD_F1"
|
654
|
-
when Wx::K_NUMPAD_F2
|
655
|
-
key = "NUMPAD_F2"
|
656
|
-
when Wx::K_NUMPAD_F3
|
657
|
-
key = "NUMPAD_F3"
|
658
|
-
when Wx::K_NUMPAD_F4
|
659
|
-
key = "NUMPAD_F4"
|
660
|
-
when Wx::K_NUMPAD_HOME
|
661
|
-
key = "NUMPAD_HOME"
|
662
|
-
when Wx::K_NUMPAD_LEFT
|
663
|
-
key = "NUMPAD_LEFT"
|
664
|
-
when Wx::K_NUMPAD_UP
|
665
|
-
key = "NUMPAD_UP"
|
666
|
-
when Wx::K_NUMPAD_RIGHT
|
667
|
-
key = "NUMPAD_RIGHT"
|
668
|
-
when Wx::K_NUMPAD_DOWN
|
669
|
-
key = "NUMPAD_DOWN"
|
670
|
-
when Wx::K_NUMPAD_PAGEUP
|
671
|
-
key = "NUMPAD_PAGEUP"
|
672
|
-
when Wx::K_NUMPAD_PAGEDOWN
|
673
|
-
key = "NUMPAD_PAGEDOWN"
|
674
|
-
when Wx::K_NUMPAD_END
|
675
|
-
key = "NUMPAD_END"
|
676
|
-
when Wx::K_NUMPAD_BEGIN
|
677
|
-
key = "NUMPAD_BEGIN"
|
678
|
-
when Wx::K_NUMPAD_INSERT
|
679
|
-
key = "NUMPAD_INSERT"
|
680
|
-
when Wx::K_NUMPAD_DELETE
|
681
|
-
key = "NUMPAD_DELETE"
|
682
|
-
when Wx::K_NUMPAD_EQUAL
|
683
|
-
key = "NUMPAD_EQUAL"
|
684
|
-
when Wx::K_NUMPAD_MULTIPLY
|
685
|
-
key = "NUMPAD_MULTIPLY"
|
686
|
-
when Wx::K_NUMPAD_ADD
|
687
|
-
key = "NUMPAD_ADD"
|
688
|
-
when Wx::K_NUMPAD_SEPARATOR
|
689
|
-
key = "NUMPAD_SEPARATOR"
|
690
|
-
when Wx::K_NUMPAD_SUBTRACT
|
691
|
-
key = "NUMPAD_SUBTRACT"
|
692
|
-
when Wx::K_NUMPAD_DECIMAL
|
693
|
-
key = "NUMPAD_DECIMAL"
|
694
|
-
when Wx::K_BROWSER_BACK
|
695
|
-
key = "BROWSER_BACK"
|
696
|
-
when Wx::K_BROWSER_FORWARD
|
697
|
-
key = "BROWSER_FORWARD"
|
698
|
-
when Wx::K_BROWSER_REFRESH
|
699
|
-
key = "BROWSER_REFRESH"
|
700
|
-
when Wx::K_BROWSER_STOP
|
701
|
-
key = "BROWSER_STOP"
|
702
|
-
when Wx::K_BROWSER_SEARCH
|
703
|
-
key = "BROWSER_SEARCH"
|
704
|
-
when Wx::K_BROWSER_FAVORITES
|
705
|
-
key = "BROWSER_FAVORITES"
|
706
|
-
when Wx::K_BROWSER_HOME
|
707
|
-
key = "BROWSER_HOME"
|
708
|
-
when Wx::K_VOLUME_MUTE
|
709
|
-
key = "VOLUME_MUTE"
|
710
|
-
when Wx::K_VOLUME_DOWN
|
711
|
-
key = "VOLUME_DOWN"
|
712
|
-
when Wx::K_VOLUME_UP
|
713
|
-
key = "VOLUME_UP"
|
714
|
-
when Wx::K_MEDIA_NEXT_TRACK
|
715
|
-
key = "MEDIA_NEXT_TRACK"
|
716
|
-
when Wx::K_MEDIA_PREV_TRACK
|
717
|
-
key = "MEDIA_PREV_TRACK"
|
718
|
-
when Wx::K_MEDIA_STOP
|
719
|
-
key = "MEDIA_STOP"
|
720
|
-
when Wx::K_MEDIA_PLAY_PAUSE
|
721
|
-
key = "MEDIA_PLAY_PAUSE"
|
722
|
-
when Wx::K_LAUNCH_MAIL
|
723
|
-
key = "LAUNCH_MAIL"
|
724
|
-
when Wx::K_LAUNCH_APP1
|
725
|
-
key = "LAUNCH_APP1"
|
726
|
-
when Wx::K_LAUNCH_APP2
|
727
|
-
key = "LAUNCH_APP2"
|
728
|
-
else
|
729
|
-
if keycode >= 32 && keycode < 127
|
730
|
-
key = "'#{keycode.chr}'"
|
731
|
-
elsif keycode > 0 && keycode < 27
|
732
|
-
key = "Ctrl-#{?A + keycode - 1}"
|
444
|
+
set_item_state(item, nState)
|
733
445
|
else
|
734
|
-
|
446
|
+
# we have only 2 checkbox states, so next state will be reversed
|
447
|
+
set_item_state(item, Wx::TREE_ITEMSTATE_NEXT)
|
735
448
|
end
|
736
449
|
end
|
737
450
|
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
event.meta_down ? 'M' : '-'])
|
743
|
-
end
|
744
|
-
|
745
|
-
def on_tree_key_down(event)
|
746
|
-
log_key_event("Tree key down ", event.key_event)
|
747
|
-
event.skip
|
748
|
-
end
|
451
|
+
def on_begin_rdrag(event)
|
452
|
+
Wx::log_message("OnBeginRDrag")
|
453
|
+
event.skip
|
454
|
+
end
|
749
455
|
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
456
|
+
def on_delete_item(event)
|
457
|
+
Wx::log_message("OnDeleteItem")
|
458
|
+
event.skip
|
459
|
+
end
|
754
460
|
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
[item_text(@dragged_item), screenpt.x, screenpt.y])
|
759
|
-
event.allow
|
760
|
-
else
|
761
|
-
Wx::log_message("OnBeginDrag: selected item can't be dragged.")
|
461
|
+
def on_get_info(event)
|
462
|
+
Wx::log_message("OnGetInfo")
|
463
|
+
event.skip
|
762
464
|
end
|
763
|
-
end
|
764
465
|
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
466
|
+
def on_set_info(event)
|
467
|
+
Wx::log_message("OnSetInfo")
|
468
|
+
event.skip
|
469
|
+
end
|
769
470
|
|
770
|
-
|
771
|
-
|
772
|
-
|
471
|
+
def on_item_expanded(event)
|
472
|
+
Wx::log_message("OnItemExpanded")
|
473
|
+
event.skip
|
773
474
|
end
|
774
475
|
|
775
|
-
|
776
|
-
Wx::log_message("
|
777
|
-
|
476
|
+
def on_item_expanding(event)
|
477
|
+
Wx::log_message("OnItemExpanding")
|
478
|
+
event.skip
|
778
479
|
end
|
779
480
|
|
780
|
-
|
781
|
-
|
782
|
-
|
481
|
+
def on_item_collapsed(event)
|
482
|
+
Wx::log_message("OnItemCollapsed")
|
483
|
+
event.skip
|
484
|
+
end
|
783
485
|
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
#
|
789
|
-
# Finally, we only copy one item here but we might copy the entire tree if
|
790
|
-
# we were dragging a folder.
|
791
|
-
image = Wx::THE_APP.show_images ? TreeCtrlIcon_File : -1
|
792
|
-
new_id = append_item(dest_item, text, image)
|
486
|
+
def on_sel_changed(event)
|
487
|
+
Wx::log_message("OnSelChanged")
|
488
|
+
event.skip
|
489
|
+
end
|
793
490
|
|
794
|
-
|
795
|
-
|
491
|
+
def on_sel_changing(event)
|
492
|
+
Wx::log_message("OnSelChanging")
|
493
|
+
event.skip
|
494
|
+
end
|
796
495
|
|
797
|
-
|
798
|
-
|
496
|
+
def log_key_event(name, event)
|
497
|
+
keycode = event.key_code
|
498
|
+
|
499
|
+
case keycode
|
500
|
+
when Wx::K_BACK
|
501
|
+
key = "BACK"
|
502
|
+
when Wx::K_TAB
|
503
|
+
key = "TAB"
|
504
|
+
when Wx::K_RETURN
|
505
|
+
key = "RETURN"
|
506
|
+
when Wx::K_ESCAPE
|
507
|
+
key = "ESCAPE"
|
508
|
+
when Wx::K_SPACE
|
509
|
+
key = "SPACE"
|
510
|
+
when Wx::K_DELETE
|
511
|
+
key = "DELETE"
|
512
|
+
when Wx::K_START
|
513
|
+
key = "START"
|
514
|
+
when Wx::K_LBUTTON
|
515
|
+
key = "LBUTTON"
|
516
|
+
when Wx::K_RBUTTON
|
517
|
+
key = "RBUTTON"
|
518
|
+
when Wx::K_CANCEL
|
519
|
+
key = "CANCEL"
|
520
|
+
when Wx::K_MBUTTON
|
521
|
+
key = "MBUTTON"
|
522
|
+
when Wx::K_CLEAR
|
523
|
+
key = "CLEAR"
|
524
|
+
when Wx::K_SHIFT
|
525
|
+
key = "SHIFT"
|
526
|
+
when Wx::K_ALT
|
527
|
+
key = "ALT"
|
528
|
+
when Wx::K_CONTROL
|
529
|
+
key = "CONTROL"
|
530
|
+
when Wx::K_MENU
|
531
|
+
key = "MENU"
|
532
|
+
when Wx::K_PAUSE
|
533
|
+
key = "PAUSE"
|
534
|
+
when Wx::K_CAPITAL
|
535
|
+
key = "CAPITAL"
|
536
|
+
when Wx::K_END
|
537
|
+
key = "END"
|
538
|
+
when Wx::K_HOME
|
539
|
+
key = "HOME"
|
540
|
+
when Wx::K_LEFT
|
541
|
+
key = "LEFT"
|
542
|
+
when Wx::K_UP
|
543
|
+
key = "UP"
|
544
|
+
when Wx::K_RIGHT
|
545
|
+
key = "RIGHT"
|
546
|
+
when Wx::K_DOWN
|
547
|
+
key = "DOWN"
|
548
|
+
when Wx::K_SELECT
|
549
|
+
key = "SELECT"
|
550
|
+
when Wx::K_PRINT
|
551
|
+
key = "PRINT"
|
552
|
+
when Wx::K_EXECUTE
|
553
|
+
key = "EXECUTE"
|
554
|
+
when Wx::K_SNAPSHOT
|
555
|
+
key = "SNAPSHOT"
|
556
|
+
when Wx::K_INSERT
|
557
|
+
key = "INSERT"
|
558
|
+
when Wx::K_HELP
|
559
|
+
key = "HELP"
|
560
|
+
when Wx::K_NUMPAD0
|
561
|
+
key = "NUMPAD0"
|
562
|
+
when Wx::K_NUMPAD1
|
563
|
+
key = "NUMPAD1"
|
564
|
+
when Wx::K_NUMPAD2
|
565
|
+
key = "NUMPAD2"
|
566
|
+
when Wx::K_NUMPAD3
|
567
|
+
key = "NUMPAD3"
|
568
|
+
when Wx::K_NUMPAD4
|
569
|
+
key = "NUMPAD4"
|
570
|
+
when Wx::K_NUMPAD5
|
571
|
+
key = "NUMPAD5"
|
572
|
+
when Wx::K_NUMPAD6
|
573
|
+
key = "NUMPAD6"
|
574
|
+
when Wx::K_NUMPAD7
|
575
|
+
key = "NUMPAD7"
|
576
|
+
when Wx::K_NUMPAD8
|
577
|
+
key = "NUMPAD8"
|
578
|
+
when Wx::K_NUMPAD9
|
579
|
+
key = "NUMPAD9"
|
580
|
+
when Wx::K_MULTIPLY
|
581
|
+
key = "MULTIPLY"
|
582
|
+
when Wx::K_ADD
|
583
|
+
key = "ADD"
|
584
|
+
when Wx::K_SEPARATOR
|
585
|
+
key = "SEPARATOR"
|
586
|
+
when Wx::K_SUBTRACT
|
587
|
+
key = "SUBTRACT"
|
588
|
+
when Wx::K_DECIMAL
|
589
|
+
key = "DECIMAL"
|
590
|
+
when Wx::K_DIVIDE
|
591
|
+
key = "DIVIDE"
|
592
|
+
when Wx::K_F1
|
593
|
+
key = "F1"
|
594
|
+
when Wx::K_F2
|
595
|
+
key = "F2"
|
596
|
+
when Wx::K_F3
|
597
|
+
key = "F3"
|
598
|
+
when Wx::K_F4
|
599
|
+
key = "F4"
|
600
|
+
when Wx::K_F5
|
601
|
+
key = "F5"
|
602
|
+
when Wx::K_F6
|
603
|
+
key = "F6"
|
604
|
+
when Wx::K_F7
|
605
|
+
key = "F7"
|
606
|
+
when Wx::K_F8
|
607
|
+
key = "F8"
|
608
|
+
when Wx::K_F9
|
609
|
+
key = "F9"
|
610
|
+
when Wx::K_F10
|
611
|
+
key = "F10"
|
612
|
+
when Wx::K_F11
|
613
|
+
key = "F11"
|
614
|
+
when Wx::K_F12
|
615
|
+
key = "F12"
|
616
|
+
when Wx::K_F13
|
617
|
+
key = "F13"
|
618
|
+
when Wx::K_F14
|
619
|
+
key = "F14"
|
620
|
+
when Wx::K_F15
|
621
|
+
key = "F15"
|
622
|
+
when Wx::K_F16
|
623
|
+
key = "F16"
|
624
|
+
when Wx::K_F17
|
625
|
+
key = "F17"
|
626
|
+
when Wx::K_F18
|
627
|
+
key = "F18"
|
628
|
+
when Wx::K_F19
|
629
|
+
key = "F19"
|
630
|
+
when Wx::K_F20
|
631
|
+
key = "F20"
|
632
|
+
when Wx::K_F21
|
633
|
+
key = "F21"
|
634
|
+
when Wx::K_F22
|
635
|
+
key = "F22"
|
636
|
+
when Wx::K_F23
|
637
|
+
key = "F23"
|
638
|
+
when Wx::K_F24
|
639
|
+
key = "F24"
|
640
|
+
when Wx::K_NUMLOCK
|
641
|
+
key = "NUMLOCK"
|
642
|
+
when Wx::K_SCROLL
|
643
|
+
key = "SCROLL"
|
644
|
+
when Wx::K_PAGEUP
|
645
|
+
key = "PAGEUP"
|
646
|
+
when Wx::K_PAGEDOWN
|
647
|
+
key = "PAGEDOWN"
|
648
|
+
when Wx::K_NUMPAD_SPACE
|
649
|
+
key = "NUMPAD_SPACE"
|
650
|
+
when Wx::K_NUMPAD_TAB
|
651
|
+
key = "NUMPAD_TAB"
|
652
|
+
when Wx::K_NUMPAD_ENTER
|
653
|
+
key = "NUMPAD_ENTER"
|
654
|
+
when Wx::K_NUMPAD_F1
|
655
|
+
key = "NUMPAD_F1"
|
656
|
+
when Wx::K_NUMPAD_F2
|
657
|
+
key = "NUMPAD_F2"
|
658
|
+
when Wx::K_NUMPAD_F3
|
659
|
+
key = "NUMPAD_F3"
|
660
|
+
when Wx::K_NUMPAD_F4
|
661
|
+
key = "NUMPAD_F4"
|
662
|
+
when Wx::K_NUMPAD_HOME
|
663
|
+
key = "NUMPAD_HOME"
|
664
|
+
when Wx::K_NUMPAD_LEFT
|
665
|
+
key = "NUMPAD_LEFT"
|
666
|
+
when Wx::K_NUMPAD_UP
|
667
|
+
key = "NUMPAD_UP"
|
668
|
+
when Wx::K_NUMPAD_RIGHT
|
669
|
+
key = "NUMPAD_RIGHT"
|
670
|
+
when Wx::K_NUMPAD_DOWN
|
671
|
+
key = "NUMPAD_DOWN"
|
672
|
+
when Wx::K_NUMPAD_PAGEUP
|
673
|
+
key = "NUMPAD_PAGEUP"
|
674
|
+
when Wx::K_NUMPAD_PAGEDOWN
|
675
|
+
key = "NUMPAD_PAGEDOWN"
|
676
|
+
when Wx::K_NUMPAD_END
|
677
|
+
key = "NUMPAD_END"
|
678
|
+
when Wx::K_NUMPAD_BEGIN
|
679
|
+
key = "NUMPAD_BEGIN"
|
680
|
+
when Wx::K_NUMPAD_INSERT
|
681
|
+
key = "NUMPAD_INSERT"
|
682
|
+
when Wx::K_NUMPAD_DELETE
|
683
|
+
key = "NUMPAD_DELETE"
|
684
|
+
when Wx::K_NUMPAD_EQUAL
|
685
|
+
key = "NUMPAD_EQUAL"
|
686
|
+
when Wx::K_NUMPAD_MULTIPLY
|
687
|
+
key = "NUMPAD_MULTIPLY"
|
688
|
+
when Wx::K_NUMPAD_ADD
|
689
|
+
key = "NUMPAD_ADD"
|
690
|
+
when Wx::K_NUMPAD_SEPARATOR
|
691
|
+
key = "NUMPAD_SEPARATOR"
|
692
|
+
when Wx::K_NUMPAD_SUBTRACT
|
693
|
+
key = "NUMPAD_SUBTRACT"
|
694
|
+
when Wx::K_NUMPAD_DECIMAL
|
695
|
+
key = "NUMPAD_DECIMAL"
|
696
|
+
when Wx::K_BROWSER_BACK
|
697
|
+
key = "BROWSER_BACK"
|
698
|
+
when Wx::K_BROWSER_FORWARD
|
699
|
+
key = "BROWSER_FORWARD"
|
700
|
+
when Wx::K_BROWSER_REFRESH
|
701
|
+
key = "BROWSER_REFRESH"
|
702
|
+
when Wx::K_BROWSER_STOP
|
703
|
+
key = "BROWSER_STOP"
|
704
|
+
when Wx::K_BROWSER_SEARCH
|
705
|
+
key = "BROWSER_SEARCH"
|
706
|
+
when Wx::K_BROWSER_FAVORITES
|
707
|
+
key = "BROWSER_FAVORITES"
|
708
|
+
when Wx::K_BROWSER_HOME
|
709
|
+
key = "BROWSER_HOME"
|
710
|
+
when Wx::K_VOLUME_MUTE
|
711
|
+
key = "VOLUME_MUTE"
|
712
|
+
when Wx::K_VOLUME_DOWN
|
713
|
+
key = "VOLUME_DOWN"
|
714
|
+
when Wx::K_VOLUME_UP
|
715
|
+
key = "VOLUME_UP"
|
716
|
+
when Wx::K_MEDIA_NEXT_TRACK
|
717
|
+
key = "MEDIA_NEXT_TRACK"
|
718
|
+
when Wx::K_MEDIA_PREV_TRACK
|
719
|
+
key = "MEDIA_PREV_TRACK"
|
720
|
+
when Wx::K_MEDIA_STOP
|
721
|
+
key = "MEDIA_STOP"
|
722
|
+
when Wx::K_MEDIA_PLAY_PAUSE
|
723
|
+
key = "MEDIA_PLAY_PAUSE"
|
724
|
+
when Wx::K_LAUNCH_MAIL
|
725
|
+
key = "LAUNCH_MAIL"
|
726
|
+
when Wx::K_LAUNCH_APP1
|
727
|
+
key = "LAUNCH_APP1"
|
728
|
+
when Wx::K_LAUNCH_APP2
|
729
|
+
key = "LAUNCH_APP2"
|
730
|
+
else
|
731
|
+
if keycode >= 32 && keycode < 127
|
732
|
+
key = "'#{keycode.chr}'"
|
733
|
+
elsif keycode > 0 && keycode < 27
|
734
|
+
key = "Ctrl-#{?A + keycode - 1}"
|
735
|
+
else
|
736
|
+
key = "unknown (#{keycode})"
|
737
|
+
end
|
738
|
+
end
|
799
739
|
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
elsif item == self.root_item
|
806
|
-
# test that it is possible to change the text of the item being edited
|
807
|
-
set_item_text(item, "Editing root item")
|
740
|
+
Wx::log_message("#{name} event: #{key} (flags = %s%s%s%s)" %
|
741
|
+
[event.control_down ? 'C' : '-',
|
742
|
+
event.alt_down ? 'A' : '-',
|
743
|
+
event.shift_down ? 'S' : '-',
|
744
|
+
event.meta_down ? 'M' : '-'])
|
808
745
|
end
|
809
|
-
end
|
810
746
|
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
Wx::log_message("Label edit was cancelled by user")
|
815
|
-
return
|
747
|
+
def on_tree_key_down(event)
|
748
|
+
log_key_event("Tree key down ", event.key_event)
|
749
|
+
event.skip
|
816
750
|
end
|
817
751
|
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
752
|
+
def on_begin_drag(event)
|
753
|
+
# need to explicitly allow drag
|
754
|
+
if event.item != root_item
|
755
|
+
@dragged_item = event.item
|
756
|
+
|
757
|
+
clientpt = event.point
|
758
|
+
screenpt = client_to_screen(clientpt)
|
759
|
+
Wx::log_message("OnBeginDrag: started dragging %s at screen coords (%i,%i)" %
|
760
|
+
[item_text(@dragged_item), screenpt.x, screenpt.y])
|
761
|
+
event.allow
|
762
|
+
else
|
763
|
+
Wx::log_message("OnBeginDrag: selected item can't be dragged.")
|
764
|
+
end
|
824
765
|
end
|
825
|
-
end
|
826
766
|
|
827
|
-
|
828
|
-
|
767
|
+
def on_end_drag(event)
|
768
|
+
src_item = @dragged_item
|
769
|
+
dest_item = event.item
|
770
|
+
@dragged_item = nil
|
829
771
|
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
772
|
+
if dest_item.ok? && !item_has_children(dest_item)
|
773
|
+
# copy to the parent then
|
774
|
+
dest_item = get_item_parent(dest_item)
|
775
|
+
end
|
776
|
+
|
777
|
+
unless dest_item.ok?
|
778
|
+
Wx::log_message("OnEndDrag: can't drop here.")
|
779
|
+
return nil
|
780
|
+
end
|
781
|
+
|
782
|
+
text = item_text(src_item)
|
783
|
+
Wx::log_message("OnEndDrag: '%s' copied to '%s'.",
|
784
|
+
text, item_text(dest_item))
|
785
|
+
|
786
|
+
# just do append here - we could also insert it just before/after the item
|
787
|
+
# on which it was dropped, but self requires slightly more work... we also
|
788
|
+
# completely ignore the client data and icon of the old item but could
|
789
|
+
# copy them as well.
|
790
|
+
#
|
791
|
+
# Finally, we only copy one item here but we might copy the entire tree if
|
792
|
+
# we were dragging a folder.
|
793
|
+
image = Wx::THE_APP.show_images ? TreeCtrlIcon_File : -1
|
794
|
+
new_id = append_item(dest_item, text, image)
|
795
|
+
|
796
|
+
set_item_state(new_id, get_item_state(src_item)) if Wx::THE_APP.show_states
|
834
797
|
end
|
835
|
-
end
|
836
798
|
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
799
|
+
def on_begin_label_edit(event)
|
800
|
+
Wx::log_message("OnBeginLabelEdit")
|
801
|
+
|
802
|
+
# for testing, prevent self item's label editing
|
803
|
+
item = event.item
|
804
|
+
if is_test_item(item)
|
805
|
+
Wx::message_box("The demo prevents you editing this item.")
|
806
|
+
event.veto
|
807
|
+
elsif item == self.root_item
|
808
|
+
# test that it is possible to change the text of the item being edited
|
809
|
+
set_item_text(item, "Editing root item")
|
810
|
+
end
|
841
811
|
end
|
842
|
-
Wx::log_message("OnItemActivated")
|
843
|
-
end
|
844
812
|
|
845
|
-
|
846
|
-
|
847
|
-
|
813
|
+
def on_end_label_edit(event)
|
814
|
+
Wx::log_message("OnEndLabelEdit")
|
815
|
+
if event.edit_cancelled?
|
816
|
+
Wx::log_message("Label edit was cancelled by user")
|
817
|
+
return
|
818
|
+
end
|
819
|
+
|
820
|
+
# For a demo, don't allow anything except letters in the labels
|
821
|
+
unless event.label =~ /^\w+/
|
822
|
+
msg = "The new label should be a single word."
|
823
|
+
Wx::message_box(msg)
|
824
|
+
Wx::log_message("Label edit was cancelled by demo")
|
825
|
+
event.veto
|
826
|
+
end
|
848
827
|
end
|
849
|
-
Wx::log_message("Item \"#{get_item_text(item_id)}\" state changed to #{get_item_state(item_id)}")
|
850
|
-
end
|
851
828
|
|
852
|
-
|
853
|
-
|
829
|
+
def on_item_collapsing(event)
|
830
|
+
Wx::log_message("OnItemCollapsing")
|
854
831
|
|
855
|
-
|
856
|
-
|
857
|
-
|
832
|
+
# for testing, prevent the user from collapsing the first child folder
|
833
|
+
if is_test_item(event.item)
|
834
|
+
Wx::message_box("You can't collapse self item.")
|
835
|
+
event.veto
|
836
|
+
end
|
837
|
+
end
|
858
838
|
|
859
|
-
|
860
|
-
|
839
|
+
# show some info about activated item
|
840
|
+
def on_item_activated(event)
|
841
|
+
if (item_id = event.item).ok?
|
842
|
+
show_info(item_id)
|
843
|
+
end
|
844
|
+
Wx::log_message("OnItemActivated")
|
845
|
+
end
|
861
846
|
|
862
|
-
|
863
|
-
|
847
|
+
def on_item_state_clicked(event)
|
848
|
+
if (item_id = event.item).ok?
|
849
|
+
do_toggle_state(item_id)
|
850
|
+
end
|
851
|
+
Wx::log_message("Item \"#{get_item_text(item_id)}\" state changed to #{get_item_state(item_id)}")
|
852
|
+
end
|
864
853
|
|
865
|
-
|
866
|
-
|
854
|
+
def on_item_menu(event)
|
855
|
+
return unless (item = event.item).ok?
|
867
856
|
|
868
|
-
|
857
|
+
item_data = get_item_data(item)
|
858
|
+
clientpt = event.get_point
|
859
|
+
screenpt = client_to_screen(clientpt)
|
869
860
|
|
870
|
-
|
871
|
-
|
861
|
+
Wx::log_message(
|
862
|
+
"OnItemMenu for item \"#{item_data ? item_data : 'unknown'}\" at screen coords (#{screenpt.x}, #{screenpt.y})")
|
872
863
|
|
873
|
-
|
874
|
-
title = ""
|
875
|
-
if id.ok?
|
876
|
-
title << "Menu for " << get_item_text(id)
|
877
|
-
else
|
878
|
-
title = "Menu for no particular item"
|
864
|
+
show_popup_menu(item, clientpt)
|
879
865
|
end
|
880
866
|
|
881
|
-
|
882
|
-
|
883
|
-
menu.append_separator
|
884
|
-
menu.append(TreeTest_Highlight, "&Highlight item")
|
885
|
-
menu.append(TreeTest_Dump, "&Dump")
|
886
|
-
popup_menu(menu, pos)
|
887
|
-
end
|
888
|
-
|
889
|
-
def on_rmouse_down(event)
|
890
|
-
Wx::log_message("Right mouse button down")
|
867
|
+
def on_context_menu(event)
|
868
|
+
pt = event.position
|
891
869
|
|
892
|
-
|
893
|
-
end
|
870
|
+
Wx::log_message("OnContextMenu at screen coords (#{pt.x}, #{pt.y})")
|
894
871
|
|
895
|
-
|
896
|
-
unless (itemId = event.item).ok?
|
897
|
-
Wx::log_message("on_item_rclick: event should have a valid item")
|
898
|
-
return
|
872
|
+
event.skip
|
899
873
|
end
|
900
874
|
|
901
|
-
|
902
|
-
|
875
|
+
def show_popup_menu(id, pos)
|
876
|
+
title = ""
|
877
|
+
if id.ok?
|
878
|
+
title << "Menu for " << get_item_text(id)
|
879
|
+
else
|
880
|
+
title = "Menu for no particular item"
|
881
|
+
end
|
903
882
|
|
904
|
-
|
905
|
-
|
883
|
+
menu = Wx::Menu.new(title)
|
884
|
+
menu.append(Wx::ID_ABOUT, "&About...")
|
885
|
+
menu.append_separator
|
886
|
+
menu.append(TreeTest_Highlight, "&Highlight item")
|
887
|
+
menu.append(TreeTest_Dump, "&Dump")
|
888
|
+
popup_menu(menu, pos)
|
889
|
+
end
|
906
890
|
|
907
|
-
|
908
|
-
|
891
|
+
def on_rmouse_down(event)
|
892
|
+
Wx::log_message("Right mouse button down")
|
909
893
|
|
910
|
-
|
911
|
-
|
894
|
+
event.skip
|
895
|
+
end
|
912
896
|
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
else
|
918
|
-
item_data = get_item_data(id)
|
919
|
-
if item_data
|
920
|
-
Wx::log_message("Item '#{item_data}' under mouse")
|
897
|
+
def on_item_rclick(event)
|
898
|
+
unless (itemId = event.item).ok?
|
899
|
+
Wx::log_message("on_item_rclick: event should have a valid item")
|
900
|
+
return
|
921
901
|
end
|
902
|
+
|
903
|
+
item_data = get_item_data(itemId)
|
904
|
+
Wx::log_message("Item \"#{item_data ? item_data : 'unknown'}\" right clicked")
|
905
|
+
|
906
|
+
event.skip
|
922
907
|
end
|
923
|
-
end
|
924
908
|
|
925
|
-
|
909
|
+
def on_rmouse_up(event)
|
910
|
+
Wx::log_message("Right mouse button up")
|
926
911
|
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
# Give it an icon
|
942
|
-
self.icon = Wx::Icon.new(File.join(File.dirname(__FILE__), '..', 'sample.xpm'), Wx::BITMAP_TYPE_XPM)
|
943
|
-
|
944
|
-
# Make a menubar
|
945
|
-
file_menu = Wx::Menu.new
|
946
|
-
style_menu = Wx::Menu.new
|
947
|
-
tree_menu = Wx::Menu.new
|
948
|
-
item_menu = Wx::Menu.new
|
949
|
-
|
950
|
-
file_menu.append(Wx::ID_CLEAR, "&Clear log\tCtrl-L");
|
951
|
-
file_menu.append_separator
|
952
|
-
file_menu.append(Wx::ID_ABOUT, "&About...")
|
953
|
-
file_menu.append_separator
|
954
|
-
file_menu.append(Wx::ID_EXIT, "E&xit\tAlt-X")
|
955
|
-
|
956
|
-
style_menu.append(TreeTest_TogButtons,
|
957
|
-
"Toggle &normal buttons", "", Wx::ITEM_CHECK)
|
958
|
-
style_menu.append(TreeTest_TogTwist,
|
959
|
-
"Toggle &twister buttons", "", Wx::ITEM_CHECK)
|
960
|
-
style_menu.append(TreeTest_ToggleButtons,
|
961
|
-
"Toggle image &buttons", "", Wx::ITEM_CHECK)
|
962
|
-
style_menu.append_separator
|
963
|
-
style_menu.append(TreeTest_TogLines,
|
964
|
-
"Toggle &no lines", "", Wx::ITEM_CHECK)
|
965
|
-
style_menu.append(TreeTest_TogRootLines,
|
966
|
-
"Toggle &lines at root", "", Wx::ITEM_CHECK)
|
967
|
-
style_menu.append(TreeTest_TogHideRoot,
|
968
|
-
"Toggle &hidden root", "", Wx::ITEM_CHECK)
|
969
|
-
style_menu.append(TreeTest_TogBorder,
|
970
|
-
"Toggle &item border", "", Wx::ITEM_CHECK)
|
971
|
-
style_menu.append(TreeTest_TogFullHighlight,
|
972
|
-
"Toggle &full row highlight", "", Wx::ITEM_CHECK)
|
973
|
-
style_menu.append(TreeTest_TogEdit,
|
974
|
-
"Toggle &edit mode", "", Wx::ITEM_CHECK)
|
975
|
-
style_menu.append(TreeTest_ToggleSel,
|
976
|
-
"Toggle multiple &selection", "", Wx::ITEM_CHECK)
|
977
|
-
style_menu.append(TreeTest_ToggleImages,
|
978
|
-
"Toggle show ima&ges", "", Wx::ITEM_CHECK)
|
979
|
-
style_menu.append(TreeTest_ToggleStates,
|
980
|
-
"Toggle show st&ates", "", Wx::ITEM_CHECK)
|
981
|
-
style_menu.append(TreeTest_ToggleBell,
|
982
|
-
"Toggle &bell on no match", "", Wx::ITEM_CHECK)
|
983
|
-
style_menu.append(TreeTest_ToggleAlternateImages,
|
984
|
-
"Toggle alternate images", "", Wx::ITEM_CHECK)
|
985
|
-
style_menu.append(TreeTest_ToggleAlternateStates,
|
986
|
-
"Toggle alternate state images", "", Wx::ITEM_CHECK)
|
987
|
-
style_menu.append(TreeTest_SetImageSize, "Set image si&ze...")
|
988
|
-
style_menu.append_separator
|
989
|
-
style_menu.append(TreeTest_SetFgColour, "Set &foreground colour...")
|
990
|
-
style_menu.append(TreeTest_SetBgColour, "Set &background colour...")
|
991
|
-
style_menu.append_separator
|
992
|
-
style_menu.append(TreeTest_ResetStyle, "&Reset to default\tF10")
|
993
|
-
|
994
|
-
tree_menu.append(TreeTest_FreezeThaw,
|
995
|
-
"&Freeze the tree", "", Wx::ITEM_CHECK)
|
996
|
-
tree_menu.append(TreeTest_Recreate, "&Recreate the tree")
|
997
|
-
tree_menu.append(TreeTest_CollapseAndReset, "C&ollapse and reset")
|
998
|
-
tree_menu.append_separator
|
999
|
-
tree_menu.append(TreeTest_AddItem, "Append a &new item")
|
1000
|
-
tree_menu.append(TreeTest_AddManyItems, "Appends &many items")
|
1001
|
-
tree_menu.append(TreeTest_InsertItem, "&Insert a new item")
|
1002
|
-
tree_menu.append(TreeTest_Delete, "&Delete selected item")
|
1003
|
-
tree_menu.append(TreeTest_DeleteChildren, "Delete &children")
|
1004
|
-
tree_menu.append(TreeTest_DeleteAll, "Delete &all items")
|
1005
|
-
tree_menu.append(TreeTest_SelectRoot, "Select root item")
|
1006
|
-
tree_menu.append_separator
|
1007
|
-
tree_menu.append(TreeTest_SetFocusedRoot, "Set focus to root item")
|
1008
|
-
tree_menu.append(TreeTest_ClearFocused, "Reset focus")
|
1009
|
-
|
1010
|
-
tree_menu.append_separator
|
1011
|
-
tree_menu.append(TreeTest_Count, "Count children of current item")
|
1012
|
-
tree_menu.append(TreeTest_CountRec, "Recursively count children of current item")
|
1013
|
-
tree_menu.append_separator
|
1014
|
-
tree_menu.append(TreeTest_Sort, "Sort children of current item")
|
1015
|
-
tree_menu.append(TreeTest_SortRev, "Sort in reversed order")
|
1016
|
-
tree_menu.append_separator
|
1017
|
-
tree_menu.append(TreeTest_EnsureVisible, "Make the last item &visible")
|
1018
|
-
tree_menu.append(TreeTest_SetFocus, "Set &focus to the tree")
|
1019
|
-
tree_menu.append_separator
|
1020
|
-
tree_menu.append(TreeTest_IncIndent, "Add 5 points to indentation\tAlt-I")
|
1021
|
-
tree_menu.append(TreeTest_DecIndent, "Reduce indentation by 5 points\tAlt-R")
|
1022
|
-
tree_menu.append_separator
|
1023
|
-
tree_menu.append(TreeTest_IncSpacing, "Add 5 points to spacing\tCtrl-I")
|
1024
|
-
tree_menu.append(TreeTest_DecSpacing, "Reduce spacing by 5 points\tCtrl-R")
|
1025
|
-
|
1026
|
-
item_menu.append(TreeTest_Dump, "&Dump item children")
|
1027
|
-
item_menu.append(TreeTest_Rename, "&Rename item...")
|
1028
|
-
|
1029
|
-
item_menu.append_separator
|
1030
|
-
item_menu.append(TreeTest_SetBold, "Make item &bold")
|
1031
|
-
item_menu.append(TreeTest_ClearBold, "Make item ¬ bold")
|
1032
|
-
item_menu.append_separator
|
1033
|
-
item_menu.append(TreeTest_ToggleIcon, "Toggle the item's &icon")
|
1034
|
-
item_menu.append(TreeTest_ToggleState, "Toggle the item's &state")
|
1035
|
-
|
1036
|
-
item_menu.append_separator
|
1037
|
-
item_menu.append(TreeTest_ShowFirstVisible, "Show &first visible")
|
1038
|
-
if Wx.has_feature?(:HAS_LAST_VISIBLE)
|
1039
|
-
item_menu.append(TreeTest_ShowLastVisible, "Show &last visible")
|
1040
|
-
end
|
1041
|
-
item_menu.append(TreeTest_ShowNextVisible, "Show &next visible")
|
1042
|
-
item_menu.append(TreeTest_ShowPrevVisible, "Show &previous visible")
|
1043
|
-
item_menu.append_separator
|
1044
|
-
item_menu.append(TreeTest_ShowParent, "Show pa&rent")
|
1045
|
-
item_menu.append(TreeTest_ShowPrevSibling, "Show &previous sibling")
|
1046
|
-
item_menu.append(TreeTest_ShowNextSibling, "Show &next sibling")
|
1047
|
-
item_menu.append_separator
|
1048
|
-
item_menu.append(TreeTest_ScrollTo, "Scroll &to item",
|
1049
|
-
"Scroll to the last by one top level child")
|
1050
|
-
item_menu.append(TreeTest_SelectLast, "Select &last item",
|
1051
|
-
"Select the last item")
|
1052
|
-
|
1053
|
-
item_menu.append_separator
|
1054
|
-
item_menu.append(TreeTest_DumpSelected, "Dump selected items\tAlt-D")
|
1055
|
-
item_menu.append(TreeTest_Select, "Select current item\tAlt-S")
|
1056
|
-
item_menu.append(TreeTest_Unselect, "Unselect everything\tAlt-U")
|
1057
|
-
item_menu.append(TreeTest_SelectChildren, "Select all children\tCtrl-A")
|
1058
|
-
|
1059
|
-
menu_bar = Wx::MenuBar.new
|
1060
|
-
menu_bar.append(file_menu, "&File")
|
1061
|
-
menu_bar.append(style_menu, "&Style")
|
1062
|
-
menu_bar.append(tree_menu, "&Tree")
|
1063
|
-
menu_bar.append(item_menu, "&Item")
|
1064
|
-
self.menu_bar = menu_bar
|
1065
|
-
|
1066
|
-
@panel = Wx::Panel.new(self)
|
1067
|
-
|
1068
|
-
# create the controls
|
1069
|
-
@textctrl = Wx::TextCtrl.new(@panel,
|
1070
|
-
:value => "Log text\n",
|
1071
|
-
:style => Wx::TE_MULTILINE | Wx::SUNKEN_BORDER)
|
1072
|
-
|
1073
|
-
create_tree_with_default_style
|
1074
|
-
|
1075
|
-
menu_bar.check(TreeTest_ToggleImages, true)
|
1076
|
-
menu_bar.check(TreeTest_ToggleStates, true)
|
1077
|
-
menu_bar.check(TreeTest_ToggleAlternateImages, false)
|
1078
|
-
menu_bar.check(TreeTest_ToggleAlternateStates, false)
|
1079
|
-
|
1080
|
-
# create a status bar with 3 panes
|
1081
|
-
create_status_bar(2)
|
1082
|
-
|
1083
|
-
set_status_text("", 0)
|
1084
|
-
|
1085
|
-
# set our text control as the log target
|
1086
|
-
logWindow = Wx::LogTextCtrl.new(@textctrl)
|
1087
|
-
@old_log_tgt = Wx::Log::set_active_target(logWindow)
|
1088
|
-
|
1089
|
-
# @splitter.split_horizontally(@treectrl, @textctrl, 500)
|
1090
|
-
|
1091
|
-
evt_close :on_close
|
1092
|
-
evt_size :on_size
|
1093
|
-
evt_idle :on_idle
|
1094
|
-
|
1095
|
-
evt_menu Wx::ID_EXIT, :on_quit
|
1096
|
-
evt_menu Wx::ID_ABOUT, :on_about
|
1097
|
-
evt_menu Wx::ID_CLEAR, :on_clear_log
|
1098
|
-
|
1099
|
-
evt_menu TreeTest_TogButtons, :on_tog_buttons
|
1100
|
-
evt_menu TreeTest_TogTwist, :on_tog_twist
|
1101
|
-
evt_menu TreeTest_TogLines, :on_tog_lines
|
1102
|
-
evt_menu TreeTest_TogEdit, :on_tog_edit
|
1103
|
-
evt_menu TreeTest_TogHideRoot, :on_tog_hide_root
|
1104
|
-
evt_menu TreeTest_TogRootLines, :on_tog_root_lines
|
1105
|
-
evt_menu TreeTest_TogBorder, :on_tog_border
|
1106
|
-
evt_menu TreeTest_TogFullHighlight, :on_tog_full_highlight
|
1107
|
-
evt_menu TreeTest_SetFgColour, :on_set_fg_colour
|
1108
|
-
evt_menu TreeTest_SetBgColour, :on_set_bg_colour
|
1109
|
-
evt_menu TreeTest_ResetStyle, :on_reset_style
|
1110
|
-
|
1111
|
-
evt_menu TreeTest_Highlight, :on_highlight
|
1112
|
-
evt_menu TreeTest_Dump, :on_dump
|
1113
|
-
evt_menu TreeTest_DumpSelected, :on_dump_selected
|
1114
|
-
evt_menu TreeTest_Select, :on_select
|
1115
|
-
evt_menu TreeTest_Unselect, :on_unselect
|
1116
|
-
evt_menu TreeTest_ToggleSel, :on_toggle_sel
|
1117
|
-
evt_menu TreeTest_SelectChildren, :on_select_children
|
1118
|
-
evt_menu TreeTest_Rename, :on_rename
|
1119
|
-
evt_menu TreeTest_Count, :on_count
|
1120
|
-
evt_menu TreeTest_CountRec, :on_count_rec
|
1121
|
-
evt_menu TreeTest_Sort, :on_sort
|
1122
|
-
evt_menu TreeTest_SortRev, :on_sort_rev
|
1123
|
-
evt_menu TreeTest_SetBold, :on_set_bold
|
1124
|
-
evt_menu TreeTest_ClearBold, :on_clear_bold
|
1125
|
-
evt_menu TreeTest_Delete, :on_delete
|
1126
|
-
evt_menu TreeTest_DeleteChildren, :on_delete_children
|
1127
|
-
evt_menu TreeTest_DeleteAll, :on_delete_all
|
1128
|
-
evt_menu TreeTest_Recreate, :on_recreate
|
1129
|
-
evt_menu TreeTest_FreezeThaw, :on_freeze_thaw
|
1130
|
-
evt_menu TreeTest_ToggleImages, :on_toggle_images
|
1131
|
-
evt_menu TreeTest_ToggleStates, :on_toggle_states
|
1132
|
-
evt_menu TreeTest_ToggleBell, :on_toggle_bell
|
1133
|
-
evt_menu TreeTest_ToggleAlternateImages, :on_toggle_alternate_images
|
1134
|
-
evt_menu TreeTest_ToggleAlternateStates, :on_toggle_alternate_states
|
1135
|
-
unless Wx.has_feature?(:WXMSW)
|
1136
|
-
evt_menu TreeTest_ToggleButtons, :on_toggle_buttons
|
1137
|
-
end
|
1138
|
-
evt_menu TreeTest_SetImageSize, :on_set_image_size
|
1139
|
-
evt_menu TreeTest_CollapseAndReset, :on_collapse_and_reset
|
1140
|
-
evt_menu TreeTest_EnsureVisible, :on_ensure_visible
|
1141
|
-
evt_menu TreeTest_SetFocus, :on_set_focus
|
1142
|
-
evt_menu TreeTest_AddItem, :on_add_item
|
1143
|
-
evt_menu TreeTest_AddManyItems, :on_add_many_items
|
1144
|
-
evt_menu TreeTest_InsertItem, :on_insert_item
|
1145
|
-
evt_menu TreeTest_IncIndent, :on_inc_indent
|
1146
|
-
evt_menu TreeTest_DecIndent, :on_dec_indent
|
1147
|
-
evt_menu TreeTest_IncSpacing, :on_inc_spacing
|
1148
|
-
evt_menu TreeTest_DecSpacing, :on_dec_spacing
|
1149
|
-
evt_menu TreeTest_ToggleIcon, :on_toggle_icon
|
1150
|
-
evt_menu TreeTest_ToggleState, :on_toggle_state
|
1151
|
-
evt_menu TreeTest_SelectRoot, :on_select_root
|
1152
|
-
evt_menu TreeTest_SetFocusedRoot, :on_set_focused_root
|
1153
|
-
evt_menu TreeTest_ClearFocused, :on_clear_focused
|
1154
|
-
|
1155
|
-
evt_menu TreeTest_ShowFirstVisible, :on_show_first_visible
|
1156
|
-
if Wx.has_feature?(:HAS_LAST_VISIBLE)
|
1157
|
-
evt_menu TreeTest_ShowLastVisible, :on_show_last_visible
|
1158
|
-
end
|
1159
|
-
evt_menu TreeTest_ShowNextVisible, :on_show_next_visible
|
1160
|
-
evt_menu TreeTest_ShowPrevVisible, :on_show_prev_visible
|
1161
|
-
evt_menu TreeTest_ShowParent, :on_show_parent
|
1162
|
-
evt_menu TreeTest_ShowPrevSibling, :on_show_prev_sibling
|
1163
|
-
evt_menu TreeTest_ShowNextSibling, :on_show_next_sibling
|
1164
|
-
evt_menu TreeTest_ScrollTo, :on_scroll_to
|
1165
|
-
evt_menu TreeTest_SelectLast, :on_select_last
|
1166
|
-
end
|
912
|
+
event.skip
|
913
|
+
end
|
914
|
+
|
915
|
+
def on_rmouse_dclick(event)
|
916
|
+
id = hit_test(event.get_position)
|
917
|
+
unless id.ok?
|
918
|
+
Wx::log_message("No item under mouse")
|
919
|
+
else
|
920
|
+
item_data = get_item_data(id)
|
921
|
+
if item_data
|
922
|
+
Wx::log_message("Item '#{item_data}' under mouse")
|
923
|
+
end
|
924
|
+
end
|
925
|
+
end
|
1167
926
|
|
1168
|
-
def check_item(id)
|
1169
|
-
Wx::message_box("Please select some item first!",
|
1170
|
-
"Tree sample error",
|
1171
|
-
Wx::OK | Wx::ICON_EXCLAMATION,
|
1172
|
-
self) unless id && id.ok?
|
1173
|
-
id && id.ok?
|
1174
927
|
end
|
1175
928
|
|
1176
|
-
|
929
|
+
class MyFrame < Wx::Frame
|
930
|
+
def initialize(title, x, y, w, h)
|
931
|
+
super(nil, :title => title, :pos => [x, y], :size => [w, h])
|
932
|
+
@panel = nil
|
933
|
+
#@splitter = nil
|
934
|
+
@treectrl = nil
|
935
|
+
@textctrl = nil
|
936
|
+
@s_num = 0
|
937
|
+
|
938
|
+
# This reduces flicker effects - even better would be to define
|
939
|
+
# OnEraseBackground to do nothing. When the tree control's scrollbars are
|
940
|
+
# show or hidden, the frame is sent a background erase event.
|
941
|
+
self.background_colour = Wx::WHITE
|
942
|
+
|
943
|
+
# Give it an icon
|
944
|
+
self.icon = Wx.Icon(:sample, Wx::BITMAP_TYPE_XPM, art_path: File.join(__dir__, '..'))
|
945
|
+
|
946
|
+
# Make a menubar
|
947
|
+
file_menu = Wx::Menu.new
|
948
|
+
style_menu = Wx::Menu.new
|
949
|
+
tree_menu = Wx::Menu.new
|
950
|
+
item_menu = Wx::Menu.new
|
951
|
+
|
952
|
+
file_menu.append(Wx::ID_CLEAR, "&Clear log\tCtrl-L");
|
953
|
+
file_menu.append_separator
|
954
|
+
file_menu.append(Wx::ID_ABOUT, "&About...")
|
955
|
+
file_menu.append_separator
|
956
|
+
file_menu.append(Wx::ID_EXIT, "E&xit\tAlt-X")
|
957
|
+
|
958
|
+
style_menu.append(TreeTest_TogButtons,
|
959
|
+
"Toggle &normal buttons", "", Wx::ITEM_CHECK)
|
960
|
+
style_menu.append(TreeTest_TogTwist,
|
961
|
+
"Toggle &twister buttons", "", Wx::ITEM_CHECK)
|
962
|
+
style_menu.append(TreeTest_ToggleButtons,
|
963
|
+
"Toggle image &buttons", "", Wx::ITEM_CHECK)
|
964
|
+
style_menu.append_separator
|
965
|
+
style_menu.append(TreeTest_TogLines,
|
966
|
+
"Toggle &no lines", "", Wx::ITEM_CHECK)
|
967
|
+
style_menu.append(TreeTest_TogRootLines,
|
968
|
+
"Toggle &lines at root", "", Wx::ITEM_CHECK)
|
969
|
+
style_menu.append(TreeTest_TogHideRoot,
|
970
|
+
"Toggle &hidden root", "", Wx::ITEM_CHECK)
|
971
|
+
style_menu.append(TreeTest_TogBorder,
|
972
|
+
"Toggle &item border", "", Wx::ITEM_CHECK)
|
973
|
+
style_menu.append(TreeTest_TogFullHighlight,
|
974
|
+
"Toggle &full row highlight", "", Wx::ITEM_CHECK)
|
975
|
+
style_menu.append(TreeTest_TogEdit,
|
976
|
+
"Toggle &edit mode", "", Wx::ITEM_CHECK)
|
977
|
+
style_menu.append(TreeTest_ToggleSel,
|
978
|
+
"Toggle multiple &selection", "", Wx::ITEM_CHECK)
|
979
|
+
style_menu.append(TreeTest_ToggleImages,
|
980
|
+
"Toggle show ima&ges", "", Wx::ITEM_CHECK)
|
981
|
+
style_menu.append(TreeTest_ToggleStates,
|
982
|
+
"Toggle show st&ates", "", Wx::ITEM_CHECK)
|
983
|
+
style_menu.append(TreeTest_ToggleBell,
|
984
|
+
"Toggle &bell on no match", "", Wx::ITEM_CHECK)
|
985
|
+
style_menu.append(TreeTest_ToggleAlternateImages,
|
986
|
+
"Toggle alternate images", "", Wx::ITEM_CHECK)
|
987
|
+
style_menu.append(TreeTest_ToggleAlternateStates,
|
988
|
+
"Toggle alternate state images", "", Wx::ITEM_CHECK)
|
989
|
+
style_menu.append(TreeTest_SetImageSize, "Set image si&ze...")
|
990
|
+
style_menu.append_separator
|
991
|
+
style_menu.append(TreeTest_SetFgColour, "Set &foreground colour...")
|
992
|
+
style_menu.append(TreeTest_SetBgColour, "Set &background colour...")
|
993
|
+
style_menu.append_separator
|
994
|
+
style_menu.append(TreeTest_ResetStyle, "&Reset to default\tF10")
|
995
|
+
|
996
|
+
tree_menu.append(TreeTest_FreezeThaw,
|
997
|
+
"&Freeze the tree", "", Wx::ITEM_CHECK)
|
998
|
+
tree_menu.append(TreeTest_Recreate, "&Recreate the tree")
|
999
|
+
tree_menu.append(TreeTest_CollapseAndReset, "C&ollapse and reset")
|
1000
|
+
tree_menu.append_separator
|
1001
|
+
tree_menu.append(TreeTest_AddItem, "Append a &new item")
|
1002
|
+
tree_menu.append(TreeTest_AddManyItems, "Appends &many items")
|
1003
|
+
tree_menu.append(TreeTest_InsertItem, "&Insert a new item")
|
1004
|
+
tree_menu.append(TreeTest_Delete, "&Delete selected item")
|
1005
|
+
tree_menu.append(TreeTest_DeleteChildren, "Delete &children")
|
1006
|
+
tree_menu.append(TreeTest_DeleteAll, "Delete &all items")
|
1007
|
+
tree_menu.append(TreeTest_SelectRoot, "Select root item")
|
1008
|
+
tree_menu.append_separator
|
1009
|
+
tree_menu.append(TreeTest_SetFocusedRoot, "Set focus to root item")
|
1010
|
+
tree_menu.append(TreeTest_ClearFocused, "Reset focus")
|
1011
|
+
|
1012
|
+
tree_menu.append_separator
|
1013
|
+
tree_menu.append(TreeTest_Count, "Count children of current item")
|
1014
|
+
tree_menu.append(TreeTest_CountRec, "Recursively count children of current item")
|
1015
|
+
tree_menu.append_separator
|
1016
|
+
tree_menu.append(TreeTest_Sort, "Sort children of current item")
|
1017
|
+
tree_menu.append(TreeTest_SortRev, "Sort in reversed order")
|
1018
|
+
tree_menu.append_separator
|
1019
|
+
tree_menu.append(TreeTest_EnsureVisible, "Make the last item &visible")
|
1020
|
+
tree_menu.append(TreeTest_SetFocus, "Set &focus to the tree")
|
1021
|
+
tree_menu.append_separator
|
1022
|
+
tree_menu.append(TreeTest_IncIndent, "Add 5 points to indentation\tAlt-I")
|
1023
|
+
tree_menu.append(TreeTest_DecIndent, "Reduce indentation by 5 points\tAlt-R")
|
1024
|
+
tree_menu.append_separator
|
1025
|
+
tree_menu.append(TreeTest_IncSpacing, "Add 5 points to spacing\tCtrl-I")
|
1026
|
+
tree_menu.append(TreeTest_DecSpacing, "Reduce spacing by 5 points\tCtrl-R")
|
1027
|
+
|
1028
|
+
item_menu.append(TreeTest_Dump, "&Dump item children")
|
1029
|
+
item_menu.append(TreeTest_Rename, "&Rename item...")
|
1030
|
+
|
1031
|
+
item_menu.append_separator
|
1032
|
+
item_menu.append(TreeTest_SetBold, "Make item &bold")
|
1033
|
+
item_menu.append(TreeTest_ClearBold, "Make item ¬ bold")
|
1034
|
+
item_menu.append_separator
|
1035
|
+
item_menu.append(TreeTest_ToggleIcon, "Toggle the item's &icon")
|
1036
|
+
item_menu.append(TreeTest_ToggleState, "Toggle the item's &state")
|
1037
|
+
|
1038
|
+
item_menu.append_separator
|
1039
|
+
item_menu.append(TreeTest_ShowFirstVisible, "Show &first visible")
|
1040
|
+
if Wx.has_feature?(:HAS_LAST_VISIBLE)
|
1041
|
+
item_menu.append(TreeTest_ShowLastVisible, "Show &last visible")
|
1042
|
+
end
|
1043
|
+
item_menu.append(TreeTest_ShowNextVisible, "Show &next visible")
|
1044
|
+
item_menu.append(TreeTest_ShowPrevVisible, "Show &previous visible")
|
1045
|
+
item_menu.append_separator
|
1046
|
+
item_menu.append(TreeTest_ShowParent, "Show pa&rent")
|
1047
|
+
item_menu.append(TreeTest_ShowPrevSibling, "Show &previous sibling")
|
1048
|
+
item_menu.append(TreeTest_ShowNextSibling, "Show &next sibling")
|
1049
|
+
item_menu.append_separator
|
1050
|
+
item_menu.append(TreeTest_ScrollTo, "Scroll &to item",
|
1051
|
+
"Scroll to the last by one top level child")
|
1052
|
+
item_menu.append(TreeTest_SelectLast, "Select &last item",
|
1053
|
+
"Select the last item")
|
1054
|
+
|
1055
|
+
item_menu.append_separator
|
1056
|
+
item_menu.append(TreeTest_DumpSelected, "Dump selected items\tAlt-D")
|
1057
|
+
item_menu.append(TreeTest_Select, "Select current item\tAlt-S")
|
1058
|
+
item_menu.append(TreeTest_Unselect, "Unselect everything\tAlt-U")
|
1059
|
+
item_menu.append(TreeTest_SelectChildren, "Select all children\tCtrl-A")
|
1060
|
+
|
1061
|
+
menu_bar = Wx::MenuBar.new
|
1062
|
+
menu_bar.append(file_menu, "&File")
|
1063
|
+
menu_bar.append(style_menu, "&Style")
|
1064
|
+
menu_bar.append(tree_menu, "&Tree")
|
1065
|
+
menu_bar.append(item_menu, "&Item")
|
1066
|
+
self.menu_bar = menu_bar
|
1067
|
+
|
1068
|
+
@panel = Wx::Panel.new(self)
|
1069
|
+
|
1070
|
+
# create the controls
|
1071
|
+
@textctrl = Wx::TextCtrl.new(@panel,
|
1072
|
+
:value => "Log text\n",
|
1073
|
+
:style => Wx::TE_MULTILINE | Wx::SUNKEN_BORDER)
|
1074
|
+
|
1075
|
+
create_tree_with_default_style
|
1076
|
+
|
1077
|
+
menu_bar.check(TreeTest_ToggleImages, true)
|
1078
|
+
menu_bar.check(TreeTest_ToggleStates, true)
|
1079
|
+
menu_bar.check(TreeTest_ToggleAlternateImages, false)
|
1080
|
+
menu_bar.check(TreeTest_ToggleAlternateStates, false)
|
1081
|
+
|
1082
|
+
# create a status bar with 3 panes
|
1083
|
+
create_status_bar(2)
|
1084
|
+
|
1085
|
+
set_status_text("", 0)
|
1086
|
+
|
1087
|
+
# set our text control as the log target
|
1088
|
+
logWindow = Wx::LogTextCtrl.new(@textctrl)
|
1089
|
+
@old_log_tgt = Wx::Log::set_active_target(logWindow)
|
1090
|
+
|
1091
|
+
# @splitter.split_horizontally(@treectrl, @textctrl, 500)
|
1092
|
+
|
1093
|
+
evt_close :on_close
|
1094
|
+
evt_size :on_size
|
1095
|
+
evt_idle :on_idle
|
1096
|
+
|
1097
|
+
evt_menu Wx::ID_EXIT, :on_quit
|
1098
|
+
evt_menu Wx::ID_ABOUT, :on_about
|
1099
|
+
evt_menu Wx::ID_CLEAR, :on_clear_log
|
1100
|
+
|
1101
|
+
evt_menu TreeTest_TogButtons, :on_tog_buttons
|
1102
|
+
evt_menu TreeTest_TogTwist, :on_tog_twist
|
1103
|
+
evt_menu TreeTest_TogLines, :on_tog_lines
|
1104
|
+
evt_menu TreeTest_TogEdit, :on_tog_edit
|
1105
|
+
evt_menu TreeTest_TogHideRoot, :on_tog_hide_root
|
1106
|
+
evt_menu TreeTest_TogRootLines, :on_tog_root_lines
|
1107
|
+
evt_menu TreeTest_TogBorder, :on_tog_border
|
1108
|
+
evt_menu TreeTest_TogFullHighlight, :on_tog_full_highlight
|
1109
|
+
evt_menu TreeTest_SetFgColour, :on_set_fg_colour
|
1110
|
+
evt_menu TreeTest_SetBgColour, :on_set_bg_colour
|
1111
|
+
evt_menu TreeTest_ResetStyle, :on_reset_style
|
1112
|
+
|
1113
|
+
evt_menu TreeTest_Highlight, :on_highlight
|
1114
|
+
evt_menu TreeTest_Dump, :on_dump
|
1115
|
+
evt_menu TreeTest_DumpSelected, :on_dump_selected
|
1116
|
+
evt_menu TreeTest_Select, :on_select
|
1117
|
+
evt_menu TreeTest_Unselect, :on_unselect
|
1118
|
+
evt_menu TreeTest_ToggleSel, :on_toggle_sel
|
1119
|
+
evt_menu TreeTest_SelectChildren, :on_select_children
|
1120
|
+
evt_menu TreeTest_Rename, :on_rename
|
1121
|
+
evt_menu TreeTest_Count, :on_count
|
1122
|
+
evt_menu TreeTest_CountRec, :on_count_rec
|
1123
|
+
evt_menu TreeTest_Sort, :on_sort
|
1124
|
+
evt_menu TreeTest_SortRev, :on_sort_rev
|
1125
|
+
evt_menu TreeTest_SetBold, :on_set_bold
|
1126
|
+
evt_menu TreeTest_ClearBold, :on_clear_bold
|
1127
|
+
evt_menu TreeTest_Delete, :on_delete
|
1128
|
+
evt_menu TreeTest_DeleteChildren, :on_delete_children
|
1129
|
+
evt_menu TreeTest_DeleteAll, :on_delete_all
|
1130
|
+
evt_menu TreeTest_Recreate, :on_recreate
|
1131
|
+
evt_menu TreeTest_FreezeThaw, :on_freeze_thaw
|
1132
|
+
evt_menu TreeTest_ToggleImages, :on_toggle_images
|
1133
|
+
evt_menu TreeTest_ToggleStates, :on_toggle_states
|
1134
|
+
evt_menu TreeTest_ToggleBell, :on_toggle_bell
|
1135
|
+
evt_menu TreeTest_ToggleAlternateImages, :on_toggle_alternate_images
|
1136
|
+
evt_menu TreeTest_ToggleAlternateStates, :on_toggle_alternate_states
|
1137
|
+
unless Wx.has_feature?(:WXMSW)
|
1138
|
+
evt_menu TreeTest_ToggleButtons, :on_toggle_buttons
|
1139
|
+
end
|
1140
|
+
evt_menu TreeTest_SetImageSize, :on_set_image_size
|
1141
|
+
evt_menu TreeTest_CollapseAndReset, :on_collapse_and_reset
|
1142
|
+
evt_menu TreeTest_EnsureVisible, :on_ensure_visible
|
1143
|
+
evt_menu TreeTest_SetFocus, :on_set_focus
|
1144
|
+
evt_menu TreeTest_AddItem, :on_add_item
|
1145
|
+
evt_menu TreeTest_AddManyItems, :on_add_many_items
|
1146
|
+
evt_menu TreeTest_InsertItem, :on_insert_item
|
1147
|
+
evt_menu TreeTest_IncIndent, :on_inc_indent
|
1148
|
+
evt_menu TreeTest_DecIndent, :on_dec_indent
|
1149
|
+
evt_menu TreeTest_IncSpacing, :on_inc_spacing
|
1150
|
+
evt_menu TreeTest_DecSpacing, :on_dec_spacing
|
1151
|
+
evt_menu TreeTest_ToggleIcon, :on_toggle_icon
|
1152
|
+
evt_menu TreeTest_ToggleState, :on_toggle_state
|
1153
|
+
evt_menu TreeTest_SelectRoot, :on_select_root
|
1154
|
+
evt_menu TreeTest_SetFocusedRoot, :on_set_focused_root
|
1155
|
+
evt_menu TreeTest_ClearFocused, :on_clear_focused
|
1156
|
+
|
1157
|
+
evt_menu TreeTest_ShowFirstVisible, :on_show_first_visible
|
1158
|
+
if Wx.has_feature?(:HAS_LAST_VISIBLE)
|
1159
|
+
evt_menu TreeTest_ShowLastVisible, :on_show_last_visible
|
1160
|
+
end
|
1161
|
+
evt_menu TreeTest_ShowNextVisible, :on_show_next_visible
|
1162
|
+
evt_menu TreeTest_ShowPrevVisible, :on_show_prev_visible
|
1163
|
+
evt_menu TreeTest_ShowParent, :on_show_parent
|
1164
|
+
evt_menu TreeTest_ShowPrevSibling, :on_show_prev_sibling
|
1165
|
+
evt_menu TreeTest_ShowNextSibling, :on_show_next_sibling
|
1166
|
+
evt_menu TreeTest_ScrollTo, :on_scroll_to
|
1167
|
+
evt_menu TreeTest_SelectLast, :on_select_last
|
1168
|
+
end
|
1177
1169
|
|
1178
|
-
|
1170
|
+
def check_item(id)
|
1171
|
+
Wx::message_box("Please select some item first!",
|
1172
|
+
"Tree sample error",
|
1173
|
+
Wx::OK | Wx::ICON_EXCLAMATION,
|
1174
|
+
self) unless id && id.ok?
|
1175
|
+
id && id.ok?
|
1176
|
+
end
|
1179
1177
|
|
1180
|
-
|
1178
|
+
def create_tree_with_default_style
|
1181
1179
|
|
1182
|
-
|
1183
|
-
# everything
|
1184
|
-
mbar = menu_bar
|
1185
|
-
mbar.check(TreeTest_TogButtons, (style & Wx::TR_HAS_BUTTONS) != 0)
|
1186
|
-
mbar.check(TreeTest_TogButtons, (style & Wx::TR_TWIST_BUTTONS) != 0)
|
1187
|
-
mbar.check(TreeTest_TogLines, (style & Wx::TR_NO_LINES) != 0)
|
1188
|
-
mbar.check(TreeTest_TogRootLines, (style & Wx::TR_LINES_AT_ROOT) != 0)
|
1189
|
-
mbar.check(TreeTest_TogHideRoot, (style & Wx::TR_HIDE_ROOT) != 0)
|
1190
|
-
mbar.check(TreeTest_TogEdit, (style & Wx::TR_EDIT_LABELS) != 0)
|
1191
|
-
mbar.check(TreeTest_TogBorder, (style & Wx::TR_ROW_LINES) != 0)
|
1192
|
-
mbar.check(TreeTest_TogFullHighlight, (style & Wx::TR_FULL_ROW_HIGHLIGHT) != 0)
|
1193
|
-
end
|
1180
|
+
style = Wx::TR_DEFAULT_STYLE | Wx::TR_HAS_VARIABLE_ROW_HEIGHT | Wx::TR_EDIT_LABELS
|
1194
1181
|
|
1195
|
-
|
1196
|
-
@treectrl = MyTreeCtrl.new(@panel, :style => style)
|
1182
|
+
create_tree(style | Wx::SUNKEN_BORDER)
|
1197
1183
|
|
1198
|
-
|
1184
|
+
# as we don't know what Wx::TR_DEFAULT_STYLE could contain, test for
|
1185
|
+
# everything
|
1186
|
+
mbar = menu_bar
|
1187
|
+
mbar.check(TreeTest_TogButtons, (style & Wx::TR_HAS_BUTTONS) != 0)
|
1188
|
+
mbar.check(TreeTest_TogButtons, (style & Wx::TR_TWIST_BUTTONS) != 0)
|
1189
|
+
mbar.check(TreeTest_TogLines, (style & Wx::TR_NO_LINES) != 0)
|
1190
|
+
mbar.check(TreeTest_TogRootLines, (style & Wx::TR_LINES_AT_ROOT) != 0)
|
1191
|
+
mbar.check(TreeTest_TogHideRoot, (style & Wx::TR_HIDE_ROOT) != 0)
|
1192
|
+
mbar.check(TreeTest_TogEdit, (style & Wx::TR_EDIT_LABELS) != 0)
|
1193
|
+
mbar.check(TreeTest_TogBorder, (style & Wx::TR_ROW_LINES) != 0)
|
1194
|
+
mbar.check(TreeTest_TogFullHighlight, (style & Wx::TR_FULL_ROW_HIGHLIGHT) != 0)
|
1195
|
+
end
|
1199
1196
|
|
1200
|
-
|
1201
|
-
|
1197
|
+
def create_tree(style)
|
1198
|
+
@treectrl = MyTreeCtrl.new(@panel, :style => style)
|
1202
1199
|
|
1203
|
-
|
1204
|
-
style = @treectrl.get_window_style ^ flag
|
1200
|
+
menu_bar.enable(TreeTest_SelectRoot, (style & Wx::TR_HIDE_ROOT) == 0)
|
1205
1201
|
|
1206
|
-
|
1207
|
-
# treectrl styles can't be changed on the fly using the native
|
1208
|
-
# control and the tree must be recreated
|
1209
|
-
@treectrl.destroy
|
1210
|
-
create_tree(style)
|
1211
|
-
else
|
1212
|
-
@treectrl.set_window_style(style)
|
1202
|
+
resize
|
1213
1203
|
end
|
1214
1204
|
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
def resize
|
1219
|
-
size = get_client_size
|
1220
|
-
@treectrl.set_size(Wx::Rect.new(0, 0, size.width, size.height * 2 / 3)) if @treectrl
|
1221
|
-
@textctrl.set_size(Wx::Rect.new(0, 2 * size.height / 3, size.width, size.height / 3)) if @textctrl
|
1222
|
-
end
|
1205
|
+
def tog_style(id, flag)
|
1206
|
+
style = @treectrl.get_window_style ^ flag
|
1223
1207
|
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
status = "Root/last item is %svisible/%svisible" %
|
1230
|
-
[@treectrl.is_visible(idRoot) ? '' : 'not ',
|
1231
|
-
idLast.ok? && @treectrl.is_visible(idLast) ? '' : 'not ']
|
1208
|
+
if Wx.has_feature?(:WXMSW)
|
1209
|
+
# treectrl styles can't be changed on the fly using the native
|
1210
|
+
# control and the tree must be recreated
|
1211
|
+
@treectrl.destroy
|
1212
|
+
create_tree(style)
|
1232
1213
|
else
|
1233
|
-
|
1214
|
+
@treectrl.set_window_style(style)
|
1234
1215
|
end
|
1235
1216
|
|
1236
|
-
|
1217
|
+
menu_bar.check(id, (style & flag) != 0)
|
1237
1218
|
end
|
1238
1219
|
|
1239
|
-
|
1240
|
-
|
1220
|
+
def resize
|
1221
|
+
size = get_client_size
|
1222
|
+
@treectrl.set_size(Wx::Rect.new(0, 0, size.width, size.height * 2 / 3)) if @treectrl
|
1223
|
+
@textctrl.set_size(Wx::Rect.new(0, 2 * size.height / 3, size.width, size.height / 3)) if @textctrl
|
1224
|
+
end
|
1241
1225
|
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1226
|
+
def on_idle(evt)
|
1227
|
+
if @treectrl
|
1228
|
+
idRoot = @treectrl.root_item
|
1229
|
+
if idRoot.ok?
|
1230
|
+
idLast = @treectrl.get_last_tree_item
|
1231
|
+
status = "Root/last item is %svisible/%svisible" %
|
1232
|
+
[@treectrl.is_visible(idRoot) ? '' : 'not ',
|
1233
|
+
idLast.ok? && @treectrl.is_visible(idLast) ? '' : 'not ']
|
1234
|
+
else
|
1235
|
+
status = "No root item";
|
1236
|
+
end
|
1246
1237
|
|
1247
|
-
|
1248
|
-
|
1249
|
-
end
|
1238
|
+
set_status_text(status, 1)
|
1239
|
+
end
|
1250
1240
|
|
1251
|
-
|
1252
|
-
|
1253
|
-
"(c) Julian Smart 1997, Vadim Zeitlin 1998, Martin Corino 2022",
|
1254
|
-
"About wxRuby tree test",
|
1255
|
-
Wx::OK | Wx::ICON_INFORMATION, self)
|
1256
|
-
end
|
1241
|
+
evt.skip
|
1242
|
+
end
|
1257
1243
|
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1244
|
+
def on_size(evt)
|
1245
|
+
resize if (@treectrl && @textctrl)
|
1246
|
+
evt.skip
|
1247
|
+
end
|
1261
1248
|
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
# TODO demonstrate creating a custom edit control...
|
1266
|
-
@treectrl.edit_label(item)
|
1267
|
-
end
|
1249
|
+
def on_quit(event)
|
1250
|
+
close(true)
|
1251
|
+
end
|
1268
1252
|
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1253
|
+
def on_about(event)
|
1254
|
+
Wx::message_box("Tree test sample\n" +
|
1255
|
+
"(c) Julian Smart 1997, Vadim Zeitlin 1998, Martin Corino 2022",
|
1256
|
+
"About wxRuby tree test",
|
1257
|
+
Wx::OK | Wx::ICON_INFORMATION, self)
|
1258
|
+
end
|
1275
1259
|
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
Wx::log_message("%d children", @treectrl.children_count(item))
|
1280
|
-
end
|
1260
|
+
def on_clear_log(event)
|
1261
|
+
@textctrl.clear
|
1262
|
+
end
|
1281
1263
|
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1264
|
+
def on_rename(event)
|
1265
|
+
item = @treectrl.selection
|
1266
|
+
return unless check_item(item)
|
1267
|
+
# TODO demonstrate creating a custom edit control...
|
1268
|
+
@treectrl.edit_label(item)
|
1269
|
+
end
|
1287
1270
|
|
1288
|
-
|
1289
|
-
|
1271
|
+
def on_count(event)
|
1272
|
+
item = @treectrl.selection
|
1273
|
+
return unless check_item(item)
|
1274
|
+
i = @treectrl.children_count(item, false)
|
1275
|
+
Wx::log_message("%d children", i)
|
1276
|
+
end
|
1290
1277
|
|
1291
|
-
|
1278
|
+
def on_count_rec(event)
|
1279
|
+
item = @treectrl.selection
|
1280
|
+
return unless check_item(item)
|
1281
|
+
Wx::log_message("%d children", @treectrl.children_count(item))
|
1282
|
+
end
|
1292
1283
|
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1284
|
+
def do_sort(reverse = false)
|
1285
|
+
item = @treectrl.selection
|
1286
|
+
return unless check_item(item)
|
1287
|
+
@treectrl.do_sort_children(item, reverse)
|
1297
1288
|
end
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1289
|
+
|
1290
|
+
def on_highlight(_event)
|
1291
|
+
id = @treectrl.get_focused_item
|
1292
|
+
|
1293
|
+
return unless check_item(id)
|
1294
|
+
|
1295
|
+
r = Wx::Rect.new
|
1296
|
+
if !@treectrl.get_bounding_rect(id, r, true) # text, not full row
|
1297
|
+
Wx::LogMessage("Failed to get bounding item rect")
|
1298
|
+
return
|
1299
|
+
end
|
1300
|
+
@treectrl.paint do |dc|
|
1301
|
+
dc.set_brush(Wx::RED_BRUSH)
|
1302
|
+
dc.set_pen(Wx::TRANSPARENT_PEN)
|
1303
|
+
dc.draw_rectangle(r)
|
1304
|
+
@treectrl.update
|
1305
|
+
end
|
1303
1306
|
end
|
1304
|
-
end
|
1305
1307
|
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1308
|
+
def on_dump(event)
|
1309
|
+
root = @treectrl.selection
|
1310
|
+
return unless check_item(root)
|
1311
|
+
@treectrl.get_items_recursively(root, -1)
|
1312
|
+
end
|
1311
1313
|
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1314
|
+
def on_toggle_sel(event)
|
1315
|
+
tog_style(event.id, Wx::TR_MULTIPLE)
|
1316
|
+
end
|
1315
1317
|
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1318
|
+
def on_dump_selected(event)
|
1319
|
+
if (@treectrl.window_style & Wx::TR_MULTIPLE) == 0
|
1320
|
+
item_id = @treectrl.selection
|
1321
|
+
if item_id.ok?
|
1322
|
+
Wx::log_message("<TreeItem '%s'>",
|
1323
|
+
@treectrl.get_item_text(item_id))
|
1324
|
+
else
|
1325
|
+
Wx::log_message("No tree item selected")
|
1326
|
+
end
|
1322
1327
|
else
|
1323
|
-
Wx::log_message("
|
1328
|
+
Wx::log_message("NOT IMPLEMENTED: Multiple selections not available")
|
1329
|
+
# Requires Wx::List - Ruby Array typemap, pointer handling, 29/08/2006
|
1330
|
+
# Currently raises incorrect number of args, 1 for 0
|
1331
|
+
# selected = @treectrl.get_selections
|
1332
|
+
# selected_items.each do | item_id |
|
1333
|
+
# Wx::log_message("\t%s", @treectrl.get_item_text(item_id))
|
1334
|
+
# end
|
1324
1335
|
end
|
1325
|
-
else
|
1326
|
-
Wx::log_message("NOT IMPLEMENTED: Multiple selections not available")
|
1327
|
-
# Requires Wx::List - Ruby Array typemap, pointer handling, 29/08/2006
|
1328
|
-
# Currently raises incorrect number of args, 1 for 0
|
1329
|
-
# selected = @treectrl.get_selections
|
1330
|
-
# selected_items.each do | item_id |
|
1331
|
-
# Wx::log_message("\t%s", @treectrl.get_item_text(item_id))
|
1332
|
-
# end
|
1333
1336
|
end
|
1334
|
-
end
|
1335
|
-
|
1336
|
-
def on_select(event)
|
1337
|
-
@treectrl.select_item(@treectrl.selection)
|
1338
|
-
end
|
1339
1337
|
|
1340
|
-
|
1341
|
-
|
1342
|
-
@treectrl.select_item(@treectrl.root_item)
|
1338
|
+
def on_select(event)
|
1339
|
+
@treectrl.select_item(@treectrl.selection)
|
1343
1340
|
end
|
1344
|
-
end
|
1345
1341
|
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1342
|
+
def on_select_root(event)
|
1343
|
+
unless @treectrl.has_flag(Wx::TR_HIDE_ROOT)
|
1344
|
+
@treectrl.select_item(@treectrl.root_item)
|
1345
|
+
end
|
1349
1346
|
end
|
1350
|
-
end
|
1351
1347
|
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1348
|
+
def on_set_focused_root(event)
|
1349
|
+
unless @treectrl.has_flag(Wx::TR_HIDE_ROOT)
|
1350
|
+
@treectrl.set_focused_item(@treectrl.root_item)
|
1351
|
+
end
|
1352
|
+
end
|
1355
1353
|
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1354
|
+
def on_clear_focused(event)
|
1355
|
+
@treectrl.clear_focused_item
|
1356
|
+
end
|
1359
1357
|
|
1360
|
-
|
1361
|
-
|
1358
|
+
def on_unselect(event)
|
1359
|
+
@treectrl.unselect_all
|
1360
|
+
end
|
1362
1361
|
|
1363
|
-
|
1362
|
+
def on_select_children(event)
|
1363
|
+
item = @treectrl.get_focused_item
|
1364
1364
|
|
1365
|
-
|
1366
|
-
end
|
1365
|
+
item = @treectrl.root_item unless item.ok?
|
1367
1366
|
|
1368
|
-
|
1369
|
-
|
1370
|
-
return unless check_item(item)
|
1371
|
-
@treectrl.set_item_bold(item, bold)
|
1372
|
-
end
|
1367
|
+
@treectrl.select_children(item)
|
1368
|
+
end
|
1373
1369
|
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1370
|
+
def do_set_bold(bold = true)
|
1371
|
+
item = @treectrl.selection
|
1372
|
+
return unless check_item(item)
|
1373
|
+
@treectrl.set_item_bold(item, bold)
|
1374
|
+
end
|
1379
1375
|
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1376
|
+
def on_delete(event)
|
1377
|
+
item = @treectrl.selection
|
1378
|
+
return unless check_item(item)
|
1379
|
+
@treectrl.delete(item)
|
1380
|
+
end
|
1385
1381
|
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1382
|
+
def on_delete_children(event)
|
1383
|
+
item = @treectrl.selection
|
1384
|
+
return unless check_item(item)
|
1385
|
+
@treectrl.delete_children(item)
|
1386
|
+
end
|
1389
1387
|
|
1390
|
-
|
1391
|
-
|
1392
|
-
@treectrl.freeze
|
1393
|
-
else
|
1394
|
-
@treectrl.thaw
|
1388
|
+
def on_delete_all(event)
|
1389
|
+
@treectrl.delete_all_items
|
1395
1390
|
end
|
1396
1391
|
|
1397
|
-
|
1398
|
-
|
1392
|
+
def on_freeze_thaw(event)
|
1393
|
+
if event.is_checked
|
1394
|
+
@treectrl.freeze
|
1395
|
+
else
|
1396
|
+
@treectrl.thaw
|
1397
|
+
end
|
1399
1398
|
|
1400
|
-
|
1401
|
-
|
1402
|
-
@treectrl.add_test_items_to_tree(5, 2)
|
1403
|
-
end
|
1399
|
+
Wx::log_message("The tree is %sfrozen", @treectrl.is_frozen ? '' : 'not ')
|
1400
|
+
end
|
1404
1401
|
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
"TreeCtrl sample",
|
1409
|
-
@treectrl.image_size)
|
1410
|
-
if size == -1
|
1411
|
-
return
|
1402
|
+
def on_recreate(event)
|
1403
|
+
on_delete_all(event)
|
1404
|
+
@treectrl.add_test_items_to_tree(5, 2)
|
1412
1405
|
end
|
1413
1406
|
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1407
|
+
def on_set_image_size(event)
|
1408
|
+
size = Wx.get_number_from_user("Enter the size for the images to use",
|
1409
|
+
"Size: ",
|
1410
|
+
"TreeCtrl sample",
|
1411
|
+
@treectrl.image_size)
|
1412
|
+
if size == -1
|
1413
|
+
return
|
1414
|
+
end
|
1418
1415
|
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
Wx::get_app.show_images = false
|
1423
|
-
else
|
1424
|
-
@treectrl.create_image_list(@treectrl.image_size)
|
1425
|
-
Wx::get_app.show_images = true
|
1416
|
+
@treectrl.create_image_list(size)
|
1417
|
+
@treectrl.refresh
|
1418
|
+
Wx::THE_APP.show_images = true
|
1426
1419
|
end
|
1427
|
-
end
|
1428
1420
|
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1421
|
+
def on_toggle_images(event)
|
1422
|
+
if Wx::get_app.show_images
|
1423
|
+
@treectrl.unset_image_list
|
1424
|
+
Wx::get_app.show_images = false
|
1425
|
+
else
|
1426
|
+
@treectrl.create_image_list(@treectrl.image_size)
|
1427
|
+
Wx::get_app.show_images = true
|
1428
|
+
end
|
1436
1429
|
end
|
1437
|
-
end
|
1438
1430
|
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1431
|
+
def on_toggle_states(event)
|
1432
|
+
if Wx::get_app.show_states
|
1433
|
+
@treectrl.create_state_imageList(true)
|
1434
|
+
Wx::get_app.show_states = false
|
1435
|
+
else
|
1436
|
+
@treectrl.create_state_imageList
|
1437
|
+
Wx::get_app.show_states = true
|
1438
|
+
end
|
1439
|
+
end
|
1442
1440
|
|
1443
|
-
|
1444
|
-
|
1441
|
+
def on_toggle_bell(event)
|
1442
|
+
@treectrl.enable_bell_on_no_match(event.checked?)
|
1443
|
+
end
|
1445
1444
|
|
1446
|
-
|
1447
|
-
|
1448
|
-
end
|
1445
|
+
def on_toggle_alternate_images(event)
|
1446
|
+
alternateImages = @treectrl.alternate_images
|
1449
1447
|
|
1450
|
-
|
1451
|
-
|
1448
|
+
@treectrl.alternate_images = !alternateImages
|
1449
|
+
@treectrl.create_image_list(0)
|
1450
|
+
end
|
1452
1451
|
|
1453
|
-
|
1454
|
-
|
1452
|
+
def on_toggle_alternate_states(event)
|
1453
|
+
alternateStates = @treectrl.alternate_states
|
1455
1454
|
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1455
|
+
@treectrl.alternate_states = !alternateStates
|
1456
|
+
@treectrl.create_state_imageList
|
1457
|
+
|
1458
|
+
# normal states < alternate states
|
1459
|
+
# so we must reset broken states
|
1460
|
+
if alternateStates
|
1461
|
+
@treectrl.reset_broken_state_images
|
1462
|
+
end
|
1460
1463
|
end
|
1461
|
-
end
|
1462
1464
|
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1465
|
+
def on_toggle_buttons(event)
|
1466
|
+
unless Wx::PLATFORM == 'WXMSW'
|
1467
|
+
if Wx::THE_APP.show_buttons
|
1468
|
+
@treectrl.create_buttons_image_list(-1)
|
1469
|
+
Wx::get_app.show_buttons = false
|
1470
|
+
else
|
1471
|
+
@treectrl.create_buttons_image_list(15)
|
1472
|
+
Wx::get_app.show_buttons = true
|
1473
|
+
end
|
1471
1474
|
end
|
1472
1475
|
end
|
1473
|
-
end
|
1474
1476
|
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1477
|
+
def on_collapse_and_reset(event)
|
1478
|
+
@treectrl.collapse_and_reset(@treectrl.get_root_item)
|
1479
|
+
end
|
1478
1480
|
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1481
|
+
def on_ensure_visible(event)
|
1482
|
+
@treectrl.do_ensure_visible
|
1483
|
+
end
|
1482
1484
|
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1485
|
+
def on_set_focus(event)
|
1486
|
+
@treectrl.set_focus
|
1487
|
+
end
|
1486
1488
|
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1489
|
+
def on_insert_item(event)
|
1490
|
+
image = Wx::THE_APP.show_images ? TreeCtrlIcon_File : -1
|
1491
|
+
@treectrl.insert_item(@treectrl.root_item, -1, "2nd item", image)
|
1492
|
+
end
|
1491
1493
|
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1494
|
+
def on_add_item(event)
|
1495
|
+
@s_num += 1
|
1496
|
+
text = sprintf("Item #%d", @s_num)
|
1497
|
+
@treectrl.append_item(@treectrl.root_item, text)
|
1498
|
+
end
|
1497
1499
|
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1500
|
+
def on_add_many_items(event)
|
1501
|
+
Wx::WindowUpdateLocker.update(@treectrl) do
|
1502
|
+
root = @treectrl.root_item
|
1503
|
+
1000.times {|n| @treectrl.append_item(root, "Item #%03d" % [n]) }
|
1504
|
+
end
|
1502
1505
|
end
|
1503
|
-
end
|
1504
1506
|
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1507
|
+
def on_inc_indent(event)
|
1508
|
+
if @treectrl.indent < 100
|
1509
|
+
@treectrl.indent += 5
|
1510
|
+
end
|
1508
1511
|
end
|
1509
|
-
end
|
1510
1512
|
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1513
|
+
def on_dec_indent(event)
|
1514
|
+
if @treectrl.indent > 10
|
1515
|
+
@treectrl.indent -= 5
|
1516
|
+
end
|
1514
1517
|
end
|
1515
|
-
end
|
1516
1518
|
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1519
|
+
def on_inc_spacing(event)
|
1520
|
+
if @treectrl.spacing < 100
|
1521
|
+
@treectrl.spacing += 5
|
1522
|
+
end
|
1520
1523
|
end
|
1521
|
-
end
|
1522
1524
|
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1525
|
+
def on_dec_spacing(event)
|
1526
|
+
if @treectrl.spacing > 10
|
1527
|
+
@treectrl.spacing -= 5
|
1528
|
+
end
|
1526
1529
|
end
|
1527
|
-
end
|
1528
1530
|
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1531
|
+
def on_toggle_icon(event)
|
1532
|
+
item = @treectrl.focused_item
|
1533
|
+
return unless check_item(item)
|
1534
|
+
@treectrl.do_toggle_icon(item)
|
1535
|
+
end
|
1534
1536
|
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1537
|
+
def on_toggle_state(event)
|
1538
|
+
item = @treectrl.focused_item
|
1539
|
+
return unless check_item(item)
|
1540
|
+
@treectrl.do_toggle_state(item)
|
1541
|
+
end
|
1540
1542
|
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1543
|
+
def do_show_first_or_last(label)
|
1544
|
+
item = yield
|
1545
|
+
unless item.ok?
|
1546
|
+
Wx::log_message("There is no %s item" % label)
|
1547
|
+
else
|
1548
|
+
Wx::log_message("The %s item is \"%s\"" %
|
1549
|
+
[label, @treectrl.item_text(item)])
|
1550
|
+
end
|
1548
1551
|
end
|
1549
|
-
end
|
1550
1552
|
|
1551
|
-
|
1552
|
-
|
1553
|
+
def do_show_relative_item(label)
|
1554
|
+
item = @treectrl.focused_item
|
1553
1555
|
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1556
|
+
return unless item.ok?
|
1557
|
+
unless !label['visible'] || @treectrl.visible?(item)
|
1558
|
+
Wx::log_message("The selected item must be visible.")
|
1559
|
+
return
|
1560
|
+
end
|
1559
1561
|
|
1560
|
-
|
1562
|
+
item = yield(item)
|
1561
1563
|
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1564
|
+
unless item.ok?
|
1565
|
+
Wx::log_message("There is no %s item" % label)
|
1566
|
+
else
|
1567
|
+
Wx::log_message("The %s item is \"%s\"" %
|
1568
|
+
[label, @treectrl.item_text(item)])
|
1569
|
+
end
|
1567
1570
|
end
|
1568
|
-
end
|
1569
1571
|
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1572
|
+
def on_show_first_visible(event)
|
1573
|
+
do_show_first_or_last("first visible") { @treectrl.first_visible_item }
|
1574
|
+
end
|
1573
1575
|
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1576
|
+
def on_show_last_visible(event)
|
1577
|
+
if Wx.has_feature?(:HAS_LAST_VISIBLE)
|
1578
|
+
do_show_first_or_last("last visible") { @treectrl.last_visible_item }
|
1579
|
+
end
|
1577
1580
|
end
|
1578
|
-
end
|
1579
1581
|
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1582
|
+
def on_show_next_visible(event)
|
1583
|
+
do_show_relative_item("next visible") { |itm| @treectrl.next_visible(itm) }
|
1584
|
+
end
|
1583
1585
|
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1586
|
+
def on_show_prev_visible(event)
|
1587
|
+
do_show_relative_item("prev visible") { |itm| @treectrl.prev_visible(itm) }
|
1588
|
+
end
|
1587
1589
|
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1590
|
+
def on_show_parent(event)
|
1591
|
+
do_show_relative_item("parent") { |itm| @treectrl.item_parent(itm) }
|
1592
|
+
end
|
1591
1593
|
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1594
|
+
def on_show_prev_sibling(event)
|
1595
|
+
do_show_relative_item("previous sibling") { |itm| @treectrl.prev_sibling(itm) }
|
1596
|
+
end
|
1595
1597
|
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1598
|
+
def on_show_next_sibling(event)
|
1599
|
+
do_show_relative_item("next sibling") { |itm| @treectrl.next_sibling(itm) }
|
1600
|
+
end
|
1599
1601
|
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1602
|
+
def on_scroll_to(event)
|
1603
|
+
# scroll to the last but one top level child
|
1604
|
+
item = @treectrl.get_prev_sibling(
|
1605
|
+
@treectrl.get_last_child(
|
1606
|
+
@treectrl.root_item))
|
1607
|
+
return unless item.ok?
|
1606
1608
|
|
1607
|
-
|
1608
|
-
|
1609
|
+
@treectrl.scroll_to(item)
|
1610
|
+
end
|
1609
1611
|
|
1610
|
-
|
1611
|
-
|
1612
|
+
def on_select_last(event)
|
1613
|
+
item = @treectrl.last_tree_item
|
1612
1614
|
|
1613
|
-
|
1615
|
+
return unless item.ok?
|
1614
1616
|
|
1615
|
-
|
1616
|
-
|
1617
|
+
@treectrl.select_item(item)
|
1618
|
+
end
|
1617
1619
|
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1620
|
+
def on_set_fg_colour(event)
|
1621
|
+
col = Wx::get_colour_from_user(self, @treectrl.foreground_colour)
|
1622
|
+
if col.ok?
|
1623
|
+
@treectrl.foreground_colour = col
|
1624
|
+
end
|
1622
1625
|
end
|
1623
|
-
end
|
1624
1626
|
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1627
|
+
def on_set_bg_colour(event)
|
1628
|
+
col = Wx::get_colour_from_user(self, @treectrl.background_colour)
|
1629
|
+
if col.ok?
|
1630
|
+
@treectrl.background_colour = col
|
1631
|
+
end
|
1629
1632
|
end
|
1630
|
-
end
|
1631
1633
|
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1634
|
+
def on_tog_buttons(event)
|
1635
|
+
tog_style(event.id, Wx::TR_HAS_BUTTONS)
|
1636
|
+
end
|
1635
1637
|
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1638
|
+
def on_tog_twist(event)
|
1639
|
+
tog_style(event.id, Wx::TR_TWIST_BUTTONS)
|
1640
|
+
end
|
1639
1641
|
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1642
|
+
def on_tog_lines(event)
|
1643
|
+
tog_style(event.id, Wx::TR_NO_LINES)
|
1644
|
+
end
|
1643
1645
|
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1646
|
+
def on_tog_edit(event)
|
1647
|
+
tog_style(event.id, Wx::TR_EDIT_LABELS)
|
1648
|
+
end
|
1647
1649
|
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1650
|
+
def on_tog_hide_root(event)
|
1651
|
+
tog_style(event.id, Wx::TR_HIDE_ROOT)
|
1652
|
+
end
|
1651
1653
|
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1654
|
+
def on_tog_root_lines(event)
|
1655
|
+
tog_style(event.id, Wx::TR_LINES_AT_ROOT)
|
1656
|
+
end
|
1655
1657
|
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1658
|
+
def on_tog_border(event)
|
1659
|
+
tog_style(event.id, Wx::TR_ROW_LINES)
|
1660
|
+
end
|
1659
1661
|
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1662
|
+
def on_tog_full_highlight(event)
|
1663
|
+
tog_style(event.id, Wx::TR_FULL_ROW_HIGHLIGHT)
|
1664
|
+
end
|
1663
1665
|
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1666
|
+
def on_reset_style(event)
|
1667
|
+
create_tree_with_default_style
|
1668
|
+
end
|
1667
1669
|
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1670
|
+
def on_set_bold(event)
|
1671
|
+
do_set_bold(true)
|
1672
|
+
end
|
1671
1673
|
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1674
|
+
def on_clear_bold(event)
|
1675
|
+
do_set_bold(false)
|
1676
|
+
end
|
1675
1677
|
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1678
|
+
def on_sort(event)
|
1679
|
+
do_sort
|
1680
|
+
end
|
1679
1681
|
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1682
|
+
def on_sort_rev(event)
|
1683
|
+
do_sort(true)
|
1684
|
+
end
|
1685
|
+
|
1686
|
+
def on_close(event)
|
1687
|
+
Wx::Log::active_target = @old_log_tgt
|
1688
|
+
destroy
|
1689
|
+
end
|
1683
1690
|
|
1684
|
-
def on_close(event)
|
1685
|
-
Wx::Log::active_target = @old_log_tgt
|
1686
|
-
destroy
|
1687
1691
|
end
|
1688
1692
|
|
1689
|
-
|
1693
|
+
class MyApp < Wx::App
|
1694
|
+
attr_accessor :show_images, :show_buttons, :show_states
|
1690
1695
|
|
1691
|
-
|
1692
|
-
|
1696
|
+
def initialize
|
1697
|
+
self.show_images = true
|
1698
|
+
self.show_buttons = false
|
1699
|
+
self.show_states = true
|
1700
|
+
super
|
1701
|
+
end
|
1693
1702
|
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1703
|
+
def on_init
|
1704
|
+
# Create the main frame window
|
1705
|
+
frame = MyFrame.new("TreeCtrl Test", 50, 50, 450, 600)
|
1706
|
+
# show the frame
|
1707
|
+
frame.show(true)
|
1708
|
+
end
|
1699
1709
|
end
|
1700
1710
|
|
1701
|
-
def on_init
|
1702
|
-
# Create the main frame window
|
1703
|
-
frame = MyFrame.new("TreeCtrl Test", 50, 50, 450, 600)
|
1704
|
-
# show the frame
|
1705
|
-
frame.show(true)
|
1706
|
-
end
|
1707
1711
|
end
|
1708
1712
|
|
1709
1713
|
module TreeCtrlSample
|
@@ -1721,7 +1725,7 @@ module TreeCtrlSample
|
|
1721
1725
|
end
|
1722
1726
|
|
1723
1727
|
if $0 == __FILE__
|
1724
|
-
MyApp.run
|
1728
|
+
TreeCtrl::MyApp.run
|
1725
1729
|
end
|
1726
1730
|
|
1727
1731
|
end
|