wxruby 2.0.0-x86-linux → 2.0.1-x86-linux
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/art/wxruby-128x128.png +0 -0
- data/art/wxruby-256x256.png +0 -0
- data/art/wxruby-64x64.png +0 -0
- data/art/wxruby.png +0 -0
- data/lib/wx/accessors.rb +1 -3
- data/lib/wx/classes/checklistbox.rb +2 -1
- data/lib/wx/classes/evthandler.rb +1 -1
- data/lib/wx/classes/image.rb +5 -0
- data/lib/wx/classes/listctrl.rb +2 -2
- data/lib/wx/classes/sizer.rb +7 -1
- data/lib/wx/classes/splitterwindow.rb +10 -0
- data/lib/wx/classes/timer.rb +2 -0
- data/lib/wx/classes/toolbar.rb +7 -1
- data/lib/wx/helpers.rb +22 -13
- data/lib/wx/keyword_ctors.rb +1 -1
- data/lib/wx/keyword_defs.rb +14 -4
- data/lib/wx/version.rb +1 -1
- data/lib/wxruby2.so +0 -0
- data/samples/bigdemo/ShapedWindow.rbw +11 -14
- data/samples/bigdemo/bigdemo.rb +2 -2
- data/samples/bigdemo/icons/wxruby-128x128.png +0 -0
- data/samples/bigdemo/wxStaticBitmap.rbw +8 -12
- data/samples/calendar/calendar.rb +92 -0
- data/samples/drawing/bitmap.rb +8 -3
- data/samples/drawing/maths_images.rb +4 -4
- data/samples/drawing/rmagic_bitmap_image.rb +110 -0
- data/samples/minimal/minimal.rb +1 -1
- data/samples/opengl/cube.rb +27 -14
- data/samples/opengl/cube_anim_lighting.rb +191 -0
- metadata +219 -238
- data/samples/bigdemo/icons/ruby.png +0 -0
- data/samples/drawing/wxruby-logo.png +0 -0
| Binary file | 
| Binary file | 
| Binary file | 
    
        data/art/wxruby.png
    ADDED
    
    | Binary file | 
    
        data/lib/wx/accessors.rb
    CHANGED
    
    
| @@ -11,8 +11,9 @@ class Wx::CheckListBox | |
| 11 11 |  | 
| 12 12 | 
             
              # Call method in ControlWithItems, then sync item data
         | 
| 13 13 | 
             
              def append(item, data = nil)
         | 
| 14 | 
            -
                super(item)
         | 
| 14 | 
            +
                i = super(item)
         | 
| 15 15 | 
             
                __wx_item_data[count - 1] = data
         | 
| 16 | 
            +
                return i
         | 
| 16 17 | 
             
              end
         | 
| 17 18 |  | 
| 18 19 | 
             
              # Call method in ControlWithItems, then sync item data
         | 
| @@ -145,7 +145,7 @@ class Wx::EvtHandler | |
| 145 145 | 
             
                case window_or_id
         | 
| 146 146 | 
             
                when Fixnum 
         | 
| 147 147 | 
             
                  window_or_id
         | 
| 148 | 
            -
                when Wx::Window, Wx::MenuItem, Wx::ToolBarTool 
         | 
| 148 | 
            +
                when Wx::Window, Wx::MenuItem, Wx::ToolBarTool, Wx::Timer
         | 
| 149 149 | 
             
                  window_or_id.wx_id
         | 
| 150 150 | 
             
                else 
         | 
| 151 151 | 
             
                  Kernel.raise ArgumentError, 
         | 
    
        data/lib/wx/classes/image.rb
    CHANGED
    
    | @@ -1,6 +1,11 @@ | |
| 1 1 | 
             
            # A platform-independent image; can be manipulated more extensively than
         | 
| 2 2 | 
             
            # Bitmap, but must be converted to a Bitmap for drawing.
         | 
| 3 3 | 
             
            class Wx::Image
         | 
| 4 | 
            +
              
         | 
| 5 | 
            +
              # alias for backward compatibility
         | 
| 6 | 
            +
              alias :get_data :get_rgb_data
         | 
| 7 | 
            +
              alias :set_data :set_rgb_data
         | 
| 8 | 
            +
              
         | 
| 4 9 | 
             
              # Load the type-guessing hash from Wx::Bitmap
         | 
| 5 10 | 
             
              require 'wx/classes/bitmap'
         | 
