wxruby 1.9.9-x86-mingw32 → 1.9.10-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +53 -53
- data/README +297 -297
- data/lib/wx.rb +53 -53
- data/lib/wx/classes/bitmap.rb +29 -1
- data/lib/wx/classes/clipboard.rb +19 -3
- data/lib/wx/classes/colour.rb +6 -4
- data/lib/wx/classes/data_object.rb +14 -0
- data/lib/wx/classes/data_object_simple.rb +6 -0
- data/lib/wx/classes/dataformat.rb +23 -0
- data/lib/wx/classes/evthandler.rb +31 -4
- data/lib/wx/classes/genericdirctrl.rb +36 -0
- data/lib/wx/classes/grid.rb +8 -0
- data/lib/wx/classes/hboxsizer.rb +6 -0
- data/lib/wx/classes/icon.rb +12 -1
- data/lib/wx/classes/image.rb +13 -1
- data/lib/wx/classes/listctrl.rb +12 -0
- data/lib/wx/classes/point.rb +8 -0
- data/lib/wx/classes/rect.rb +10 -1
- data/lib/wx/classes/richtextctrl.rb +22 -0
- data/lib/wx/classes/size.rb +9 -0
- data/lib/wx/classes/sizer.rb +18 -3
- data/lib/wx/classes/toolbar.rb +4 -6
- data/lib/wx/classes/vboxsizer.rb +6 -0
- data/lib/wx/classes/window.rb +7 -0
- data/lib/wx/classes/xmlresource.rb +17 -0
- data/lib/wx/helpers.rb +16 -1
- data/lib/wx/keyword_ctors.rb +3 -2
- data/lib/wx/keyword_defs.rb +27 -5
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby2.so +0 -0
- data/samples/SAMPLES-LICENSE.TXT +17 -17
- data/samples/bigdemo/About.rbw +39 -39
- data/samples/bigdemo/ColorPanel.rbw +23 -23
- data/samples/bigdemo/GridSimple.rbw +78 -78
- data/samples/bigdemo/MDIDemo.rbw +57 -57
- data/samples/bigdemo/PopupMenu.rbw +149 -149
- data/samples/bigdemo/Sizers.rbw +543 -543
- data/samples/bigdemo/bigdemo.rb +823 -823
- data/samples/bigdemo/demoTemplate.rbw +33 -33
- data/samples/bigdemo/icons/choice.xpm +27 -27
- data/samples/bigdemo/icons/combo.xpm +27 -27
- data/samples/bigdemo/icons/copy.xpm +25 -25
- data/samples/bigdemo/icons/cut.xpm +24 -24
- data/samples/bigdemo/icons/gauge.xpm +27 -27
- data/samples/bigdemo/icons/help.xpm +25 -25
- data/samples/bigdemo/icons/list.xpm +27 -27
- data/samples/bigdemo/icons/mondrian.xpm +44 -44
- data/samples/bigdemo/icons/new.xpm +24 -24
- data/samples/bigdemo/icons/ogl.ico +0 -0
- data/samples/bigdemo/icons/ogl.xpm +45 -45
- data/samples/bigdemo/icons/open.xpm +26 -26
- data/samples/bigdemo/icons/paste.xpm +38 -38
- data/samples/bigdemo/icons/preview.xpm +26 -26
- data/samples/bigdemo/icons/print.xpm +26 -26
- data/samples/bigdemo/icons/radio.xpm +27 -27
- data/samples/bigdemo/icons/robert.xpm +415 -415
- data/samples/bigdemo/icons/save.xpm +25 -25
- data/samples/bigdemo/icons/smiles.xpm +39 -39
- data/samples/bigdemo/icons/smiley.xpm +42 -42
- data/samples/bigdemo/icons/stattext.xpm +24 -24
- data/samples/bigdemo/icons/test2.bmp +0 -0
- data/samples/bigdemo/icons/test2.xpm +79 -79
- data/samples/bigdemo/icons/text.xpm +27 -27
- data/samples/bigdemo/icons/tog1.xpm +38 -38
- data/samples/bigdemo/icons/tog2.xpm +38 -38
- data/samples/bigdemo/icons/wxwin16x16.xpm +25 -25
- data/samples/bigdemo/tips.txt +7 -7
- data/samples/bigdemo/utils.rb +11 -11
- data/samples/bigdemo/wxButton.rbw +64 -64
- data/samples/bigdemo/wxCalendarCtrl.rbw +60 -60
- data/samples/bigdemo/wxCheckBox.rbw +50 -50
- data/samples/bigdemo/wxCheckListBox.rbw +65 -75
- data/samples/bigdemo/wxChoice.rbw +47 -47
- data/samples/bigdemo/wxColourDialog.rbw +31 -31
- data/samples/bigdemo/wxComboBox.rbw +77 -77
- data/samples/bigdemo/wxDialog.rbw +74 -74
- data/samples/bigdemo/wxDirDialog.rbw +29 -29
- data/samples/bigdemo/wxFileDialog.rbw +37 -37
- data/samples/bigdemo/wxFileDialog_Save.rbw +35 -35
- data/samples/bigdemo/wxFindReplaceDialog.rbw +82 -82
- data/samples/bigdemo/wxFontDialog.rbw +173 -173
- data/samples/bigdemo/wxFrame.rbw +53 -53
- data/samples/bigdemo/wxGauge.rbw +71 -71
- data/samples/bigdemo/wxGrid.rbw +66 -66
- data/samples/bigdemo/wxListBox.rbw +140 -140
- data/samples/bigdemo/wxListCtrl_virtual.rbw +112 -107
- data/samples/bigdemo/wxMDIWindows.rbw +50 -50
- data/samples/bigdemo/wxMenu.rbw +236 -236
- data/samples/bigdemo/wxMessageDialog.rbw +27 -27
- data/samples/bigdemo/wxMultipleChoiceDialog.rbw +32 -32
- data/samples/bigdemo/wxNotebook.rbw +136 -136
- data/samples/bigdemo/wxProgressDialog.rbw +43 -43
- data/samples/bigdemo/wxRadioBox.rbw +72 -72
- data/samples/bigdemo/wxRadioButton.rbw +125 -125
- data/samples/bigdemo/wxSashWindow.rbw +2 -2
- data/samples/bigdemo/wxScrolledMessageDialog.rbw +57 -57
- data/samples/bigdemo/wxScrolledWindow.rbw +199 -199
- data/samples/bigdemo/wxSingleChoiceDialog.rbw +33 -33
- data/samples/bigdemo/wxSlider.rbw +42 -42
- data/samples/bigdemo/wxSpinButton.rbw +50 -50
- data/samples/bigdemo/wxSpinCtrl.rbw +51 -51
- data/samples/bigdemo/wxSplitterWindow.rbw +63 -63
- data/samples/bigdemo/wxStaticBitmap.rbw +51 -51
- data/samples/bigdemo/wxStaticText.rbw +55 -55
- data/samples/bigdemo/wxStatusBar.rbw +126 -126
- data/samples/bigdemo/wxTextCtrl.rbw +149 -149
- data/samples/bigdemo/wxTextEntryDialog.rbw +31 -31
- data/samples/bigdemo/wxToggleButton.rbw +49 -49
- data/samples/bigdemo/wxToolBar.rbw +131 -131
- data/samples/bigdemo/wxTreeCtrl.rbw +191 -190
- data/samples/calendar/calendar.rb +256 -271
- data/samples/caret/caret.rb +282 -282
- data/samples/caret/mondrian.xpm +44 -44
- data/samples/controls/controls.rb +1136 -1136
- data/samples/controls/get_item_sample.rb +87 -87
- data/samples/controls/icons/choice.xpm +27 -27
- data/samples/controls/icons/combo.xpm +27 -27
- data/samples/controls/icons/gauge.xpm +27 -27
- data/samples/controls/icons/list.xpm +27 -27
- data/samples/controls/icons/radio.xpm +27 -27
- data/samples/controls/icons/stattext.xpm +24 -24
- data/samples/controls/icons/text.xpm +27 -27
- data/samples/controls/mondrian.xpm +44 -44
- data/samples/dialogs/dialogs.rb +797 -723
- data/samples/dialogs/tips.txt +18 -18
- data/samples/drawing/images.rb +37 -37
- data/samples/etc/activation.rb +102 -102
- data/samples/etc/choice.rb +67 -67
- data/samples/etc/miniframe.rb +79 -79
- data/samples/etc/sash.rb +130 -130
- data/samples/etc/scrollwin.rb +110 -110
- data/samples/etc/system_settings.rb +252 -252
- data/samples/etc/toolbar_sizer_additem.rb +55 -0
- data/samples/etc/wizard.rb +74 -74
- data/samples/event/update_ui_event.rb +70 -0
- data/samples/grid/gridtablebase.rb +43 -29
- data/samples/listbook/listbook.rb +174 -174
- data/samples/listbook/listbook.xrc +370 -370
- data/samples/mdi/mdi.rb +85 -77
- data/samples/minimal/minimal.rb +77 -77
- data/samples/minimal/nothing.rb +16 -16
- data/samples/text/format-text-bold.png +0 -0
- data/samples/text/format-text-italic.png +0 -0
- data/samples/text/format-text-underline.png +0 -0
- data/samples/text/rich_textctrl.rb +98 -0
- data/samples/text/textctrl.rb +111 -113
- data/samples/text/unicode.rb +242 -242
- data/samples/text/utf8.txt +14 -14
- data/samples/treectrl/treectrl.rb +1166 -1174
- data/samples/xrc/samples.xrc +46 -46
- data/samples/xrc/xrc_sample.rb +76 -96
- metadata +15 -3
    
        data/samples/bigdemo/bigdemo.rb
    CHANGED
    
    | @@ -1,823 +1,823 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            # wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
         | 
| 3 | 
            -
            # Freely reusable code: see SAMPLES-LICENSE.TXT for details
         | 
| 4 | 
            -
            begin
         | 
| 5 | 
            -
              require 'rubygems' 
         | 
| 6 | 
            -
            rescue LoadError
         | 
| 7 | 
            -
            end
         | 
| 8 | 
            -
            require 'wx'
         | 
| 9 | 
            -
             | 
| 10 | 
            -
            # Demo created by Robert Carlin, based on the wxPython demo by Robin Dunn
         | 
| 11 | 
            -
            # Modified by Kevin Smith, Roy Sutton, Alex Fenton
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
            #  TODO:
         | 
| 15 | 
            -
            #    Finish Scintilla integration
         | 
| 16 | 
            -
            #    Fix 'Find Next'
         | 
| 17 | 
            -
            #    Refactor editor pane
         | 
| 18 | 
            -
            #    More samples
         | 
| 19 | 
            -
            #    Finish 'rubification' of source
         | 
| 20 | 
            -
            #    Fix non-scintilla code viewer
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            OVR_TEXT = "This is the WxRuby Demo.  It was ported from the wxPython Demo, created by Robin Dunn.  Many thanks to him for all his hard work - this demo is what it is because of him.  Click on any of the items in the tree control to start the demo.  Don't forget to check out the Demo Code tab - you can see the source code for each demo!\nHope you like it!"
         | 
| 23 | 
            -
             | 
