Sha256: 03b713d70e75e1c508aeccea00e85f6f6879dd40160d7a5e32e31694837b56d6

Contents?: true

Size: 1.86 KB

Versions: 20

Compression:

Stored size: 1.86 KB

Contents

#!/usr/bin/env ruby

begin
  require 'wx'
rescue LoadError => no_wx_err
  begin
    require 'rubygems'
    require 'wx'
  rescue LoadError
    raise no_wx_err
  end
end

class MySplitter < Wx::SplitterWindow
    def initialize(parent, id, log)
        super(parent, id)
        @log = log
        
        evt_splitter_sash_pos_changed(self.get_id()) {|event| on_sash_changed(event)}
        evt_splitter_sash_pos_changing(self.get_id()) {|event| on_sash_changing(event)}
    end
    
    def on_sash_changed(event)
        @log.write_text("sash changed to: " + event.get_sash_position().to_s())
        # uncomment this to not allow the change
        #evt.set_sash_position(-1)
    end
    
    def on_sash_changing(event)
        @log.write_text("sash changing to: " + event.get_sash_position().to_s())
        # uncomment this to not allow the change
        #evt.set_sash_position(-1)

    end
end

module Demo
    def Demo.run(frame,nb,log)
        splitter = MySplitter.new(nb, -1, log)
        
        p1 = Wx::Window.new(splitter, -1)
        p1.set_background_colour(Wx::RED)
        Wx::StaticText.new(p1, -1, "Panel One", Wx::Point.new(5,5)).set_background_colour(Wx::RED)
        
        p2 = Wx::Window.new(splitter, -1)
        p2.set_background_colour(Wx::BLUE)
        Wx::StaticText.new(p2, -1, "Panel Two", Wx::Point.new(5,5)).set_background_colour(Wx::BLUE)
        
        splitter.set_minimum_pane_size(20)
        splitter.split_vertically(p1, p2, 100)
        
        return splitter
    end
    
    def Demo.overview
        "This class manages up to two subwindows. The current view can be split into two programmatically (perhaps from a menu command), and unsplit either programmatically or via the wxSplitterWindow user interface."
    end
end


if __FILE__ == $0
  run_solo_lib = File.join( File.dirname(__FILE__), 'run.rb')
  load run_solo_lib
  run File.basename($0)
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
wxruby-1.9.3-i386-mswin32 samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.2-powerpc-darwin8.10.0 samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.2-i686-linux samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.2-i686-darwin8.8.2 samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.1-powerpc-darwin8.3.0 samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.1-i686-linux samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.1-i686-darwin8.4.1 samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.0-powerpc-darwin8.10.0 samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.0-i686-linux samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.0-i686-darwin8.4.1 samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.0-i386-mswin32 samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.1-x86_64-linux samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.3-universal-darwin samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.2-x86_64-linux samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.3-x86-linux samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.4-x86-linux samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.4-x86_64-linux samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.5-universal-darwin-9 samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.5-x86-linux samples/bigdemo/wxSplitterWindow.rbw
wxruby-1.9.5-x86_64-linux samples/bigdemo/wxSplitterWindow.rbw