class AGTkVSplittedFrames
Attributes
left_frame[R]
right_frame[R]
splitter_frame[R]
Public Class Methods
new(parent=nil, frame=nil, width=10, slen=5, perc=false, user_control=true, keys=nil) { |self| ... }
click to toggle source
Calls superclass method
AGTkSplittedFrames::new
# File lib/a-tkcommons.rb, line 412 def initialize(parent=nil, frame=nil, width=10, slen=5, perc=false, user_control=true, keys=nil) super(parent, frame, width, slen, user_control, keys) @left_frame = TkFrame.new(self, Arcadia.style('panel')) @frame1 = @left_frame if perc p_width = TkWinfo.screenwidth(self) x = (p_width/100*width).to_i else x = width end @left_frame.place( 'relx' => 0, 'x' => 0, 'y' => '0', 'relheight' => '1', 'rely' => 0, 'bordermode' => 'inside', 'width' => x ) @left_frame_obj = AGTkObjPlace.new(@left_frame, 'x', nil, false) @left_frame_obj.width = x @left_frame_obj.height = 0 @left_frame_obj.relwidth = 0 @left_frame_obj.relheight = 1 @splitter_frame = TkFrame.new(self, Arcadia.style('splitter')) @splitter_frame.place( 'relx' => 0, 'x' => x, 'y' => '0', 'relheight' => '1', 'rely' => 0, 'bordermode' => 'inside', 'width' => @slen ) if @user_control @splitter_frame.bind_append( "ButtonRelease-1", proc{do_resize} ) _xbutton = Arcadia.wf.toolbutton(@splitter_frame){ image Arcadia.image_res(VERTICAL_SPLITTER_HIDE_LEFT_GIF) } # _xbutton = TkButton.new(@splitter_frame, Arcadia.style('toolbarbutton')){ # background '#4966d7' # } _xbutton.place( 'x' => 0, 'y' => 0, 'relwidth' => 1, 'bordermode' => 'outside', 'height' => 20 ) _xbutton.bind_append( "ButtonPress-1", proc{hide_left} ) _ybutton = Arcadia.wf.toolbutton(@splitter_frame){ image Arcadia.image_res(VERTICAL_SPLITTER_HIDE_RIGHT_GIF) } # _ybutton = TkButton.new(@splitter_frame, Arcadia.style('toolbarbutton')){ # background '#118124' # } _ybutton.place( 'x' => 0, 'y' => 21, 'bordermode' => 'outside', 'height' => 20, 'relwidth' => 1 ) _ybutton.bind_append( "ButtonPress-1", proc{hide_right} ) end #----- #----- @splitter_frame_obj = AGTkObjPlace.new(@splitter_frame, 'x', nil, @user_control) @splitter_frame_obj.width = @slen @splitter_frame_obj.height = 0 @splitter_frame_obj.relwidth = 0 @splitter_frame_obj.relheight = 1 x = x + @slen @right_frame = TkFrame.new(self, Arcadia.style('panel')) @frame2 = @right_frame @right_frame.place( 'relwidth' => 1, 'relx' => 0, 'x' => x, 'y' => 0, 'width' => -x, 'relheight' => 1, 'rely' => 0, 'bordermode' => 'inside' ) @right_frame_obj = AGTkObjPlace.new(@right_frame, 'x', nil, false) @right_frame_obj.width = -x @right_frame_obj.height = 0 @right_frame_obj.relwidth = 1 @right_frame_obj.relheight = 1 @state = 'middle' yield(self) if block_given? end
Public Instance Methods
do_resize()
click to toggle source
# File lib/a-tkcommons.rb, line 527 def do_resize _x = @splitter_frame_obj.x0 _w = @splitter_frame_obj.w @left_frame_obj.width = _x @left_frame_obj.go(_x,0) @right_frame_obj.width = - _x - _w @right_frame_obj.amove(_x + _w,0) end
get_main_x()
click to toggle source
# File lib/a-tkcommons.rb, line 519 def get_main_x if TkWinfo.manager(@parent)=='place' return TkPlace.info(@parent)['x'] / 2 else return 20 end end
hide(_name)
click to toggle source
# File lib/a-tkcommons.rb, line 624 def hide(_name) end
hide_left()
click to toggle source
# File lib/a-tkcommons.rb, line 550 def hide_left if (@state=='left') _w = @last @state = 'middle' @left_frame_obj.width = _w @left_frame_obj.go(_w,0) else _w = 0 @state = 'right' @last = @left_frame_obj.w end @left_frame_obj.amove(0,0) @left_frame_obj.obj.place_forget if @state=='right' @splitter_frame_obj.amove(_w,0) @right_frame_obj.width = - _w - @slen @right_frame_obj.amove(_w + @slen,0) end
hide_right()
click to toggle source
# File lib/a-tkcommons.rb, line 584 def hide_right if (@state=='right') _w = @last @state = 'middle' else _w = @right_frame_obj.w + @left_frame_obj.w #+ @slen @state = 'left' @last = @left_frame_obj.w end @right_frame_obj.width = - _w - @slen @right_frame_obj.amove(_w + @slen,0) @right_frame_obj.obj.place_forget if @state=='left' #.unplace if @state=='left' @splitter_frame_obj.amove(_w,0) @left_frame_obj.width = _w @left_frame_obj.go(_w,0) end
is_left_hide?()
click to toggle source
# File lib/a-tkcommons.rb, line 568 def is_left_hide? @left_frame_obj.w == 0 end
maximize(_frame)
click to toggle source
Calls superclass method
AGTkSplittedFrames#maximize
# File lib/a-tkcommons.rb, line 602 def maximize(_frame) super(_frame) case _frame when left_frame hide_right when right_frame hide_left end Tk.update end
minimize(_frame)
click to toggle source
Calls superclass method
AGTkSplittedFrames#minimize
# File lib/a-tkcommons.rb, line 613 def minimize(_frame) super(_frame) case _frame when left_frame hide_left when right_frame hide_right end Tk.update end
move_splitter(_gapx=0,_gapy=0)
click to toggle source
# File lib/a-tkcommons.rb, line 536 def move_splitter(_gapx=0,_gapy=0) @splitter_frame_obj.amove(_gapx,_gapy) do_resize end
resize_left(_new_width)
click to toggle source
# File lib/a-tkcommons.rb, line 541 def resize_left(_new_width) @left_frame_obj.width = _new_width @left_frame_obj.go(_new_width,0) @left_frame_obj.amove(0,0) @splitter_frame_obj.amove(_new_width,0) @right_frame_obj.width = - _new_width - @slen @right_frame_obj.amove(_new_width + @slen,0) end
show(_name)
click to toggle source
# File lib/a-tkcommons.rb, line 627 def show(_name) end
show_left()
click to toggle source
# File lib/a-tkcommons.rb, line 572 def show_left if @state=='right' _w = @last @state = 'middle' @right_frame_obj.width = - _w - @slen @right_frame_obj.amove(_w + @slen,0) @splitter_frame_obj.amove(_w,0) @left_frame_obj.width = _w @left_frame_obj.go(_w,0) end end