| 24 | 
            -
            $tree_list = [
         | 
| 25 | 
            -
                #new stuff
         | 
| 26 | 
            -
                #['Recent Additions', [
         | 
| 27 | 
            -
                #    'wxMaskedNumCtrl',
         | 
| 28 | 
            -
                #    'FloatCanvas',
         | 
| 29 | 
            -
                #    ]],
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                # managed windows == things with a [optional] caption you can close
         | 
| 32 | 
            -
                ['Base Frames and Dialogs', [
         | 
| 33 | 
            -
                    'wxDialog',
         | 
| 34 | 
            -
                    'wxFrame',
         | 
| 35 | 
            -
                    'wxMDIWindows',
         | 
| 36 | 
            -
                    'wxMiniFrame',
         | 
| 37 | 
            -
                    #'wxWizard',
         | 
| 38 | 
            -
                    ]],
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                # the common dialogs
         | 
| 41 | 
            -
                ['Common Dialogs', [
         | 
| 42 | 
            -
                    'wxColourDialog',
         | 
| 43 | 
            -
                    'wxDirDialog',
         | 
| 44 | 
            -
                    'wxFileDialog',
         | 
| 45 | 
            -
                    'wxFileDialog_Save',
         | 
| 46 | 
            -
                    'wxFindReplaceDialog',
         | 
| 47 | 
            -
                    'wxFontDialog',
         | 
| 48 | 
            -
                    'wxMessageDialog',
         | 
| 49 | 
            -
                    #'wxPageSetupDialog',
         | 
| 50 | 
            -
                    #'wxPrintDialog',
         | 
| 51 | 
            -
                    'wxProgressDialog',
         | 
| 52 | 
            -
                    'wxSingleChoiceDialog',
         | 
| 53 | 
            -
                    'wxTextEntryDialog',
         | 
| 54 | 
            -
                    ]],
         | 
| 55 | 
            -
             | 
| 56 | 
            -
                # dialogs from libraries
         | 
| 57 | 
            -
                ['More Dialogs', [
         | 
| 58 | 
            -
                #    'ErrorDialogs',
         | 
| 59 | 
            -
                #    'ImageBrowser',
         | 
| 60 | 
            -
                    'wxMultipleChoiceDialog',
         | 
| 61 | 
            -
                    'wxScrolledMessageDialog'
         | 
| 62 | 
            -
                    ]],
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                # core controls
         | 
| 65 | 
            -
                ['Core Windows/Controls', [
         | 
| 66 | 
            -
                    'PopupMenu',
         | 
| 67 | 
            -
                    'wxBitmapButton',
         | 
| 68 | 
            -
                    'wxButton',
         | 
| 69 | 
            -
                    'wxCheckBox',
         | 
| 70 | 
            -
                    'wxCheckListBox',
         | 
| 71 | 
            -
                    'wxChoice',
         | 
| 72 | 
            -
                    'wxChoicebook',
         | 
| 73 | 
            -
                    'wxComboBox',
         | 
| 74 | 
            -
                    'wxGauge',
         | 
| 75 | 
            -
                    'wxGenericDirCtrl',
         | 
| 76 | 
            -
                    'wxGrid',
         | 
| 77 | 
            -
                    #'wxGrid_MegaExample',
         | 
| 78 | 
            -
                    'wxListBox',
         | 
| 79 | 
            -
                    #'wxListCtrl',
         | 
| 80 | 
            -
                    'wxListCtrl_virtual',
         | 
| 81 | 
            -
                    'wxMenu',
         | 
| 82 | 
            -
                    'wxNotebook',
         | 
| 83 | 
            -
                    #'wxPopupWindow',
         | 
| 84 | 
            -
                    'wxRadioBox',
         | 
| 85 | 
            -
                    'wxRadioButton',
         | 
| 86 | 
            -
                    'wxSashWindow',
         | 
| 87 | 
            -
                    'wxScrolledWindow',
         | 
| 88 | 
            -
                    'wxSlider',
         | 
| 89 | 
            -
                    'wxSpinButton',
         | 
| 90 | 
            -
                    'wxSpinCtrl',
         | 
| 91 | 
            -
                    'wxSplitterWindow',
         | 
| 92 | 
            -
                    'wxStaticBitmap',
         | 
| 93 | 
            -
                    'wxStaticText',
         | 
| 94 | 
            -
                    'wxStatusBar',
         | 
| 95 | 
            -
                    'wxTextCtrl',
         | 
| 96 | 
            -
                    'wxToggleButton',
         | 
| 97 | 
            -
                    'wxToolBar',
         | 
| 98 | 
            -
                    'wxTreeCtrl',
         | 
| 99 | 
            -
                    #'wxValidator',
         | 
| 100 | 
            -
                    ]],
         | 
| 101 | 
            -
             | 
| 102 | 
            -
                # controls coming from other libraries
         | 
| 103 | 
            -
                ['More Windows/Controls', [
         | 
| 104 | 
            -
                    #'wxFloatBar',          deprecated
         | 
| 105 | 
            -
                    #'wxMVCTree',           deprecated
         | 
| 106 | 
            -
                    #'wxRightTextCtrl',     deprecated as we have wxTE_RIGHT now.
         | 
| 107 | 
            -
                    #'AnalogClockWindow',
         | 
| 108 | 
            -
                    #'ColourSelect',
         | 
| 109 | 
            -
                    #'ContextHelp',
         | 
| 110 | 
            -
                    #'FancyText',
         | 
| 111 | 
            -
                    #'FloatCanvas',
         | 
| 112 | 
            -
                    #'FileBrowseButton',
         | 
| 113 | 
            -
                    #'GenericButtons',
         | 
| 114 | 
            -
                    #'MaskedEditControls',
         | 
| 115 | 
            -
                    #'SplitTree',
         | 
| 116 | 
            -
                    #'TablePrint',
         | 
| 117 | 
            -
                    #'Throbber',
         | 
| 118 | 
            -
                    #'wxCalendar',
         | 
| 119 | 
            -
                    'wxCalendarCtrl',
         | 
| 120 | 
            -
                    #'wxDynamicSashWindow',
         | 
| 121 | 
            -
                    #'wxEditableListBox',
         | 
| 122 | 
            -
                    #'wxEditor',
         | 
| 123 | 
            -
                    #'wxHtmlWindow',
         | 
| 124 | 
            -
                    #'wxIEHtmlWin',
         | 
| 125 | 
            -
                    #'wxIntCtrl',
         | 
| 126 | 
            -
                    #'wxLEDNumberCtrl',
         | 
| 127 | 
            -
                    #'wxMimeTypesManager',
         | 
| 128 | 
            -
                    #'wxMaskedNumCtrl',
         | 
| 129 | 
            -
                    #'wxMultiSash',
         | 
| 130 | 
            -
                    #'wxPopupControl',
         | 
| 131 | 
            -
                    #'wxStyledTextCtrl_1',
         | 
| 132 | 
            -
                    #'wxStyledTextCtrl_2',
         | 
| 133 | 
            -
                    #'wxTimeCtrl',
         | 
| 134 | 
            -
                    #'wxTreeListCtrl',
         | 
| 135 | 
            -
                    ]],
         | 
| 136 | 
            -
             | 
| 137 | 
            -
                # How to lay out the controls in a frame/dialog
         | 
| 138 | 
            -
                ['Window Layout', [
         | 
| 139 | 
            -
                #    'LayoutAnchors',
         | 
| 140 | 
            -
                #    'Layoutf',
         | 
| 141 | 
            -
                #    'RowColSizer',
         | 
| 142 | 
            -
                    'Sizers',
         | 
| 143 | 
            -
                #    'wxScrolledPanel',
         | 
| 144 | 
            -
                #    'wxXmlResource',
         | 
| 145 | 
            -
                #    'wxXmlResourceHandler',
         | 
| 146 | 
            -
                    ]],
         | 
| 147 | 
            -
             | 
| 148 | 
            -
                # ditto
         | 
| 149 | 
            -
                #['Process and Events', [
         | 
| 150 | 
            -
                #    'EventManager',
         | 
| 151 | 
            -
                #   'infoframe',
         | 
| 152 | 
            -
                #    'OOR',
         | 
| 153 | 
            -
                #    'PythonEvents',
         | 
| 154 | 
            -
                #    'Threads',
         | 
| 155 | 
            -
                #    'wxKeyEvents',
         | 
| 156 | 
            -
                #    'wxProcess',
         | 
| 157 | 
            -
                #    'wxTimer',
         | 
| 158 | 
            -
                #    ]],
         | 
| 159 | 
            -
             | 
| 160 | 
            -
                #~ # Clipboard and DnD
         | 
| 161 | 
            -
                #~ ['Clipboard and DnD', [
         | 
| 162 | 
            -
                    #~ #'CustomDragAndDrop',
         | 
| 163 | 
            -
                    #~ 'DragAndDrop',
         | 
| 164 | 
            -
                    #~ 'URLDragAndDrop',
         | 
| 165 | 
            -
                    #~ ]],
         | 
| 166 | 
            -
             | 
| 167 | 
            -
                # Images
         | 
| 168 | 
            -
                ['Using Images', [
         | 
| 169 | 
            -
                #    'Throbber',
         | 
| 170 | 
            -
                    'wxArtProvider',
         | 
| 171 | 
            -
                    'wxCursor',
         | 
| 172 | 
            -
                    'wxDragImage',
         | 
| 173 | 
            -
                #    'wxImage',
         | 
| 174 | 
            -
                #    'wxImageFromStream',
         | 
| 175 | 
            -
                #    'wxMask',
         | 
| 176 | 
            -
                    ]],
         | 
| 177 | 
            -
             | 
| 178 | 
            -
                # Other stuff
         | 
| 179 | 
            -
                ['Miscellaneous', [
         | 
| 180 | 
            -
                #    'ColourDB',
         | 
| 181 | 
            -
                #    'DialogUnits',
         | 
| 182 | 
            -
                #    'DrawXXXList',
         | 
| 183 | 
            -
                #    'FontEnumerator',
         | 
| 184 | 
            -
                #    'PrintFramework',
         | 
| 185 | 
            -
                     'ShapedWindow',
         | 
| 186 | 
            -
                #    'Throbber',
         | 
| 187 | 
            -
                #    'Unicode',
         | 
| 188 | 
            -
                #    'wxFileHistory',
         | 
| 189 | 
            -
                #    'wxJoystick',
         | 
| 190 | 
            -
                #    'wxOGL',
         | 
| 191 | 
            -
                #    'wxWave',
         | 
| 192 | 
            -
                    ]],
         | 
| 193 | 
            -
             | 
| 194 | 
            -
                # need libs not coming with the demo
         | 
| 195 | 
            -
                #['Objects using an external library', [
         | 
| 196 | 
            -
                #    'ActiveXWrapper_Acrobat',
         | 
| 197 | 
            -
                #    'ActiveXWrapper_IE',
         | 
| 198 | 
            -
                #    'wxGLCanvas',
         | 
| 199 | 
            -
                #    'wxPlotCanvas',
         | 
| 200 | 
            -
                #    ]],
         | 
| 201 | 
            -
             | 
| 202 | 
            -
             | 
| 203 | 
            -
                ['Check out the samples dir too', [
         | 
| 204 | 
            -
                    ]],
         | 
| 205 | 
            -
             | 
| 206 | 
            -
            ]
         | 
| 207 | 
            -
             | 
| 208 | 
            -
            class DemoCodeViewer < Wx::TextCtrl
         | 
| 209 | 
            -
                def intialize(parent, id)
         | 
| 210 | 
            -
                    super(parent, id, OVR_TEXT, Wx::DEFAULT_POSITION, Wx::Size.new(400, 400), 
         | 
| 211 | 
            -
                          Wx::TE_MULTILINE|Wx::TE_READONLY|Wx::HSCROLL|
         | 
| 212 | 
            -
                          Wx::TE_RICH|Wx::TE_NOHIDESEL)
         | 
| 213 | 
            -
                end
         | 
| 214 | 
            -
            end
         | 
| 215 | 
            -
             | 
| 216 | 
            -
            class WxRubyDemo < Wx::Frame
         | 
| 217 | 
            -
                attr_accessor :otherWin
         | 
| 218 | 
            -
                
         | 
| 219 | 
            -
                def initialize(title, pos, size, style=Wx::DEFAULT_FRAME_STYLE)
         | 
| 220 | 
            -
            	    super(nil,-1,title,pos,size,style)
         | 
| 221 | 
            -
                    @demoID = 6000
         | 
| 222 | 
            -
                    @otherWin = nil
         | 
| 223 | 
            -
                    
         | 
| 224 | 
            -
                    icon_file = File.join(File.dirname(__FILE__), 'icons', 'mondrian.xpm')
         | 
| 225 | 
            -
                    icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_XPM)
         | 
| 226 | 
            -
                    set_icon(icon)
         | 
| 227 | 
            -
             | 
| 228 | 
            -
                    @tbicon = DemoTaskBarIcon.new(self)
         | 
| 229 | 
            -
                    
         | 
| 230 | 
            -
                    evt_idle {|event| on_idle(event)}
         | 
| 231 | 
            -
                    evt_close {|event| on_close(event)}
         | 
| 232 | 
            -
                    evt_iconize {|event| on_iconize(event)}
         | 
| 233 | 
            -
                    evt_maximize {|event| on_maximize(event)}
         | 
| 234 | 
            -
                    
         | 
| 235 | 
            -
                    centre(Wx::BOTH)
         | 
| 236 | 
            -
                    create_status_bar(1, Wx::ST_SIZEGRIP)
         | 
| 237 | 
            -
                    set_status_text("Welcome to the WxRuby Demo!")
         | 
| 238 | 
            -
                    
         | 
| 239 | 
            -
                    splitter = Wx::SplitterWindow.new(self, -1)
         | 
| 240 | 
            -
                    splitter2 = Wx::SplitterWindow.new(splitter, -1)
         | 
| 241 | 
            -
                    
         | 
| 242 | 
            -
                    # Make a File menu
         | 
| 243 | 
            -
                    
         | 
| 244 | 
            -
                    @mainmenu = Wx::MenuBar.new
         | 
| 245 | 
            -
                    menu = Wx::Menu.new
         | 
| 246 | 
            -
                    menu.append(Wx::ID_EXIT, "E&xit\tALT-X", "Get the heck outta here!")
         | 
| 247 | 
            -
                    evt_menu(Wx::ID_EXIT) {exit}
         | 
| 248 | 
            -
                    @mainmenu.append(menu, "&File")
         | 
| 249 | 
            -
                    
         | 
| 250 | 
            -
                    # Make a Demo menu - thanks to Kevin Smith for figuring the submenus out!
         | 
| 251 | 
            -
                    menu = Wx::Menu.new
         | 
| 252 | 
            -
                    $tree_list.each do |item|
         | 
| 253 | 
            -
                        @submenu = Wx::Menu.new
         | 
| 254 | 
            -
                        item[1].each do |childItem|
         | 
| 255 | 
            -
                            mID = @demoID += 1
         | 
| 256 | 
            -
                            @submenu.append(mID, childItem)
         | 
| 257 | 
            -
                            evt_menu(mID) {|event| on_demo_menu(childItem)}
         | 
| 258 | 
            -
                        end
         | 
| 259 | 
            -
                        menuItem = Wx::MenuItem.new(menu, 500000, item[0], "", Wx::ITEM_NORMAL, @submenu)
         | 
| 260 | 
            -
                        menu.append_item(menuItem)
         | 
| 261 | 
            -
                    end
         | 
| 262 | 
            -
                    @mainmenu.append(menu, "&Demo")
         | 
| 263 | 
            -
                    
         | 
| 264 | 
            -
                    # Make a Help menu
         | 
| 265 | 
            -
                    helpID = Wx::ID_ABOUT
         | 
| 266 | 
            -
                    findID = @demoID += 1
         | 
| 267 | 
            -
                    findnextID = @demoID += 1
         | 
| 268 | 
            -
                    clearID = @demoID += 1
         | 
| 269 | 
            -
                    menu = Wx::Menu.new
         | 
| 270 | 
            -
                    menu.append(findID, "&Find\tCtrl-F", "Find in the Demo Code")
         | 
| 271 | 
            -
                    menu.append(findnextID, "Find &Next\tF3", "Find Next")
         | 
| 272 | 
            -
                    menu.append_separator
         | 
| 273 | 
            -
                    menu.append(helpID, "&About\tCtrl-H", "wxRuby RULES!!!")
         | 
| 274 | 
            -
                    evt_menu(helpID) {|event| on_help_about(event)}
         | 
| 275 | 
            -
                    evt_menu(findID) {|event| on_help_find(event)}
         | 
| 276 | 
            -
                    evt_menu(findnextID) {|event| on_find_next(event)}
         | 
| 277 | 
            -
                    evt_find(-1) {|event| on_find(event)}
         | 
| 278 | 
            -
                    evt_find_next(-1) {|event| on_find(event)}
         | 
| 279 | 
            -
                    evt_find_close(-1) {|event| on_find_close(event)}
         | 
| 280 | 
            -
                    @mainmenu.append(menu, "&Help")
         | 
| 281 | 
            -
                    set_menu_bar(@mainmenu)
         | 
| 282 | 
            -
                    
         | 
| 283 | 
            -
                    @finddata = Wx::FindReplaceData.new()
         | 
| 284 | 
            -
                    
         | 
| 285 | 
            -
                    @treeMap = {}
         | 
| 286 | 
            -
                    @tree = Wx::TreeCtrl.new(splitter)
         | 
| 287 | 
            -
                    root = @tree.add_root("wxRuby Overview")
         | 
| 288 | 
            -
                    firstChild = nil
         | 
| 289 | 
            -
                    
         | 
| 290 | 
            -
                    $tree_list.each do |item|
         | 
| 291 | 
            -
                        child = @tree.append_item(root, item[0])
         | 
| 292 | 
            -
                        if not firstChild then firstChild = child end
         | 
| 293 | 
            -
                        item[1].each do |childItem|
         | 
| 294 | 
            -
                            theDemo = @tree.append_item(child, childItem)
         | 
| 295 | 
            -
                            @treeMap[childItem] = theDemo
         | 
| 296 | 
            -
                        end
         | 
| 297 | 
            -
                    end
         | 
| 298 | 
            -
                    @tree.expand(root)
         | 
| 299 | 
            -
                    @tree.expand(firstChild)
         | 
| 300 | 
            -
                    
         | 
| 301 | 
            -
                    evt_tree_item_expanded   @tree, :on_item_expanded
         | 
| 302 | 
            -
                    evt_tree_item_collapsed  @tree, :on_item_collapsed
         | 
| 303 | 
            -
                    evt_tree_sel_changed     @tree, :on_tree_sel_changed
         | 
| 304 | 
            -
                    evt_tree_item_activated  @tree, :on_tree_sel_changed
         | 
| 305 | 
            -
                    @tree.evt_left_down method(:on_tree_left_down)
         | 
| 306 | 
            -
                    
         | 
| 307 | 
            -
                    
         | 
| 308 | 
            -
                    
         | 
| 309 | 
            -
                    # Create a Notebook
         | 
| 310 | 
            -
                    @nb = Wx::Notebook.new(splitter2, :style => Wx::CLIP_CHILDREN)
         | 
| 311 | 
            -
                    
         | 
| 312 | 
            -
                    @ovr = Wx::TextCtrl.new(@nb, :value => OVR_TEXT, :style =>
         | 
| 313 | 
            -
                                            Wx::TE_MULTILINE|Wx::TE_READONLY|
         | 
| 314 | 
            -
                                            Wx::TE_RICH|Wx::TE_NOHIDESEL)
         | 
| 315 | 
            -
                    @nb.add_page(@ovr, "Overview")
         | 
| 316 | 
            -
                    
         | 
| 317 | 
            -
                    if Wx.const_defined?(:Scintilla)
         | 
| 318 | 
            -
                      panel, @txt = setup_editor(@nb)
         | 
