Class: AGTkOSplittedFrames
- Inherits:
-
AGTkSplittedFrames
- Object
- TkFrame
- TkFrameAdapter
- AGTkSplittedFrames
- AGTkOSplittedFrames
- Defined in:
- lib/a-tkcommons.rb
Instance Attribute Summary collapse
-
#bottom_frame ⇒ Object
readonly
Returns the value of attribute bottom_frame.
-
#splitter_frame ⇒ Object
readonly
Returns the value of attribute splitter_frame.
-
#top_frame ⇒ Object
readonly
Returns the value of attribute top_frame.
Attributes inherited from AGTkSplittedFrames
Attributes inherited from TkFrameAdapter
Instance Method Summary collapse
- #do_resize ⇒ Object
- #get_main_y ⇒ Object
- #hide(_name) ⇒ Object
- #hide_bottom ⇒ Object
- #hide_top ⇒ Object
-
#initialize(parent = nil, frame = nil, height = 10, slen = 5, perc = false, keys = nil) {|_self| ... } ⇒ AGTkOSplittedFrames
constructor
A new instance of AGTkOSplittedFrames.
- #maximize(_frame) ⇒ Object
- #minimize(_frame) ⇒ Object
- #show(_name) ⇒ Object
Methods inherited from TkFrameAdapter
#add_moved_by, #attach_frame, #detach_frame, #refresh
Methods included from TkMovable
#moving_do_move_obj, #moving_do_press, #start_moving, #stop_moving
Constructor Details
#initialize(parent = nil, frame = nil, height = 10, slen = 5, perc = false, keys = nil) {|_self| ... } ⇒ AGTkOSplittedFrames
Returns a new instance of AGTkOSplittedFrames.
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 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 |
# File 'lib/a-tkcommons.rb', line 558 def initialize(parent=nil, frame=nil, height=10, slen=5, perc=false, keys=nil) super(parent, frame, height, slen, 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.bind_append( "B1-Motion", proc{@splitter_frame.raise} ) @splitter_frame.bind_append( "ButtonRelease-1", proc{do_resize} ) @splitter_frame_obj = AGTkObjPlace.new(@splitter_frame, 'y') @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 = TkButton.new(@splitter_frame, Arcadia.style('toolbarbutton')){ background '#4966d7' } .place( 'x' => 0, 'y' => 0, 'relheight' => 1, 'bordermode' => 'outside', 'width' => 20 ) .bind_append( "ButtonPress-1", proc{hide_top} ) = TkButton.new(@splitter_frame, Arcadia.style('toolbarbutton')){ background '#118124' } .place( 'x' => 21, 'y' => 0, 'bordermode' => 'outside', 'width' => 20, 'relheight' => 1 ) .bind_append( "ButtonPress-1", proc{hide_bottom} ) @state = 'middle' yield(self) if block_given? end |
Instance Attribute Details
#bottom_frame ⇒ Object (readonly)
Returns the value of attribute bottom_frame.
557 558 559 |
# File 'lib/a-tkcommons.rb', line 557 def bottom_frame @bottom_frame end |
#splitter_frame ⇒ Object (readonly)
Returns the value of attribute splitter_frame.
557 558 559 |
# File 'lib/a-tkcommons.rb', line 557 def splitter_frame @splitter_frame end |
#top_frame ⇒ Object (readonly)
Returns the value of attribute top_frame.
557 558 559 |
# File 'lib/a-tkcommons.rb', line 557 def top_frame @top_frame end |
Instance Method Details
#do_resize ⇒ Object
726 727 728 729 730 731 732 733 734 |
# File 'lib/a-tkcommons.rb', line 726 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 ⇒ Object
722 723 724 |
# File 'lib/a-tkcommons.rb', line 722 def get_main_y return 40 end |
#hide(_name) ⇒ Object
736 737 |
# File 'lib/a-tkcommons.rb', line 736 def hide(_name) end |
#hide_bottom ⇒ Object
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 |
# File 'lib/a-tkcommons.rb', line 679 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 ⇒ Object
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
# File 'lib/a-tkcommons.rb', line 659 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
699 700 701 702 703 704 705 706 707 708 |
# File 'lib/a-tkcommons.rb', line 699 def maximize(_frame) super(_frame) case _frame when top_frame hide_bottom when bottom_frame hide_top end Tk.update end |
#minimize(_frame) ⇒ Object
710 711 712 713 714 715 716 717 718 719 |
# File 'lib/a-tkcommons.rb', line 710 def minimize(_frame) super(_frame) case _frame when top_frame hide_top when bottom_frame hide_bottom end Tk.update end |
#show(_name) ⇒ Object
739 740 |
# File 'lib/a-tkcommons.rb', line 739 def show(_name) end |