| 6 11 | 
             
              BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
         | 
    
        data/lib/wx/classes/listctrl.rb
    CHANGED
    
    | @@ -11,10 +11,10 @@ class Wx::ListCtrl | |
| 11 11 | 
             
              # items 
         | 
| 12 12 | 
             
              def get_selections
         | 
| 13 13 | 
             
                selections = []
         | 
| 14 | 
            -
                item = get_next_item(-1, Wx:: | 
| 14 | 
            +
                item = get_next_item(-1, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED)
         | 
| 15 15 | 
             
                while item >= 0
         | 
| 16 16 | 
             
                  selections << item
         | 
| 17 | 
            -
                  item = get_next_item(item, Wx:: | 
| 17 | 
            +
                  item = get_next_item(item, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED) 
         | 
| 18 18 | 
             
                end
         | 
| 19 19 | 
             
                selections
         | 
| 20 20 | 
             
              end
         | 
    
        data/lib/wx/classes/sizer.rb
    CHANGED
    
    | @@ -9,7 +9,13 @@ class Wx::Sizer | |
| 9 9 | 
             
                                  Wx::Parameter[ :user_data, nil ] ]
         | 
| 10 10 |  | 
| 11 11 | 
             
              def add_item(item, *mixed_args)
         | 
| 12 | 
            -
             | 
| 12 | 
            +
             | 
| 13 | 
            +
                begin
         | 
| 14 | 
            +
                  args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args)
         | 
| 15 | 
            +
                rescue => err
         | 
| 16 | 
            +
                  err.set_backtrace(caller)
         | 
| 17 | 
            +
                  Kernel.raise err
         | 
| 18 | 
            +
                end
         | 
| 13 19 |  | 
| 14 20 | 
             
                full_args = []
         | 
| 15 21 |  | 
| @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            # Class with movable sash to separate two windows
         | 
| 2 | 
            +
            class Wx::SplitterWindow
         | 
| 3 | 
            +
              # These were released in wxRuby 2.0 with names slightly out of kilter
         | 
| 4 | 
            +
              # with the documentation. The correct ones have an underscore before
         | 
| 5 | 
            +
              # the digit.
         | 
| 6 | 
            +
              #
         | 
| 7 | 
            +
              # FIXME - the old names :get_window1 should be deleted in future versions.
         | 
| 8 | 
            +
              alias :get_window_1 :get_window1
         | 
| 9 | 
            +
              alias :get_window_2 :get_window2
         | 
| 10 | 
            +
            end
         | 
    
        data/lib/wx/classes/timer.rb
    CHANGED
    
    | @@ -24,6 +24,8 @@ class Wx::Timer | |
| 24 24 | 
             
              # In common with other classes, make the id method refer to the
         | 
| 25 25 | 
             
              # wxWidgets id, not ruby's deprecated name for object_id
         | 
| 26 26 | 
             
              alias :id :get_id
         | 
| 27 | 
            +
              # In case a more explicit option is preferred.
         | 
| 28 | 
            +
              alias :wx_id :get_id
         | 
| 27 29 |  | 
| 28 30 | 
             
              # This class can be linked to an owner - an instance of a class
         | 
| 29 31 | 
             
              # derived from EvtHandler which will receive Timer events. However,
         | 
    
        data/lib/wx/classes/toolbar.rb
    CHANGED
    
    | @@ -13,7 +13,13 @@ class Wx::ToolBar | |
| 13 13 | 
             
                                  Wx::Parameter[ :client_data, nil ] ]
         | 
| 14 14 |  | 
| 15 15 | 
             
              def add_item(bitmap1, *mixed_args)
         | 
| 16 | 
            -
             | 
| 16 | 
            +
             | 
| 17 | 
            +
                begin
         | 
| 18 | 
            +
                  args = Wx::args_as_list(ADD_ITEM_PARAMS, *mixed_args)
         | 
| 19 | 
            +
                rescue => err
         | 
| 20 | 
            +
                  err.set_backtrace(caller)
         | 
| 21 | 
            +
                  Kernel.raise err
         | 
| 22 | 
            +
                end
         | 
| 17 23 |  | 
| 18 24 | 
             
                bitmap2 = args.shift
         | 
| 19 25 | 
             
                pos = args.shift
         | 
    
        data/lib/wx/helpers.rb
    CHANGED
    
    | @@ -9,22 +9,31 @@ module Wx | |