| 319 | 
            -
                      @nb.add_page(panel, "Demo Code")
         | 
| 320 | 
            -
                    else
         | 
| 321 | 
            -
                      # FIXME: Should use DemoCodeViewer, but when we do (on Windows) it
         | 
| 322 | 
            -
                      #         puts all text on one line!  Can remove instance_eval
         | 
| 323 | 
            -
                      #         once that's resolved
         | 
| 324 | 
            -
                      @txt = Wx::TextCtrl.new(@nb, :value => OVR_TEXT, :style =>
         | 
| 325 | 
            -
                                               Wx::TE_MULTILINE|Wx::TE_READONLY|
         | 
| 326 | 
            -
                                               Wx::HSCROLL|Wx::TE_RICH|Wx::TE_RICH2|
         | 
| 327 | 
            -
                                               Wx::TE_NOHIDESEL)
         | 
| 328 | 
            -
                      @txt.instance_eval { alias clear_all clear }
         | 
| 329 | 
            -
                      @txt.set_max_length(0)
         | 
| 330 | 
            -
                      @nb.add_page(@txt, "Demo Code")
         | 
| 331 | 
            -
                    end
         | 
| 332 | 
            -
                    
         | 
| 333 | 
            -
                    get_demo_file(__FILE__)
         | 
| 334 | 
            -
                    
         | 
| 335 | 
            -
                    @log = Wx::TextCtrl.new(splitter2, -1, "", Wx::DEFAULT_POSITION, 
         | 
| 336 | 
            -
                                            Wx::DEFAULT_SIZE, 
         | 
| 337 | 
            -
                                            Wx::TE_MULTILINE|Wx::TE_READONLY|Wx::HSCROLL)
         | 
| 338 | 
            -
                    # For some reason when the number of characters entered is
         | 
| 339 | 
            -
                    # greater than about 10,700, the text control freezes.  I know  
         | 
| 340 | 
            -
                    # someone mentioned this on the list a while ago...calling
         | 
| 341 | 
            -
                    # set_max_length(0) with zero as the argument tells the text 
         | 
| 342 | 
            -
                    # control to default limit that the underlying native text
         | 
| 343 | 
            -
                    # control can handle. 
         | 
| 344 | 
            -
                    @log.set_max_length(0)
         | 
| 345 | 
            -
                    Wx::Log::set_active_target(Wx::LogTextCtrl.new(@log))
         | 
| 346 | 
            -
                    
         | 
| 347 | 
            -
                    splitter.split_vertically(@tree, splitter2, 220)
         | 
| 348 | 
            -
                    splitter2.split_horizontally(@nb, @log, 300)
         | 
| 349 | 
            -
             | 
| 350 | 
            -
                    
         | 
| 351 | 
            -
                    splitter.set_minimum_pane_size(20)        
         | 
| 352 | 
            -
                    splitter2.set_minimum_pane_size(100)
         | 
| 353 | 
            -
                    
         | 
| 354 | 
            -
                    @nb.set_selection(0)
         | 
| 355 | 
            -
                    @tree.select_item(root)
         | 
| 356 | 
            -
                    show_tip()
         | 
| 357 | 
            -
                end
         | 
| 358 | 
            -
                
         | 
| 359 | 
            -
                def write_text(text)
         | 
| 360 | 
            -
                    Wx::log_message(text)
         | 
| 361 | 
            -
                end
         | 
| 362 | 
            -
                
         | 
| 363 | 
            -
                def on_idle(event)
         | 
| 364 | 
            -
                    if @otherWin != nil
         | 
| 365 | 
            -
                        @otherWin.raise()
         | 
| 366 | 
            -
                        @window = @otherWin
         | 
| 367 | 
            -
                        @otherWin = nil
         | 
| 368 | 
            -
                    end
         | 
| 369 | 
            -
                end
         | 
| 370 | 
            -
                
         | 
| 371 | 
            -
                def on_close(event)
         | 
| 372 | 
            -
                    @tbicon.remove_icon
         | 
| 373 | 
            -
                    destroy()
         | 
| 374 | 
            -
                    exit()
         | 
| 375 | 
            -
                end
         | 
| 376 | 
            -
                
         | 
| 377 | 
            -
                def on_item_expanded(event)
         | 
| 378 | 
            -
                    item = event.get_item()
         | 
| 379 | 
            -
                    Wx::log_message("on_item_expanded: %s" % @tree.get_item_text(item))
         | 
| 380 | 
            -
                end
         | 
| 381 | 
            -
                
         | 
| 382 | 
            -
                def on_item_collapsed(event)
         | 
| 383 | 
            -
                    item = event.get_item()
         | 
| 384 | 
            -
                    Wx::log_message("on_item_collapsed: %s" % @tree.get_item_text(item))
         | 
| 385 | 
            -
                end
         | 
| 386 | 
            -
                
         | 
| 387 | 
            -
                def on_tree_sel_changed(event)
         | 
| 388 | 
            -
             | 
| 389 | 
            -
                    item = event.get_item()
         | 
| 390 | 
            -
             | 
| 391 | 
            -
                    if item.nonzero?
         | 
| 392 | 
            -
                      itemText = @tree.get_item_text(item)
         | 
| 393 | 
            -
                      run_demo(itemText)
         | 
| 394 | 
            -
                    end
         | 
| 395 | 
            -
                end
         | 
| 396 | 
            -
                
         | 
| 397 | 
            -
                def on_tree_left_down(event)
         | 
| 398 | 
            -
                    pt = Wx::Point.new(event.get_x, event.get_y)
         | 
| 399 | 
            -
                    item = @tree.hit_test(pt)
         | 
| 400 | 
            -
                    if item == @tree.get_selection()
         | 
| 401 | 
            -
                        set_overview(@tree.get_item_text(item) + " Overview", @curOverview)
         | 
| 402 | 
            -
                        Wx::log_message(@tree.get_item_text(item) + " Overview")
         | 
| 403 | 
            -
             | 
| 404 | 
            -
                    end
         | 
| 405 | 
            -
             | 
| 406 | 
            -
                    event.skip()
         | 
| 407 | 
            -
                end
         | 
| 408 | 
            -
                
         | 
| 409 | 
            -
                def run_demo(itemText)
         | 
| 410 | 
            -
                    if @nb.get_page_count() == 3
         | 
| 411 | 
            -
                        if @nb.get_selection() == 2
         | 
| 412 | 
            -
                            @nb.set_selection(0)
         | 
| 413 | 
            -
                        end
         | 
| 414 | 
            -
                        if @window != nil
         | 
| 415 | 
            -
                            @window = nil
         | 
| 416 | 
            -
                        end
         | 
| 417 | 
            -
                        @nb.delete_page(2)
         | 
| 418 | 
            -
                    end
         | 
| 419 | 
            -
                    
         | 
| 420 | 
            -
                    if itemText == "wxRuby Overview"
         | 
| 421 | 
            -
                        get_demo_file(__FILE__)
         | 
| 422 | 
            -
                        set_overview("wxRuby Overview", OVR_TEXT)
         | 
| 423 | 
            -
                        @nb.refresh()
         | 
| 424 | 
            -
                        @window = nil       
         | 
| 425 | 
            -
                    else
         | 
| 426 | 
            -
                      demo_file = File.join( File.dirname(__FILE__), itemText + '.rbw')
         | 
| 427 | 
            -
                        if File.exist?(demo_file)
         | 
| 428 | 
            -
                            Wx::log_message("Running Demo: " + itemText + ".rbw")
         | 
| 429 | 
            -
                            get_demo_file(demo_file)
         | 
| 430 | 
            -
                            # I use load() here because it allows the user to modify
         | 
| 431 | 
            -
                            # the underlying file for each sample, so that each time 
         | 
| 432 | 
            -
                            # They run it any changes made will be reflected without
         | 
| 433 | 
            -
                            # having to restart the demo. 
         | 
| 434 | 
            -
                            begin
         | 
| 435 | 
            -
                                load demo_file
         | 
| 436 | 
            -
                                set_overview(itemText + " Overview", Demo::overview)
         | 
| 437 | 
            -
                                @tree.refresh()
         | 
| 438 | 
            -
                                @nb.refresh()
         | 
| 439 | 
            -
                                @window = Demo.run(self, @nb, self)
         | 
| 440 | 
            -
                                if @window.class.ancestors.include?(Wx::Window)
         | 
| 441 | 
            -
                                    # Check to see if the demo returned a Wx::Window, Wx::Panel or a new class inheriting from them
         | 
| 442 | 
            -
                                    # if so, create a new tab in the notebook for them
         | 
| 443 | 
            -
                                    @nb.add_page(@window, "Demo")
         | 
| 444 | 
            -
                                    @nb.set_selection(2)
         | 
| 445 | 
            -
                                    @nb.refresh()
         | 
| 446 | 
            -
                                end
         | 
| 447 | 
            -
                            rescue Exception => problem
         | 
| 448 | 
            -
                                dlg = Wx::MessageDialog.new(self, "A problem occurred with the %s demo:\n%s\n%s" % [itemText, problem, problem.backtrace().join("\n").to_s()], 
         | 
| 449 | 
            -
                                                            "Error!!!", Wx::OK | Wx::ICON_ERROR)
         | 
| 450 | 
            -
                                dlg.show_modal()
         | 
| 451 | 
            -
                                dlg.destroy()
         | 
| 452 | 
            -
                            end
         | 
| 453 | 
            -
                        else
         | 
| 454 | 
            -
                            @ovr.set_value("")
         | 
| 455 | 
            -
                            @txt.clear_all
         | 
| 456 | 
            -
                            @window = nil
         | 
| 457 | 
            -
                        end
         | 
| 458 | 
            -
                    end
         | 
| 459 | 
            -
                    @tree.set_focus()
         | 
| 460 | 
            -
                end
         | 
| 461 | 
            -
                
         | 
| 462 | 
            -
                def get_demo_file(fileName)
         | 
| 463 | 
            -
                    @filename = fileName
         | 
| 464 | 
            -
                    @txt.clear()
         | 
| 465 | 
            -
                    @txt.load_file(fileName)
         | 
| 466 | 
            -
                    if @txt.is_a?(Wx::TextCtrl)
         | 
| 467 | 
            -
                      @txt.set_insertion_point(0)
         | 
| 468 | 
            -
                      @txt.show_position(0)
         | 
| 469 | 
            -
                    end
         | 
| 470 | 
            -
                end
         | 
| 471 | 
            -
                
         | 
| 472 | 
            -
                def set_overview(name, text)
         | 
| 473 | 
            -
                    text ||= ''
         | 
| 474 | 
            -
                    @curOverview = text
         | 
| 475 | 
            -
                    @ovr.set_value(text)
         | 
| 476 | 
            -
                    @ovr.set_style(0,text.length,Wx::TextAttr.new(Wx::BLUE, Wx::Colour.new("White"), Wx::Font.new(12, Wx::FONTFAMILY_SWISS, Wx::FONTSTYLE_NORMAL, Wx::FONTWEIGHT_BOLD)))
         | 
| 477 | 
            -
                    @nb.set_page_text(0, name)
         | 
| 478 | 
            -
                end
         | 
| 479 | 
            -
                
         | 
| 480 | 
            -
                # Menu Methods
         | 
| 481 | 
            -
                
         | 
| 482 | 
            -
                def on_file_exit(event)
         | 
| 483 | 
            -
                    close()
         | 
| 484 | 
            -
                end
         | 
| 485 | 
            -
                
         | 
| 486 | 
            -
                def on_help_about(event)
         | 
| 487 | 
            -
                    load File.join(File.dirname(__FILE__), "About.rbw")
         | 
| 488 | 
            -
                    about = About::MyAboutBox.new(self)
         | 
| 489 | 
            -
                    about.show_modal()
         | 
| 490 | 
            -
                    about.destroy()
         | 
| 491 | 
            -
                end
         | 
| 492 | 
            -
                
         | 
| 493 | 
            -
                def on_help_find(event)
         | 
| 494 | 
            -
                    @nb.set_selection(1)
         | 
| 495 | 
            -
                    @finddlg = Wx::FindReplaceDialog.new(self, @finddata, "Find", Wx::FR_NOUPDOWN | Wx::FR_NOMATCHCASE | Wx::FR_NOWHOLEWORD)
         | 
| 496 | 
            -
                    @finddlg.show()
         | 
| 497 | 
            -
                end
         | 
| 498 | 
            -
                
         | 
| 499 | 
            -
                def on_find(event)
         | 
| 500 | 
            -
                    # FIXME: These problems are probably resolved now
         | 
| 501 | 
            -
                    # Problems
         | 
| 502 | 
            -
                    # 1) For some reason, the control is not properly counting EOL characters - it almost seems to be skipping them
         | 
| 503 | 
            -
                    #    causing the control to incorrectly set the initial insertion point for the the "found" text
         | 
| 504 | 
            -
                    # 2) This also is causing problems with the amount of text that is highlighted - the length of the highlighted string
         | 
| 505 | 
            -
                    #    is less than it should be 
         | 
| 506 | 
            -
                    # 3) After doing an initial "find" operation, using the "find next" operation causes the program to crash - again, I
         | 
| 507 | 
            -
                    #    don't know why this is :(
         | 
| 508 | 
            -
                    # Example - When I try to find "menu", the text that gets highlighted is the newline on the second line and the "ME" of 
         | 
| 509 | 
            -
                    #           MENU_EXIT - a total of only 3 characters, when it should highlight all of "menu".  I don't fully understand
         | 
| 510 | 
            -
                    #           this problem, but it doesn't appear until after you attempt to find text beyond the first line :(
         | 
| 511 | 
            -
                    if @txt.is_a?(Wx::TextCtrl)
         | 
| 512 | 
            -
                      @nb.set_selection(1)
         | 
| 513 | 
            -
                      myEnd = @txt.get_last_position()
         | 
| 514 | 
            -
                      write_text("Last position = %d" % myEnd)
         | 
| 515 | 
            -
                      textstring = @txt.get_range(0,myEnd).downcase()
         | 
| 516 | 
            -
                      if Wx::PLATFORM == "WXMSW"
         | 
| 517 | 
            -
                          textstring.sub!(/\n/, "\r\n")
         | 
| 518 | 
            -
                      end
         | 
| 519 | 
            -
                      #write_text("textstring - %s" % textstring)
         | 
| 520 | 
            -
                      start = @txt.get_insertion_point()
         | 
| 521 | 
            -
                      write_text("insertion point = " + start.to_s())
         | 
| 522 | 
            -
                      findstring = @finddata.get_find_string().downcase()
         | 
| 523 | 
            -
                      write_text("finddata = " + findstring)
         | 
| 524 | 
            -
                      loc = textstring.index(findstring, start)
         | 
| 525 | 
            -
                      write_text("location = " + loc.to_s())
         | 
| 526 | 
            -
                      write_text("findstring.length() = " + findstring.length().to_s())
         | 
| 527 | 
            -
                      if loc == nil and start != 0
         | 
| 528 | 
            -
                        # string not found, start at beginning
         | 
| 529 | 
            -
                        start = 0
         | 
| 530 | 
            -
                        loc = textstring.index(findstring, start)
         | 
| 531 | 
            -
                      end
         | 
| 532 | 
            -
                    
         | 
| 533 | 
            -
                      if loc == nil
         | 
| 534 | 
            -
                        dlg = Wx::MessageDialog.new(self, 'Find String Not Found', 'Find String Not Found in Demo File',
         | 
| 535 | 
            -
                                                      Wx::OK | Wx::ICON_INFORMATION)
         | 
