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
| @@ -1,271 +1,256 @@ | |
| 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 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
                 | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
                 | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
                 | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
                 | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
              def  | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
                 | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
                 | 
| 73 | 
            -
             | 
| 74 | 
            -
                 | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
                 | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 109 | 
            -
             | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
                 | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
                menu_cal | 
| 117 | 
            -
                menu_cal.append( | 
| 118 | 
            -
             | 
| 119 | 
            -
             | 
| 120 | 
            -
             | 
| 121 | 
            -
                menu_cal.append( | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
                menu_cal.append( | 
| 125 | 
            -
             | 
| 126 | 
            -
             | 
| 127 | 
            -
             | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 130 | 
            -
             | 
| 131 | 
            -
                 | 
| 132 | 
            -
             | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 136 | 
            -
                 | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
| 139 | 
            -
                 | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
             | 
| 144 | 
            -
                 | 
| 145 | 
            -
                 | 
| 146 | 
            -
             | 
| 147 | 
            -
             | 
| 148 | 
            -
             | 
| 149 | 
            -
                 | 
| 150 | 
            -
                 | 
| 151 | 
            -
                 | 
| 152 | 
            -
             | 
| 153 | 
            -
             | 
| 154 | 
            -
             | 
| 155 | 
            -
             | 
| 156 | 
            -
             | 
| 157 | 
            -
                 | 
| 158 | 
            -
             | 
| 159 | 
            -
             | 
| 160 | 
            -
             | 
| 161 | 
            -
                 | 
| 162 | 
            -
             | 
| 163 | 
            -
             | 
| 164 | 
            -
             | 
| 165 | 
            -
             | 
| 166 | 
            -
             | 
| 167 | 
            -
             | 
| 168 | 
            -
                 | 
| 169 | 
            -
             | 
| 170 | 
            -
             | 
| 171 | 
            -
             | 
| 172 | 
            -
                 | 
| 173 | 
            -
                 | 
| 174 | 
            -
             | 
| 175 | 
            -
             | 
| 176 | 
            -
             | 
| 177 | 
            -
             | 
| 178 | 
            -
             | 
| 179 | 
            -
             | 
| 180 | 
            -
             | 
| 181 | 
            -
             | 
| 182 | 
            -
             | 
| 183 | 
            -
             | 
| 184 | 
            -
             | 
| 185 | 
            -
             | 
| 186 | 
            -
             | 
| 187 | 
            -
             | 
| 188 | 
            -
             | 
| 189 | 
            -
             | 
| 190 | 
            -
             | 
| 191 | 
            -
             | 
| 192 | 
            -
             | 
| 193 | 
            -
             | 
| 194 | 
            -
             | 
| 195 | 
            -
             | 
| 196 | 
            -
             | 
| 197 | 
            -
                 | 
| 198 | 
            -
             | 
| 199 | 
            -
             | 
| 200 | 
            -
             | 
| 201 | 
            -
             | 
| 202 | 
            -
             | 
| 203 | 
            -
             | 
| 204 | 
            -
             | 
| 205 | 
            -
             | 
| 206 | 
            -
             | 
| 207 | 
            -
             | 
| 208 | 
            -
                 | 
| 209 | 
            -
             | 
| 210 | 
            -
             | 
| 211 | 
            -
             | 
| 212 | 
            -
             | 
| 213 | 
            -
                end
         | 
| 214 | 
            -
             | 
| 215 | 
            -
             | 
| 216 | 
            -
             | 
| 217 | 
            -
             | 
| 218 | 
            -
             | 
| 219 | 
            -
             | 
| 220 | 
            -
                 | 
| 221 | 
            -
             | 
| 222 | 
            -
             | 
| 223 | 
            -
             | 
| 224 | 
            -
             | 
| 225 | 
            -
             | 
| 226 | 
            -
             | 
| 227 | 
            -
             | 
| 228 | 
            -
             | 
| 229 | 
            -
                  @calendar | 
| 230 | 
            -
                  @ | 
| 231 | 
            -
             | 
| 232 | 
            -
             | 
| 233 | 
            -
             | 
| 234 | 
            -
             | 
| 235 | 
            -
             | 
| 236 | 
            -
             | 
| 237 | 
            -
             | 
| 238 | 
            -
             | 
| 239 | 
            -
             | 
| 240 | 
            -
             | 
| 241 | 
            -
             | 
| 242 | 
            -
             | 
| 243 | 
            -
             | 
| 244 | 
            -
             | 
| 245 | 
            -
             | 
| 246 | 
            -
             | 
| 247 | 
            -
             | 
| 248 | 
            -
             | 
| 249 | 
            -
             | 
| 250 | 
            -
             | 
| 251 | 
            -
                 | 
| 252 | 
            -
             | 
| 253 | 
            -
             | 
| 254 | 
            -
             | 
| 255 | 
            -
             | 
| 256 | 
            -
             | 
| 257 | 
            -
                                         "Date chosen" ).show_modal
         | 
| 258 | 
            -
                end
         | 
| 259 | 
            -
                
         | 
| 260 | 
            -
            end
         | 
| 261 | 
            -
             | 
| 262 | 
            -
             | 
| 263 | 
            -
            class RbApp < App
         | 
| 264 | 
            -
                def on_init()
         | 
| 265 | 
            -
              	    frame = MyFrame.new("Calendar Windows sample")
         | 
| 266 | 
            -
                frame.show(true)
         | 
| 267 | 
            -
                end
         | 
| 268 | 
            -
            end
         | 
| 269 | 
            -
             | 
| 270 | 
            -
            a = RbApp.new
         | 
| 271 | 
            -
            a.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 | 
            +
            include Wx
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            Calendar_Cal_Monday = 200
         | 
| 13 | 
            +
            Calendar_Cal_Holidays = 201
         | 
| 14 | 
            +
            Calendar_Cal_Special = 202
         | 
| 15 | 
            +
            Calendar_Cal_Month = 203
         | 
| 16 | 
            +
            Calendar_Cal_Year = 204
         | 
| 17 | 
            +
            Calendar_Cal_SeqMonth = 205
         | 
| 18 | 
            +
            Calendar_Cal_SurroundWeeks = 206
         | 
| 19 | 
            +
             | 
| 20 | 
            +
             | 
| 21 | 
            +
            class MyCalendar < CalendarCtrl
         | 
| 22 | 
            +
              def initialize(parent, display_frame, initial_date, calendar_flags)
         | 
| 23 | 
            +
                super( parent, 
         | 
| 24 | 
            +
                       :date  => initial_date, 
         | 
| 25 | 
            +
                       :style => calendar_flags | RAISED_BORDER)
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                @display = display_frame
         | 
| 28 | 
            +
                @date = initial_date
         | 
| 29 | 
            +
                @weekday_names = %w|Sun Mon Tue Wed Thu Fri Sat|
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                evt_calendar self, :on_calendar
         | 
| 32 | 
            +
                evt_calendar_month self, :on_cal_month_change
         | 
| 33 | 
            +
                evt_calendar_year self, :on_cal_year_change
         | 
| 34 | 
            +
                evt_calendar_sel_changed self, :on_calendar_change
         | 
| 35 | 
            +
                evt_calendar_weekday_clicked self, :on_calendar_weekday_click
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
              def on_calendar(event)
         | 
| 39 | 
            +
                @display.date = event.date
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
              def on_calendar_change(event)
         | 
| 43 | 
            +
                @date = event.date
         | 
| 44 | 
            +
                log_status("Selected date: #{@date.strftime('%Y-%M-%D')}")
         | 
| 45 | 
            +
              end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
              def on_cal_month_change
         | 
| 48 | 
            +
                log_status("Calendar month changed")
         | 
| 49 | 
            +
              end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
              def on_cal_year_change
         | 
| 52 | 
            +
                log_status("Calendar year changed")
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
              def on_calendar_weekday_click(event)
         | 
| 56 | 
            +
                wday = event.week_day
         | 
| 57 | 
            +
                log_status("Clicked on #{@weekday_names[wday]}")
         | 
| 58 | 
            +
              end
         | 
| 59 | 
            +
              
         | 
| 60 | 
            +
              attr_reader :date
         | 
| 61 | 
            +
            end
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            class MyFrame < Frame
         | 
| 64 | 
            +
              def initialize(title)
         | 
| 65 | 
            +
                super(nil, -1, title)
         | 
| 66 | 
            +
                @panel = Wx::Panel.new(self)
         | 
| 67 | 
            +
                add_menu_bar
         | 
| 68 | 
            +
                add_status_bar
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                @calendar_flags = CAL_MONDAY_FIRST | CAL_SHOW_HOLIDAYS
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                @calendar = MyCalendar.new(@panel, self, Time.now, @calendar_flags)
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                @sizer = BoxSizer.new(VERTICAL)
         | 
| 75 | 
            +
                configure_window
         | 
| 76 | 
            +
             | 
| 77 | 
            +
              	evt_menu Wx::ID_EXIT, :on_quit
         | 
| 78 | 
            +
              	evt_menu Wx::ID_ABOUT, :on_about
         | 
| 79 | 
            +
             | 
| 80 | 
            +
              	evt_menu Calendar_Cal_Monday, :on_cal_monday
         | 
| 81 | 
            +
              	evt_menu Calendar_Cal_Holidays, :on_cal_holidays
         | 
| 82 | 
            +
              	evt_menu Calendar_Cal_Special, :on_cal_special
         | 
| 83 | 
            +
             | 
| 84 | 
            +
              	evt_menu Calendar_Cal_Month, :on_cal_allow_month
         | 
| 85 | 
            +
              	evt_menu Calendar_Cal_Year, :on_cal_allow_year
         | 
| 86 | 
            +
             | 
| 87 | 
            +
              	evt_menu Calendar_Cal_SeqMonth, :on_cal_seq_month
         | 
| 88 | 
            +
              	evt_menu Calendar_Cal_SurroundWeeks, :on_cal_show_surrounding_weeks
         | 
| 89 | 
            +
             | 
| 90 | 
            +
              	evt_update_ui Calendar_Cal_Year, :on_allow_year_update
         | 
| 91 | 
            +
              end
         | 
| 92 | 
            +
              
         | 
| 93 | 
            +
              def add_menu_bar
         | 
| 94 | 
            +
                # create a menu bar
         | 
| 95 | 
            +
                menu_file = Menu.new
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                menu_file.append(Wx::ID_ABOUT, "&About...\tCtrl-A", "Show about dialog")
         | 
| 98 | 
            +
                menu_file.append_separator
         | 
| 99 | 
            +
                menu_file.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Quit self program")
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                menu_cal = Menu.new
         | 
| 102 | 
            +
                menu_cal.append(Calendar_Cal_Monday,
         | 
| 103 | 
            +
                                 "Monday &first weekday\tCtrl-F",
         | 
| 104 | 
            +
                                 "Toggle between Mon and Sun as the first week day",
         | 
| 105 | 
            +
                                 ITEM_CHECK)
         | 
| 106 | 
            +
                menu_cal.append(Calendar_Cal_Holidays, "Show &holidays\tCtrl-H",
         | 
| 107 | 
            +
                                 "Toggle highlighting the holidays",
         | 
| 108 | 
            +
                                 ITEM_CHECK)
         | 
| 109 | 
            +
                menu_cal.append(Calendar_Cal_Special, "Highlight &special dates\tCtrl-S",
         | 
| 110 | 
            +
                                 "Test custom highlighting",
         | 
| 111 | 
            +
                                 ITEM_CHECK)
         | 
| 112 | 
            +
                menu_cal.append(Calendar_Cal_SurroundWeeks,
         | 
| 113 | 
            +
                                 "Show s&urrounding weeks\tCtrl-W",
         | 
| 114 | 
            +
                                 "Show the neighbouring weeks in the prev/next month",
         | 
| 115 | 
            +
                                 ITEM_CHECK)
         | 
| 116 | 
            +
                menu_cal.append_separator
         | 
| 117 | 
            +
                menu_cal.append(Calendar_Cal_SeqMonth,
         | 
| 118 | 
            +
                                 "To&ggle month selector style\tCtrl-G",
         | 
| 119 | 
            +
                                 "Use another style for the calendar controls",
         | 
| 120 | 
            +
                                 ITEM_CHECK)
         | 
| 121 | 
            +
                menu_cal.append(Calendar_Cal_Month, "&Month can be changed\tCtrl-M",
         | 
| 122 | 
            +
                                 "Allow changing the month in the calendar",
         | 
| 123 | 
            +
                                 ITEM_CHECK)
         | 
| 124 | 
            +
                menu_cal.append(Calendar_Cal_Year, "&Year can be changed\tCtrl-Y",
         | 
| 125 | 
            +
                                 "Allow changing the year in the calendar",
         | 
| 126 | 
            +
                                 ITEM_CHECK)
         | 
| 127 | 
            +
             | 
| 128 | 
            +
                # now append the freshly created menu to the menu bar...
         | 
| 129 | 
            +
                menu_bar = MenuBar.new
         | 
| 130 | 
            +
                menu_bar.append(menu_file, "&File")
         | 
| 131 | 
            +
                menu_bar.append(menu_cal, "&Calendar")
         | 
| 132 | 
            +
             | 
| 133 | 
            +
                menu_bar.check(Calendar_Cal_Monday, TRUE)
         | 
| 134 | 
            +
                menu_bar.check(Calendar_Cal_Holidays, TRUE)
         | 
| 135 | 
            +
                menu_bar.check(Calendar_Cal_Month, TRUE)
         | 
| 136 | 
            +
                menu_bar.check(Calendar_Cal_Year, TRUE)
         | 
| 137 | 
            +
             | 
| 138 | 
            +
                # ... and attach self menu bar to the frame
         | 
| 139 | 
            +
                self.menu_bar = menu_bar
         | 
| 140 | 
            +
              end
         | 
| 141 | 
            +
             | 
| 142 | 
            +
              def add_status_bar
         | 
| 143 | 
            +
                # create a status bar just for fun (by default with 1 pane only)
         | 
| 144 | 
            +
                create_status_bar
         | 
| 145 | 
            +
                set_status_text("Welcome to Windows!")
         | 
| 146 | 
            +
              end
         | 
| 147 | 
            +
              
         | 
| 148 | 
            +
              def configure_window
         | 
| 149 | 
            +
                @sizer.add(@calendar, 0, Wx::ALIGN_CENTRE|Wx::ALL, 5)
         | 
| 150 | 
            +
                @sizer.size_hints = @panel
         | 
| 151 | 
            +
                layout
         | 
| 152 | 
            +
                @panel.sizer = @sizer
         | 
| 153 | 
            +
              end
         | 
| 154 | 
            +
              
         | 
| 155 | 
            +
              def on_quit
         | 
| 156 | 
            +
                # true is to force the frame to close
         | 
| 157 | 
            +
                close(true)
         | 
| 158 | 
            +
              end
         | 
| 159 | 
            +
             | 
| 160 | 
            +
              def on_about
         | 
| 161 | 
            +
                message_box("wxRuby CalendarCtrl sample\nby Kevin Smith\n" +
         | 
| 162 | 
            +
                             "based on the wxWidgets version by Vadim Zeitlin",
         | 
| 163 | 
            +
                             "About Calendar", OK | ICON_INFORMATION, self)
         | 
| 164 | 
            +
              end
         | 
| 165 | 
            +
             | 
| 166 | 
            +
              def on_cal_monday(event)
         | 
| 167 | 
            +
                enable = get_menu_bar().is_checked(event.get_id())
         | 
| 168 | 
            +
                toggle_cal_style(enable, CAL_MONDAY_FIRST)
         | 
| 169 | 
            +
              end
         | 
| 170 | 
            +
             | 
| 171 | 
            +
              def on_cal_holidays(event)
         | 
| 172 | 
            +
                enable = get_menu_bar().is_checked(event.get_id())
         | 
| 173 | 
            +
                @calendar.enable_holiday_display(enable)
         | 
| 174 | 
            +
              end
         | 
| 175 | 
            +
             | 
| 176 | 
            +
              def on_cal_special(event)
         | 
| 177 | 
            +
                highlight_special(get_menu_bar().is_checked(event.get_id()))
         | 
| 178 | 
            +
              end
         | 
| 179 | 
            +
             | 
| 180 | 
            +
              def on_cal_allow_month(event)
         | 
| 181 | 
            +
                allow = get_menu_bar().is_checked(event.get_id())
         | 
| 182 | 
            +
                @calendar.enable_month_change(allow)
         | 
| 183 | 
            +
              end
         | 
| 184 | 
            +
             | 
| 185 | 
            +
              def on_cal_allow_year(event)
         | 
| 186 | 
            +
                allow = get_menu_bar().is_checked(event.get_id())
         | 
| 187 | 
            +
                @calendar.enable_year_change(allow)
         | 
| 188 | 
            +
              end
         | 
| 189 | 
            +
             | 
| 190 | 
            +
              def on_cal_seq_month(event)
         | 
| 191 | 
            +
                allow = get_menu_bar().is_checked(event.get_id())
         | 
| 192 | 
            +
                toggle_cal_style(allow, CAL_SEQUENTIAL_MONTH_SELECTION)
         | 
| 193 | 
            +
              end
         | 
| 194 | 
            +
             | 
| 195 | 
            +
              def on_cal_show_surrounding_weeks(event)
         | 
| 196 | 
            +
                allow = get_menu_bar().is_checked(event.get_id())
         | 
| 197 | 
            +
                toggle_cal_style(allow, CAL_SHOW_SURROUNDING_WEEKS)
         | 
| 198 | 
            +
              end
         | 
| 199 | 
            +
             | 
| 200 | 
            +
              def on_allow_year_update(event)
         | 
| 201 | 
            +
                event.enable( get_menu_bar().is_checked(Calendar_Cal_Month))
         | 
| 202 | 
            +
              end
         | 
| 203 | 
            +
             | 
| 204 | 
            +
              def toggle_cal_style(on,flag)
         | 
| 205 | 
            +
                style = @calendar.get_window_style_flag
         | 
| 206 | 
            +
                date = @calendar.date
         | 
| 207 | 
            +
                @sizer.detach(@calendar)
         | 
| 208 | 
            +
                @calendar.destroy
         | 
| 209 | 
            +
                if  on
         | 
| 210 | 
            +
                  style |= flag
         | 
| 211 | 
            +
                else
         | 
| 212 | 
            +
                  style &= ~flag
         | 
| 213 | 
            +
                end
         | 
| 214 | 
            +
                @calendar = MyCalendar.new(@panel, self, date, style)
         | 
| 215 | 
            +
                @sizer.add(@calendar, 0, Wx::ALIGN_CENTRE|Wx::ALL, 5)
         | 
| 216 | 
            +
                @panel.layout
         | 
| 217 | 
            +
              end
         | 
| 218 | 
            +
             | 
| 219 | 
            +
              def highlight_special(on)
         | 
| 220 | 
            +
                if on
         | 
| 221 | 
            +
                  attr_red_circle = CalendarDateAttr.new(CAL_BORDER_ROUND, RED)
         | 
| 222 | 
            +
                  attr_green_square = CalendarDateAttr.new(CAL_BORDER_SQUARE, GREEN)
         | 
| 223 | 
            +
                  # This wraps correctly, but causes problems because the colour is freed
         | 
| 224 | 
            +
                  # when the attribute is reset.
         | 
| 225 | 
            +
                  #
         | 
| 226 | 
            +
                  # attr_header_like = CalendarDateAttr.new(BLUE, LIGHT_GREY)
         | 
| 227 | 
            +
             | 
| 228 | 
            +
                  @calendar.set_attr(17, attr_red_circle)
         | 
| 229 | 
            +
                  @calendar.set_attr(29, attr_green_square)
         | 
| 230 | 
            +
                  # @calendar.set_attr(13, attr_header_like)
         | 
| 231 | 
            +
                else
         | 
| 232 | 
            +
                  @calendar.reset_attr(17)
         | 
| 233 | 
            +
                  @calendar.reset_attr(29)
         | 
| 234 | 
            +
                  # @calendar.reset_attr(13)
         | 
| 235 | 
            +
                end
         | 
| 236 | 
            +
                @calendar.refresh()
         | 
| 237 | 
            +
              end
         | 
| 238 | 
            +
             | 
| 239 | 
            +
              def set_date(d)
         | 
| 240 | 
            +
                str = "%s-%s-%s" % [ d.year, d.mon, d.day ]
         | 
| 241 | 
            +
                Wx::MessageDialog.new( self, "The selected date is #{str}", 
         | 
| 242 | 
            +
                                       "Date chosen" ).show_modal
         | 
| 243 | 
            +
              end
         | 
| 244 | 
            +
              
         | 
| 245 | 
            +
            end
         | 
| 246 | 
            +
             | 
| 247 | 
            +
             | 
| 248 | 
            +
            class RbApp < App
         | 
| 249 | 
            +
              def on_init()
         | 
| 250 | 
            +
                frame = MyFrame.new("Calendar Windows sample")
         | 
| 251 | 
            +
                frame.show(true)
         | 
| 252 | 
            +
              end
         | 
| 253 | 
            +
            end
         | 
| 254 | 
            +
             | 
| 255 | 
            +
            a = RbApp.new
         | 
| 256 | 
            +
            a.main_loop()
         |