class AGTkOSplittedFrames

Attributes

bottom_frame[R]
splitter_frame[R]
top_frame[R]

Public Class Methods

new(parent=nil, frame=nil, height=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 634
  def initialize(parent=nil, frame=nil, height=10, slen=5, perc=false, user_control=true, keys=nil)
    super(parent, frame, height, slen, user_control, keys)
    @top_frame = TkFrame.new(self, Arcadia.style('panel')){
      # relief 'flat'
    }
    @frame1 = @top_frame
    if perc
      p_height = TkWinfo.screenheight(self)
      y = (p_height/100*height).to_i
    else
      y = height
    end
    @top_frame.place(
    'relwidth' => '1',
    'bordermode' => 'inside',
    'height' => y
    )

    @top_frame_obj = AGTkObjPlace.new(@top_frame, 'y', nil, false)
    @top_frame_obj.width = 0
    @top_frame_obj.height = y
    @top_frame_obj.relwidth = 1
    @top_frame_obj.relheight = 0
    @splitter_frame = TkFrame.new(self, Arcadia.style('splitter')){
      #relief  'groove'
      #border 1
    }
    @splitter_frame.place(
    'relx' => 0,
    'x' => 0,
    'y' => y,
    'relwidth' => '1',
    'rely' => 0,
    'bordermode' => 'inside',
    'height' => @slen
    )
    @splitter_frame_obj = AGTkObjPlace.new(@splitter_frame, 'y', nil, user_control)
    @splitter_frame_obj.width = 0
    @splitter_frame_obj.height = @slen
    @splitter_frame_obj.relwidth = 1
    @splitter_frame_obj.relheight = 0
    y = y + @slen
    @bottom_frame = TkFrame.new(self, Arcadia.style('panel')){
      # relief 'flat'
    }
    @frame2 = @bottom_frame
    @bottom_frame.place(
    'relwidth' => 1,
    'relx' => 0,
    'x' => 0,
    'y' => y,
    'height' => -y,
    'relheight' => 1,
    'rely' => 0,
    'bordermode' => 'inside'
    )
    @bottom_frame_obj = AGTkObjPlace.new(@bottom_frame, 'y', nil, false)
    @bottom_frame_obj.width = 0
    @bottom_frame_obj.height = -y
    @bottom_frame_obj.relwidth = 1
    @bottom_frame_obj.relheight = 1
    if @user_control
      @splitter_frame.bind_append(
      "B1-Motion",
      proc{@splitter_frame.raise}
      )
      @splitter_frame.bind_append(
      "ButtonRelease-1",
      proc{do_resize}
      )
      _xbutton = Arcadia.wf.toolbutton(@splitter_frame){
        image Arcadia.image_res(HORIZONTAL_SPLITTER_HIDE_TOP_GIF)
      }
#      _xbutton = TkButton.new(@splitter_frame, Arcadia.style('toolbarbutton')){
#        background '#4966d7'
#      }
      _xbutton.place(
      'x' => 0,
      'y' => 0,
      'relheight' => 1,
      'bordermode' => 'outside',
      'width' => 20
      )
      _xbutton.bind_append(
      "ButtonPress-1",
      proc{hide_top}
      )

      _ybutton = Arcadia.wf.toolbutton(@splitter_frame){
        image Arcadia.image_res(HORIZONTAL_SPLITTER_HIDE_BOTTOM_GIF)
      }
#      _ybutton = TkButton.new(@splitter_frame, Arcadia.style('toolbarbutton')){
#        background '#118124'
#      }
      _ybutton.place(
      'x' => 21,
      'y' => 0,
      'bordermode' => 'outside',
      'width' => 20,
      'relheight' => 1
      )
      _ybutton.bind_append(
      "ButtonPress-1",
      proc{hide_bottom}
      )
    end
    @state = 'middle'
    yield(self) if block_given?
  end

Public Instance Methods

do_resize() click to toggle source
# File lib/a-tkcommons.rb, line 811
def do_resize
  _y = @splitter_frame_obj.y0
  _h = @splitter_frame_obj.h
  @top_frame_obj.height = _y
  @top_frame_obj.go(0,_y)
  @bottom_frame_obj.height = -_y-_h
  @bottom_frame_obj.amove(0,_y + _h)
  #end
end
get_main_y() click to toggle source
# File lib/a-tkcommons.rb, line 807
def get_main_y
  return 40
end
hide(_name) click to toggle source
# File lib/a-tkcommons.rb, line 821
def hide(_name)
end
hide_bottom() click to toggle source
# File lib/a-tkcommons.rb, line 764
def hide_bottom
  if (@state=='bottom')
    _h = @last
    @state = 'middle'
  elsif (@state == 'top')
    return
  else
    _h = @bottom_frame_obj.h + @top_frame_obj.h #+ @slen
    @state = 'top'
    @last = @top_frame_obj.h #+ @slen
  end
  @bottom_frame_obj.height = - _h - @slen
  @bottom_frame_obj.amove(0,_h + @slen)
  @bottom_frame_obj.obj.unplace if @state=='top'
  @splitter_frame_obj.amove(0,_h)
  @top_frame_obj.height = _h
  @top_frame_obj.go(0,_h)
end
hide_top() click to toggle source
# File lib/a-tkcommons.rb, line 744
def hide_top
  if (@state=='top')
    _h = @last
    @state = 'middle'
    @top_frame_obj.height = _h
    @top_frame_obj.go(0,_h)
  elsif (@state=='bottom')
    return
  else
    _h = 0
    @state = 'bottom'
    @last = @top_frame_obj.h
  end
  @top_frame_obj.amove(0,0)
  @top_frame_obj.obj.unplace if @state=='bottom'
  @splitter_frame_obj.amove(0, _h)
  @bottom_frame_obj.height = - _h - @slen
  @bottom_frame_obj.amove(0,_h + @slen)
end
maximize(_frame) click to toggle source
Calls superclass method AGTkSplittedFrames#maximize
# File lib/a-tkcommons.rb, line 784
def maximize(_frame)
  super(_frame)
  case _frame
  when top_frame
    hide_bottom
  when bottom_frame
    hide_top
  end
  Tk.update
end
minimize(_frame) click to toggle source
Calls superclass method AGTkSplittedFrames#minimize
# File lib/a-tkcommons.rb, line 795
def minimize(_frame)
  super(_frame)
  case _frame
  when top_frame
    hide_top
  when bottom_frame
    hide_bottom
  end
  Tk.update
end
show(_name) click to toggle source
# File lib/a-tkcommons.rb, line 824
def show(_name)
end