| 536 | 
            -
                        dlg.show_modal()
         | 
| 537 | 
            -
                        dlg.destroy()
         | 
| 538 | 
            -
                      end
         | 
| 539 | 
            -
                    
         | 
| 540 | 
            -
                      if @finddlg
         | 
| 541 | 
            -
                        if loc == nil
         | 
| 542 | 
            -
                            @finddlg.set_focus()
         | 
| 543 | 
            -
                            return
         | 
| 544 | 
            -
                        else
         | 
| 545 | 
            -
                            @finddlg.hide()
         | 
| 546 | 
            -
                        end
         | 
| 547 | 
            -
                      end
         | 
| 548 | 
            -
                      @txt.show_position(loc)
         | 
| 549 | 
            -
                      @txt.set_selection(loc, loc + findstring.length())
         | 
| 550 | 
            -
                    else # Scintilla
         | 
| 551 | 
            -
                      # FIXME: Take into account search direction
         | 
| 552 | 
            -
                      @txt.set_target_start(@txt.get_target_end)
         | 
| 553 | 
            -
                      @txt.set_target_end(@txt.get_length - 1)
         | 
| 554 | 
            -
                      # FIXME: get flags from find dialog
         | 
| 555 | 
            -
                      @txt.set_search_flags(0)
         | 
| 556 | 
            -
                      loc = @txt.search_in_target(event.get_find_string)
         | 
| 557 | 
            -
                      if loc == -1
         | 
| 558 | 
            -
                        dlg = Wx::MessageDialog.new(self, 'Find String Not Found', 'Find String Not Found in Demo File',
         | 
| 559 | 
            -
                                                      Wx::OK | Wx::ICON_INFORMATION)
         | 
| 560 | 
            -
                        dlg.show_modal()
         | 
| 561 | 
            -
                        dlg.destroy()
         | 
| 562 | 
            -
                      end
         | 
| 563 | 
            -
             | 
| 564 | 
            -
                      if @finddlg
         | 
| 565 | 
            -
                        if loc == -1
         | 
| 566 | 
            -
                          @finddlg.set_focus()
         | 
| 567 | 
            -
                          return
         | 
| 568 | 
            -
                        end
         | 
| 569 | 
            -
                      end
         | 
| 570 | 
            -
                      @txt.ensure_caret_visible
         | 
| 571 | 
            -
                      @txt.set_selection(loc, loc + event.get_find_string.length)
         | 
| 572 | 
            -
                    end
         | 
| 573 | 
            -
                end
         | 
| 574 | 
            -
                
         | 
| 575 | 
            -
                def on_find_next(event)
         | 
| 576 | 
            -
                    # FIXME: Saving an event is probably a bad idea
         | 
| 577 | 
            -
                    if @finddata.get_find_string() != ""
         | 
| 578 | 
            -
                        on_find(event)
         | 
| 579 | 
            -
                    else
         | 
| 580 | 
            -
                        on_help_find(event)
         | 
| 581 | 
            -
                    end
         | 
| 582 | 
            -
                end
         | 
| 583 | 
            -
                
         | 
| 584 | 
            -
                def on_find_close(event)
         | 
| 585 | 
            -
                    event.get_dialog().destroy()
         | 
| 586 | 
            -
                end
         | 
| 587 | 
            -
                
         | 
| 588 | 
            -
                def show_tip()
         | 
| 589 | 
            -
                  tips_file = File.join(File.dirname(__FILE__), 'tips.txt')
         | 
| 590 | 
            -
                  tp = Wx::create_file_tip_provider( tips_file, rand(6) )
         | 
| 591 | 
            -
                  Wx::show_tip(self, tp)
         | 
| 592 | 
            -
                end
         | 
| 593 | 
            -
                
         | 
| 594 | 
            -
                def on_demo_menu(childItem)
         | 
| 595 | 
            -
                    # Also, for some reason I haven't figured out yet either, the demo executes two times
         | 
| 596 | 
            -
                    selectedDemo = @treeMap[childItem]
         | 
| 597 | 
            -
                    if selectedDemo
         | 
| 598 | 
            -
                        @tree.select_item(selectedDemo)
         | 
| 599 | 
            -
                        @tree.ensure_visible(selectedDemo)
         | 
| 600 | 
            -
                    end
         | 
| 601 | 
            -
                end
         | 
| 602 | 
            -
                
         | 
| 603 | 
            -
                def on_iconize(event)
         | 
| 604 | 
            -
                    Wx::log_message("on_iconify")
         | 
| 605 | 
            -
                    event.skip
         | 
| 606 | 
            -
                end
         | 
| 607 | 
            -
                
         | 
| 608 | 
            -
                def on_maximize(event)
         | 
| 609 | 
            -
                    Wx::log_message("on_maximize")
         | 
| 610 | 
            -
                    event.skip
         | 
| 611 | 
            -
                end
         | 
| 612 | 
            -
             | 
| 613 | 
            -
                # FIXME: Refactor into a class
         | 
| 614 | 
            -
                def setup_editor(parent)
         | 
| 615 | 
            -
                  panel = Wx::Panel.new(parent)
         | 
| 616 | 
            -
                  panel.hide
         | 
| 617 | 
            -
                  sci = setup_scintilla(panel)
         | 
| 618 | 
            -
                  @save_button = Wx::Button.new(panel, -1, 'Save Changes')
         | 
| 619 | 
            -
                  @delete_button = Wx::Button.new(panel, -1, 'Delete Modified')
         | 
| 620 | 
            -
                  @save_button.enable(false);
         | 
| 621 | 
            -
                  panel.evt_button(@save_button.get_id) { on_save }
         | 
| 622 | 
            -
                  panel.evt_button(@delete_button.get_id) { on_delete }
         | 
| 623 | 
            -
                  panel.evt_sci_modified { on_modified }
         | 
| 624 | 
            -
             | 
| 625 | 
            -
                  radio_buttons = {:original => Wx::RadioButton.new(panel, -1, "Original", Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::RB_GROUP),
         | 
| 626 | 
            -
                                   :modified => Wx::RadioButton.new(panel, -1, "Modified")}
         | 
| 627 | 
            -
                  
         | 
| 628 | 
            -
                  @control_box = Wx::BoxSizer.new(Wx::HORIZONTAL)
         | 
| 629 | 
            -
                  @control_box.add(Wx::StaticText.new(panel, -1, 'Active Version:'), 0, Wx::RIGHT | Wx::LEFT | Wx::ALIGN_CENTER_VERTICAL, 5)
         | 
| 630 | 
            -
                  radio_buttons.each_pair { |id, button|
         | 
| 631 | 
            -
                    @control_box.add(button, 0, Wx::EXPAND | Wx::RIGHT, 5)
         | 
| 632 | 
            -
                    evt_radiobutton(button.get_id) { |event| on_radio_button(event) }
         | 
| 633 | 
            -
                  }
         | 
| 634 | 
            -
                  @control_box.add(@save_button, 0, Wx::RIGHT, 5)
         | 
| 635 | 
            -
                  @control_box.add(@delete_button, 0)
         | 
| 636 | 
            -
             | 
| 637 | 
            -
                  @box = Wx::BoxSizer.new(Wx::VERTICAL)
         | 
| 638 | 
            -
                  @box.add(@control_box, 0, Wx::EXPAND)
         | 
| 639 | 
            -
                  @box.add(Wx::StaticLine.new(panel), 0, Wx::EXPAND)
         | 
| 640 | 
            -
                  
         | 
| 641 | 
            -
                  @box.add(sci, 1, Wx::EXPAND)
         | 
| 642 | 
            -
                  @box.fit(panel)
         | 
| 643 | 
            -
                  panel.set_sizer(@box)
         | 
| 644 | 
            -
                  [panel, sci]
         | 
| 645 | 
            -
                end
         | 
| 646 | 
            -
             | 
| 647 | 
            -
                def setup_scintilla(parent)
         | 
| 648 | 
            -
                  sci = Wx::Scintilla.new(parent)
         | 
| 649 | 
            -
                  font = Wx::Font.new(10, Wx::TELETYPE, Wx::NORMAL, Wx::NORMAL)
         | 
| 650 | 
            -
                  sci.style_set_font(Wx::SCI_STYLE_DEFAULT, font);
         | 
| 651 | 
            -
                  sci.set_edge_mode(Wx::SCI_EDGE_LINE)
         | 
| 652 | 
            -
                  line_num_margin = sci.text_width(Wx::SCI_STYLE_LINENUMBER, "_99999")
         | 
| 653 | 
            -
                  sci.set_margin_width(0, line_num_margin)
         | 
| 654 | 
            -
             | 
| 655 | 
            -
                  sci.style_set_foreground(Wx::SCI_STYLE_DEFAULT, Wx::BLACK);
         | 
| 656 | 
            -
                  sci.style_set_background(Wx::SCI_STYLE_DEFAULT, Wx::WHITE);
         | 
| 657 | 
            -
                  sci.style_set_foreground(Wx::SCI_STYLE_LINENUMBER, Wx::LIGHT_GREY);
         | 
| 658 | 
            -
                  sci.style_set_background(Wx::SCI_STYLE_LINENUMBER, Wx::WHITE);
         | 
| 659 | 
            -
                  sci.style_set_foreground(Wx::SCI_STYLE_INDENTGUIDE, Wx::LIGHT_GREY);
         | 
| 660 | 
            -
             | 
| 661 | 
            -
                  sci.set_tab_width(2)
         | 
| 662 | 
            -
                  sci.set_use_tabs(false)
         | 
| 663 | 
            -
                  sci.set_tab_indents(true)
         | 
| 664 | 
            -
                  sci.set_back_space_un_indents(true)
         | 
| 665 | 
            -
                  sci.set_indent(2)
         | 
| 666 | 
            -
                  sci.set_edge_column(80)
         | 
| 667 | 
            -
             | 
| 668 | 
            -
                  sci.set_lexer(Wx::SCI_LEX_RUBY)
         | 
| 669 | 
            -
                  sci.style_clear_all
         | 
| 670 | 
            -
                  sci.style_set_foreground(2, Wx::RED)
         | 
| 671 | 
            -
                  sci.style_set_foreground(3, Wx::GREEN)
         | 
| 672 | 
            -
                  sci.style_set_foreground(5, Wx::BLUE)
         | 
| 673 | 
            -
                  sci.style_set_foreground(6, Wx::BLUE)
         | 
| 674 | 
            -
                  sci.style_set_foreground(7, Wx::BLUE)
         | 
| 675 | 
            -
                  sci.set_key_words(0, "begin break elsif module retry unless end case next return until class ensure nil self when def false not super while alias defined? for or then yield and do if redo true else in rescue undef")
         | 
| 676 | 
            -
             | 
| 677 | 
            -
                  sci.set_property("fold","1")
         | 
| 678 | 
            -
                  sci.set_property("fold.compact", "0")
         | 
| 679 | 
            -
                  sci.set_property("fold.comment", "1")
         | 
| 680 | 
            -
                  sci.set_property("fold.preprocessor", "1")
         | 
| 681 | 
            -
             | 
| 682 | 
            -
                  sci.set_margin_width(1, 0)
         | 
| 683 | 
            -
                  sci.set_margin_type(1, Wx::SCI_MARGIN_SYMBOL)
         | 
| 684 | 
            -
                  sci.set_margin_mask(1, Wx::SCI_MASK_FOLDERS)
         | 
| 685 | 
            -
                  sci.set_margin_width(1, 20)
         | 
| 686 | 
            -
             | 
| 687 | 
            -
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDER, Wx::SCI_MARK_PLUS)
         | 
| 688 | 
            -
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDEROPEN, Wx::SCI_MARK_MINUS)
         | 
| 689 | 
            -
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDEREND, Wx::SCI_MARK_EMPTY)
         | 
| 690 | 
            -
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDERMIDTAIL, Wx::SCI_MARK_EMPTY)
         | 
| 691 | 
            -
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDEROPENMID, Wx::SCI_MARK_EMPTY)
         | 
| 692 | 
            -
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDERSUB, Wx::SCI_MARK_EMPTY)
         | 
| 693 | 
            -
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDERTAIL, Wx::SCI_MARK_EMPTY)
         | 
| 694 | 
            -
                  sci.set_fold_flags(16)
         | 
| 695 | 
            -
             | 
| 696 | 
            -
                  sci.set_margin_sensitive(1,1)
         | 
| 697 | 
            -
                  sci
         | 
| 698 | 
            -
                end
         | 
| 699 | 
            -
             | 
| 700 | 
            -
                def on_save
         | 
| 701 | 
            -
                  if not FileTest.directory?(File.dirname(modified_filename))
         | 
| 702 | 
            -
                    if not Dir.mkdir(File.dirname(modified_filename))
         | 
| 703 | 
            -
                      Wx::log_message("Unable to create directory 'modified'")
         | 
| 704 | 
            -
                      return
         | 
| 705 | 
            -
                    end
         | 
| 706 | 
            -
                  end
         | 
| 707 | 
            -
                  File.open(modified_filename, "w") { |file|
         | 
| 708 | 
            -
                    file.write(@txt.get_text)
         | 
| 709 | 
            -
                  }
         | 
| 710 | 
            -
                  # FIXME: Reload module we just saved
         | 
| 711 | 
            -
                end
         | 
| 712 | 
            -
             | 
| 713 | 
            -
                def on_delete
         | 
| 714 | 
            -
                  if File.exists?(modified_filename)
         | 
| 715 | 
            -
                    File.unlink(modified_filename)
         | 
| 716 | 
            -
                  end
         | 
| 717 | 
            -
                  # FIXME: Update state
         | 
| 718 | 
            -
                end
         | 
| 719 | 
            -
             | 
| 720 | 
            -
                def on_modified
         | 
| 721 | 
            -
                  @save_button.enable(@txt.get_modify)
         | 
| 722 | 
            -
                end
         | 
| 723 | 
            -
             | 
| 724 | 
            -
                def on_radio_button(event)
         | 
| 725 | 
            -
                  # FIXME: Can't do anything here yet
         | 
| 726 | 
            -
                end
         | 
| 727 | 
            -
             | 
| 728 | 
            -
                def modified_filename
         | 
| 729 | 
            -
                  File.join(File.dirname(@filename), "modified", File.basename(@filename))
         | 
| 730 | 
            -
                end
         | 
| 731 | 
            -
            end
         | 
| 732 | 
            -
             | 
| 733 | 
            -
            class DemoTaskBarIcon < Wx::TaskBarIcon
         | 
| 734 | 
            -
              # TODO: Need a new_id function like wxPython has
         | 
| 735 | 
            -
              TBMENU_RESTORE = 6000
         | 
| 736 | 
            -
              TBMENU_CLOSE = 6001
         | 
| 737 | 
            -
              TBMENU_CHANGE = 6002
         | 
| 738 | 
            -
              TBMENU_REMOVE = 6003
         | 
| 739 | 
            -
             | 
| 740 | 
            -
              def initialize(frame)
         | 
| 741 | 
            -
                super()
         | 
| 742 | 
            -
             | 
| 743 | 
            -
                @frame = frame
         | 
| 744 | 
            -
             | 
| 745 | 
            -
                # starting image
         | 
| 746 | 
            -
                icon = make_icon('ruby.png')
         | 
| 747 | 
            -
                set_icon(icon, 'wxRuby Demo')
         | 
| 748 | 
            -
                @image_index = 1
         | 
| 749 | 
            -
             | 
| 750 | 
            -
                # events
         | 