| 9 9 | 
             
              # possible argument. +mixed_args+ is an array which may optionally end
         | 
| 10 10 | 
             
              # with a set of named arguments
         | 
| 11 11 | 
             
              def self.args_as_list(param_spec, *mixed_args)
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                 | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
                   | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 12 | 
            +
             | 
| 13 | 
            +
                begin
         | 
| 14 | 
            +
                  # get keyword arguments from mixed args if supplied, else empty
         | 
| 15 | 
            +
                  kwa = mixed_args.last.kind_of?(Hash) ? mixed_args.pop : {}
         | 
| 16 | 
            +
                  out_args = []
         | 
| 17 | 
            +
                  param_spec.each_with_index do | param, i |
         | 
| 18 | 
            +
                    if arg = mixed_args[i] # use the supplied list arg 
         | 
| 19 | 
            +
                      out_args << arg
         | 
| 20 | 
            +
                    elsif kwa.key?(param.name) # use the keyword arg
         | 
| 21 | 
            +
                      out_args << kwa.delete(param.name)
         | 
| 22 | 
            +
                    else # use the default argument
         | 
| 23 | 
            +
                      out_args << param.default
         | 
| 24 | 
            +
                    end
         | 
| 22 25 | 
             
                  end
         | 
| 26 | 
            +
                rescue
         | 
| 27 | 
            +
                  Kernel.raise ArgumentError, 
         | 
| 28 | 
            +
                             "Bad arg composition of #{mixed_args.inspect}"
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                unless kwa.empty?
         | 
| 32 | 
            +
                  Kernel.raise ArgumentError, 
         | 
| 33 | 
            +
                             "Unknown keyword argument(s) : #{kwa.keys.inspect}"
         | 
| 23 34 | 
             
                end
         | 
| 35 | 
            +
             | 
| 24 36 | 
             
                out_args
         | 
| 25 | 
            -
              rescue
         | 
| 26 | 
            -
                Kernel.raise ArgumentError, 
         | 
| 27 | 
            -
                             "Bad arg composition of #{mixed_args.inspect}"
         | 
| 28 37 | 
             
              end
         | 
| 29 38 |  | 
| 30 39 | 
             
              # Given an integer constant +int_const+, returns an array Wx constant
         | 
    
        data/lib/wx/keyword_ctors.rb
    CHANGED
    
    | @@ -163,8 +163,8 @@ module Wx | |
| 163 163 | 
             
                        return
         | 
| 164 164 | 
             
                      end
         | 
| 165 165 |  | 
| 166 | 
            -
                      real_args = [ parent ] + self.class.args_as_list(*mixed_args)
         | 
| 167 166 | 
             
                      begin
         | 
| 167 | 
            +
                        real_args = [ parent ] + self.class.args_as_list(*mixed_args)
         | 
| 168 168 | 
             
                        pre_wx_kwctor_init(*real_args)
         | 
| 169 169 | 
             
                      rescue => err
         | 
| 170 170 | 
             
                        msg = "Error initializing #{self.inspect}\n"+
         | 
    
        data/lib/wx/keyword_defs.rb
    CHANGED
    
    | @@ -105,6 +105,15 @@ end | |
| 105 105 |  | 
| 106 106 | 
             
            # MISCELLANEOUS WINDOWS
         | 
| 107 107 |  | 
| 108 | 
            +
            # OpenGL Canvas
         | 
| 109 | 
            +
            Wx::define_keyword_ctors('GLCanvas') do
         | 
| 110 | 
            +
              wx_ctor_params :id
         | 
| 111 | 
            +
              wx_ctor_params :pos, :size, :style => Wx::FULL_REPAINT_ON_RESIZE
         | 
| 112 | 
            +
              wx_ctor_params :name => 'GLCanvas'
         | 
| 113 | 
            +
              wx_ctor_params :attrib_list => [Wx::GL_RGBA, Wx::GL_DOUBLEBUFFER]
         | 
| 114 | 
            +
              wx_ctor_params :palette => Wx::NULL_PALETTE
         | 
| 115 | 
            +
            end
         | 
| 116 | 
            +
             | 
| 108 117 | 
             
            # A window whose colour changes according to current user settings
         | 
| 109 118 | 
             
            Wx::define_keyword_ctors('Panel') do
         | 
