wxruby3 0.9.1 → 0.9.3
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/wxruby3/include/wxRubyApp.h +338 -0
- data/ext/wxruby3/include/wxruby-ClientData.h +48 -0
- data/ext/wxruby3/include/wxruby-Config.h +6 -6
- data/ext/wxruby3/include/wxruby-Validator.h +39 -0
- data/ext/wxruby3/include/wxruby-ValidatorBinding.h +64 -0
- data/ext/wxruby3/swig/common.i +1 -1
- data/ext/wxruby3/swig/custom/director.swg +8 -0
- data/ext/wxruby3/swig/mark_free_impl.i +0 -33
- 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/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/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/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/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/lib/core/include/client_data.inc +65 -0
- data/rakelib/lib/core/include/funcall.inc +1 -1
- data/rakelib/lib/core/package.rb +31 -9
- data/rakelib/lib/core/parameter.rb +1 -1
- data/rakelib/lib/core/spec.rb +6 -1
- data/rakelib/lib/core/spec_helper.rb +7 -1
- data/rakelib/lib/director/accelerator.rb +2 -3
- data/rakelib/lib/director/accessible.rb +47 -0
- data/rakelib/lib/director/app.rb +30 -319
- data/rakelib/lib/director/app_traits.rb +13 -13
- data/rakelib/lib/director/bitmap_combobox.rb +2 -2
- data/rakelib/lib/director/combobox.rb +22 -0
- data/rakelib/lib/director/comboctrl.rb +1 -55
- data/rakelib/lib/director/ctrl_with_items.rb +105 -26
- data/rakelib/lib/director/data_format.rb +1 -1
- data/rakelib/lib/director/date_picker_ctrl.rb +8 -6
- data/rakelib/lib/director/derived_dc.rb +1 -1
- data/rakelib/lib/director/dialog.rb +1 -0
- data/rakelib/lib/director/drag_image.rb +2 -3
- data/rakelib/lib/director/editable_listbox.rb +30 -0
- data/rakelib/lib/director/event.rb +104 -14
- data/rakelib/lib/director/event_handler.rb +3 -2
- data/rakelib/lib/director/frame.rb +1 -3
- data/rakelib/lib/director/functions.rb +4 -2
- data/rakelib/lib/director/gdicommon.rb +8 -10
- data/rakelib/lib/director/generic_dirctrl.rb +17 -0
- data/rakelib/lib/director/graphics_context.rb +2 -4
- data/rakelib/lib/director/grid_cell_attr.rb +0 -2
- data/rakelib/lib/director/grid_cell_editor.rb +0 -2
- data/rakelib/lib/director/grid_cell_renderer.rb +0 -2
- data/rakelib/lib/director/grid_ctrl.rb +34 -3
- data/rakelib/lib/director/header_ctrl.rb +6 -1
- data/rakelib/lib/director/html_listbox.rb +96 -22
- data/rakelib/lib/director/icon.rb +5 -2
- data/rakelib/lib/director/list_ctrl.rb +5 -6
- data/rakelib/lib/director/locale.rb +1 -3
- data/rakelib/lib/director/log.rb +1 -4
- data/rakelib/lib/director/media_ctrl.rb +54 -0
- data/rakelib/lib/director/menu.rb +16 -1
- data/rakelib/lib/director/menu_item.rb +2 -2
- data/rakelib/lib/director/num_validator.rb +495 -0
- data/rakelib/lib/director/numeric_property_validator.rb +131 -6
- data/rakelib/lib/director/owner_drawn_combobox.rb +192 -0
- data/rakelib/lib/director/pgproperties.rb +1 -1
- data/rakelib/lib/director/pgproperty.rb +27 -30
- data/rakelib/lib/director/property_grid_interface.rb +5 -10
- data/rakelib/lib/director/ribbon_button_bar.rb +3 -3
- data/rakelib/lib/director/ribbon_gallery.rb +3 -5
- data/rakelib/lib/director/richtext_composite_object.rb +25 -0
- data/rakelib/lib/director/richtext_ctrl.rb +14 -4
- data/rakelib/lib/director/richtext_formatting_dialog.rb +7 -5
- data/rakelib/lib/director/richtext_paragraph_layout_box.rb +9 -7
- data/rakelib/lib/director/sizer.rb +30 -4
- data/rakelib/lib/director/sizer_item.rb +13 -0
- data/rakelib/lib/director/static_bitmap.rb +28 -0
- data/rakelib/lib/director/static_box.rb +4 -5
- data/rakelib/lib/director/styled_text_ctrl.rb +12 -0
- data/rakelib/lib/director/task_bar_button.rb +30 -0
- data/rakelib/lib/director/task_bar_icon.rb +5 -13
- data/rakelib/lib/director/text_entry.rb +4 -0
- data/rakelib/lib/director/text_validator.rb +124 -13
- data/rakelib/lib/director/textctrl.rb +12 -1
- data/rakelib/lib/director/toggle_button.rb +1 -0
- data/rakelib/lib/director/tool_tip.rb +1 -1
- data/rakelib/lib/director/top_level_window.rb +4 -7
- data/rakelib/lib/director/tree_ctrl.rb +40 -6
- data/rakelib/lib/director/utils.rb +16 -2
- data/rakelib/lib/director/validator.rb +196 -21
- data/rakelib/lib/director/variant.rb +1 -1
- data/rakelib/lib/director/window.rb +40 -7
- data/rakelib/lib/director.rb +4 -4
- data/rakelib/lib/extractor/function.rb +8 -7
- data/rakelib/lib/extractor.rb +34 -5
- data/rakelib/lib/generate/analyzer.rb +9 -4
- data/rakelib/lib/generate/doc/busy_info.yaml +0 -2
- data/rakelib/lib/generate/doc/clipboard.yaml +0 -2
- data/rakelib/lib/generate/doc/cursor.yaml +0 -2
- data/rakelib/lib/generate/doc/panel.yaml +7 -0
- data/rakelib/lib/generate/doc.rb +85 -17
- data/rakelib/lib/specs/interfaces.rb +163 -160
- data/rakelib/lib/swig_runner.rb +55 -9
- data/rakelib/lib/typemap/client_data.rb +67 -0
- data/rakelib/lib/typemap/common.rb +33 -4
- data/rakelib/lib/typemap/datetime.rb +1 -1
- data/rakelib/lib/typemap/tree_itemid.rb +2 -2
- 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 +121 -139
- data/lib/wx/core/choice.rb +0 -14
- data/lib/wx/core/combo_ctrl.rb +0 -110
- data/rakelib/lib/typemap/grid_client_data.rb +0 -58
- 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
data/samples/ribbon/ribbon.rb
CHANGED
@@ -8,872 +8,878 @@
|
|
8
8
|
|
9
9
|
require 'wx'
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
11
|
+
module Ribbon
|
12
|
+
|
13
|
+
class MyFrame < Wx::Frame
|
14
|
+
|
15
|
+
module ID
|
16
|
+
%i[
|
17
|
+
CIRCLE
|
18
|
+
CROSS
|
19
|
+
TRIANGLE
|
20
|
+
SQUARE
|
21
|
+
POLYGON
|
22
|
+
SELECTION_EXPAND_H
|
23
|
+
SELECTION_EXPAND_V
|
24
|
+
SELECTION_CONTRACT
|
25
|
+
BUTTON_XX
|
26
|
+
BUTTON_XY
|
27
|
+
PRIMARY_COLOUR
|
28
|
+
SECONDARY_COLOUR
|
29
|
+
DEFAULT_PROVIDER
|
30
|
+
AUI_PROVIDER
|
31
|
+
MSW_PROVIDER
|
32
|
+
MAIN_TOOLBAR
|
33
|
+
POSITION_TOP
|
34
|
+
POSITION_TOP_ICONS
|
35
|
+
POSITION_TOP_BOTH
|
36
|
+
POSITION_LEFT
|
37
|
+
POSITION_LEFT_LABELS
|
38
|
+
POSITION_LEFT_BOTH
|
39
|
+
TOGGLE_PANELS
|
40
|
+
ENABLE
|
41
|
+
DISABLE
|
42
|
+
DISABLED
|
43
|
+
UI_ENABLE_UPDATED
|
44
|
+
CHECK
|
45
|
+
UI_CHECK_UPDATED
|
46
|
+
CHANGE_TEXT1
|
47
|
+
CHANGE_TEXT2
|
48
|
+
UI_CHANGE_TEXT_UPDATED
|
49
|
+
REMOVE_PAGE
|
50
|
+
HIDE_PAGES
|
51
|
+
SHOW_PAGES
|
52
|
+
PLUS_MINUS
|
53
|
+
CHANGE_LABEL
|
54
|
+
SMALL_BUTTON_1
|
55
|
+
SMALL_BUTTON_2
|
56
|
+
SMALL_BUTTON_3
|
57
|
+
SMALL_BUTTON_4
|
58
|
+
SMALL_BUTTON_5
|
59
|
+
SMALL_BUTTON_6
|
60
|
+
].each_with_index { |sym, ix| self.const_set(sym, Wx::ID_HIGHEST+1+ix) }
|
61
|
+
end
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
Wx::RBN::
|
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
|
-
selection = Wx::RBN::RibbonButtonBar.new(selection_panel)
|
112
|
-
selection.add_button(ID::SELECTION_EXPAND_V, "Expand Vertically", bitmap_(:expand_selection_v_xpm),
|
113
|
-
"This is a tooltip for Expand Vertically\ndemonstrating a tooltip")
|
114
|
-
selection.add_button(ID::SELECTION_EXPAND_H, "Expand Horizontally", bitmap_(:expand_selection_h_xpm), '')
|
115
|
-
selection.add_button(ID::SELECTION_CONTRACT, "Contract", bitmap_(:auto_crop_selection_xpm), bitmap_(:auto_crop_selection_small_xpm))
|
116
|
-
|
117
|
-
shapes_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Shapes", bitmap_(:circle_small_xpm))
|
118
|
-
shapes = Wx::RBN::RibbonButtonBar.new(shapes_panel)
|
119
|
-
shapes.add_button(ID::CIRCLE, "Circle", bitmap_(:circle_xpm), bitmap_(:circle_small_xpm),
|
120
|
-
Wx::NULL_BITMAP, Wx::NULL_BITMAP, Wx::RBN::RIBBON_BUTTON_NORMAL,
|
121
|
-
"This is a tooltip for the circle button\ndemonstrating another tooltip")
|
122
|
-
shapes.add_button(ID::CROSS, "Cross", bitmap_(:cross_xpm), '')
|
123
|
-
shapes.add_hybrid_button(ID::TRIANGLE, "Triangle", bitmap_(:triangle_xpm))
|
124
|
-
shapes.add_button(ID::SQUARE, "Square", bitmap_(:square_xpm), '')
|
125
|
-
shapes.add_dropdown_button(ID::POLYGON, "Other Polygon", bitmap_(:hexagon_xpm), '')
|
126
|
-
|
127
|
-
sizer_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Panel with Sizer",
|
128
|
-
style: Wx::RBN::RIBBON_PANEL_DEFAULT_STYLE)
|
129
|
-
|
130
|
-
as = ["Item 1 using a box sizer now", "Item 2 using a box sizer now"]
|
131
|
-
sizer_panelcombo = Wx::ComboBox.new(sizer_panel, Wx::ID_ANY,
|
132
|
-
choices: as, style: Wx::CB_READONLY)
|
133
|
-
|
134
|
-
sizer_panelcombo2 = Wx::ComboBox.new(sizer_panel, Wx::ID_ANY,
|
135
|
-
choices: as, style: Wx::CB_READONLY)
|
136
|
-
|
137
|
-
sizer_panelcombo.select(0)
|
138
|
-
sizer_panelcombo2.select(1)
|
139
|
-
sizer_panelcombo.set_min_size(Wx::Size.new(150, -1))
|
140
|
-
sizer_panelcombo2.set_min_size(Wx::Size.new(150, -1))
|
141
|
-
|
142
|
-
bar = Wx::RBN::RibbonButtonBar.new(sizer_panel, Wx::ID_ANY)
|
143
|
-
bar.add_button(ID::BUTTON_XX, "xx", bitmap_(:ribbon_xpm))
|
144
|
-
bar.add_button(ID::BUTTON_XY, "xy", bitmap_(:ribbon_xpm))
|
145
|
-
# This prevents ribbon buttons in panels with sizer from collapsing.
|
146
|
-
bar.set_button_min_size_class(ID::BUTTON_XX, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_LARGE)
|
147
|
-
bar.set_button_min_size_class(ID::BUTTON_XY, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_LARGE)
|
148
|
-
|
149
|
-
sizer_panelsizer_h = Wx::BoxSizer.new(Wx::HORIZONTAL)
|
150
|
-
sizer_panelsizer_v = Wx::BoxSizer.new(Wx::VERTICAL)
|
151
|
-
sizer_panelsizer_v.add_stretch_spacer(1)
|
152
|
-
sizer_panelsizer_v.add(sizer_panelcombo, 0, Wx::ALL|Wx::EXPAND, 2)
|
153
|
-
sizer_panelsizer_v.add(sizer_panelcombo2, 0, Wx::ALL|Wx::EXPAND, 2)
|
154
|
-
sizer_panelsizer_v.add_stretch_spacer(1)
|
155
|
-
sizer_panelsizer_h.add(bar, 0, Wx::EXPAND)
|
156
|
-
sizer_panelsizer_h.add(sizer_panelsizer_v, 0)
|
157
|
-
sizer_panel.set_sizer(sizer_panelsizer_h)
|
158
|
-
|
159
|
-
@label_font = Wx::Font.new(Wx::FontInfo.new(8).light)
|
160
|
-
|
161
|
-
scheme = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Appearance", bitmap_(:eye_xpm))
|
162
|
-
@default_primary = Wx::Colour.new
|
163
|
-
@default_secondary = Wx::Colour.new
|
164
|
-
@default_tertiary = Wx::Colour.new
|
165
|
-
@ribbon.get_art_provider.get_colour_scheme(@default_primary, @default_secondary, @default_tertiary)
|
166
|
-
provider_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
|
167
|
-
"Art", style: Wx::RBN::RIBBON_PANEL_NO_AUTO_MINIMISE)
|
168
|
-
provider_bar = Wx::RBN::RibbonButtonBar.new(provider_panel, Wx::ID_ANY)
|
169
|
-
provider_bar.add_button(ID::DEFAULT_PROVIDER, "Default Provider",
|
170
|
-
Wx::ArtProvider.get_bitmap(Wx::ART_QUESTION, Wx::ART_OTHER, Wx::Size.new(32, 32)))
|
171
|
-
provider_bar.add_button(ID::AUI_PROVIDER, "AUI Provider", bitmap_(:aui_style_xpm))
|
172
|
-
provider_bar.add_button(ID::MSW_PROVIDER, "MSW Provider", bitmap_(:msw_style_xpm))
|
173
|
-
primary_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
|
174
|
-
"Primary Colour", bitmap_(:colours_xpm))
|
175
|
-
@primary_gallery = populate_colours_panel(primary_panel,
|
176
|
-
@default_primary, ID::PRIMARY_COLOUR)
|
177
|
-
secondary_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
|
178
|
-
"Secondary Colour", bitmap_(:colours_xpm))
|
179
|
-
@secondary_gallery = populate_colours_panel(secondary_panel,
|
180
|
-
@default_secondary, ID::SECONDARY_COLOUR)
|
181
|
-
|
182
|
-
page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "UI Updated", bitmap_(:ribbon_xpm))
|
183
|
-
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Enable/Disable", bitmap_(:ribbon_xpm))
|
184
|
-
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
185
|
-
bar.add_button(ID::DISABLED, "Disabled", bitmap_(:ribbon_xpm))
|
186
|
-
bar.add_button(ID::ENABLE, "Enable", bitmap_(:ribbon_xpm))
|
187
|
-
bar.add_button(ID::DISABLE, "Disable", bitmap_(:ribbon_xpm))
|
188
|
-
bar.add_button(ID::UI_ENABLE_UPDATED, "Enable UI updated", bitmap_(:ribbon_xpm))
|
189
|
-
bar.enable_button(ID::DISABLED, false)
|
190
|
-
@bEnabled = true
|
191
|
-
|
192
|
-
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Toggle", bitmap_(:ribbon_xpm))
|
193
|
-
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
194
|
-
bar.add_button(ID::CHECK, "Toggle", bitmap_(:ribbon_xpm))
|
195
|
-
bar.add_toggle_button(ID::UI_CHECK_UPDATED, "Toggled UI updated", bitmap_(:ribbon_xpm))
|
196
|
-
@bChecked = true
|
197
|
-
|
198
|
-
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Change text", bitmap_(:ribbon_xpm))
|
199
|
-
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
200
|
-
bar.add_button(ID::CHANGE_TEXT1, "One", bitmap_(:ribbon_xpm))
|
201
|
-
bar.add_button(ID::CHANGE_TEXT2, "Two", bitmap_(:ribbon_xpm))
|
202
|
-
bar.add_button(ID::UI_CHANGE_TEXT_UPDATED, "Zero", bitmap_(:ribbon_xpm))
|
203
|
-
|
204
|
-
# Also set the general disabled text colour:
|
205
|
-
artProvider = @ribbon.get_art_provider
|
206
|
-
tColour = artProvider.get_color(Wx::RBN::RIBBON_ART_BUTTON_BAR_LABEL_COLOUR)
|
207
|
-
artProvider.set_color(Wx::RBN::RIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR, tColour.make_disabled)
|
208
|
-
|
209
|
-
Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Empty Page", bitmap_(:empty_xpm))
|
210
|
-
|
211
|
-
page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Another Page", bitmap_(:empty_xpm))
|
212
|
-
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Page manipulation", bitmap_(:ribbon_xpm))
|
213
|
-
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
214
|
-
bar.add_button(ID::REMOVE_PAGE, "Remove", Wx::ArtProvider.get_bitmap(Wx::ART_DELETE, Wx::ART_OTHER, Wx::Size.new(24, 24)))
|
215
|
-
bar.add_button(ID::HIDE_PAGES, "Hide Pages", bitmap_(:ribbon_xpm))
|
216
|
-
bar.add_button(ID::SHOW_PAGES, "Show Pages", bitmap_(:ribbon_xpm))
|
217
|
-
|
218
|
-
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Button bar manipulation", bitmap_(:ribbon_xpm))
|
219
|
-
button_bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
220
|
-
button_bar.add_button(ID::PLUS_MINUS, "+/-",
|
221
|
-
Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, Wx::Size.new(24, 24)))
|
222
|
-
@plus_minus_state = false
|
223
|
-
button_bar.add_button(ID::CHANGE_LABEL, "short", bitmap_(:ribbon_xpm))
|
224
|
-
button_bar.set_button_text_min_width(ID::CHANGE_LABEL, "some long text")
|
225
|
-
@change_label_state = false
|
226
|
-
|
227
|
-
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Always medium buttons", bitmap_(:ribbon_xpm))
|
228
|
-
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
229
|
-
bar.add_button(ID::SMALL_BUTTON_1, "Button 1", bitmap_(:ribbon_xpm))
|
230
|
-
bar.set_button_max_size_class(ID::SMALL_BUTTON_1, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
231
|
-
bar.add_button(ID::SMALL_BUTTON_2, "Button 2", bitmap_(:ribbon_xpm))
|
232
|
-
bar.set_button_max_size_class(ID::SMALL_BUTTON_2, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
233
|
-
bar.add_button(ID::SMALL_BUTTON_3, "Button 3", bitmap_(:ribbon_xpm))
|
234
|
-
bar.add_button(ID::SMALL_BUTTON_4, "Button 4", bitmap_(:ribbon_xpm))
|
235
|
-
bar.add_button(ID::SMALL_BUTTON_5, "Button 5", bitmap_(:ribbon_xpm))
|
236
|
-
bar.set_button_max_size_class(ID::SMALL_BUTTON_5, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
237
|
-
bar.add_button(ID::SMALL_BUTTON_6, "Button 6", bitmap_(:ribbon_xpm))
|
238
|
-
bar.set_button_max_size_class(ID::SMALL_BUTTON_6, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
239
|
-
|
240
|
-
Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Highlight Page", bitmap_(:empty_xpm))
|
241
|
-
@ribbon.add_page_highlight(@ribbon.get_page_count-1)
|
242
|
-
|
243
|
-
|
244
|
-
page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Advanced", bitmap_(:empty_xpm))
|
245
|
-
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Button bar manipulation", bitmap_(:ribbon_xpm))
|
246
|
-
button_bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
247
|
-
button_bar.add_button(ID::PLUS_MINUS, "+/-",
|
248
|
-
Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, Wx::Size.new(24, 24)))
|
249
|
-
@plus_minus_state = false
|
250
|
-
button_bar.add_button(ID::CHANGE_LABEL, "short", bitmap_(:ribbon_xpm))
|
251
|
-
button_bar.set_button_text_min_width(ID::CHANGE_LABEL, "some long text")
|
252
|
-
@change_label_state = false
|
253
|
-
|
254
|
-
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Always medium buttons", bitmap_(:ribbon_xpm))
|
255
|
-
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
256
|
-
bar.add_button(ID::SMALL_BUTTON_1, "Button 1", bitmap_(:ribbon_xpm))
|
257
|
-
bar.set_button_max_size_class(ID::SMALL_BUTTON_1, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
258
|
-
bar.add_button(ID::SMALL_BUTTON_2, "Button 2", bitmap_(:ribbon_xpm))
|
259
|
-
bar.set_button_max_size_class(ID::SMALL_BUTTON_2, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
260
|
-
bar.add_button(ID::SMALL_BUTTON_3, "Button 3", bitmap_(:ribbon_xpm))
|
261
|
-
bar.add_button(ID::SMALL_BUTTON_4, "Button 4", bitmap_(:ribbon_xpm))
|
262
|
-
bar.add_button(ID::SMALL_BUTTON_5, "Button 5", bitmap_(:ribbon_xpm))
|
263
|
-
bar.set_button_max_size_class(ID::SMALL_BUTTON_5, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
264
|
-
bar.add_button(ID::SMALL_BUTTON_6, "Button 6", bitmap_(:ribbon_xpm))
|
265
|
-
bar.set_button_max_size_class(ID::SMALL_BUTTON_6, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
266
|
-
|
267
|
-
@ribbon.realize
|
268
|
-
|
269
|
-
@logwindow = Wx::TextCtrl.new(self, Wx::ID_ANY, style: Wx::TE_MULTILINE | Wx::TE_READONLY |
|
270
|
-
Wx::TE_LEFT | Wx::TE_BESTWRAP | Wx::BORDER_NONE)
|
271
|
-
|
272
|
-
@togglePanels = Wx::ToggleButton.new(self, ID::TOGGLE_PANELS, "&Toggle panels")
|
273
|
-
@togglePanels.set_value(true)
|
274
|
-
|
275
|
-
s = Wx::BoxSizer.new(Wx::VERTICAL)
|
276
|
-
|
277
|
-
s.add(@ribbon, 0, Wx::EXPAND)
|
278
|
-
s.add(@logwindow, 1, Wx::EXPAND)
|
279
|
-
s.add(@togglePanels, Wx::SizerFlags.new.border)
|
280
|
-
|
281
|
-
set_sizer(s)
|
282
|
-
|
283
|
-
evt_ribbonbuttonbar_clicked(ID::ENABLE, :on_enable)
|
284
|
-
evt_ribbonbuttonbar_clicked(ID::DISABLE, :on_disable)
|
285
|
-
evt_ribbonbuttonbar_clicked(ID::DISABLED, :on_disabled)
|
286
|
-
evt_ribbonbuttonbar_clicked(ID::UI_ENABLE_UPDATED, :on_enable_updated)
|
287
|
-
evt_update_ui(ID::UI_ENABLE_UPDATED, :on_enable_update_ui)
|
288
|
-
evt_ribbonbuttonbar_clicked(ID::CHECK, :on_check)
|
289
|
-
evt_update_ui(ID::UI_CHECK_UPDATED, :on_check_update_ui)
|
290
|
-
evt_ribbonbuttonbar_clicked(ID::CHANGE_TEXT1, :on_change_text1)
|
291
|
-
evt_ribbonbuttonbar_clicked(ID::CHANGE_TEXT2, :on_change_text2)
|
292
|
-
evt_update_ui(ID::UI_CHANGE_TEXT_UPDATED, :on_change_text_update_ui)
|
293
|
-
evt_ribbonbuttonbar_clicked(ID::DEFAULT_PROVIDER, :on_default_provider)
|
294
|
-
evt_ribbonbuttonbar_clicked(ID::AUI_PROVIDER, :on_aui_provider)
|
295
|
-
evt_ribbonbuttonbar_clicked(ID::MSW_PROVIDER, :on_msw_provider)
|
296
|
-
evt_ribbonbuttonbar_clicked(ID::SELECTION_EXPAND_H, :on_selection_expand_h_button)
|
297
|
-
evt_ribbonbuttonbar_clicked(ID::SELECTION_EXPAND_V, :on_selection_expand_v_button)
|
298
|
-
evt_ribbonbuttonbar_clicked(ID::SELECTION_CONTRACT, :on_selection_contract_button)
|
299
|
-
evt_ribbonbuttonbar_clicked(ID::CIRCLE, :on_circle_button)
|
300
|
-
evt_ribbonbuttonbar_clicked(ID::CROSS, :on_cross_button)
|
301
|
-
evt_ribbonbuttonbar_clicked(ID::TRIANGLE, :on_triangle_button)
|
302
|
-
evt_ribbonbuttonbar_clicked(ID::SQUARE, :on_square_button)
|
303
|
-
evt_ribbonbuttonbar_dropdown_clicked(ID::TRIANGLE, :on_triangle_dropdown)
|
304
|
-
evt_ribbonbuttonbar_dropdown_clicked(ID::POLYGON, :on_polygon_dropdown)
|
305
|
-
evt_ribbongallery_hover_changed(ID::PRIMARY_COLOUR, :on_hovered_colour_change)
|
306
|
-
evt_ribbongallery_hover_changed(ID::SECONDARY_COLOUR, :on_hovered_colour_change)
|
307
|
-
evt_ribbongallery_selected(ID::PRIMARY_COLOUR, :on_primary_colour_select)
|
308
|
-
evt_ribbongallery_selected(ID::SECONDARY_COLOUR, :on_secondary_colour_select)
|
309
|
-
evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_LEFT, :on_justify)
|
310
|
-
evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_CENTER, :on_justify)
|
311
|
-
evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_RIGHT, :on_justify)
|
312
|
-
evt_update_ui(Wx::ID_JUSTIFY_LEFT, :on_justify_update_ui)
|
313
|
-
evt_update_ui(Wx::ID_JUSTIFY_CENTER, :on_justify_update_ui)
|
314
|
-
evt_update_ui(Wx::ID_JUSTIFY_RIGHT, :on_justify_update_ui)
|
315
|
-
evt_ribbontoolbar_clicked(Wx::ID_NEW, :on_new)
|
316
|
-
evt_ribbontoolbar_dropdown_clicked(Wx::ID_NEW, :on_new_dropdown)
|
317
|
-
evt_ribbontoolbar_clicked(Wx::ID_PRINT, :on_print)
|
318
|
-
evt_ribbontoolbar_dropdown_clicked(Wx::ID_PRINT, :on_print_dropdown)
|
319
|
-
evt_ribbontoolbar_dropdown_clicked(Wx::ID_REDO, :on_redo_dropdown)
|
320
|
-
evt_ribbontoolbar_dropdown_clicked(Wx::ID_UNDO, :on_undo_dropdown)
|
321
|
-
evt_ribbontoolbar_clicked(ID::POSITION_LEFT, :on_position_left)
|
322
|
-
evt_ribbontoolbar_dropdown_clicked(ID::POSITION_LEFT, :on_position_left_dropdown)
|
323
|
-
evt_ribbontoolbar_clicked(ID::POSITION_TOP, :on_position_top)
|
324
|
-
evt_ribbontoolbar_dropdown_clicked(ID::POSITION_TOP, :on_position_top_dropdown)
|
325
|
-
evt_button(ID::PRIMARY_COLOUR, :on_colour_gallery_button)
|
326
|
-
evt_button(ID::SECONDARY_COLOUR, :on_colour_gallery_button)
|
327
|
-
evt_menu(ID::POSITION_LEFT, :on_position_left_icons)
|
328
|
-
evt_menu(ID::POSITION_LEFT_LABELS, :on_position_left_labels)
|
329
|
-
evt_menu(ID::POSITION_LEFT_BOTH, :on_position_left_both)
|
330
|
-
evt_menu(ID::POSITION_TOP, :on_position_top_labels)
|
331
|
-
evt_menu(ID::POSITION_TOP_ICONS, :on_position_top_icons)
|
332
|
-
evt_menu(ID::POSITION_TOP_BOTH, :on_position_top_both)
|
333
|
-
evt_togglebutton(ID::TOGGLE_PANELS, :on_toggle_panels)
|
334
|
-
evt_ribbonpanel_extbutton_activated(Wx::ID_ANY, :on_ext_button)
|
335
|
-
evt_ribbonbuttonbar_clicked(ID::REMOVE_PAGE, :on_remove_page)
|
336
|
-
evt_ribbonbuttonbar_clicked(ID::HIDE_PAGES, :on_hide_pages)
|
337
|
-
evt_ribbonbuttonbar_clicked(ID::SHOW_PAGES, :on_show_pages)
|
338
|
-
evt_ribbonbuttonbar_clicked(ID::PLUS_MINUS, :on_plus_minus)
|
339
|
-
evt_ribbonbuttonbar_clicked(ID::CHANGE_LABEL, :on_change_label)
|
340
|
-
evt_ribbonbar_toggled(Wx::ID_ANY, :on_ribbon_bar_toggled)
|
341
|
-
evt_ribbonbar_help_click(Wx::ID_ANY, :on_ribbon_bar_help_clicked)
|
342
|
-
evt_size(:on_size_event)
|
343
|
-
end
|
63
|
+
def initialize
|
64
|
+
super(nil, Wx::ID_ANY, "wxRibbon Sample Application", size: [800, 600], style: Wx::DEFAULT_FRAME_STYLE)
|
65
|
+
|
66
|
+
self.icon = Wx.Icon(:sample, Wx::BITMAP_TYPE_XPM, art_path: File.join(__dir__, '..'))
|
67
|
+
|
68
|
+
@colour_data = Wx::ColourData.new
|
69
|
+
@ribbon = Wx::RBN::RibbonBar.new(self, Wx::ID_ANY,
|
70
|
+
style: Wx::RBN::RIBBON_BAR_FLOW_HORIZONTAL |
|
71
|
+
Wx::RBN::RIBBON_BAR_SHOW_PAGE_LABELS |
|
72
|
+
Wx::RBN::RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS |
|
73
|
+
Wx::RBN::RIBBON_BAR_SHOW_TOGGLE_BUTTON |
|
74
|
+
Wx::RBN::RIBBON_BAR_SHOW_HELP_BUTTON)
|
75
|
+
|
76
|
+
home = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Examples", bitmap_(:ribbon_xpm))
|
77
|
+
toolbar_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Toolbar",
|
78
|
+
style: Wx::RBN::RIBBON_PANEL_NO_AUTO_MINIMISE |
|
79
|
+
Wx::RBN::RIBBON_PANEL_EXT_BUTTON)
|
80
|
+
toolbar = Wx::RBN::RibbonToolBar.new(toolbar_panel, ID::MAIN_TOOLBAR)
|
81
|
+
toolbar.add_toggle_tool(Wx::ID_JUSTIFY_LEFT, bitmap_(:align_left_xpm))
|
82
|
+
toolbar.add_toggle_tool(Wx::ID_JUSTIFY_CENTER , bitmap_(:align_center_xpm))
|
83
|
+
toolbar.add_toggle_tool(Wx::ID_JUSTIFY_RIGHT, bitmap_(:align_right_xpm))
|
84
|
+
toolbar.add_separator
|
85
|
+
toolbar.add_hybrid_tool(Wx::ID_NEW, Wx::ArtProvider.get_bitmap(Wx::ART_NEW, Wx::ART_OTHER, Wx::Size.new(16, 15)))
|
86
|
+
toolbar.add_tool(Wx::ID_OPEN, Wx::ArtProvider.get_bitmap(Wx::ART_FILE_OPEN, Wx::ART_OTHER, Wx::Size.new(16, 15)), "Open something")
|
87
|
+
toolbar.add_tool(Wx::ID_SAVE, Wx::ArtProvider.get_bitmap(Wx::ART_FILE_SAVE, Wx::ART_OTHER, Wx::Size.new(16, 15)), "Save something")
|
88
|
+
toolbar.add_tool(Wx::ID_SAVEAS, Wx::ArtProvider.get_bitmap(Wx::ART_FILE_SAVE_AS, Wx::ART_OTHER, Wx::Size.new(16, 15)), "Save something as ...")
|
89
|
+
toolbar.enable_tool(Wx::ID_OPEN, false)
|
90
|
+
toolbar.enable_tool(Wx::ID_SAVE, false)
|
91
|
+
toolbar.enable_tool(Wx::ID_SAVEAS, false)
|
92
|
+
toolbar.add_separator
|
93
|
+
toolbar.add_dropdown_tool(Wx::ID_UNDO, Wx::ArtProvider.get_bitmap(Wx::ART_UNDO, Wx::ART_OTHER, Wx::Size.new(16, 15)))
|
94
|
+
toolbar.add_dropdown_tool(Wx::ID_REDO, Wx::ArtProvider.get_bitmap(Wx::ART_REDO, Wx::ART_OTHER, Wx::Size.new(16, 15)))
|
95
|
+
toolbar.add_separator
|
96
|
+
toolbar.add_tool(Wx::ID_ANY, Wx::ArtProvider.get_bitmap(Wx::ART_REPORT_VIEW, Wx::ART_OTHER, Wx::Size.new(16, 15)))
|
97
|
+
toolbar.add_tool(Wx::ID_ANY, Wx::ArtProvider.get_bitmap(Wx::ART_LIST_VIEW, Wx::ART_OTHER, Wx::Size.new(16, 15)))
|
98
|
+
toolbar.add_separator
|
99
|
+
toolbar.add_hybrid_tool(ID::POSITION_LEFT, bitmap_(:position_left_xpm),
|
100
|
+
"Align ribbonbar vertically\non the left\nfor demonstration purposes")
|
101
|
+
toolbar.add_hybrid_tool(ID::POSITION_TOP, bitmap_(:position_top_xpm),
|
102
|
+
"Align the ribbonbar horizontally\nat the top\nfor demonstration purposes")
|
103
|
+
toolbar.add_separator
|
104
|
+
prt_tool = toolbar.add_hybrid_tool(Wx::ID_PRINT, Wx::ArtProvider.get_bitmap(Wx::ART_PRINT, Wx::ART_OTHER, Wx::Size.new(16, 15)),
|
105
|
+
"This is the Print button tooltip\ndemonstrating a tooltip")
|
106
|
+
toolbar.set_rows(2, 3)
|
107
|
+
|
108
|
+
if toolbar.tool_count != (toolbar.tool_pos(prt_tool)+1)
|
109
|
+
Wx.log_error('Wx::RibbonToolBar::get_tool_count or Wx::RibbonToolBar::get_tool_pos is broken')
|
110
|
+
elsif Wx::ID_PRINT != toolbar.tool_by_pos(toolbar.tool_pos(prt_tool))
|
111
|
+
Wx.log_error('Wx::RibbonToolBar::get_tool_by_pos is broken')
|
112
|
+
end
|
344
113
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
114
|
+
selection_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Selection", bitmap_(:selection_panel_xpm))
|
115
|
+
selection = Wx::RBN::RibbonButtonBar.new(selection_panel)
|
116
|
+
selection.add_button(ID::SELECTION_EXPAND_V, "Expand Vertically", bitmap_(:expand_selection_v_xpm),
|
117
|
+
"This is a tooltip for Expand Vertically\ndemonstrating a tooltip")
|
118
|
+
selection.add_button(ID::SELECTION_EXPAND_H, "Expand Horizontally", bitmap_(:expand_selection_h_xpm), '')
|
119
|
+
selection.add_button(ID::SELECTION_CONTRACT, "Contract", bitmap_(:auto_crop_selection_xpm), bitmap_(:auto_crop_selection_small_xpm))
|
120
|
+
|
121
|
+
shapes_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Shapes", bitmap_(:circle_small_xpm))
|
122
|
+
shapes = Wx::RBN::RibbonButtonBar.new(shapes_panel)
|
123
|
+
shapes.add_button(ID::CIRCLE, "Circle", bitmap_(:circle_xpm), bitmap_(:circle_small_xpm),
|
124
|
+
Wx::NULL_BITMAP, Wx::NULL_BITMAP, Wx::RBN::RIBBON_BUTTON_NORMAL,
|
125
|
+
"This is a tooltip for the circle button\ndemonstrating another tooltip")
|
126
|
+
shapes.add_button(ID::CROSS, "Cross", bitmap_(:cross_xpm), '')
|
127
|
+
shapes.add_hybrid_button(ID::TRIANGLE, "Triangle", bitmap_(:triangle_xpm))
|
128
|
+
shapes.add_button(ID::SQUARE, "Square", bitmap_(:square_xpm), '')
|
129
|
+
shapes.add_dropdown_button(ID::POLYGON, "Other Polygon", bitmap_(:hexagon_xpm), '')
|
130
|
+
|
131
|
+
sizer_panel = Wx::RBN::RibbonPanel.new(home, Wx::ID_ANY, "Panel with Sizer",
|
132
|
+
style: Wx::RBN::RIBBON_PANEL_DEFAULT_STYLE)
|
133
|
+
|
134
|
+
as = ["Item 1 using a box sizer now", "Item 2 using a box sizer now"]
|
135
|
+
sizer_panelcombo = Wx::ComboBox.new(sizer_panel, Wx::ID_ANY,
|
136
|
+
choices: as, style: Wx::CB_READONLY)
|
137
|
+
|
138
|
+
sizer_panelcombo2 = Wx::ComboBox.new(sizer_panel, Wx::ID_ANY,
|
139
|
+
choices: as, style: Wx::CB_READONLY)
|
140
|
+
|
141
|
+
sizer_panelcombo.select(0)
|
142
|
+
sizer_panelcombo2.select(1)
|
143
|
+
sizer_panelcombo.set_min_size(Wx::Size.new(150, -1))
|
144
|
+
sizer_panelcombo2.set_min_size(Wx::Size.new(150, -1))
|
145
|
+
|
146
|
+
bar = Wx::RBN::RibbonButtonBar.new(sizer_panel, Wx::ID_ANY)
|
147
|
+
bar.add_button(ID::BUTTON_XX, "xx", bitmap_(:ribbon_xpm))
|
148
|
+
bar.add_button(ID::BUTTON_XY, "xy", bitmap_(:ribbon_xpm))
|
149
|
+
# This prevents ribbon buttons in panels with sizer from collapsing.
|
150
|
+
bar.set_button_min_size_class(ID::BUTTON_XX, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_LARGE)
|
151
|
+
bar.set_button_min_size_class(ID::BUTTON_XY, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_LARGE)
|
152
|
+
|
153
|
+
sizer_panelsizer_h = Wx::BoxSizer.new(Wx::HORIZONTAL)
|
154
|
+
sizer_panelsizer_v = Wx::BoxSizer.new(Wx::VERTICAL)
|
155
|
+
sizer_panelsizer_v.add_stretch_spacer(1)
|
156
|
+
sizer_panelsizer_v.add(sizer_panelcombo, 0, Wx::ALL|Wx::EXPAND, 2)
|
157
|
+
sizer_panelsizer_v.add(sizer_panelcombo2, 0, Wx::ALL|Wx::EXPAND, 2)
|
158
|
+
sizer_panelsizer_v.add_stretch_spacer(1)
|
159
|
+
sizer_panelsizer_h.add(bar, 0, Wx::EXPAND)
|
160
|
+
sizer_panelsizer_h.add(sizer_panelsizer_v, 0)
|
161
|
+
sizer_panel.set_sizer(sizer_panelsizer_h)
|
162
|
+
|
163
|
+
@label_font = Wx::Font.new(Wx::FontInfo.new(8).light)
|
164
|
+
|
165
|
+
scheme = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Appearance", bitmap_(:eye_xpm))
|
166
|
+
@default_primary = Wx::Colour.new
|
167
|
+
@default_secondary = Wx::Colour.new
|
168
|
+
@default_tertiary = Wx::Colour.new
|
169
|
+
@ribbon.get_art_provider.get_colour_scheme(@default_primary, @default_secondary, @default_tertiary)
|
170
|
+
provider_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
|
171
|
+
"Art", style: Wx::RBN::RIBBON_PANEL_NO_AUTO_MINIMISE)
|
172
|
+
provider_bar = Wx::RBN::RibbonButtonBar.new(provider_panel, Wx::ID_ANY)
|
173
|
+
provider_bar.add_button(ID::DEFAULT_PROVIDER, "Default Provider",
|
174
|
+
Wx::ArtProvider.get_bitmap(Wx::ART_QUESTION, Wx::ART_OTHER, Wx::Size.new(32, 32)))
|
175
|
+
provider_bar.add_button(ID::AUI_PROVIDER, "AUI Provider", bitmap_(:aui_style_xpm))
|
176
|
+
provider_bar.add_button(ID::MSW_PROVIDER, "MSW Provider", bitmap_(:msw_style_xpm))
|
177
|
+
primary_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
|
178
|
+
"Primary Colour", bitmap_(:colours_xpm))
|
179
|
+
@primary_gallery = populate_colours_panel(primary_panel,
|
180
|
+
@default_primary, ID::PRIMARY_COLOUR)
|
181
|
+
secondary_panel = Wx::RBN::RibbonPanel.new(scheme, Wx::ID_ANY,
|
182
|
+
"Secondary Colour", bitmap_(:colours_xpm))
|
183
|
+
@secondary_gallery = populate_colours_panel(secondary_panel,
|
184
|
+
@default_secondary, ID::SECONDARY_COLOUR)
|
185
|
+
|
186
|
+
page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "UI Updated", bitmap_(:ribbon_xpm))
|
187
|
+
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Enable/Disable", bitmap_(:ribbon_xpm))
|
188
|
+
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
189
|
+
bar.add_button(ID::DISABLED, "Disabled", bitmap_(:ribbon_xpm))
|
190
|
+
bar.add_button(ID::ENABLE, "Enable", bitmap_(:ribbon_xpm))
|
191
|
+
bar.add_button(ID::DISABLE, "Disable", bitmap_(:ribbon_xpm))
|
192
|
+
bar.add_button(ID::UI_ENABLE_UPDATED, "Enable UI updated", bitmap_(:ribbon_xpm))
|
193
|
+
bar.enable_button(ID::DISABLED, false)
|
194
|
+
@bEnabled = true
|
195
|
+
|
196
|
+
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Toggle", bitmap_(:ribbon_xpm))
|
197
|
+
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
198
|
+
bar.add_button(ID::CHECK, "Toggle", bitmap_(:ribbon_xpm))
|
199
|
+
bar.add_toggle_button(ID::UI_CHECK_UPDATED, "Toggled UI updated", bitmap_(:ribbon_xpm))
|
200
|
+
@bChecked = true
|
201
|
+
|
202
|
+
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Change text", bitmap_(:ribbon_xpm))
|
203
|
+
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
204
|
+
bar.add_button(ID::CHANGE_TEXT1, "One", bitmap_(:ribbon_xpm))
|
205
|
+
bar.add_button(ID::CHANGE_TEXT2, "Two", bitmap_(:ribbon_xpm))
|
206
|
+
bar.add_button(ID::UI_CHANGE_TEXT_UPDATED, "Zero", bitmap_(:ribbon_xpm))
|
207
|
+
|
208
|
+
# Also set the general disabled text colour:
|
209
|
+
artProvider = @ribbon.get_art_provider
|
210
|
+
tColour = artProvider.get_color(Wx::RBN::RIBBON_ART_BUTTON_BAR_LABEL_COLOUR)
|
211
|
+
artProvider.set_color(Wx::RBN::RIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR, tColour.make_disabled)
|
212
|
+
|
213
|
+
Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Empty Page", bitmap_(:empty_xpm))
|
214
|
+
|
215
|
+
page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Another Page", bitmap_(:empty_xpm))
|
216
|
+
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Page manipulation", bitmap_(:ribbon_xpm))
|
217
|
+
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
218
|
+
bar.add_button(ID::REMOVE_PAGE, "Remove", Wx::ArtProvider.get_bitmap(Wx::ART_DELETE, Wx::ART_OTHER, Wx::Size.new(24, 24)))
|
219
|
+
bar.add_button(ID::HIDE_PAGES, "Hide Pages", bitmap_(:ribbon_xpm))
|
220
|
+
bar.add_button(ID::SHOW_PAGES, "Show Pages", bitmap_(:ribbon_xpm))
|
221
|
+
|
222
|
+
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Button bar manipulation", bitmap_(:ribbon_xpm))
|
223
|
+
button_bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
224
|
+
button_bar.add_button(ID::PLUS_MINUS, "+/-",
|
225
|
+
Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, Wx::Size.new(24, 24)))
|
226
|
+
@plus_minus_state = false
|
227
|
+
button_bar.add_button(ID::CHANGE_LABEL, "short", bitmap_(:ribbon_xpm))
|
228
|
+
button_bar.set_button_text_min_width(ID::CHANGE_LABEL, "some long text")
|
229
|
+
@change_label_state = false
|
349
230
|
|
350
|
-
|
351
|
-
|
352
|
-
|
231
|
+
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Always medium buttons", bitmap_(:ribbon_xpm))
|
232
|
+
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
233
|
+
bar.add_button(ID::SMALL_BUTTON_1, "Button 1", bitmap_(:ribbon_xpm))
|
234
|
+
bar.set_button_max_size_class(ID::SMALL_BUTTON_1, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
235
|
+
bar.add_button(ID::SMALL_BUTTON_2, "Button 2", bitmap_(:ribbon_xpm))
|
236
|
+
bar.set_button_max_size_class(ID::SMALL_BUTTON_2, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
237
|
+
bar.add_button(ID::SMALL_BUTTON_3, "Button 3", bitmap_(:ribbon_xpm))
|
238
|
+
bar.add_button(ID::SMALL_BUTTON_4, "Button 4", bitmap_(:ribbon_xpm))
|
239
|
+
bar.add_button(ID::SMALL_BUTTON_5, "Button 5", bitmap_(:ribbon_xpm))
|
240
|
+
bar.set_button_max_size_class(ID::SMALL_BUTTON_5, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
241
|
+
bar.add_button(ID::SMALL_BUTTON_6, "Button 6", bitmap_(:ribbon_xpm))
|
242
|
+
bar.set_button_max_size_class(ID::SMALL_BUTTON_6, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
243
|
+
|
244
|
+
Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Highlight Page", bitmap_(:empty_xpm))
|
245
|
+
@ribbon.add_page_highlight(@ribbon.get_page_count-1)
|
246
|
+
|
247
|
+
|
248
|
+
page = Wx::RBN::RibbonPage.new(@ribbon, Wx::ID_ANY, "Advanced", bitmap_(:empty_xpm))
|
249
|
+
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Button bar manipulation", bitmap_(:ribbon_xpm))
|
250
|
+
button_bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
251
|
+
button_bar.add_button(ID::PLUS_MINUS, "+/-",
|
252
|
+
Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, Wx::Size.new(24, 24)))
|
253
|
+
@plus_minus_state = false
|
254
|
+
button_bar.add_button(ID::CHANGE_LABEL, "short", bitmap_(:ribbon_xpm))
|
255
|
+
button_bar.set_button_text_min_width(ID::CHANGE_LABEL, "some long text")
|
256
|
+
@change_label_state = false
|
353
257
|
|
354
|
-
|
355
|
-
|
356
|
-
|
258
|
+
panel = Wx::RBN::RibbonPanel.new(page, Wx::ID_ANY, "Always medium buttons", bitmap_(:ribbon_xpm))
|
259
|
+
bar = Wx::RBN::RibbonButtonBar.new(panel, Wx::ID_ANY)
|
260
|
+
bar.add_button(ID::SMALL_BUTTON_1, "Button 1", bitmap_(:ribbon_xpm))
|
261
|
+
bar.set_button_max_size_class(ID::SMALL_BUTTON_1, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
262
|
+
bar.add_button(ID::SMALL_BUTTON_2, "Button 2", bitmap_(:ribbon_xpm))
|
263
|
+
bar.set_button_max_size_class(ID::SMALL_BUTTON_2, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
264
|
+
bar.add_button(ID::SMALL_BUTTON_3, "Button 3", bitmap_(:ribbon_xpm))
|
265
|
+
bar.add_button(ID::SMALL_BUTTON_4, "Button 4", bitmap_(:ribbon_xpm))
|
266
|
+
bar.add_button(ID::SMALL_BUTTON_5, "Button 5", bitmap_(:ribbon_xpm))
|
267
|
+
bar.set_button_max_size_class(ID::SMALL_BUTTON_5, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
268
|
+
bar.add_button(ID::SMALL_BUTTON_6, "Button 6", bitmap_(:ribbon_xpm))
|
269
|
+
bar.set_button_max_size_class(ID::SMALL_BUTTON_6, Wx::RBN::RIBBON_BUTTONBAR_BUTTON_MEDIUM)
|
270
|
+
|
271
|
+
@ribbon.realize
|
357
272
|
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
@
|
273
|
+
@logwindow = Wx::TextCtrl.new(self, Wx::ID_ANY, style: Wx::TE_MULTILINE | Wx::TE_READONLY |
|
274
|
+
Wx::TE_LEFT | Wx::TE_BESTWRAP | Wx::BORDER_NONE)
|
275
|
+
|
276
|
+
@togglePanels = Wx::ToggleButton.new(self, ID::TOGGLE_PANELS, "&Toggle panels")
|
277
|
+
@togglePanels.set_value(true)
|
278
|
+
|
279
|
+
s = Wx::BoxSizer.new(Wx::VERTICAL)
|
280
|
+
|
281
|
+
s.add(@ribbon, 0, Wx::EXPAND)
|
282
|
+
s.add(@logwindow, 1, Wx::EXPAND)
|
283
|
+
s.add(@togglePanels, Wx::SizerFlags.new.border)
|
284
|
+
|
285
|
+
set_sizer(s)
|
286
|
+
|
287
|
+
evt_ribbonbuttonbar_clicked(ID::ENABLE, :on_enable)
|
288
|
+
evt_ribbonbuttonbar_clicked(ID::DISABLE, :on_disable)
|
289
|
+
evt_ribbonbuttonbar_clicked(ID::DISABLED, :on_disabled)
|
290
|
+
evt_ribbonbuttonbar_clicked(ID::UI_ENABLE_UPDATED, :on_enable_updated)
|
291
|
+
evt_update_ui(ID::UI_ENABLE_UPDATED, :on_enable_update_ui)
|
292
|
+
evt_ribbonbuttonbar_clicked(ID::CHECK, :on_check)
|
293
|
+
evt_update_ui(ID::UI_CHECK_UPDATED, :on_check_update_ui)
|
294
|
+
evt_ribbonbuttonbar_clicked(ID::CHANGE_TEXT1, :on_change_text1)
|
295
|
+
evt_ribbonbuttonbar_clicked(ID::CHANGE_TEXT2, :on_change_text2)
|
296
|
+
evt_update_ui(ID::UI_CHANGE_TEXT_UPDATED, :on_change_text_update_ui)
|
297
|
+
evt_ribbonbuttonbar_clicked(ID::DEFAULT_PROVIDER, :on_default_provider)
|
298
|
+
evt_ribbonbuttonbar_clicked(ID::AUI_PROVIDER, :on_aui_provider)
|
299
|
+
evt_ribbonbuttonbar_clicked(ID::MSW_PROVIDER, :on_msw_provider)
|
300
|
+
evt_ribbonbuttonbar_clicked(ID::SELECTION_EXPAND_H, :on_selection_expand_h_button)
|
301
|
+
evt_ribbonbuttonbar_clicked(ID::SELECTION_EXPAND_V, :on_selection_expand_v_button)
|
302
|
+
evt_ribbonbuttonbar_clicked(ID::SELECTION_CONTRACT, :on_selection_contract_button)
|
303
|
+
evt_ribbonbuttonbar_clicked(ID::CIRCLE, :on_circle_button)
|
304
|
+
evt_ribbonbuttonbar_clicked(ID::CROSS, :on_cross_button)
|
305
|
+
evt_ribbonbuttonbar_clicked(ID::TRIANGLE, :on_triangle_button)
|
306
|
+
evt_ribbonbuttonbar_clicked(ID::SQUARE, :on_square_button)
|
307
|
+
evt_ribbonbuttonbar_dropdown_clicked(ID::TRIANGLE, :on_triangle_dropdown)
|
308
|
+
evt_ribbonbuttonbar_dropdown_clicked(ID::POLYGON, :on_polygon_dropdown)
|
309
|
+
evt_ribbongallery_hover_changed(ID::PRIMARY_COLOUR, :on_hovered_colour_change)
|
310
|
+
evt_ribbongallery_hover_changed(ID::SECONDARY_COLOUR, :on_hovered_colour_change)
|
311
|
+
evt_ribbongallery_selected(ID::PRIMARY_COLOUR, :on_primary_colour_select)
|
312
|
+
evt_ribbongallery_selected(ID::SECONDARY_COLOUR, :on_secondary_colour_select)
|
313
|
+
evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_LEFT, :on_justify)
|
314
|
+
evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_CENTER, :on_justify)
|
315
|
+
evt_ribbontoolbar_clicked(Wx::ID_JUSTIFY_RIGHT, :on_justify)
|
316
|
+
evt_update_ui(Wx::ID_JUSTIFY_LEFT, :on_justify_update_ui)
|
317
|
+
evt_update_ui(Wx::ID_JUSTIFY_CENTER, :on_justify_update_ui)
|
318
|
+
evt_update_ui(Wx::ID_JUSTIFY_RIGHT, :on_justify_update_ui)
|
319
|
+
evt_ribbontoolbar_clicked(Wx::ID_NEW, :on_new)
|
320
|
+
evt_ribbontoolbar_dropdown_clicked(Wx::ID_NEW, :on_new_dropdown)
|
321
|
+
evt_ribbontoolbar_clicked(Wx::ID_PRINT, :on_print)
|
322
|
+
evt_ribbontoolbar_dropdown_clicked(Wx::ID_PRINT, :on_print_dropdown)
|
323
|
+
evt_ribbontoolbar_dropdown_clicked(Wx::ID_REDO, :on_redo_dropdown)
|
324
|
+
evt_ribbontoolbar_dropdown_clicked(Wx::ID_UNDO, :on_undo_dropdown)
|
325
|
+
evt_ribbontoolbar_clicked(ID::POSITION_LEFT, :on_position_left)
|
326
|
+
evt_ribbontoolbar_dropdown_clicked(ID::POSITION_LEFT, :on_position_left_dropdown)
|
327
|
+
evt_ribbontoolbar_clicked(ID::POSITION_TOP, :on_position_top)
|
328
|
+
evt_ribbontoolbar_dropdown_clicked(ID::POSITION_TOP, :on_position_top_dropdown)
|
329
|
+
evt_button(ID::PRIMARY_COLOUR, :on_colour_gallery_button)
|
330
|
+
evt_button(ID::SECONDARY_COLOUR, :on_colour_gallery_button)
|
331
|
+
evt_menu(ID::POSITION_LEFT, :on_position_left_icons)
|
332
|
+
evt_menu(ID::POSITION_LEFT_LABELS, :on_position_left_labels)
|
333
|
+
evt_menu(ID::POSITION_LEFT_BOTH, :on_position_left_both)
|
334
|
+
evt_menu(ID::POSITION_TOP, :on_position_top_labels)
|
335
|
+
evt_menu(ID::POSITION_TOP_ICONS, :on_position_top_icons)
|
336
|
+
evt_menu(ID::POSITION_TOP_BOTH, :on_position_top_both)
|
337
|
+
evt_togglebutton(ID::TOGGLE_PANELS, :on_toggle_panels)
|
338
|
+
evt_ribbonpanel_extbutton_activated(Wx::ID_ANY, :on_ext_button)
|
339
|
+
evt_ribbonbuttonbar_clicked(ID::REMOVE_PAGE, :on_remove_page)
|
340
|
+
evt_ribbonbuttonbar_clicked(ID::HIDE_PAGES, :on_hide_pages)
|
341
|
+
evt_ribbonbuttonbar_clicked(ID::SHOW_PAGES, :on_show_pages)
|
342
|
+
evt_ribbonbuttonbar_clicked(ID::PLUS_MINUS, :on_plus_minus)
|
343
|
+
evt_ribbonbuttonbar_clicked(ID::CHANGE_LABEL, :on_change_label)
|
344
|
+
evt_ribbonbar_toggled(Wx::ID_ANY, :on_ribbon_bar_toggled)
|
345
|
+
evt_ribbonbar_help_click(Wx::ID_ANY, :on_ribbon_bar_help_clicked)
|
346
|
+
evt_size(:on_size_event)
|
362
347
|
end
|
363
|
-
end
|
364
348
|
|
365
|
-
|
366
|
-
|
367
|
-
|
349
|
+
# utility function to find an icon relative to this ruby script
|
350
|
+
def bitmap_(bitmap_name)
|
351
|
+
Wx::Bitmap.new(File.join(File.dirname(__FILE__), bitmap_name.to_s.sub(/_([A-Za-z]+)\Z/, '.\1')))
|
352
|
+
end
|
368
353
|
|
369
|
-
|
370
|
-
|
371
|
-
|
354
|
+
def on_enable_update_ui(evt)
|
355
|
+
evt.enable(@bEnabled)
|
356
|
+
end
|
372
357
|
|
373
|
-
|
374
|
-
|
375
|
-
|
358
|
+
def on_check_update_ui(evt)
|
359
|
+
evt.check(@bChecked)
|
360
|
+
end
|
376
361
|
|
377
|
-
|
378
|
-
|
379
|
-
|
362
|
+
def on_change_text_update_ui(evt)
|
363
|
+
unless @new_text.nil? || @new_text.empty?
|
364
|
+
evt.set_text(@new_text)
|
365
|
+
@new_text = ''
|
366
|
+
end
|
367
|
+
end
|
380
368
|
|
381
|
-
|
382
|
-
|
383
|
-
|
369
|
+
def on_check(evt)
|
370
|
+
@bChecked = !@bChecked
|
371
|
+
end
|
384
372
|
|
385
|
-
|
386
|
-
|
387
|
-
|
373
|
+
def on_enable(evt)
|
374
|
+
@bEnabled = true
|
375
|
+
end
|
388
376
|
|
389
|
-
|
390
|
-
|
391
|
-
|
377
|
+
def on_disable(evt)
|
378
|
+
@bEnabled = false
|
379
|
+
end
|
392
380
|
|
393
|
-
|
394
|
-
|
395
|
-
|
381
|
+
def on_disabled(evt)
|
382
|
+
add_text("ERROR: Disabled button activated (not supposed to happen)")
|
383
|
+
end
|
396
384
|
|
397
|
-
|
398
|
-
|
399
|
-
|
385
|
+
def on_enable_updated(evt)
|
386
|
+
add_text("Button activated")
|
387
|
+
end
|
400
388
|
|
401
|
-
|
402
|
-
|
403
|
-
|
389
|
+
def on_change_text1(evt)
|
390
|
+
@new_text = "One"
|
391
|
+
end
|
404
392
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
menu.append(Wx::ID_ANY, "Isosceles")
|
409
|
-
menu.append(Wx::ID_ANY, "Scalene")
|
393
|
+
def on_change_text2(evt)
|
394
|
+
@new_text = "Two"
|
395
|
+
end
|
410
396
|
|
411
|
-
evt
|
412
|
-
|
397
|
+
def on_circle_button(evt)
|
398
|
+
add_text("Circle button clicked.")
|
399
|
+
end
|
413
400
|
|
414
|
-
|
415
|
-
|
416
|
-
|
401
|
+
def on_cross_button(evt)
|
402
|
+
add_text("Cross button clicked.")
|
403
|
+
end
|
417
404
|
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
menu.append(Wx::ID_ANY, "Hexagon (6 sided)")
|
422
|
-
menu.append(Wx::ID_ANY, "Heptagon (7 sided)")
|
423
|
-
menu.append(Wx::ID_ANY, "Octogon (8 sided)")
|
424
|
-
menu.append(Wx::ID_ANY, "Nonagon (9 sided)")
|
425
|
-
menu.append(Wx::ID_ANY, "Decagon (10 sided)")
|
405
|
+
def on_triangle_button(evt)
|
406
|
+
add_text("Triangle button clicked.")
|
407
|
+
end
|
426
408
|
|
427
|
-
evt
|
428
|
-
|
409
|
+
def on_triangle_dropdown(evt)
|
410
|
+
menu = Wx::Menu.new
|
411
|
+
menu.append(Wx::ID_ANY, "Equilateral")
|
412
|
+
menu.append(Wx::ID_ANY, "Isosceles")
|
413
|
+
menu.append(Wx::ID_ANY, "Scalene")
|
429
414
|
|
430
|
-
|
431
|
-
|
432
|
-
end
|
415
|
+
evt.popup_menu(menu)
|
416
|
+
end
|
433
417
|
|
434
|
-
|
435
|
-
|
436
|
-
|
418
|
+
def on_square_button(evt)
|
419
|
+
add_text("Square button clicked.")
|
420
|
+
end
|
437
421
|
|
438
|
-
|
439
|
-
|
440
|
-
|
422
|
+
def on_polygon_dropdown(evt)
|
423
|
+
menu = Wx::Menu.new
|
424
|
+
menu.append(Wx::ID_ANY, "Pentagon (5 sided)")
|
425
|
+
menu.append(Wx::ID_ANY, "Hexagon (6 sided)")
|
426
|
+
menu.append(Wx::ID_ANY, "Heptagon (7 sided)")
|
427
|
+
menu.append(Wx::ID_ANY, "Octogon (8 sided)")
|
428
|
+
menu.append(Wx::ID_ANY, "Nonagon (9 sided)")
|
429
|
+
menu.append(Wx::ID_ANY, "Decagon (10 sided)")
|
441
430
|
|
442
|
-
|
443
|
-
|
444
|
-
# default if there is no longer a hovered item.
|
431
|
+
evt.popup_menu(menu)
|
432
|
+
end
|
445
433
|
|
446
|
-
|
447
|
-
|
434
|
+
def on_selection_expand_v_button(evt)
|
435
|
+
add_text("Expand selection horizontally button clicked.")
|
436
|
+
end
|
448
437
|
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
438
|
+
def on_selection_expand_h_button(evt)
|
439
|
+
add_text("Expand selection vertically button clicked.")
|
440
|
+
end
|
441
|
+
|
442
|
+
def on_selection_contract_button(evt)
|
443
|
+
add_text("Contract selection button clicked.")
|
444
|
+
end
|
445
|
+
|
446
|
+
def on_hovered_colour_change(evt)
|
447
|
+
# Set the background of the gallery to the hovered colour, or back to the
|
448
|
+
# default if there is no longer a hovered item.
|
449
|
+
|
450
|
+
gallery = evt.gallery
|
451
|
+
provider = gallery.get_art_provider
|
452
|
+
|
453
|
+
if evt.gallery_item != 0
|
454
|
+
if provider == @ribbon.art_provider
|
455
|
+
provider = provider.clone
|
456
|
+
gallery.set_art_provider(provider)
|
457
|
+
end
|
458
|
+
_, colour = get_gallery_colour(evt.get_gallery, evt.get_gallery_item)
|
459
|
+
provider.set_colour(Wx::RIBBON_ART_GALLERY_HOVER_BACKGROUND_COLOUR,
|
460
|
+
colour)
|
461
|
+
else
|
462
|
+
if provider != @ribbon.get_art_provider
|
463
|
+
gallery.set_art_provider(@ribbon.get_art_provider)
|
464
|
+
end
|
460
465
|
end
|
461
466
|
end
|
462
|
-
end
|
463
467
|
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
468
|
+
def on_primary_colour_select(evt)
|
469
|
+
name, colour = get_gallery_colour(evt.get_gallery, evt.get_gallery_item)
|
470
|
+
add_text("Colour \"" + name + "\" selected as primary.")
|
471
|
+
secondary = Wx::Colour.new
|
472
|
+
tertiary = Wx::Colour.new
|
473
|
+
@ribbon.get_art_provider.get_colour_scheme(nil, secondary, tertiary)
|
474
|
+
@ribbon.get_art_provider.set_colour_scheme(colour, secondary, tertiary)
|
475
|
+
reset_gallery_art_providers
|
476
|
+
@ribbon.refresh
|
477
|
+
end
|
474
478
|
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
479
|
+
def on_secondary_colour_select(evt)
|
480
|
+
name, colour = get_gallery_colour(evt.get_gallery, evt.get_gallery_item)
|
481
|
+
add_text("Colour \"" + name + "\" selected as secondary.")
|
482
|
+
primary = Wx::Colour.new
|
483
|
+
tertiary = Wx::Colour.new
|
484
|
+
@ribbon.art_provider.get_colour_scheme(primary, nil, tertiary)
|
485
|
+
@ribbon.art_provider.set_colour_scheme(primary, colour, tertiary)
|
486
|
+
reset_gallery_art_providers
|
487
|
+
@ribbon.refresh
|
488
|
+
end
|
489
|
+
|
490
|
+
def on_colour_gallery_button(evt)
|
491
|
+
gallery = evt.get_event_object
|
492
|
+
return unless gallery
|
493
|
+
|
494
|
+
@ribbon.dismiss_expanded_panel
|
495
|
+
if gallery.get_selection
|
496
|
+
_, c = get_gallery_colour(gallery, gallery.get_selection)
|
497
|
+
@colour_data.colour = c
|
498
|
+
end
|
499
|
+
Wx.ColourDialog(self, @colour_data) do |dlg|
|
500
|
+
if dlg.show_modal == Wx::ID_OK
|
501
|
+
@colour_data = dlg.colour_data
|
502
|
+
clr = @colour_data.colour
|
485
503
|
|
486
|
-
|
487
|
-
gallery = evt.get_event_object
|
488
|
-
return unless gallery
|
489
|
-
|
490
|
-
@ribbon.dismiss_expanded_panel
|
491
|
-
if gallery.get_selection
|
492
|
-
_, c = get_gallery_colour(gallery, gallery.get_selection)
|
493
|
-
@colour_data.colour = c
|
494
|
-
end
|
495
|
-
Wx.ColourDialog(self, @colour_data) do |dlg|
|
496
|
-
if dlg.show_modal == Wx::ID_OK
|
497
|
-
@colour_data = dlg.colour_data
|
498
|
-
clr = @colour_data.colour
|
499
|
-
|
500
|
-
# Try to find colour in gallery
|
501
|
-
item = nil
|
502
|
-
gallery.count.times do |i|
|
503
|
-
item = gallery.item(i)
|
504
|
-
_, c = get_gallery_colour(gallery, item)
|
505
|
-
break if c == clr
|
504
|
+
# Try to find colour in gallery
|
506
505
|
item = nil
|
507
|
-
|
506
|
+
gallery.count.times do |i|
|
507
|
+
item = gallery.item(i)
|
508
|
+
_, c = get_gallery_colour(gallery, item)
|
509
|
+
break if c == clr
|
510
|
+
item = nil
|
511
|
+
end
|
508
512
|
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
513
|
+
# Colour not in gallery - add it
|
514
|
+
unless item
|
515
|
+
Wx::MemoryDC.draw_on do |dc|
|
516
|
+
item = add_colour_to_gallery(gallery,
|
517
|
+
clr.get_as_string(Wx::C2S_HTML_SYNTAX), dc, clr)
|
518
|
+
end
|
519
|
+
gallery.realise
|
514
520
|
end
|
515
|
-
gallery.realise
|
516
|
-
end
|
517
521
|
|
518
|
-
|
519
|
-
|
520
|
-
|
522
|
+
# Set selection
|
523
|
+
gallery.ensure_visible(item)
|
524
|
+
gallery.set_selection(item)
|
521
525
|
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
526
|
+
# Send an event to respond to the selection change
|
527
|
+
dummy = Wx::RBN::RibbonGalleryEvent.new(Wx::RBN::EVT_RIBBONGALLERY_SELECTED, gallery.id)
|
528
|
+
dummy.set_event_object(gallery)
|
529
|
+
dummy.set_gallery(gallery)
|
530
|
+
dummy.set_gallery_item(item)
|
531
|
+
process_window_event(dummy)
|
532
|
+
end
|
528
533
|
end
|
529
534
|
end
|
530
|
-
end
|
531
535
|
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
+
def on_default_provider(evt)
|
537
|
+
@ribbon.dismiss_expanded_panel
|
538
|
+
set_art_provider(Wx::RibbonDefaultArtProvider.new)
|
539
|
+
end
|
536
540
|
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
+
def on_aui_provider(evt)
|
542
|
+
@ribbon.dismiss_expanded_panel
|
543
|
+
set_art_provider(Wx::RBN::RibbonAUIArtProvider.new)
|
544
|
+
end
|
541
545
|
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
+
def on_msw_provider(evt)
|
547
|
+
@ribbon.dismiss_expanded_panel
|
548
|
+
set_art_provider(Wx::RBN::RibbonMSWArtProvider.new)
|
549
|
+
end
|
546
550
|
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
551
|
+
def on_justify(evt)
|
552
|
+
style = @logwindow.get_window_style & ~(Wx::TE_LEFT | Wx::TE_CENTER | Wx::TE_RIGHT)
|
553
|
+
case evt.id
|
554
|
+
when Wx::ID_JUSTIFY_LEFT
|
555
|
+
@logwindow.set_window_style(style | Wx::TE_LEFT)
|
556
|
+
when Wx::ID_JUSTIFY_CENTER
|
557
|
+
@logwindow.set_window_style(style | Wx::TE_CENTER)
|
558
|
+
when Wx::ID_JUSTIFY_RIGHT
|
559
|
+
@logwindow.set_window_style(style | Wx::TE_RIGHT)
|
560
|
+
end
|
556
561
|
end
|
557
|
-
end
|
558
562
|
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
563
|
+
def on_justify_update_ui(evt)
|
564
|
+
case evt.id
|
565
|
+
when Wx::ID_JUSTIFY_LEFT
|
566
|
+
evt.check(!@logwindow.has_flag(Wx::TE_CENTER | Wx::TE_RIGHT))
|
567
|
+
when Wx::ID_JUSTIFY_CENTER
|
568
|
+
evt.check(@logwindow.has_flag(Wx::TE_CENTER))
|
569
|
+
when Wx::ID_JUSTIFY_RIGHT
|
570
|
+
evt.check(@logwindow.has_flag(Wx::TE_RIGHT))
|
571
|
+
end
|
567
572
|
end
|
568
|
-
end
|
569
573
|
|
570
|
-
|
571
|
-
|
572
|
-
|
574
|
+
def on_new(evt)
|
575
|
+
add_text("New button clicked.")
|
576
|
+
end
|
573
577
|
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
578
|
+
def on_new_dropdown(evt)
|
579
|
+
menu = Wx::Menu.new
|
580
|
+
menu.append(Wx::ID_ANY, "New Document")
|
581
|
+
menu.append(Wx::ID_ANY, "New Template")
|
582
|
+
menu.append(Wx::ID_ANY, "New Mail")
|
579
583
|
|
580
|
-
|
581
|
-
|
584
|
+
evt.popup_menu(menu)
|
585
|
+
end
|
582
586
|
|
583
|
-
|
584
|
-
|
585
|
-
|
587
|
+
def on_print(evt)
|
588
|
+
add_text("Print button clicked.")
|
589
|
+
end
|
586
590
|
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
591
|
+
def on_print_dropdown(evt)
|
592
|
+
menu = Wx::Menu.new
|
593
|
+
menu.append(Wx::ID_ANY, "Print")
|
594
|
+
menu.append(Wx::ID_ANY, "Preview")
|
595
|
+
menu.append(Wx::ID_ANY, "Options")
|
592
596
|
|
593
|
-
|
594
|
-
|
597
|
+
evt.popup_menu(menu)
|
598
|
+
end
|
595
599
|
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
600
|
+
def on_redo_dropdown(evt)
|
601
|
+
menu = Wx::Menu.new
|
602
|
+
menu.append(Wx::ID_ANY, "Redo E")
|
603
|
+
menu.append(Wx::ID_ANY, "Redo F")
|
604
|
+
menu.append(Wx::ID_ANY, "Redo G")
|
601
605
|
|
602
|
-
|
603
|
-
|
606
|
+
evt.popup_menu(menu)
|
607
|
+
end
|
604
608
|
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
609
|
+
def on_undo_dropdown(evt)
|
610
|
+
menu = Wx::Menu.new
|
611
|
+
menu.append(Wx::ID_ANY, "Undo C")
|
612
|
+
menu.append(Wx::ID_ANY, "Undo B")
|
613
|
+
menu.append(Wx::ID_ANY, "Undo A")
|
610
614
|
|
611
|
-
|
612
|
-
|
615
|
+
evt.popup_menu(menu)
|
616
|
+
end
|
613
617
|
|
614
|
-
|
615
|
-
|
616
|
-
|
618
|
+
def on_position_top(evt)
|
619
|
+
on_position_top_labels(evt)
|
620
|
+
end
|
617
621
|
|
618
|
-
|
619
|
-
|
620
|
-
|
622
|
+
def on_position_top_labels(evt)
|
623
|
+
set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE)
|
624
|
+
end
|
621
625
|
|
622
|
-
|
623
|
-
|
624
|
-
|
626
|
+
def on_position_top_icons(evt)
|
627
|
+
set_bar_style((Wx::RBN::RIBBON_BAR_DEFAULT_STYLE & (~Wx::RBN::RIBBON_BAR_SHOW_PAGE_LABELS)) | Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS)
|
628
|
+
end
|
625
629
|
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
def on_position_top_dropdown(evt)
|
631
|
-
menu = Wx::Menu.new
|
632
|
-
menu.append(ID::POSITION_TOP, "Top with Labels")
|
633
|
-
menu.append(ID::POSITION_TOP_ICONS, "Top with Icons")
|
634
|
-
menu.append(ID::POSITION_TOP_BOTH, "Top with Both")
|
635
|
-
evt.popup_menu(menu)
|
636
|
-
end
|
630
|
+
def on_position_top_both(evt)
|
631
|
+
set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE | Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS)
|
632
|
+
end
|
637
633
|
|
638
|
-
|
639
|
-
|
640
|
-
|
634
|
+
def on_position_top_dropdown(evt)
|
635
|
+
menu = Wx::Menu.new
|
636
|
+
menu.append(ID::POSITION_TOP, "Top with Labels")
|
637
|
+
menu.append(ID::POSITION_TOP_ICONS, "Top with Icons")
|
638
|
+
menu.append(ID::POSITION_TOP_BOTH, "Top with Both")
|
639
|
+
evt.popup_menu(menu)
|
640
|
+
end
|
641
641
|
|
642
|
-
|
643
|
-
|
644
|
-
|
642
|
+
def on_position_left(evt)
|
643
|
+
on_position_left_icons(evt)
|
644
|
+
end
|
645
645
|
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
end
|
646
|
+
def on_position_left_labels(evt)
|
647
|
+
set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE | Wx::RBN::RIBBON_BAR_FLOW_VERTICAL)
|
648
|
+
end
|
650
649
|
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
650
|
+
def on_position_left_icons(evt)
|
651
|
+
set_bar_style((Wx::RBN::RIBBON_BAR_DEFAULT_STYLE & (~Wx::RBN::RIBBON_BAR_SHOW_PAGE_LABELS)) |
|
652
|
+
Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS | Wx::RBN::RIBBON_BAR_FLOW_VERTICAL)
|
653
|
+
end
|
655
654
|
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
menu.append(ID::POSITION_LEFT_BOTH, "Left with Both")
|
661
|
-
evt.popup_menu(menu)
|
662
|
-
end
|
655
|
+
def on_position_left_both(evt)
|
656
|
+
set_bar_style(Wx::RBN::RIBBON_BAR_DEFAULT_STYLE | Wx::RBN::RIBBON_BAR_SHOW_PAGE_ICONS |
|
657
|
+
Wx::RBN::RIBBON_BAR_FLOW_VERTICAL)
|
658
|
+
end
|
663
659
|
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
660
|
+
def on_position_left_dropdown(evt)
|
661
|
+
menu = Wx::Menu.new
|
662
|
+
menu.append(ID::POSITION_LEFT, "Left with Icons")
|
663
|
+
menu.append(ID::POSITION_LEFT_LABELS, "Left with Labels")
|
664
|
+
menu.append(ID::POSITION_LEFT_BOTH, "Left with Both")
|
665
|
+
evt.popup_menu(menu)
|
669
666
|
end
|
670
|
-
end
|
671
667
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
668
|
+
def on_remove_page(evt)
|
669
|
+
n = @ribbon.get_page_count
|
670
|
+
if n > 0
|
671
|
+
@ribbon.delete_page(n-1)
|
672
|
+
@ribbon.realize
|
673
|
+
end
|
674
|
+
end
|
678
675
|
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
676
|
+
def on_hide_pages(evt)
|
677
|
+
@ribbon.hide_page(1)
|
678
|
+
@ribbon.hide_page(2)
|
679
|
+
@ribbon.hide_page(3)
|
680
|
+
@ribbon.realize
|
681
|
+
end
|
685
682
|
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
@
|
691
|
-
else
|
692
|
-
evt.bar.set_button_icon(ID::PLUS_MINUS,
|
693
|
-
Wx::ArtProvider.get_bitmap(Wx::ART_MINUS, Wx::ART_OTHER, [24, 24]))
|
694
|
-
@plus_minus_state = true
|
683
|
+
def on_show_pages(evt)
|
684
|
+
@ribbon.show_page(1)
|
685
|
+
@ribbon.show_page(2)
|
686
|
+
@ribbon.show_page(3)
|
687
|
+
@ribbon.realize
|
695
688
|
end
|
696
|
-
end
|
697
689
|
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
690
|
+
def on_plus_minus(evt)
|
691
|
+
if @plus_minus_state
|
692
|
+
evt.bar.set_button_icon(ID::PLUS_MINUS,
|
693
|
+
Wx::ArtProvider.get_bitmap(Wx::ART_PLUS, Wx::ART_OTHER, [24, 24]))
|
694
|
+
@plus_minus_state = false
|
695
|
+
else
|
696
|
+
evt.bar.set_button_icon(ID::PLUS_MINUS,
|
697
|
+
Wx::ArtProvider.get_bitmap(Wx::ART_MINUS, Wx::ART_OTHER, [24, 24]))
|
698
|
+
@plus_minus_state = true
|
699
|
+
end
|
705
700
|
end
|
706
|
-
end
|
707
701
|
|
708
|
-
|
709
|
-
|
710
|
-
|
702
|
+
def on_change_label(evt)
|
703
|
+
if @change_label_state
|
704
|
+
evt.bar.set_button_text(ID::CHANGE_LABEL, "short")
|
705
|
+
@change_label_state = false
|
706
|
+
else
|
707
|
+
evt.bar.set_button_text(ID::CHANGE_LABEL, "some long text")
|
708
|
+
@change_label_state = true
|
709
|
+
end
|
710
|
+
end
|
711
711
|
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
end
|
712
|
+
def on_toggle_panels(evt)
|
713
|
+
@ribbon.show_panels(@togglePanels.value)
|
714
|
+
end
|
716
715
|
|
717
|
-
|
718
|
-
|
719
|
-
|
716
|
+
def on_ribbon_bar_toggled(evt)
|
717
|
+
add_text("Ribbon bar %s." %
|
718
|
+
(@ribbon.are_panels_shown ? "expanded" : "collapsed"))
|
719
|
+
end
|
720
720
|
|
721
|
-
|
722
|
-
|
723
|
-
@ribbon.hide()
|
724
|
-
else
|
725
|
-
@ribbon.show
|
721
|
+
def on_ribbon_bar_help_clicked(evt)
|
722
|
+
add_text("Ribbon bar help clicked")
|
726
723
|
end
|
727
|
-
evt.skip
|
728
|
-
end
|
729
724
|
|
730
|
-
|
731
|
-
|
732
|
-
|
725
|
+
def on_size_event(evt)
|
726
|
+
if evt.size.width < 200
|
727
|
+
@ribbon.hide()
|
728
|
+
else
|
729
|
+
@ribbon.show
|
730
|
+
end
|
731
|
+
evt.skip
|
732
|
+
end
|
733
733
|
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
gallery = panel.find_window_by_id(gallery_id)
|
738
|
-
if gallery
|
739
|
-
gallery.clear
|
740
|
-
else
|
741
|
-
gallery = Wx::RBN::RibbonGallery.new(panel, gallery_id)
|
742
|
-
end
|
743
|
-
Wx::MemoryDC.draw_on do |dc|
|
744
|
-
def_item = add_colour_to_gallery(gallery, "Default", dc, defclr)
|
745
|
-
gallery.set_selection(def_item)
|
746
|
-
add_colour_to_gallery(gallery, "BLUE", dc)
|
747
|
-
add_colour_to_gallery(gallery, "BLUE VIOLET", dc)
|
748
|
-
add_colour_to_gallery(gallery, "BROWN", dc)
|
749
|
-
add_colour_to_gallery(gallery, "CADET BLUE", dc)
|
750
|
-
add_colour_to_gallery(gallery, "CORAL", dc)
|
751
|
-
add_colour_to_gallery(gallery, "CYAN", dc)
|
752
|
-
add_colour_to_gallery(gallery, "DARK GREEN", dc)
|
753
|
-
add_colour_to_gallery(gallery, "DARK ORCHID", dc)
|
754
|
-
add_colour_to_gallery(gallery, "FIREBRICK", dc)
|
755
|
-
add_colour_to_gallery(gallery, "GOLD", dc)
|
756
|
-
add_colour_to_gallery(gallery, "GOLDENROD", dc)
|
757
|
-
add_colour_to_gallery(gallery, "GREEN", dc)
|
758
|
-
add_colour_to_gallery(gallery, "INDIAN RED", dc)
|
759
|
-
add_colour_to_gallery(gallery, "KHAKI", dc)
|
760
|
-
add_colour_to_gallery(gallery, "LIGHT BLUE", dc)
|
761
|
-
add_colour_to_gallery(gallery, "LIME GREEN", dc)
|
762
|
-
add_colour_to_gallery(gallery, "MAGENTA", dc)
|
763
|
-
add_colour_to_gallery(gallery, "MAROON", dc)
|
764
|
-
add_colour_to_gallery(gallery, "NAVY", dc)
|
765
|
-
add_colour_to_gallery(gallery, "ORANGE", dc)
|
766
|
-
add_colour_to_gallery(gallery, "ORCHID", dc)
|
767
|
-
add_colour_to_gallery(gallery, "PINK", dc)
|
768
|
-
add_colour_to_gallery(gallery, "PLUM", dc)
|
769
|
-
add_colour_to_gallery(gallery, "PURPLE", dc)
|
770
|
-
add_colour_to_gallery(gallery, "RED", dc)
|
771
|
-
add_colour_to_gallery(gallery, "SALMON", dc)
|
772
|
-
add_colour_to_gallery(gallery, "SEA GREEN", dc)
|
773
|
-
add_colour_to_gallery(gallery, "SIENNA", dc)
|
774
|
-
add_colour_to_gallery(gallery, "SKY BLUE", dc)
|
775
|
-
add_colour_to_gallery(gallery, "TAN", dc)
|
776
|
-
add_colour_to_gallery(gallery, "THISTLE", dc)
|
777
|
-
add_colour_to_gallery(gallery, "TURQUOISE", dc)
|
778
|
-
add_colour_to_gallery(gallery, "VIOLET", dc)
|
779
|
-
add_colour_to_gallery(gallery, "VIOLET RED", dc)
|
780
|
-
add_colour_to_gallery(gallery, "WHEAT", dc)
|
781
|
-
add_colour_to_gallery(gallery, "WHITE", dc)
|
782
|
-
add_colour_to_gallery(gallery, "YELLOW", dc)
|
783
|
-
end
|
784
|
-
|
785
|
-
gallery
|
786
|
-
end
|
734
|
+
def on_ext_button(evt)
|
735
|
+
Wx.message_box("Extension button clicked")
|
736
|
+
end
|
787
737
|
|
788
|
-
|
789
|
-
@logwindow.append_text(msg)
|
790
|
-
@logwindow.append_text("\n")
|
791
|
-
@ribbon.dismiss_expanded_panel
|
792
|
-
end
|
738
|
+
protected
|
793
739
|
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
740
|
+
def populate_colours_panel(panel, defclr, gallery_id)
|
741
|
+
gallery = panel.find_window_by_id(gallery_id)
|
742
|
+
if gallery
|
743
|
+
gallery.clear
|
744
|
+
else
|
745
|
+
gallery = Wx::RBN::RibbonGallery.new(panel, gallery_id)
|
746
|
+
end
|
747
|
+
Wx::MemoryDC.draw_on do |dc|
|
748
|
+
def_item = add_colour_to_gallery(gallery, "Default", dc, defclr)
|
749
|
+
gallery.set_selection(def_item)
|
750
|
+
add_colour_to_gallery(gallery, "BLUE", dc)
|
751
|
+
add_colour_to_gallery(gallery, "BLUE VIOLET", dc)
|
752
|
+
add_colour_to_gallery(gallery, "BROWN", dc)
|
753
|
+
add_colour_to_gallery(gallery, "CADET BLUE", dc)
|
754
|
+
add_colour_to_gallery(gallery, "CORAL", dc)
|
755
|
+
add_colour_to_gallery(gallery, "CYAN", dc)
|
756
|
+
add_colour_to_gallery(gallery, "DARK GREEN", dc)
|
757
|
+
add_colour_to_gallery(gallery, "DARK ORCHID", dc)
|
758
|
+
add_colour_to_gallery(gallery, "FIREBRICK", dc)
|
759
|
+
add_colour_to_gallery(gallery, "GOLD", dc)
|
760
|
+
add_colour_to_gallery(gallery, "GOLDENROD", dc)
|
761
|
+
add_colour_to_gallery(gallery, "GREEN", dc)
|
762
|
+
add_colour_to_gallery(gallery, "INDIAN RED", dc)
|
763
|
+
add_colour_to_gallery(gallery, "KHAKI", dc)
|
764
|
+
add_colour_to_gallery(gallery, "LIGHT BLUE", dc)
|
765
|
+
add_colour_to_gallery(gallery, "LIME GREEN", dc)
|
766
|
+
add_colour_to_gallery(gallery, "MAGENTA", dc)
|
767
|
+
add_colour_to_gallery(gallery, "MAROON", dc)
|
768
|
+
add_colour_to_gallery(gallery, "NAVY", dc)
|
769
|
+
add_colour_to_gallery(gallery, "ORANGE", dc)
|
770
|
+
add_colour_to_gallery(gallery, "ORCHID", dc)
|
771
|
+
add_colour_to_gallery(gallery, "PINK", dc)
|
772
|
+
add_colour_to_gallery(gallery, "PLUM", dc)
|
773
|
+
add_colour_to_gallery(gallery, "PURPLE", dc)
|
774
|
+
add_colour_to_gallery(gallery, "RED", dc)
|
775
|
+
add_colour_to_gallery(gallery, "SALMON", dc)
|
776
|
+
add_colour_to_gallery(gallery, "SEA GREEN", dc)
|
777
|
+
add_colour_to_gallery(gallery, "SIENNA", dc)
|
778
|
+
add_colour_to_gallery(gallery, "SKY BLUE", dc)
|
779
|
+
add_colour_to_gallery(gallery, "TAN", dc)
|
780
|
+
add_colour_to_gallery(gallery, "THISTLE", dc)
|
781
|
+
add_colour_to_gallery(gallery, "TURQUOISE", dc)
|
782
|
+
add_colour_to_gallery(gallery, "VIOLET", dc)
|
783
|
+
add_colour_to_gallery(gallery, "VIOLET RED", dc)
|
784
|
+
add_colour_to_gallery(gallery, "WHEAT", dc)
|
785
|
+
add_colour_to_gallery(gallery, "WHITE", dc)
|
786
|
+
add_colour_to_gallery(gallery, "YELLOW", dc)
|
823
787
|
end
|
824
|
-
dc.set_text_foreground(foreground)
|
825
|
-
dc.draw_text(colour, (iWidth - size[0] + 1).div(2), (iHeight - size[1]).div(2))
|
826
|
-
dc.select_object_as_source(Wx::NULL_BITMAP)
|
827
788
|
|
828
|
-
|
829
|
-
gallery.set_item_client_data(item, [colour, c])
|
789
|
+
gallery
|
830
790
|
end
|
831
|
-
item
|
832
|
-
end
|
833
791
|
|
834
|
-
|
835
|
-
|
836
|
-
|
792
|
+
def add_text(msg)
|
793
|
+
@logwindow.append_text(msg)
|
794
|
+
@logwindow.append_text("\n")
|
795
|
+
@ribbon.dismiss_expanded_panel
|
796
|
+
end
|
797
|
+
|
798
|
+
def add_colour_to_gallery(gallery, colour, dc, value = nil)
|
799
|
+
item = nil
|
800
|
+
|
801
|
+
c = nil
|
802
|
+
c = Wx::Colour.new(colour) if colour != "Default"
|
803
|
+
|
804
|
+
c = value unless c && c.ok?
|
805
|
+
|
806
|
+
if c.ok?
|
807
|
+
iWidth = 64
|
808
|
+
iHeight = 40
|
809
|
+
|
810
|
+
bitmap = Wx::Bitmap.new(iWidth, iHeight)
|
811
|
+
dc.select_object(bitmap)
|
812
|
+
dc.set_font(@label_font)
|
813
|
+
b = Wx::Brush.new (c)
|
814
|
+
dc.set_pen(Wx::BLACK_PEN)
|
815
|
+
dc.set_brush(b)
|
816
|
+
dc.draw_rectangle(0, 0, iWidth, iHeight)
|
817
|
+
|
818
|
+
colour = colour[0] + colour[1,colour.size].downcase
|
819
|
+
size = dc.get_text_extent(colour)
|
820
|
+
foreground = Wx::Colour.new(~c.red, ~c.green, ~c.blue)
|
821
|
+
if ((foreground.red - c.red).abs +
|
822
|
+
(foreground.blue - c.blue).abs +
|
823
|
+
(foreground.green - c.green).abs) < 64
|
824
|
+
# Foreground too similar to background - use a different
|
825
|
+
# strategy to find a contrasting colour
|
826
|
+
foreground = Wx::Colour.new((c.red + 64) % 256, 255 - c.green, (c.blue + 192) % 256)
|
827
|
+
end
|
828
|
+
dc.set_text_foreground(foreground)
|
829
|
+
dc.draw_text(colour, (iWidth - size[0] + 1).div(2), (iHeight - size[1]).div(2))
|
830
|
+
dc.select_object_as_source(Wx::NULL_BITMAP)
|
837
831
|
|
838
|
-
|
839
|
-
|
840
|
-
|
832
|
+
item = gallery.append(bitmap, Wx::ID_ANY)
|
833
|
+
gallery.set_item_client_object(item, [colour, c])
|
834
|
+
end
|
835
|
+
item
|
841
836
|
end
|
842
|
-
|
843
|
-
|
837
|
+
|
838
|
+
def get_gallery_colour(gallery, item)
|
839
|
+
gallery.get_item_client_object(item)
|
844
840
|
end
|
845
|
-
end
|
846
841
|
|
847
|
-
|
848
|
-
|
849
|
-
|
842
|
+
def reset_gallery_art_providers
|
843
|
+
if @primary_gallery.get_art_provider != @ribbon.get_art_provider
|
844
|
+
@primary_gallery.set_art_provider(@ribbon.get_art_provider)
|
845
|
+
end
|
846
|
+
if @secondary_gallery.art_provider != @ribbon.art_provider
|
847
|
+
@secondary_gallery.art_provider= @ribbon.art_provider
|
848
|
+
end
|
849
|
+
end
|
850
850
|
|
851
|
-
prov
|
852
|
-
|
853
|
-
|
851
|
+
def set_art_provider(prov)
|
852
|
+
@ribbon.freeze
|
853
|
+
@ribbon.set_art_provider(prov)
|
854
854
|
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
855
|
+
prov.get_colour_scheme(@default_primary, @default_secondary, @default_tertiary)
|
856
|
+
populate_colours_panel(@primary_gallery.get_parent, @default_primary, ID::PRIMARY_COLOUR)
|
857
|
+
populate_colours_panel(@secondary_gallery.parent, @default_secondary, ID::SECONDARY_COLOUR)
|
858
|
+
|
859
|
+
@ribbon.realize
|
860
|
+
@ribbon.thaw
|
861
|
+
get_sizer.layout
|
862
|
+
end
|
863
|
+
|
864
|
+
def set_bar_style(style)
|
865
|
+
@ribbon.freeze
|
866
|
+
@ribbon.set_window_style_flag(style)
|
867
|
+
pTopSize = get_sizer
|
868
|
+
pToolbar = find_window_by_id(ID::MAIN_TOOLBAR)
|
869
|
+
if (style & Wx::RBN::RIBBON_BAR_FLOW_VERTICAL) == Wx::RBN::RIBBON_BAR_FLOW_VERTICAL
|
870
|
+
@ribbon.set_tab_ctrl_margins(10, 10)
|
871
|
+
pTopSize.set_orientation(Wx::HORIZONTAL)
|
872
|
+
pToolbar.set_rows(3, 5) if pToolbar
|
873
|
+
else
|
874
|
+
@ribbon.set_tab_ctrl_margins(50, 20)
|
875
|
+
pTopSize.set_orientation(Wx::VERTICAL)
|
876
|
+
pToolbar.set_rows(2, 3) if pToolbar
|
877
|
+
end
|
878
|
+
@ribbon.realise
|
879
|
+
layout
|
880
|
+
@ribbon.thaw
|
881
|
+
end
|
859
882
|
|
860
|
-
def set_bar_style(style)
|
861
|
-
@ribbon.freeze
|
862
|
-
@ribbon.set_window_style_flag(style)
|
863
|
-
pTopSize = get_sizer
|
864
|
-
pToolbar = find_window_by_id(ID::MAIN_TOOLBAR)
|
865
|
-
if (style & Wx::RBN::RIBBON_BAR_FLOW_VERTICAL) == Wx::RBN::RIBBON_BAR_FLOW_VERTICAL
|
866
|
-
@ribbon.set_tab_ctrl_margins(10, 10)
|
867
|
-
pTopSize.set_orientation(Wx::HORIZONTAL)
|
868
|
-
pToolbar.set_rows(3, 5) if pToolbar
|
869
|
-
else
|
870
|
-
@ribbon.set_tab_ctrl_margins(50, 20)
|
871
|
-
pTopSize.set_orientation(Wx::VERTICAL)
|
872
|
-
pToolbar.set_rows(2, 3) if pToolbar
|
873
|
-
end
|
874
|
-
@ribbon.realise
|
875
|
-
layout
|
876
|
-
@ribbon.thaw
|
877
883
|
end
|
878
884
|
|
879
885
|
end
|
@@ -889,7 +895,7 @@ module RibbonSample
|
|
889
895
|
end
|
890
896
|
|
891
897
|
def self.activate
|
892
|
-
frame = MyFrame.new
|
898
|
+
frame = Ribbon::MyFrame.new
|
893
899
|
frame.show(true)
|
894
900
|
frame
|
895
901
|
end
|