| 751 | 
            -
                evt_taskbar_left_dclick  {|evt| on_taskbar_activate(evt) }
         | 
| 752 | 
            -
                
         | 
| 753 | 
            -
                evt_menu(TBMENU_RESTORE) {|evt| on_taskbar_activate(evt) }
         | 
| 754 | 
            -
                evt_menu(TBMENU_CLOSE)   { @frame.close }
         | 
| 755 | 
            -
                evt_menu(TBMENU_CHANGE)  {|evt| on_taskbar_change(evt) }
         | 
| 756 | 
            -
                evt_menu(TBMENU_REMOVE)  { remove_icon }
         | 
| 757 | 
            -
              end
         | 
| 758 | 
            -
             | 
| 759 | 
            -
              def create_popup_menu
         | 
| 760 | 
            -
                # Called by the base class when it needs to popup the menu
         | 
| 761 | 
            -
                #  (the default evt_right_down event).  Create and return
         | 
| 762 | 
            -
                #  the menu to display.
         | 
| 763 | 
            -
                menu = Wx::Menu.new
         | 
| 764 | 
            -
                menu.append(TBMENU_RESTORE, "Restore wxRuby Demo")
         | 
| 765 | 
            -
                menu.append(TBMENU_CLOSE,   "Close wxRuby Demo")
         | 
| 766 | 
            -
                menu.append_separator
         | 
| 767 | 
            -
                menu.append(TBMENU_CHANGE,  "Change the TB Icon")
         | 
| 768 | 
            -
                menu.append(TBMENU_REMOVE,  "Remove the TB Icon")
         | 
| 769 | 
            -
                return menu
         | 
| 770 | 
            -
              end
         | 
| 771 | 
            -
             | 
| 772 | 
            -
              def make_icon(imgname)
         | 
| 773 | 
            -
                # Different platforms have different requirements for the
         | 
| 774 | 
            -
                #  taskbar icon size
         | 
| 775 | 
            -
                filename = File.join( File.dirname(__FILE__), 'icons', imgname )
         | 
| 776 | 
            -
                img = Wx::Image.new(filename)
         | 
| 777 | 
            -
                if Wx::PLATFORM == "WXMSW"
         | 
| 778 | 
            -
                  img = img.scale(16, 16)
         | 
| 779 | 
            -
                elsif Wx::PLATFORM == "WXGTK"
         | 
| 780 | 
            -
                  img = img.scale(22, 22)
         | 
| 781 | 
            -
                end
         | 
| 782 | 
            -
                # WXMAC can be any size up to 128x128, so don't scale
         | 
| 783 | 
            -
                icon = Wx::Icon.new
         | 
| 784 | 
            -
                icon.copy_from_bitmap(Wx::Bitmap.new(img))
         | 
| 785 | 
            -
                return icon
         | 
| 786 | 
            -
              end
         | 
| 787 | 
            -
             | 
| 788 | 
            -
              def on_taskbar_activate(evt)
         | 
| 789 | 
            -
                if @frame.is_iconized
         | 
| 790 | 
            -
                  @frame.iconize(false)
         | 
| 791 | 
            -
                end
         | 
| 792 | 
            -
                if not @frame.is_shown
         | 
| 793 | 
            -
                  @frame.show(true)
         | 
| 794 | 
            -
                end
         | 
| 795 | 
            -
                @frame.raise
         | 
| 796 | 
            -
              end
         | 
| 797 | 
            -
             | 
| 798 | 
            -
              def on_taskbar_change(evt)
         | 
| 799 | 
            -
                names = [ "ruby.png", "wxwin16x16.xpm", "smiles.xpm", "mondrian.xpm" ]
         | 
| 800 | 
            -
                name = names[@image_index]
         | 
| 801 | 
            -
                @image_index += 1
         | 
| 802 | 
            -
                if @image_index >= names.length
         | 
| 803 | 
            -
                  @image_index = 0
         | 
| 804 | 
            -
                end
         | 
| 805 | 
            -
             | 
| 806 | 
            -
                icon = make_icon(name)
         | 
| 807 | 
            -
                set_icon(icon, 'This is a new icon: ' + name)
         | 
| 808 | 
            -
              end
         | 
| 809 | 
            -
             | 
| 810 | 
            -
            end
         | 
| 811 | 
            -
             | 
| 812 | 
            -
            class DemoApp < Wx::App
         | 
| 813 | 
            -
              def on_init
         | 
| 814 | 
            -
                frame = WxRubyDemo.new("WxRuby BIG combined demo",
         | 
| 815 | 
            -
                                       Wx::DEFAULT_POSITION, 
         | 
| 816 | 
            -
                                       Wx::Size.new(750, 550))
         | 
| 817 | 
            -
             | 
| 818 | 
            -
                frame.show(true)
         | 
| 819 | 
            -
              end
         | 
| 820 | 
            -
            end
         | 
| 821 | 
            -
             | 
| 822 | 
            -
            demo = DemoApp.new
         | 
| 823 | 
            -
            demo.main_loop
         | 
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
            # wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team
         | 
| 3 | 
            +
            # Freely reusable code: see SAMPLES-LICENSE.TXT for details
         | 
| 4 | 
            +
            begin
         | 
| 5 | 
            +
              require 'rubygems' 
         | 
| 6 | 
            +
            rescue LoadError
         | 
| 7 | 
            +
            end
         | 
| 8 | 
            +
            require 'wx'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            # Demo created by Robert Carlin, based on the wxPython demo by Robin Dunn
         | 
| 11 | 
            +
            # Modified by Kevin Smith, Roy Sutton, Alex Fenton
         | 
| 12 | 
            +
             | 
| 13 | 
            +
             | 
| 14 | 
            +
            #  TODO:
         | 
| 15 | 
            +
            #    Finish Scintilla integration
         | 
| 16 | 
            +
            #    Fix 'Find Next'
         | 
| 17 | 
            +
            #    Refactor editor pane
         | 
| 18 | 
            +
            #    More samples
         | 
| 19 | 
            +
            #    Finish 'rubification' of source
         | 
| 20 | 
            +
            #    Fix non-scintilla code viewer
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            OVR_TEXT = "This is the WxRuby Demo.  It was ported from the wxPython Demo, created by Robin Dunn.  Many thanks to him for all his hard work - this demo is what it is because of him.  Click on any of the items in the tree control to start the demo.  Don't forget to check out the Demo Code tab - you can see the source code for each demo!\nHope you like it!"
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            $tree_list = [
         | 
| 25 | 
            +
                #new stuff
         | 
| 26 | 
            +
                #['Recent Additions', [
         | 
| 27 | 
            +
                #    'wxMaskedNumCtrl',
         | 
| 28 | 
            +
                #    'FloatCanvas',
         | 
| 29 | 
            +
                #    ]],
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                # managed windows == things with a [optional] caption you can close
         | 
| 32 | 
            +
                ['Base Frames and Dialogs', [
         | 
| 33 | 
            +
                    'wxDialog',
         | 
| 34 | 
            +
                    'wxFrame',
         | 
| 35 | 
            +
                    'wxMDIWindows',
         | 
| 36 | 
            +
                    'wxMiniFrame',
         | 
| 37 | 
            +
                    #'wxWizard',
         | 
| 38 | 
            +
                    ]],
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                # the common dialogs
         | 
| 41 | 
            +
                ['Common Dialogs', [
         | 
| 42 | 
            +
                    'wxColourDialog',
         | 
| 43 | 
            +
                    'wxDirDialog',
         | 
| 44 | 
            +
                    'wxFileDialog',
         | 
| 45 | 
            +
                    'wxFileDialog_Save',
         | 
| 46 | 
            +
                    'wxFindReplaceDialog',
         | 
| 47 | 
            +
                    'wxFontDialog',
         | 
| 48 | 
            +
                    'wxMessageDialog',
         | 
| 49 | 
            +
                    #'wxPageSetupDialog',
         | 
| 50 | 
            +
                    #'wxPrintDialog',
         | 
| 51 | 
            +
                    'wxProgressDialog',
         | 
| 52 | 
            +
                    'wxSingleChoiceDialog',
         | 
| 53 | 
            +
                    'wxTextEntryDialog',
         | 
| 54 | 
            +
                    ]],
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                # dialogs from libraries
         | 
| 57 | 
            +
                ['More Dialogs', [
         | 
| 58 | 
            +
                #    'ErrorDialogs',
         | 
| 59 | 
            +
                #    'ImageBrowser',
         | 
| 60 | 
            +
                    'wxMultipleChoiceDialog',
         | 
| 61 | 
            +
                    'wxScrolledMessageDialog'
         | 
| 62 | 
            +
                    ]],
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                # core controls
         | 
| 65 | 
            +
                ['Core Windows/Controls', [
         | 
| 66 | 
            +
                    'PopupMenu',
         | 
| 67 | 
            +
                    'wxBitmapButton',
         | 
| 68 | 
            +
                    'wxButton',
         | 
| 69 | 
            +
                    'wxCheckBox',
         | 
| 70 | 
            +
                    'wxCheckListBox',
         | 
| 71 | 
            +
                    'wxChoice',
         | 
| 72 | 
            +
                    'wxChoicebook',
         | 
| 73 | 
            +
                    'wxComboBox',
         | 
| 74 | 
            +
                    'wxGauge',
         | 
| 75 | 
            +
                    'wxGenericDirCtrl',
         | 
| 76 | 
            +
                    'wxGrid',
         | 
| 77 | 
            +
                    #'wxGrid_MegaExample',
         | 
| 78 | 
            +
                    'wxListBox',
         | 
| 79 | 
            +
                    #'wxListCtrl',
         | 
| 80 | 
            +
                    'wxListCtrl_virtual',
         | 
| 81 | 
            +
                    'wxMenu',
         | 
| 82 | 
            +
                    'wxNotebook',
         | 
| 83 | 
            +
                    #'wxPopupWindow',
         | 
| 84 | 
            +
                    'wxRadioBox',
         | 
| 85 | 
            +
                    'wxRadioButton',
         | 
| 86 | 
            +
                    'wxSashWindow',
         | 
| 87 | 
            +
                    'wxScrolledWindow',
         | 
| 88 | 
            +
                    'wxSlider',
         | 
| 89 | 
            +
                    'wxSpinButton',
         | 
| 90 | 
            +
                    'wxSpinCtrl',
         | 
| 91 | 
            +
                    'wxSplitterWindow',
         | 
| 92 | 
            +
                    'wxStaticBitmap',
         | 
| 93 | 
            +
                    'wxStaticText',
         | 
| 94 | 
            +
                    'wxStatusBar',
         | 
| 95 | 
            +
                    'wxTextCtrl',
         | 
| 96 | 
            +
                    'wxToggleButton',
         | 
| 97 | 
            +
                    'wxToolBar',
         | 
| 98 | 
            +
                    'wxTreeCtrl',
         | 
| 99 | 
            +
                    #'wxValidator',
         | 
| 100 | 
            +
                    ]],
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                # controls coming from other libraries
         | 
| 103 | 
            +
                ['More Windows/Controls', [
         | 
| 104 | 
            +
                    #'wxFloatBar',          deprecated
         | 
| 105 | 
            +
                    #'wxMVCTree',           deprecated
         | 
| 106 | 
            +
                    #'wxRightTextCtrl',     deprecated as we have wxTE_RIGHT now.
         | 
| 107 | 
            +
                    #'AnalogClockWindow',
         | 
| 108 | 
            +
                    #'ColourSelect',
         | 
| 109 | 
            +
                    #'ContextHelp',
         | 
| 110 | 
            +
                    #'FancyText',
         | 
| 111 | 
            +
                    #'FloatCanvas',
         | 
| 112 | 
            +
                    #'FileBrowseButton',
         | 
| 113 | 
            +
                    #'GenericButtons',
         | 
| 114 | 
            +
                    #'MaskedEditControls',
         | 
| 115 | 
            +
                    #'SplitTree',
         | 
| 116 | 
            +
                    #'TablePrint',
         | 
| 117 | 
            +
                    #'Throbber',
         | 
| 118 | 
            +
                    #'wxCalendar',
         | 
| 119 | 
            +
                    'wxCalendarCtrl',
         | 
| 120 | 
            +
                    #'wxDynamicSashWindow',
         | 
| 121 | 
            +
                    #'wxEditableListBox',
         | 
| 122 | 
            +
                    #'wxEditor',
         | 
| 123 | 
            +
                    #'wxHtmlWindow',
         | 
| 124 | 
            +
                    #'wxIEHtmlWin',
         | 
| 125 | 
            +
                    #'wxIntCtrl',
         | 
| 126 | 
            +
                    #'wxLEDNumberCtrl',
         | 
| 127 | 
            +
                    #'wxMimeTypesManager',
         | 
| 128 | 
            +
                    #'wxMaskedNumCtrl',
         | 
| 129 | 
            +
                    #'wxMultiSash',
         | 
| 130 | 
            +
                    #'wxPopupControl',
         | 
| 131 | 
            +
                    #'wxStyledTextCtrl_1',
         | 
| 132 | 
            +
                    #'wxStyledTextCtrl_2',
         | 
| 133 | 
            +
                    #'wxTimeCtrl',
         | 
| 134 | 
            +
                    #'wxTreeListCtrl',
         | 
| 135 | 
            +
                    ]],
         | 
| 136 | 
            +
             | 
| 137 | 
            +
                # How to lay out the controls in a frame/dialog
         | 
| 138 | 
            +
                ['Window Layout', [
         | 
| 139 | 
            +
                #    'LayoutAnchors',
         | 
| 140 | 
            +
                #    'Layoutf',
         | 
| 141 | 
            +
                #    'RowColSizer',
         | 
| 142 | 
            +
                    'Sizers',
         | 
| 143 | 
            +
                #    'wxScrolledPanel',
         | 
| 144 | 
            +
                #    'wxXmlResource',
         | 
| 145 | 
            +
                #    'wxXmlResourceHandler',
         | 
| 146 | 
            +
                    ]],
         | 
| 147 | 
            +
             | 
| 148 | 
            +
                # ditto
         | 
| 149 | 
            +
                #['Process and Events', [
         | 
| 150 | 
            +
                #    'EventManager',
         | 
| 151 | 
            +
                #   'infoframe',
         | 
| 152 | 
            +
                #    'OOR',
         | 
| 153 | 
            +
                #    'PythonEvents',
         | 
| 154 | 
            +
                #    'Threads',
         | 
| 155 | 
            +
                #    'wxKeyEvents',
         | 
| 156 | 
            +
                #    'wxProcess',
         | 
| 157 | 
            +
                #    'wxTimer',
         | 
| 158 | 
            +
                #    ]],
         | 
| 159 | 
            +
             | 
| 160 | 
            +
                #~ # Clipboard and DnD
         | 
| 161 | 
            +
                #~ ['Clipboard and DnD', [
         | 
| 162 | 
            +
                    #~ #'CustomDragAndDrop',
         | 
| 163 | 
            +
                    #~ 'DragAndDrop',
         | 
| 164 | 
            +
                    #~ 'URLDragAndDrop',
         | 
| 165 | 
            +
                    #~ ]],
         | 
| 166 | 
            +
             | 
| 167 | 
            +
                # Images
         | 
| 168 | 
            +
                ['Using Images', [
         | 
| 169 | 
            +
                #    'Throbber',
         | 
| 170 | 
            +
                    'wxArtProvider',
         | 
| 171 | 
            +
                    'wxCursor',
         | 
| 172 | 
            +
                    'wxDragImage',
         | 
| 173 | 
            +
                #    'wxImage',
         | 
| 174 | 
            +
                #    'wxImageFromStream',
         | 
| 175 | 
            +
                #    'wxMask',
         | 
| 176 | 
            +
                    ]],
         | 
| 177 | 
            +
             | 
| 178 | 
            +
                # Other stuff
         | 
| 179 | 
            +
                ['Miscellaneous', [
         | 
| 180 | 
            +
                #    'ColourDB',
         | 
| 181 | 
            +
                #    'DialogUnits',
         | 
| 182 | 
            +
                #    'DrawXXXList',
         | 
| 183 | 
            +
                #    'FontEnumerator',
         | 
| 184 | 
            +
                #    'PrintFramework',
         | 
| 185 | 
            +
                     'ShapedWindow',
         | 
| 186 | 
            +
                #    'Throbber',
         | 
| 187 | 
            +
                #    'Unicode',
         | 
| 188 | 
            +
                #    'wxFileHistory',
         | 
| 189 | 
            +
                #    'wxJoystick',
         | 
| 190 | 
            +
                #    'wxOGL',
         | 
| 191 | 
            +
                #    'wxWave',
         | 
| 192 | 
            +
                    ]],
         | 
| 193 | 
            +
             | 
| 194 | 
            +
                # need libs not coming with the demo
         | 
| 195 | 
            +
                #['Objects using an external library', [
         | 
| 196 | 
            +
                #    'ActiveXWrapper_Acrobat',
         | 
| 197 | 
            +
                #    'ActiveXWrapper_IE',
         | 
| 198 | 
            +
                #    'wxGLCanvas',
         | 
| 199 | 
            +
                #    'wxPlotCanvas',
         | 
| 200 | 
            +
                #    ]],
         | 
| 201 | 
            +
             | 
| 202 | 
            +
             | 
| 203 | 
            +
                ['Check out the samples dir too', [
         | 
| 204 | 
            +
                    ]],
         | 
| 205 | 
            +
             | 
| 206 | 
            +
            ]
         | 