| 110 119 | 
             
              wx_ctor_params :id, :pos, :size, :style => Wx::TAB_TRAVERSAL
         | 
| @@ -227,7 +236,8 @@ end | |
| 227 236 | 
             
            Wx::define_keyword_ctors('DirDialog') do
         | 
| 228 237 | 
             
              wx_ctor_params :message => 'Choose a directory'
         | 
| 229 238 | 
             
              wx_ctor_params :default_path => ''
         | 
| 230 | 
            -
              wx_ctor_params :style | 
| 239 | 
            +
              wx_ctor_params :style => Wx::DD_DEFAULT_STYLE
         | 
| 240 | 
            +
              wx_ctor_params :pos, :size, :name => 'wxDirCtrl'
         | 
| 231 241 | 
             
            end
         | 
| 232 242 |  | 
| 233 243 | 
             
            # wxFileDialog 	File selector dialog
         | 
| @@ -236,7 +246,8 @@ Wx::define_keyword_ctors('FileDialog') do | |
| 236 246 | 
             
              wx_ctor_params :default_dir  => ''
         | 
| 237 247 | 
             
              wx_ctor_params :default_file => ''
         | 
| 238 248 | 
             
              wx_ctor_params :wildcard => '*.*'
         | 
| 239 | 
            -
              wx_ctor_params :style | 
| 249 | 
            +
              wx_ctor_params :style => Wx::FD_DEFAULT_STYLE
         | 
| 250 | 
            +
              wx_ctor_params :pos, :size, :name => 'filedlg'
         | 
| 240 251 | 
             
            end
         | 
| 241 252 |  | 
| 242 253 | 
             
            # wxFindReplaceDialog 	Text search/replace dialog
         | 
| @@ -551,8 +562,7 @@ Wx::define_keyword_ctors('HtmlListBox') do | |
| 551 562 | 
             
            end
         | 
| 552 563 |  | 
| 553 564 | 
             
            Wx::define_keyword_ctors('DatePickerCtrl') do
         | 
| 554 | 
            -
              wx_ctor_params :id, :dt =>  | 
| 555 | 
            -
              wx_ctor_params :pos, :size, :style, :validator, :name => 'dateCtrl'
         | 
| 565 | 
            +
              wx_ctor_params :id, :dt, :pos, :size, :style, :validator, :name => 'dateCtrl'
         | 
| 556 566 | 
             
            end
         | 
| 557 567 |  | 
| 558 568 | 
             
            Wx::define_keyword_ctors('RichTextCtrl') do
         | 
    
        data/lib/wx/version.rb
    CHANGED
    
    
    
        data/lib/wxruby2.so
    CHANGED
    
    | Binary file | 
| @@ -7,16 +7,13 @@ rescue LoadError | |
| 7 7 | 
             
            end
         | 
| 8 8 | 
             
            require 'wx'
         | 
| 9 9 |  | 
| 10 | 
            -
             | 
| 11 10 | 
             
            include Wx
         | 
| 12 11 |  | 
| 13 | 
            -
            BUTTON_CLOSE = 1003
         | 
| 14 | 
            -
             | 
| 15 12 | 
             
            class MyFrame < Frame
         | 
| 16 13 | 
             
              def initialize(parent, log)
         | 
| 17 14 | 
             
                @log = log
         | 
| 18 | 
            -
                super(parent,  | 
| 19 | 
            -
                      FRAME_SHAPED|SIMPLE_BORDER|FRAME_NO_TASKBAR|STAY_ON_TOP)
         | 
| 15 | 
            +
                super(parent, :title => "Shaped Window", :size => [350,200], 
         | 
| 16 | 
            +
                      :style => FRAME_SHAPED|SIMPLE_BORDER|FRAME_NO_TASKBAR|STAY_ON_TOP)
         | 
| 20 17 |  | 
| 21 18 | 
             
                @has_shape = false
         | 
| 22 19 | 
             
                @delta = [0,0]
         | 
| @@ -28,9 +25,9 @@ class MyFrame < Frame | |
| 28 25 | 
             
                evt_right_up {on_exit}
         | 
| 29 26 | 
             
                evt_paint {on_paint}
         | 
