Class: AGTkOSplittedFrames

Inherits:
AGTkSplittedFrames show all
Defined in:
lib/a-tkcommons.rb

Instance Attribute Summary collapse

Attributes inherited from AGTkSplittedFrames

#frame1, #frame2

Attributes inherited from TkFrameAdapter

#frame

Instance Method Summary collapse

Methods inherited from TkFrameAdapter

#attach_frame, #detach_frame, #is_pack?, #is_place?, #is_undefined?, #layout_manager, #map, #refresh_layout_manager, #unmap

Constructor Details

#initialize(parent = nil, frame = nil, height = 10, slen = 5, perc = false, user_control = true, keys = nil) {|_self| ... } ⇒ AGTkOSplittedFrames

Returns a new instance of AGTkOSplittedFrames.

Yields:

  • (_self)

Yield Parameters:



631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
# File 'lib/a-tkcommons.rb', line 631

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

Instance Attribute Details

#bottom_frameObject (readonly)

Returns the value of attribute bottom_frame.



630
631
632
# File 'lib/a-tkcommons.rb', line 630

def bottom_frame
  @bottom_frame
end

#splitter_frameObject (readonly)

Returns the value of attribute splitter_frame.



630
631
632
# File 'lib/a-tkcommons.rb', line 630

def splitter_frame
  @splitter_frame
end

#top_frameObject (readonly)

Returns the value of attribute top_frame.



630
631
632
# File 'lib/a-tkcommons.rb', line 630

def top_frame
  @top_frame
end

Instance Method Details

#do_resizeObject



808
809
810
811
812
813
814
815
816
# File 'lib/a-tkcommons.rb', line 808

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_yObject



804
805
806
# File 'lib/a-tkcommons.rb', line 804

def get_main_y
  return 40
end

#hide(_name) ⇒ Object



818
819
# File 'lib/a-tkcommons.rb', line 818

def hide(_name)
end

#hide_bottomObject



761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
# File 'lib/a-tkcommons.rb', line 761

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_topObject



741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
# File 'lib/a-tkcommons.rb', line 741

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) ⇒ Object



781
782
783
784
785
786
787
788
789
790
# File 'lib/a-tkcommons.rb', line 781

def maximize(_frame)
  super(_frame)
  case _frame
  when top_frame
    hide_bottom
  when bottom_frame
    hide_top
  end
  Tk.update
end

#minimize(_frame) ⇒ Object



792
793
794
795
796
797
798
799
800
801
# File 'lib/a-tkcommons.rb', line 792

def minimize(_frame)
  super(_frame)
  case _frame
  when top_frame
    hide_top
  when bottom_frame
    hide_bottom
  end
  Tk.update
end

#show(_name) ⇒ Object



821
822
# File 'lib/a-tkcommons.rb', line 821

def show(_name)
end