| 207 | 
            +
             | 
| 208 | 
            +
            class DemoCodeViewer < Wx::TextCtrl
         | 
| 209 | 
            +
                def intialize(parent, id)
         | 
| 210 | 
            +
                    super(parent, id, OVR_TEXT, Wx::DEFAULT_POSITION, Wx::Size.new(400, 400), 
         | 
| 211 | 
            +
                          Wx::TE_MULTILINE|Wx::TE_READONLY|Wx::HSCROLL|
         | 
| 212 | 
            +
                          Wx::TE_RICH|Wx::TE_NOHIDESEL)
         | 
| 213 | 
            +
                end
         | 
| 214 | 
            +
            end
         | 
| 215 | 
            +
             | 
| 216 | 
            +
            class WxRubyDemo < Wx::Frame
         | 
| 217 | 
            +
                attr_accessor :otherWin
         | 
| 218 | 
            +
                
         | 
| 219 | 
            +
                def initialize(title, pos, size, style=Wx::DEFAULT_FRAME_STYLE)
         | 
| 220 | 
            +
            	    super(nil,-1,title,pos,size,style)
         | 
| 221 | 
            +
                    @demoID = 6000
         | 
| 222 | 
            +
                    @otherWin = nil
         | 
| 223 | 
            +
                    
         | 
| 224 | 
            +
                    icon_file = File.join(File.dirname(__FILE__), 'icons', 'mondrian.xpm')
         | 
| 225 | 
            +
                    icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_XPM)
         | 
| 226 | 
            +
                    set_icon(icon)
         | 
| 227 | 
            +
             | 
| 228 | 
            +
                    @tbicon = DemoTaskBarIcon.new(self)
         | 
| 229 | 
            +
                    
         | 
| 230 | 
            +
                    evt_idle {|event| on_idle(event)}
         | 
| 231 | 
            +
                    evt_close {|event| on_close(event)}
         | 
| 232 | 
            +
                    evt_iconize {|event| on_iconize(event)}
         | 
| 233 | 
            +
                    evt_maximize {|event| on_maximize(event)}
         | 
| 234 | 
            +
                    
         | 
| 235 | 
            +
                    centre(Wx::BOTH)
         | 
| 236 | 
            +
                    create_status_bar(1, Wx::ST_SIZEGRIP)
         | 
| 237 | 
            +
                    set_status_text("Welcome to the WxRuby Demo!")
         | 
| 238 | 
            +
                    
         | 
| 239 | 
            +
                    splitter = Wx::SplitterWindow.new(self, -1)
         | 
| 240 | 
            +
                    splitter2 = Wx::SplitterWindow.new(splitter, -1)
         | 
| 241 | 
            +
                    
         | 
| 242 | 
            +
                    # Make a File menu
         | 
| 243 | 
            +
                    
         | 
| 244 | 
            +
                    @mainmenu = Wx::MenuBar.new
         | 
| 245 | 
            +
                    menu = Wx::Menu.new
         | 
| 246 | 
            +
                    menu.append(Wx::ID_EXIT, "E&xit\tALT-X", "Get the heck outta here!")
         | 
| 247 | 
            +
                    evt_menu(Wx::ID_EXIT) {exit}
         | 
| 248 | 
            +
                    @mainmenu.append(menu, "&File")
         | 
| 249 | 
            +
                    
         | 
| 250 | 
            +
                    # Make a Demo menu - thanks to Kevin Smith for figuring the submenus out!
         | 
| 251 | 
            +
                    menu = Wx::Menu.new
         | 
| 252 | 
            +
                    $tree_list.each do |item|
         | 
| 253 | 
            +
                        @submenu = Wx::Menu.new
         | 
| 254 | 
            +
                        item[1].each do |childItem|
         | 
| 255 | 
            +
                            mID = @demoID += 1
         | 
| 256 | 
            +
                            @submenu.append(mID, childItem)
         | 
| 257 | 
            +
                            evt_menu(mID) {|event| on_demo_menu(childItem)}
         | 
| 258 | 
            +
                        end
         | 
| 259 | 
            +
                        menuItem = Wx::MenuItem.new(menu, 500000, item[0], "", Wx::ITEM_NORMAL, @submenu)
         | 
| 260 | 
            +
                        menu.append_item(menuItem)
         | 
| 261 | 
            +
                    end
         | 
| 262 | 
            +
                    @mainmenu.append(menu, "&Demo")
         | 
| 263 | 
            +
                    
         | 
| 264 | 
            +
                    # Make a Help menu
         | 
| 265 | 
            +
                    helpID = Wx::ID_ABOUT
         | 
| 266 | 
            +
                    findID = @demoID += 1
         | 
| 267 | 
            +
                    findnextID = @demoID += 1
         | 
| 268 | 
            +
                    clearID = @demoID += 1
         | 
| 269 | 
            +
                    menu = Wx::Menu.new
         | 
| 270 | 
            +
                    menu.append(findID, "&Find\tCtrl-F", "Find in the Demo Code")
         | 
| 271 | 
            +
                    menu.append(findnextID, "Find &Next\tF3", "Find Next")
         | 
| 272 | 
            +
                    menu.append_separator
         | 
| 273 | 
            +
                    menu.append(helpID, "&About\tCtrl-H", "wxRuby RULES!!!")
         | 
| 274 | 
            +
                    evt_menu(helpID) {|event| on_help_about(event)}
         | 
| 275 | 
            +
                    evt_menu(findID) {|event| on_help_find(event)}
         | 
| 276 | 
            +
                    evt_menu(findnextID) {|event| on_find_next(event)}
         | 
| 277 | 
            +
                    evt_find(-1) {|event| on_find(event)}
         | 
| 278 | 
            +
                    evt_find_next(-1) {|event| on_find(event)}
         | 
| 279 | 
            +
                    evt_find_close(-1) {|event| on_find_close(event)}
         | 
| 280 | 
            +
                    @mainmenu.append(menu, "&Help")
         | 
| 281 | 
            +
                    set_menu_bar(@mainmenu)
         | 
| 282 | 
            +
                    
         | 
| 283 | 
            +
                    @finddata = Wx::FindReplaceData.new()
         | 
| 284 | 
            +
                    
         | 
| 285 | 
            +
                    @treeMap = {}
         | 
| 286 | 
            +
                    @tree = Wx::TreeCtrl.new(splitter)
         | 
| 287 | 
            +
                    root = @tree.add_root("wxRuby Overview")
         | 
| 288 | 
            +
                    firstChild = nil
         | 
| 289 | 
            +
                    
         | 
| 290 | 
            +
                    $tree_list.each do |item|
         | 
| 291 | 
            +
                        child = @tree.append_item(root, item[0])
         | 
| 292 | 
            +
                        if not firstChild then firstChild = child end
         | 
| 293 | 
            +
                        item[1].each do |childItem|
         | 
| 294 | 
            +
                            theDemo = @tree.append_item(child, childItem)
         | 
| 295 | 
            +
                            @treeMap[childItem] = theDemo
         | 
| 296 | 
            +
                        end
         | 
| 297 | 
            +
                    end
         | 
| 298 | 
            +
                    @tree.expand(root)
         | 
| 299 | 
            +
                    @tree.expand(firstChild)
         | 
| 300 | 
            +
                    
         | 
| 301 | 
            +
                    evt_tree_item_expanded   @tree, :on_item_expanded
         | 
| 302 | 
            +
                    evt_tree_item_collapsed  @tree, :on_item_collapsed
         | 
| 303 | 
            +
                    evt_tree_sel_changed     @tree, :on_tree_sel_changed
         | 
| 304 | 
            +
                    evt_tree_item_activated  @tree, :on_tree_sel_changed
         | 
| 305 | 
            +
                    @tree.evt_left_down method(:on_tree_left_down)
         | 
| 306 | 
            +
                    
         | 
| 307 | 
            +
                    
         | 
| 308 | 
            +
                    
         | 
| 309 | 
            +
                    # Create a Notebook
         | 
| 310 | 
            +
                    @nb = Wx::Notebook.new(splitter2, :style => Wx::CLIP_CHILDREN)
         | 
| 311 | 
            +
                    
         | 
| 312 | 
            +
                    @ovr = Wx::TextCtrl.new(@nb, :value => OVR_TEXT, :style =>
         | 
| 313 | 
            +
                                            Wx::TE_MULTILINE|Wx::TE_READONLY|
         | 
| 314 | 
            +
                                            Wx::TE_RICH|Wx::TE_NOHIDESEL)
         | 
| 315 | 
            +
                    @nb.add_page(@ovr, "Overview")
         | 
| 316 | 
            +
                    
         | 
| 317 | 
            +
                    if Wx.const_defined?(:Scintilla)
         | 
| 318 | 
            +
                      panel, @txt = setup_editor(@nb)
         | 
| 319 | 
            +
                      @nb.add_page(panel, "Demo Code")
         | 
| 320 | 
            +
                    else
         | 
| 321 | 
            +
                      # FIXME: Should use DemoCodeViewer, but when we do (on Windows) it
         | 
| 322 | 
            +
                      #         puts all text on one line!  Can remove instance_eval
         | 
| 323 | 
            +
                      #         once that's resolved
         | 
| 324 | 
            +
                      @txt = Wx::TextCtrl.new(@nb, :value => OVR_TEXT, :style =>
         | 
| 325 | 
            +
                                               Wx::TE_MULTILINE|Wx::TE_READONLY|
         | 
| 326 | 
            +
                                               Wx::HSCROLL|Wx::TE_RICH|Wx::TE_RICH2|
         | 
| 327 | 
            +
                                               Wx::TE_NOHIDESEL)
         | 
| 328 | 
            +
                      @txt.instance_eval { alias clear_all clear }
         | 
| 329 | 
            +
                      @txt.set_max_length(0)
         | 
| 330 | 
            +
                      @nb.add_page(@txt, "Demo Code")
         | 
| 331 | 
            +
                    end
         | 
| 332 | 
            +
                    
         | 
| 333 | 
            +
                    get_demo_file(__FILE__)
         | 
| 334 | 
            +
                    
         | 
| 335 | 
            +
                    @log = Wx::TextCtrl.new(splitter2, -1, "", Wx::DEFAULT_POSITION, 
         | 
| 336 | 
            +
                                            Wx::DEFAULT_SIZE, 
         | 
| 337 | 
            +
                                            Wx::TE_MULTILINE|Wx::TE_READONLY|Wx::HSCROLL)
         | 
| 338 | 
            +
                    # For some reason when the number of characters entered is
         | 
| 339 | 
            +
                    # greater than about 10,700, the text control freezes.  I know  
         | 
| 340 | 
            +
                    # someone mentioned this on the list a while ago...calling
         | 
| 341 | 
            +
                    # set_max_length(0) with zero as the argument tells the text 
         | 
| 342 | 
            +
                    # control to default limit that the underlying native text
         | 
| 343 | 
            +
                    # control can handle. 
         | 
| 344 | 
            +
                    @log.set_max_length(0)
         | 
| 345 | 
            +
                    Wx::Log::set_active_target(Wx::LogTextCtrl.new(@log))
         | 
| 346 | 
            +
                    
         | 
| 347 | 
            +
                    splitter.split_vertically(@tree, splitter2, 220)
         | 
| 348 | 
            +
                    splitter2.split_horizontally(@nb, @log, 300)
         | 
| 349 | 
            +
             | 
| 350 | 
            +
                    
         | 
| 351 | 
            +
                    splitter.set_minimum_pane_size(20)        
         | 
| 352 | 
            +
                    splitter2.set_minimum_pane_size(100)
         | 
| 353 | 
            +
                    
         | 
| 354 | 
            +
                    @nb.set_selection(0)
         | 
| 355 | 
            +
                    @tree.select_item(root)
         | 
| 356 | 
            +
                    show_tip()
         | 
| 357 | 
            +
                end
         | 
| 358 | 
            +
                
         | 
| 359 | 
            +
                def write_text(text)
         | 
| 360 | 
            +
                    Wx::log_message(text)
         | 
| 361 | 
            +
                end
         | 
| 362 | 
            +
                
         | 
| 363 | 
            +
                def on_idle(event)
         | 
| 364 | 
            +
                    if @otherWin != nil
         | 
| 365 | 
            +
                        @otherWin.raise()
         | 
| 366 | 
            +
                        @window = @otherWin
         | 
| 367 | 
            +
                        @otherWin = nil
         | 
| 368 | 
            +
                    end
         | 
| 369 | 
            +
                end
         | 
| 370 | 
            +
                
         | 
| 371 | 
            +
                def on_close(event)
         | 
| 372 | 
            +
                    @tbicon.remove_icon
         | 
| 373 | 
            +
                    destroy()
         | 
| 374 | 
            +
                    exit()
         | 
| 375 | 
            +
                end
         | 
| 376 | 
            +
                
         | 
| 377 | 
            +
                def on_item_expanded(event)
         | 
| 378 | 
            +
                    item = event.get_item()
         | 
| 379 | 
            +
                    Wx::log_message("on_item_expanded: %s" % @tree.get_item_text(item))
         | 
| 380 | 
            +
                end
         | 
| 381 | 
            +
                
         | 
| 382 | 
            +
                def on_item_collapsed(event)
         | 
| 383 | 
            +
                    item = event.get_item()
         | 
| 384 | 
            +
                    Wx::log_message("on_item_collapsed: %s" % @tree.get_item_text(item))
         | 
| 385 | 
            +
                end
         | 
| 386 | 
            +
                
         | 
| 387 | 
            +
                def on_tree_sel_changed(event)
         | 
| 388 | 
            +
             | 
| 389 | 
            +
                    item = event.get_item()
         | 