| 30 27 |  | 
| 31 | 
            -
                shape = File.join( File.dirname(__FILE__), 'icons', ' | 
| 28 | 
            +
                shape = File.join( File.dirname(__FILE__), 'icons', 'wxruby-128x128.png' )
         | 
| 32 29 | 
             
                @bmp = Bitmap.new( Image.new(shape) )
         | 
| 33 | 
            -
                set_client_size(@bmp. | 
| 30 | 
            +
                set_client_size(@bmp.width, @bmp.height)
         | 
| 34 31 |  | 
| 35 32 | 
             
                if Wx::PLATFORM == 'WXGTK'
         | 
| 36 33 | 
             
                  # wxGTK requires that the window be created before you can
         | 
| @@ -69,8 +66,8 @@ class MyFrame < Frame | |
| 69 66 |  | 
| 70 67 | 
             
              def on_left_down(event)
         | 
| 71 68 | 
             
                capture_mouse
         | 
| 72 | 
            -
                point = client_to_screen(event. | 
| 73 | 
            -
                origin =  | 
| 69 | 
            +
                point = client_to_screen(event.position)
         | 
| 70 | 
            +
                origin = position
         | 
| 74 71 | 
             
                dx = point.x - origin.x
         | 
| 75 72 | 
             
                dy = point.y - origin.y
         | 
| 76 73 | 
             
                @delta = [dx, dy]
         | 
| @@ -84,7 +81,7 @@ class MyFrame < Frame | |
| 84 81 |  | 
| 85 82 | 
             
              def on_mouse_move(event)
         | 
| 86 83 | 
             
                if event.dragging and event.left_is_down
         | 
| 87 | 
            -
                  point = client_to_screen(event. | 
| 84 | 
            +
                  point = client_to_screen(event.position)
         | 
| 88 85 | 
             
                  move(point.x - @delta[0], point.y - @delta[1])
         | 
| 89 86 | 
             
                end
         | 
| 90 87 | 
             
              end
         | 
| @@ -92,16 +89,16 @@ end | |
| 92 89 |  | 
| 93 90 | 
             
            class TestPanel < Wx::Panel
         | 
| 94 91 | 
             
              def initialize(parent, log)
         | 
| 95 | 
            -
                super(parent,  | 
| 92 | 
            +
                super(parent, :style => Wx::NO_FULL_REPAINT_ON_RESIZE)
         | 
| 96 93 | 
             
                @log = log
         | 
| 97 94 |  | 
| 98 | 
            -
                b = Button.new(self,  | 
| 99 | 
            -
                evt_button(b | 
| 95 | 
            +
                b = Button.new(self, :label => 'Show the ShapedWindow Sample', :pos => [50,50])
         | 
| 96 | 
            +
                evt_button(b) { on_button }
         | 
| 100 97 | 
             
              end
         | 
| 101 98 |  | 
| 102 99 | 
             
              def on_button
         | 
| 103 100 | 
             
                win = MyFrame.new(self, @log)
         | 
| 104 | 
            -
                win. | 
| 101 | 
            +
                win.size = [200, 200]
         | 
| 105 102 | 
             
                win.center_on_parent(Wx::BOTH)
         | 
| 106 103 | 
             
                win.show(true)
         | 
| 107 104 | 
             
              end
         | 
    
        data/samples/bigdemo/bigdemo.rb
    CHANGED
    
    | @@ -743,7 +743,7 @@ class DemoTaskBarIcon < Wx::TaskBarIcon | |
| 743 743 | 
             
                @frame = frame
         | 
| 744 744 |  | 
| 745 745 | 
             
                # starting image
         | 
| 746 | 
            -
                icon = make_icon(' | 
| 746 | 
            +
                icon = make_icon('wxruby-128x128.png')
         | 
| 747 747 | 
             
                set_icon(icon, 'wxRuby Demo')
         | 
| 748 748 | 
             
                @image_index = 1
         | 
| 749 749 |  | 
| @@ -796,7 +796,7 @@ class DemoTaskBarIcon < Wx::TaskBarIcon | |
| 796 796 | 
             
              end
         | 
| 797 797 |  | 
| 798 798 | 
             
              def on_taskbar_change(evt)
         | 
| 799 | 
            -
                names = [ " | 
| 799 | 
            +
                names = [ "wxruby-128x128.png", "wxwin16x16.xpm", "smiles.xpm", "mondrian.xpm" ]
         | 
| 800 800 | 
             
                name = names[@image_index]
         | 
| 801 801 | 
             
                @image_index += 1
         | 
| 802 802 | 
             
                if @image_index >= names.length
         | 
| Binary file | 
| @@ -11,24 +11,20 @@ require 'wx' | |
| 11 11 |  | 
| 12 12 | 
             
            class TestPanel < Wx::Panel
         | 
| 13 13 | 
             
              def initialize(parent, log)
         | 
| 14 | 
            -
                super(parent | 
| 14 | 
            +
                super(parent)
         | 
| 15 15 |  | 
| 16 | 
            -
                Wx::StaticText.new( self,  | 
| 17 | 
            -
                                    Wx::Point.new(45,5))
         | 
| 16 | 
            +
                Wx::StaticText.new( self, :label => "This is a wxStaticBitmap.", :pos => [45,5])
         | 
| 18 17 |  | 
| 19 18 | 
             
                bmp_file1 = File.join(File.dirname(__FILE__), 'icons', 'test2.xpm')
         | 
| 20 | 
            -
                Wx::StaticBitmap.new( self,  | 
| 21 | 
            -
                                       | 
| 22 | 
            -
                                      Wx::Point.new(80,25)) 
         | 
| 19 | 
            +
                Wx::StaticBitmap.new( self, :label => Wx::Bitmap.new(bmp_file1), 
         | 
| 20 | 
            +
                                      :pos => [80,25]) 
         | 
| 23 21 |  | 
| 24 22 | 
             
                bmp_file2 = File.join(File.dirname(__FILE__), 'icons', 'robert.xpm')
         | 
| 25 | 
            -
                Wx::StaticBitmap.new( self,  | 
| 26 | 
            -
                                       | 
| 27 | 
            -
                                      Wx::Point.new(0, 100))
         | 
| 23 | 
            +
                Wx::StaticBitmap.new( self, :label => Wx::Bitmap.new(bmp_file2), 
         | 
| 24 | 
            +
                                      :pos => [0, 100])
         | 
| 28 25 |  | 
| 29 | 
            -
                Wx::StaticText.new( self,  | 
| 30 | 
            -
                                     | 
| 31 | 
            -
                                    Wx::Point.new(100, 125) )
         | 
| 26 | 
            +
                Wx::StaticText.new( self, :label => "Hey, if Ousterhout (and Dunn) can do it, so can I.", 
         | 
| 27 | 
            +
                                    :pos => [100, 125])
         | 
| 32 28 | 
             
              end
         | 
| 33 29 | 
             
            end
         | 
| 34 30 |  | 
| @@ -17,6 +17,11 @@ Calendar_Cal_Year = 204 | |
| 17 17 | 
             
            Calendar_Cal_SeqMonth = 205
         | 
| 18 18 | 
             
            Calendar_Cal_SurroundWeeks = 206
         | 
| 19 19 |  | 
| 20 | 
            +
            Calendar_DatePicker_AskDate = 300
         | 
| 21 | 
            +
            Calendar_DatePicker_ShowCentury = 301
         | 
| 22 | 
            +
            Calendar_DatePicker_DropDown = 302
         | 
| 23 | 
            +
            Calendar_DatePicker_AllowNone = 303
         | 
| 24 | 
            +
            Calendar_DatePicker_StartWithNone = 304
         | 
| 20 25 |  | 
| 21 26 | 
             
            class MyCalendar < CalendarCtrl
         | 
| 22 27 | 
             
              def initialize(parent, display_frame, initial_date, calendar_flags)
         | 
| @@ -77,6 +82,9 @@ class MyFrame < Frame | |
| 77 82 | 
             
              	evt_menu Wx::ID_EXIT, :on_quit
         | 
| 78 83 | 
             
              	evt_menu Wx::ID_ABOUT, :on_about
         | 
| 79 84 |  | 
| 85 | 
            +
              	evt_menu Calendar_DatePicker_AskDate, :on_ask_date
         | 
| 86 | 
            +
              	evt_update_ui Calendar_DatePicker_StartWithNone, :on_update_ui_start_with_none
         | 
| 87 | 
            +
             | 
| 80 88 | 
             
              	evt_menu Calendar_Cal_Monday, :on_cal_monday
         | 
| 81 89 | 
             
              	evt_menu Calendar_Cal_Holidays, :on_cal_holidays
         | 
| 82 90 | 
             
              	evt_menu Calendar_Cal_Special, :on_cal_special
         | 
| @@ -125,16 +133,27 @@ class MyFrame < Frame | |
| 125 133 | 
             
                                 "Allow changing the year in the calendar",
         | 
| 126 134 | 
             
                                 ITEM_CHECK)
         | 
| 127 135 |  | 
| 136 | 
            +
                menu_date = Menu.new
         | 
| 137 | 
            +
                menu_date.append_check_item(Calendar_DatePicker_ShowCentury, "Al&ways show century")
         | 
| 138 | 
            +
                menu_date.append_check_item(Calendar_DatePicker_DropDown, "Use &drop down control")
         | 
| 139 | 
            +
                menu_date.append_check_item(Calendar_DatePicker_AllowNone, "Allow &no date")
         | 
| 140 | 
            +
                menu_date.append_check_item(Calendar_DatePicker_StartWithNone, "Start &with no date")
         | 
| 141 | 
            +
                menu_date.append_separator
         | 
| 142 | 
            +
                menu_date.append(Calendar_DatePicker_AskDate, "&Choose date...\tCtrl-D", "Show dialog with DatePickerCtrl")
         | 
| 143 | 
            +
             | 
| 128 144 | 
             
                # now append the freshly created menu to the menu bar...
         | 
| 129 145 | 
             
                menu_bar = MenuBar.new
         | 
| 130 146 | 
             
                menu_bar.append(menu_file, "&File")
         | 
| 131 147 | 
             
                menu_bar.append(menu_cal, "&Calendar")
         | 
| 148 | 
            +
                menu_bar.append(menu_date, "&Date picker")
         | 
| 132 149 |  | 
| 133 150 | 
             
                menu_bar.check(Calendar_Cal_Monday, TRUE)
         | 
| 134 151 | 
             
                menu_bar.check(Calendar_Cal_Holidays, TRUE)
         | 
| 135 152 | 
             
                menu_bar.check(Calendar_Cal_Month, TRUE)
         | 
| 136 153 | 
             
                menu_bar.check(Calendar_Cal_Year, TRUE)
         | 
| 137 154 |  | 
| 155 | 
            +
                menu_bar.check(Calendar_DatePicker_ShowCentury, TRUE)
         | 
| 156 | 
            +
             | 
| 138 157 | 
             
                # ... and attach self menu bar to the frame
         | 
| 139 158 | 
             
                self.menu_bar = menu_bar
         | 
| 140 159 | 
             
              end
         | 
| @@ -201,6 +220,36 @@ class MyFrame < Frame | |
| 201 220 | 
             
                event.enable( get_menu_bar().is_checked(Calendar_Cal_Month))
         | 
| 202 221 | 
             
              end
         | 
| 203 222 |  | 
| 223 | 
            +
              def on_update_ui_start_with_none(event)
         | 
| 224 | 
            +
                event.enable( get_menu_bar().is_checked(Calendar_DatePicker_AllowNone))
         | 
| 225 | 
            +
              end
         | 
| 226 | 
            +
             | 
| 227 | 
            +
              def on_ask_date(event)
         | 
| 228 | 
            +
                dt = @calendar.get_date
         | 
| 229 | 
            +
                
         | 
| 230 | 
            +
                style = DP_DEFAULT
         | 
| 231 | 
            +
                style |= DP_SHOWCENTURY if get_menu_bar.is_checked(Calendar_DatePicker_ShowCentury)
         | 
| 232 | 
            +
                style |= DP_DROPDOWN if get_menu_bar.is_checked(Calendar_DatePicker_DropDown)
         | 
| 233 | 
            +
                if get_menu_bar.is_checked(Calendar_DatePicker_AllowNone)
         | 
| 234 | 
            +
                  style |= DP_ALLOWNONE
         | 
| 235 | 
            +
                  dt = nil if get_menu_bar.is_checked(Calendar_DatePicker_StartWithNone)
         | 
| 236 | 
            +
                end
         | 
| 237 | 
            +
                
         | 
| 238 | 
            +
                dlg = MyDialog.new(self, dt, style)
         | 
| 239 | 
            +
                if dlg.show_modal == ID_OK
         | 
| 240 | 
            +
                  if dt = dlg.get_date
         | 
| 241 | 
            +
                    today = Time.now
         | 
| 242 | 
            +
                    if dt.day == today.day && dt.month == today.month
         | 
| 243 | 
            +
                      message_box("Happy birthday", "Calendar Sample")
         | 
| 244 | 
            +
                    end
         | 
| 245 | 
            +
                    @calendar.set_date(dt)
         | 
| 246 | 
            +
                    log_status("Changed the date to your input")
         | 
| 247 | 
            +
                  else
         | 
| 248 | 
            +
                    log_status("No date entered")
         | 
| 249 | 
            +
                  end
         | 
| 250 | 
            +
                end
         | 
| 251 | 
            +
              end
         | 
| 252 | 
            +
             | 
| 204 253 | 
             
              def toggle_cal_style(on,flag)
         | 
| 205 254 | 
             
                style = @calendar.get_window_style_flag
         | 
| 206 255 | 
             
                date = @calendar.date
         | 
| @@ -244,6 +293,49 @@ class MyFrame < Frame | |
| 244 293 |  | 
| 245 294 | 
             
            end
         | 
| 246 295 |  | 
| 296 | 
            +
            class MyDialog < Dialog
         | 
| 297 | 
            +
              def initialize(parent, dt, picker_style)
         | 
| 298 | 
            +
                super(parent, :style => DEFAULT_DIALOG_STYLE|RESIZE_BORDER)
         | 
| 299 | 
            +
                sizer_buttons = StdDialogButtonSizer.new
         | 
| 300 | 
            +
                sizer_buttons.add_button(Button.new(self, ID_OK))
         | 
| 301 | 
            +
                sizer_buttons.add_button(Button.new(self, ID_CANCEL))
         | 
| 302 | 
            +
                sizer_buttons.realize
         | 
| 303 | 
            +
                
         | 
| 304 | 
            +
                sizer_text = BoxSizer.new(HORIZONTAL)
         | 
| 305 | 
            +
                sizer_text.add(StaticText.new(self, ID_ANY, "Date in ISO format:"), 0, ALL|ALIGN_CENTRE_VERTICAL, 10)
         | 
| 306 | 
            +
                @text = TextCtrl.new(self)
         | 
| 307 | 
            +
                sizer_text.add(@text, 1, ALL|ALIGN_CENTRE_VERTICAL|EXPAND, 10)
         | 
| 308 | 
            +
                
         | 
| 309 | 
            +
                sizer_top = BoxSizer.new(VERTICAL)
         | 
| 310 | 
            +
                sizer_top.add(StaticText.new(self, ID_ANY, "Enter your birthday date (not before 20th century):"), 0, ALL, 10)
         | 
| 311 | 
            +
             | 
| 312 | 
            +
                @picker = DatePickerCtrl.new(self, ID_ANY, dt, DEFAULT_POSITION, DEFAULT_SIZE, picker_style)
         | 
| 313 | 
            +
                @picker.set_range(DateTime.new(1900, 1, 1), nil)
         | 
| 314 | 
            +
                sizer_top.add(@picker, 0, ALL|EXPAND, 10)
         | 
| 315 | 
            +
                sizer_top.add_stretch_spacer(1)
         | 
| 316 | 
            +
                sizer_top.add(sizer_text, 0, EXPAND)
         | 
| 317 | 
            +
                
         | 
| 318 | 
            +
                sizer_top.add(sizer_buttons, 0, ALL|ALIGN_CENTER, 10)
         | 
| 319 | 
            +
                
         | 
| 320 | 
            +
                set_sizer_and_fit(sizer_top)
         | 
| 321 | 
            +
                layout
         | 
| 322 | 
            +
                
         | 
| 323 | 
            +
                evt_date_changed(@picker, :on_date_changed)
         | 
| 324 | 
            +
              end
         | 
| 325 | 
            +
             | 
| 326 | 
            +
              def get_date
         | 
| 327 | 
            +
                @picker.get_value
         | 
| 328 | 
            +
              end
         | 
| 329 | 
            +
             | 
| 330 | 
            +
              def on_date_changed(event)
         | 
| 331 | 
            +
                if dt = event.get_date
         | 
| 332 | 
            +
                  @text.set_value(dt.to_s)
         | 
| 333 | 
            +
                else
         | 
| 334 | 
            +
                  @text.set_value("")
         | 
| 335 | 
            +
                end
         | 
| 336 | 
            +
              end
         | 
| 337 | 
            +
             | 
| 338 | 
            +
            end
         | 
| 247 339 |  | 
| 248 340 | 
             
            class RbApp < App
         | 
| 249 341 | 
             
              def on_init()
         |