| 390 | 
            +
             | 
| 391 | 
            +
                    if item.nonzero?
         | 
| 392 | 
            +
                      itemText = @tree.get_item_text(item)
         | 
| 393 | 
            +
                      run_demo(itemText)
         | 
| 394 | 
            +
                    end
         | 
| 395 | 
            +
                end
         | 
| 396 | 
            +
                
         | 
| 397 | 
            +
                def on_tree_left_down(event)
         | 
| 398 | 
            +
                    pt = Wx::Point.new(event.get_x, event.get_y)
         | 
| 399 | 
            +
                    item = @tree.hit_test(pt)
         | 
| 400 | 
            +
                    if item == @tree.get_selection()
         | 
| 401 | 
            +
                        set_overview(@tree.get_item_text(item) + " Overview", @curOverview)
         | 
| 402 | 
            +
                        Wx::log_message(@tree.get_item_text(item) + " Overview")
         | 
| 403 | 
            +
             | 
| 404 | 
            +
                    end
         | 
| 405 | 
            +
             | 
| 406 | 
            +
                    event.skip()
         | 
| 407 | 
            +
                end
         | 
| 408 | 
            +
                
         | 
| 409 | 
            +
                def run_demo(itemText)
         | 
| 410 | 
            +
                    if @nb.get_page_count() == 3
         | 
| 411 | 
            +
                        if @nb.get_selection() == 2
         | 
| 412 | 
            +
                            @nb.set_selection(0)
         | 
| 413 | 
            +
                        end
         | 
| 414 | 
            +
                        if @window != nil
         | 
| 415 | 
            +
                            @window = nil
         | 
| 416 | 
            +
                        end
         | 
| 417 | 
            +
                        @nb.delete_page(2)
         | 
| 418 | 
            +
                    end
         | 
| 419 | 
            +
                    
         | 
| 420 | 
            +
                    if itemText == "wxRuby Overview"
         | 
| 421 | 
            +
                        get_demo_file(__FILE__)
         | 
| 422 | 
            +
                        set_overview("wxRuby Overview", OVR_TEXT)
         | 
| 423 | 
            +
                        @nb.refresh()
         | 
| 424 | 
            +
                        @window = nil       
         | 
| 425 | 
            +
                    else
         | 
| 426 | 
            +
                      demo_file = File.join( File.dirname(__FILE__), itemText + '.rbw')
         | 
| 427 | 
            +
                        if File.exist?(demo_file)
         | 
| 428 | 
            +
                            Wx::log_message("Running Demo: " + itemText + ".rbw")
         | 
| 429 | 
            +
                            get_demo_file(demo_file)
         | 
| 430 | 
            +
                            # I use load() here because it allows the user to modify
         | 
| 431 | 
            +
                            # the underlying file for each sample, so that each time 
         | 
| 432 | 
            +
                            # They run it any changes made will be reflected without
         | 
| 433 | 
            +
                            # having to restart the demo. 
         | 
| 434 | 
            +
                            begin
         | 
| 435 | 
            +
                                load demo_file
         | 
| 436 | 
            +
                                set_overview(itemText + " Overview", Demo::overview)
         | 
| 437 | 
            +
                                @tree.refresh()
         | 
| 438 | 
            +
                                @nb.refresh()
         | 
| 439 | 
            +
                                @window = Demo.run(self, @nb, self)
         | 
| 440 | 
            +
                                if @window.class.ancestors.include?(Wx::Window)
         | 
| 441 | 
            +
                                    # Check to see if the demo returned a Wx::Window, Wx::Panel or a new class inheriting from them
         | 
| 442 | 
            +
                                    # if so, create a new tab in the notebook for them
         | 
| 443 | 
            +
                                    @nb.add_page(@window, "Demo")
         | 
| 444 | 
            +
                                    @nb.set_selection(2)
         | 
| 445 | 
            +
                                    @nb.refresh()
         | 
| 446 | 
            +
                                end
         | 
| 447 | 
            +
                            rescue Exception => problem
         | 
| 448 | 
            +
                                dlg = Wx::MessageDialog.new(self, "A problem occurred with the %s demo:\n%s\n%s" % [itemText, problem, problem.backtrace().join("\n").to_s()], 
         | 
| 449 | 
            +
                                                            "Error!!!", Wx::OK | Wx::ICON_ERROR)
         | 
| 450 | 
            +
                                dlg.show_modal()
         | 
| 451 | 
            +
                                dlg.destroy()
         | 
| 452 | 
            +
                            end
         | 
| 453 | 
            +
                        else
         | 
| 454 | 
            +
                            @ovr.set_value("")
         | 
| 455 | 
            +
                            @txt.clear_all
         | 
| 456 | 
            +
                            @window = nil
         | 
| 457 | 
            +
                        end
         | 
| 458 | 
            +
                    end
         | 
| 459 | 
            +
                    @tree.set_focus()
         | 
| 460 | 
            +
                end
         | 
| 461 | 
            +
                
         | 
| 462 | 
            +
                def get_demo_file(fileName)
         | 
| 463 | 
            +
                    @filename = fileName
         | 
| 464 | 
            +
                    @txt.clear()
         | 
| 465 | 
            +
                    @txt.load_file(fileName)
         | 
| 466 | 
            +
                    if @txt.is_a?(Wx::TextCtrl)
         | 
| 467 | 
            +
                      @txt.set_insertion_point(0)
         | 
| 468 | 
            +
                      @txt.show_position(0)
         | 
| 469 | 
            +
                    end
         | 
| 470 | 
            +
                end
         | 
| 471 | 
            +
                
         | 
| 472 | 
            +
                def set_overview(name, text)
         | 
| 473 | 
            +
                    text ||= ''
         | 
| 474 | 
            +
                    @curOverview = text
         | 
| 475 | 
            +
                    @ovr.set_value(text)
         | 
| 476 | 
            +
                    @ovr.set_style(0,text.length,Wx::TextAttr.new(Wx::BLUE, Wx::Colour.new("White"), Wx::Font.new(12, Wx::FONTFAMILY_SWISS, Wx::FONTSTYLE_NORMAL, Wx::FONTWEIGHT_BOLD)))
         | 
| 477 | 
            +
                    @nb.set_page_text(0, name)
         | 
| 478 | 
            +
                end
         | 
| 479 | 
            +
                
         | 
| 480 | 
            +
                # Menu Methods
         | 
| 481 | 
            +
                
         | 
| 482 | 
            +
                def on_file_exit(event)
         | 
| 483 | 
            +
                    close()
         | 
| 484 | 
            +
                end
         | 
| 485 | 
            +
                
         | 
| 486 | 
            +
                def on_help_about(event)
         | 
| 487 | 
            +
                    load File.join(File.dirname(__FILE__), "About.rbw")
         | 
| 488 | 
            +
                    about = About::MyAboutBox.new(self)
         | 
| 489 | 
            +
                    about.show_modal()
         | 
| 490 | 
            +
                    about.destroy()
         | 
| 491 | 
            +
                end
         | 
| 492 | 
            +
                
         | 
| 493 | 
            +
                def on_help_find(event)
         | 
| 494 | 
            +
                    @nb.set_selection(1)
         | 
| 495 | 
            +
                    @finddlg = Wx::FindReplaceDialog.new(self, @finddata, "Find", Wx::FR_NOUPDOWN | Wx::FR_NOMATCHCASE | Wx::FR_NOWHOLEWORD)
         | 
| 496 | 
            +
                    @finddlg.show()
         | 
| 497 | 
            +
                end
         | 
| 498 | 
            +
                
         | 
| 499 | 
            +
                def on_find(event)
         | 
| 500 | 
            +
                    # FIXME: These problems are probably resolved now
         | 
| 501 | 
            +
                    # Problems
         | 
| 502 | 
            +
                    # 1) For some reason, the control is not properly counting EOL characters - it almost seems to be skipping them
         | 
| 503 | 
            +
                    #    causing the control to incorrectly set the initial insertion point for the the "found" text
         | 
| 504 | 
            +
                    # 2) This also is causing problems with the amount of text that is highlighted - the length of the highlighted string
         | 
| 505 | 
            +
                    #    is less than it should be 
         | 
| 506 | 
            +
                    # 3) After doing an initial "find" operation, using the "find next" operation causes the program to crash - again, I
         | 
| 507 | 
            +
                    #    don't know why this is :(
         | 
| 508 | 
            +
                    # Example - When I try to find "menu", the text that gets highlighted is the newline on the second line and the "ME" of 
         | 
| 509 | 
            +
                    #           MENU_EXIT - a total of only 3 characters, when it should highlight all of "menu".  I don't fully understand
         | 
| 510 | 
            +
                    #           this problem, but it doesn't appear until after you attempt to find text beyond the first line :(
         | 
| 511 | 
            +
                    if @txt.is_a?(Wx::TextCtrl)
         | 
| 512 | 
            +
                      @nb.set_selection(1)
         | 
| 513 | 
            +
                      myEnd = @txt.get_last_position()
         | 
| 514 | 
            +
                      write_text("Last position = %d" % myEnd)
         | 
| 515 | 
            +
                      textstring = @txt.get_range(0,myEnd).downcase()
         | 
| 516 | 
            +
                      if Wx::PLATFORM == "WXMSW"
         | 
| 517 | 
            +
                          textstring.sub!(/\n/, "\r\n")
         | 
| 518 | 
            +
                      end
         | 
| 519 | 
            +
                      #write_text("textstring - %s" % textstring)
         | 
| 520 | 
            +
                      start = @txt.get_insertion_point()
         | 
| 521 | 
            +
                      write_text("insertion point = " + start.to_s())
         | 
| 522 | 
            +
                      findstring = @finddata.get_find_string().downcase()
         | 
| 523 | 
            +
                      write_text("finddata = " + findstring)
         | 
| 524 | 
            +
                      loc = textstring.index(findstring, start)
         | 
| 525 | 
            +
                      write_text("location = " + loc.to_s())
         | 
| 526 | 
            +
                      write_text("findstring.length() = " + findstring.length().to_s())
         | 
| 527 | 
            +
                      if loc == nil and start != 0
         | 
| 528 | 
            +
                        # string not found, start at beginning
         | 
| 529 | 
            +
                        start = 0
         | 
| 530 | 
            +
                        loc = textstring.index(findstring, start)
         | 
| 531 | 
            +
                      end
         | 
| 532 | 
            +
                    
         | 
| 533 | 
            +
                      if loc == nil
         | 
| 534 | 
            +
                        dlg = Wx::MessageDialog.new(self, 'Find String Not Found', 'Find String Not Found in Demo File',
         | 
| 535 | 
            +
                                                      Wx::OK | Wx::ICON_INFORMATION)
         | 
| 536 | 
            +
                        dlg.show_modal()
         | 
| 537 | 
            +
                        dlg.destroy()
         | 
| 538 | 
            +
                      end
         | 
| 539 | 
            +
                    
         | 
| 540 | 
            +
                      if @finddlg
         | 
| 541 | 
            +
                        if loc == nil
         | 
| 542 | 
            +
                            @finddlg.set_focus()
         | 
| 543 | 
            +
                            return
         | 
| 544 | 
            +
                        else
         | 
| 545 | 
            +
                            @finddlg.hide()
         | 
| 546 | 
            +
                        end
         | 
| 547 | 
            +
                      end
         | 
| 548 | 
            +
                      @txt.show_position(loc)
         | 
| 549 | 
            +
                      @txt.set_selection(loc, loc + findstring.length())
         | 
| 550 | 
            +
                    else # Scintilla
         | 
| 551 | 
            +
                      # FIXME: Take into account search direction
         | 
| 552 | 
            +
                      @txt.set_target_start(@txt.get_target_end)
         | 
| 553 | 
            +
                      @txt.set_target_end(@txt.get_length - 1)
         | 
| 554 | 
            +
                      # FIXME: get flags from find dialog
         | 
| 555 | 
            +
                      @txt.set_search_flags(0)
         | 
| 556 | 
            +
                      loc = @txt.search_in_target(event.get_find_string)
         | 
| 557 | 
            +
                      if loc == -1
         | 
| 558 | 
            +
                        dlg = Wx::MessageDialog.new(self, 'Find String Not Found', 'Find String Not Found in Demo File',
         | 
| 559 | 
            +
                                                      Wx::OK | Wx::ICON_INFORMATION)
         | 
| 560 | 
            +
                        dlg.show_modal()
         | 
| 561 | 
            +
                        dlg.destroy()
         | 
| 562 | 
            +
                      end
         | 
| 563 | 
            +
             | 
| 564 | 
            +
                      if @finddlg
         | 
| 565 | 
            +
                        if loc == -1
         | 
| 566 | 
            +
                          @finddlg.set_focus()
         | 
| 567 | 
            +
                          return
         | 
| 568 | 
            +
                        end
         | 
| 569 | 
            +
                      end
         | 
| 570 | 
            +
                      @txt.ensure_caret_visible
         | 
| 571 | 
            +
                      @txt.set_selection(loc, loc + event.get_find_string.length)
         | 
| 572 | 
            +
                    end
         | 
| 573 | 
            +
                end
         | 
| 574 | 
            +
                
         | 
| 575 | 
            +
                def on_find_next(event)
         | 
| 576 | 
            +
                    # FIXME: Saving an event is probably a bad idea
         | 
| 577 | 
            +
                    if @finddata.get_find_string() != ""
         | 
| 578 | 
            +
                        on_find(event)
         | 
| 579 | 
            +
                    else
         | 
| 580 | 
            +
                        on_help_find(event)
         | 
| 581 | 
            +
                    end
         | 
| 582 | 
            +
                end
         | 
| 583 | 
            +
                
         | 
| 584 | 
            +
                def on_find_close(event)
         | 
| 585 | 
            +
                    event.get_dialog().destroy()
         | 
| 586 | 
            +
                end
         | 
| 587 | 
            +
                
         | 
| 588 | 
            +
                def show_tip()
         | 
| 589 | 
            +
                  tips_file = File.join(File.dirname(__FILE__), 'tips.txt')
         | 
| 590 | 
            +
                  tp = Wx::create_file_tip_provider( tips_file, rand(6) )
         | 
| 591 | 
            +
                  Wx::show_tip(self, tp)
         | 
| 592 | 
            +
                end
         | 
| 593 | 
            +
                
         | 
| 594 | 
            +
                def on_demo_menu(childItem)
         | 
| 595 | 
            +
                    # Also, for some reason I haven't figured out yet either, the demo executes two times
         | 
| 596 | 
            +
                    selectedDemo = @treeMap[childItem]
         | 
| 597 | 
            +
                    if selectedDemo
         | 
| 598 | 
            +
                        @tree.select_item(selectedDemo)
         | 
| 599 | 
            +
                        @tree.ensure_visible(selectedDemo)
         | 
| 600 | 
            +
                    end
         | 
| 601 | 
            +
                end
         | 
| 602 | 
            +
                
         | 
| 603 | 
            +
                def on_iconize(event)
         | 
| 604 | 
            +
                    Wx::log_message("on_iconify")
         | 
| 605 | 
            +
                    event.skip
         | 
| 606 | 
            +
                end
         | 
| 607 | 
            +
                
         | 
| 608 | 
            +
                def on_maximize(event)
         | 
| 609 | 
            +
                    Wx::log_message("on_maximize")
         | 
| 610 | 
            +
                    event.skip
         | 
| 611 | 
            +
                end
         | 
| 612 | 
            +
             | 
| 613 | 
            +
                # FIXME: Refactor into a class
         | 
| 614 | 
            +
                def setup_editor(parent)
         | 
| 615 | 
            +
                  panel = Wx::Panel.new(parent)
         | 
| 616 | 
            +
                  panel.hide
         | 
| 617 | 
            +
                  sci = setup_scintilla(panel)
         | 
| 618 | 
            +
                  @save_button = Wx::Button.new(panel, -1, 'Save Changes')
         | 
| 619 | 
            +
                  @delete_button = Wx::Button.new(panel, -1, 'Delete Modified')
         | 
| 620 | 
            +
                  @save_button.enable(false);
         | 
| 621 | 
            +
                  panel.evt_button(@save_button.get_id) { on_save }
         | 
| 622 | 
            +
                  panel.evt_button(@delete_button.get_id) { on_delete }
         | 
| 623 | 
            +
                  panel.evt_sci_modified { on_modified }
         | 
| 624 | 
            +
             | 
| 625 | 
            +
                  radio_buttons = {:original => Wx::RadioButton.new(panel, -1, "Original", Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::RB_GROUP),
         | 
| 626 | 
            +
                                   :modified => Wx::RadioButton.new(panel, -1, "Modified")}
         | 
| 627 | 
            +
                  
         | 
| 628 | 
            +
                  @control_box = Wx::BoxSizer.new(Wx::HORIZONTAL)
         | 
| 629 | 
            +
                  @control_box.add(Wx::StaticText.new(panel, -1, 'Active Version:'), 0, Wx::RIGHT | Wx::LEFT | Wx::ALIGN_CENTER_VERTICAL, 5)
         | 
| 630 | 
            +
                  radio_buttons.each_pair { |id, button|
         | 
| 631 | 
            +
                    @control_box.add(button, 0, Wx::EXPAND | Wx::RIGHT, 5)
         | 
| 632 | 
            +
                    evt_radiobutton(button.get_id) { |event| on_radio_button(event) }
         | 
| 633 | 
            +
                  }
         | 
| 634 | 
            +
                  @control_box.add(@save_button, 0, Wx::RIGHT, 5)
         | 
| 635 | 
            +
                  @control_box.add(@delete_button, 0)
         | 
| 636 | 
            +
             | 
| 637 | 
            +
                  @box = Wx::BoxSizer.new(Wx::VERTICAL)
         | 
| 638 | 
            +
                  @box.add(@control_box, 0, Wx::EXPAND)
         | 
| 639 | 
            +
                  @box.add(Wx::StaticLine.new(panel), 0, Wx::EXPAND)
         | 
| 640 | 
            +
                  
         | 
| 641 | 
            +
                  @box.add(sci, 1, Wx::EXPAND)
         | 
| 642 | 
            +
                  @box.fit(panel)
         | 
| 643 | 
            +
                  panel.set_sizer(@box)
         | 
| 644 | 
            +
                  [panel, sci]
         | 
| 645 | 
            +
                end
         | 
| 646 | 
            +
             | 
| 647 | 
            +
                def setup_scintilla(parent)
         | 
| 648 | 
            +
                  sci = Wx::Scintilla.new(parent)
         | 
| 649 | 
            +
                  font = Wx::Font.new(10, Wx::TELETYPE, Wx::NORMAL, Wx::NORMAL)
         | 
| 650 | 
            +
                  sci.style_set_font(Wx::SCI_STYLE_DEFAULT, font);
         | 
| 651 | 
            +
                  sci.set_edge_mode(Wx::SCI_EDGE_LINE)
         | 
| 652 | 
            +
                  line_num_margin = sci.text_width(Wx::SCI_STYLE_LINENUMBER, "_99999")
         | 
| 653 | 
            +
                  sci.set_margin_width(0, line_num_margin)
         | 
| 654 | 
            +
             | 
| 655 | 
            +
                  sci.style_set_foreground(Wx::SCI_STYLE_DEFAULT, Wx::BLACK);
         | 
| 656 | 
            +
                  sci.style_set_background(Wx::SCI_STYLE_DEFAULT, Wx::WHITE);
         | 
| 657 | 
            +
                  sci.style_set_foreground(Wx::SCI_STYLE_LINENUMBER, Wx::LIGHT_GREY);
         | 
| 658 | 
            +
                  sci.style_set_background(Wx::SCI_STYLE_LINENUMBER, Wx::WHITE);
         | 
| 659 | 
            +
                  sci.style_set_foreground(Wx::SCI_STYLE_INDENTGUIDE, Wx::LIGHT_GREY);
         | 
| 660 | 
            +
             | 
| 661 | 
            +
                  sci.set_tab_width(2)
         | 
| 662 | 
            +
                  sci.set_use_tabs(false)
         | 
| 663 | 
            +
                  sci.set_tab_indents(true)
         | 
| 664 | 
            +
                  sci.set_back_space_un_indents(true)
         | 
| 665 | 
            +
                  sci.set_indent(2)
         | 
| 666 | 
            +
                  sci.set_edge_column(80)
         | 
| 667 | 
            +
             | 
| 668 | 
            +
                  sci.set_lexer(Wx::SCI_LEX_RUBY)
         | 
| 669 | 
            +
                  sci.style_clear_all
         | 
| 670 | 
            +
                  sci.style_set_foreground(2, Wx::RED)
         | 
| 671 | 
            +
                  sci.style_set_foreground(3, Wx::GREEN)
         | 
| 672 | 
            +
                  sci.style_set_foreground(5, Wx::BLUE)
         | 
| 673 | 
            +
                  sci.style_set_foreground(6, Wx::BLUE)
         | 
| 674 | 
            +
                  sci.style_set_foreground(7, Wx::BLUE)
         | 
| 675 | 
            +
                  sci.set_key_words(0, "begin break elsif module retry unless end case next return until class ensure nil self when def false not super while alias defined? for or then yield and do if redo true else in rescue undef")
         | 
| 676 | 
            +
             | 
| 677 | 
            +
                  sci.set_property("fold","1")
         | 
| 678 | 
            +
                  sci.set_property("fold.compact", "0")
         | 
| 679 | 
            +
                  sci.set_property("fold.comment", "1")
         | 
| 680 | 
            +
                  sci.set_property("fold.preprocessor", "1")
         | 
| 681 | 
            +
             | 
| 682 | 
            +
                  sci.set_margin_width(1, 0)
         | 
| 683 | 
            +
                  sci.set_margin_type(1, Wx::SCI_MARGIN_SYMBOL)
         | 
| 684 | 
            +
                  sci.set_margin_mask(1, Wx::SCI_MASK_FOLDERS)
         | 
| 685 | 
            +
                  sci.set_margin_width(1, 20)
         | 
| 686 | 
            +
             | 
| 687 | 
            +
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDER, Wx::SCI_MARK_PLUS)
         | 
| 688 | 
            +
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDEROPEN, Wx::SCI_MARK_MINUS)
         | 
| 689 | 
            +
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDEREND, Wx::SCI_MARK_EMPTY)
         | 
| 690 | 
            +
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDERMIDTAIL, Wx::SCI_MARK_EMPTY)
         | 
| 691 | 
            +
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDEROPENMID, Wx::SCI_MARK_EMPTY)
         | 
| 692 | 
            +
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDERSUB, Wx::SCI_MARK_EMPTY)
         | 
| 693 | 
            +
                  sci.marker_define(Wx::SCI_MARKNUM_FOLDERTAIL, Wx::SCI_MARK_EMPTY)
         | 
| 694 | 
            +
                  sci.set_fold_flags(16)
         | 
| 695 | 
            +
             | 
| 696 | 
            +
                  sci.set_margin_sensitive(1,1)
         | 
| 697 | 
            +
                  sci
         | 
| 698 | 
            +
                end
         | 
| 699 | 
            +
             | 
| 700 | 
            +
                def on_save
         | 
| 701 | 
            +
                  if not FileTest.directory?(File.dirname(modified_filename))
         | 
| 702 | 
            +
                    if not Dir.mkdir(File.dirname(modified_filename))
         | 
| 703 | 
            +
                      Wx::log_message("Unable to create directory 'modified'")
         | 
| 704 | 
            +
                      return
         | 
| 705 | 
            +
                    end
         | 
| 706 | 
            +
                  end
         | 
| 707 | 
            +
                  File.open(modified_filename, "w") { |file|
         | 
| 708 | 
            +
                    file.write(@txt.get_text)
         | 
| 709 | 
            +
                  }
         | 
| 710 | 
            +
                  # FIXME: Reload module we just saved
         | 
| 711 | 
            +
                end
         | 
| 712 | 
            +
             | 
| 713 | 
            +
                def on_delete
         | 
| 714 | 
            +
                  if File.exists?(modified_filename)
         | 
| 715 | 
            +
                    File.unlink(modified_filename)
         | 
| 716 | 
            +
                  end
         | 
| 717 | 
            +
                  # FIXME: Update state
         | 
| 718 | 
            +
                end
         | 
| 719 | 
            +
             | 
| 720 | 
            +
                def on_modified
         | 
| 721 | 
            +
                  @save_button.enable(@txt.get_modify)
         | 
| 722 | 
            +
                end
         | 
| 723 | 
            +
             | 
| 724 | 
            +
                def on_radio_button(event)
         | 
| 725 | 
            +
                  # FIXME: Can't do anything here yet
         | 
| 726 | 
            +
                end
         | 
| 727 | 
            +
             | 
| 728 | 
            +
                def modified_filename
         | 
| 729 | 
            +
                  File.join(File.dirname(@filename), "modified", File.basename(@filename))
         | 
| 730 | 
            +
                end
         | 
| 731 | 
            +
            end
         | 
| 732 | 
            +
             | 
| 733 | 
            +
            class DemoTaskBarIcon < Wx::TaskBarIcon
         | 
| 734 | 
            +
              # TODO: Need a new_id function like wxPython has
         | 
| 735 | 
            +
              TBMENU_RESTORE = 6000
         | 
| 736 | 
            +
              TBMENU_CLOSE = 6001
         | 
| 737 | 
            +
              TBMENU_CHANGE = 6002
         | 
| 738 | 
            +
              TBMENU_REMOVE = 6003
         | 
| 739 | 
            +
             | 
| 740 | 
            +
              def initialize(frame)
         | 
| 741 | 
            +
                super()
         | 
| 742 | 
            +
             | 
| 743 | 
            +
                @frame = frame
         | 
| 744 | 
            +
             | 
| 745 | 
            +
                # starting image
         | 
| 746 | 
            +
                icon = make_icon('ruby.png')
         | 
| 747 | 
            +
                set_icon(icon, 'wxRuby Demo')
         | 
| 748 | 
            +
                @image_index = 1
         | 
| 749 | 
            +
             | 
| 750 | 
            +
                # events
         | 
| 751 | 
            +
                evt_taskbar_left_dclick  {|evt| on_taskbar_activate(evt) }
         | 
| 752 | 
            +
                
         | 
| 753 | 
            +
                evt_menu(TBMENU_RESTORE) {|evt| on_taskbar_activate(evt) }
         | 
| 754 | 
            +
                evt_menu(TBMENU_CLOSE)   { @frame.close }
         | 
| 755 | 
            +
                evt_menu(TBMENU_CHANGE)  {|evt| on_taskbar_change(evt) }
         | 
| 756 | 
            +
                evt_menu(TBMENU_REMOVE)  { remove_icon }
         | 
| 757 | 
            +
              end
         | 
| 758 | 
            +
             | 
| 759 | 
            +
              def create_popup_menu
         | 
| 760 | 
            +
                # Called by the base class when it needs to popup the menu
         | 
| 761 | 
            +
                #  (the default evt_right_down event).  Create and return
         | 
| 762 | 
            +
                #  the menu to display.
         | 
| 763 | 
            +
                menu = Wx::Menu.new
         | 
| 764 | 
            +
                menu.append(TBMENU_RESTORE, "Restore wxRuby Demo")
         | 
| 765 | 
            +
                menu.append(TBMENU_CLOSE,   "Close wxRuby Demo")
         | 
| 766 | 
            +
                menu.append_separator
         | 
| 767 | 
            +
                menu.append(TBMENU_CHANGE,  "Change the TB Icon")
         | 
| 768 | 
            +
                menu.append(TBMENU_REMOVE,  "Remove the TB Icon")
         | 
| 769 | 
            +
                return menu
         | 
| 770 | 
            +
              end
         | 
| 771 | 
            +
             | 
| 772 | 
            +
              def make_icon(imgname)
         | 
| 773 | 
            +
                # Different platforms have different requirements for the
         | 
| 774 | 
            +
                #  taskbar icon size
         | 
| 775 | 
            +
                filename = File.join( File.dirname(__FILE__), 'icons', imgname )
         | 
| 776 | 
            +
                img = Wx::Image.new(filename)
         | 
| 777 | 
            +
                if Wx::PLATFORM == "WXMSW"
         | 
| 778 | 
            +
                  img = img.scale(16, 16)
         | 
| 779 | 
            +
                elsif Wx::PLATFORM == "WXGTK"
         | 
| 780 | 
            +
                  img = img.scale(22, 22)
         | 
| 781 | 
            +
                end
         | 
| 782 | 
            +
                # WXMAC can be any size up to 128x128, so don't scale
         | 
| 783 | 
            +
                icon = Wx::Icon.new
         | 
| 784 | 
            +
                icon.copy_from_bitmap(Wx::Bitmap.new(img))
         | 
| 785 | 
            +
                return icon
         | 
| 786 | 
            +
              end
         | 
| 787 | 
            +
             | 
| 788 | 
            +
              def on_taskbar_activate(evt)
         | 
| 789 | 
            +
                if @frame.is_iconized
         | 
| 790 | 
            +
                  @frame.iconize(false)
         | 
| 791 | 
            +
                end
         | 
| 792 | 
            +
                if not @frame.is_shown
         | 
| 793 | 
            +
                  @frame.show(true)
         | 
| 794 | 
            +
                end
         | 
| 795 | 
            +
                @frame.raise
         | 
| 796 | 
            +
              end
         | 
| 797 | 
            +
             | 
| 798 | 
            +
              def on_taskbar_change(evt)
         | 
| 799 | 
            +
                names = [ "ruby.png", "wxwin16x16.xpm", "smiles.xpm", "mondrian.xpm" ]
         | 
| 800 | 
            +
                name = names[@image_index]
         | 
| 801 | 
            +
                @image_index += 1
         | 
| 802 | 
            +
                if @image_index >= names.length
         | 
| 803 | 
            +
                  @image_index = 0
         | 
| 804 | 
            +
                end
         | 
| 805 | 
            +
             | 
| 806 | 
            +
                icon = make_icon(name)
         | 
| 807 | 
            +
                set_icon(icon, 'This is a new icon: ' + name)
         | 
| 808 | 
            +
              end
         | 
| 809 | 
            +
             | 
| 810 | 
            +
            end
         | 
| 811 | 
            +
             | 
| 812 | 
            +
            class DemoApp < Wx::App
         | 
| 813 | 
            +
              def on_init
         | 
| 814 | 
            +
                frame = WxRubyDemo.new("WxRuby BIG combined demo",
         | 
| 815 | 
            +
                                       Wx::DEFAULT_POSITION, 
         | 
| 816 | 
            +
                                       Wx::Size.new(750, 550))
         | 
| 817 | 
            +
             | 
| 818 | 
            +
                frame.show(true)
         | 
| 819 | 
            +
              end
         | 
| 820 | 
            +
            end
         | 
| 821 | 
            +
             | 
| 822 | 
            +
            demo = DemoApp.new
         | 
| 823 | 
            +
            demo.main_loop
         |