Class: TkBaseTitledFrame

Inherits:
TkFrame
  • Object
show all
Defined in:
lib/a-tkcommons.rb

Direct Known Subclasses

TkFloatTitledFrame, TkTitledFrame

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil, *args) ⇒ TkBaseTitledFrame

Returns a new instance of TkBaseTitledFrame.



710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
# File 'lib/a-tkcommons.rb', line 710

def initialize(parent=nil, *args)
  super(parent, Arcadia.style('panel'))
  @parent = parent
  @title_height = 18
  @top = TkFrame.new(self){
    background  Arcadia.conf('titlelabel.background')
    #foreground  'white'
    #anchor 'w'
  }.place('x'=>0, 'y'=>0,'height'=>@title_height, 'relwidth'=>1)
  #.pack('fill'=> 'x','ipady'=> @title_height, 'side'=>'top')
  @frame = create_frame
  @button_frame=TkFrame.new(@top){
    #background  '#303b50'
    background  Arcadia.conf('titlelabel.background')
  }.pack('side'=> 'right','anchor'=> 'w')
  @buttons = Hash.new
  @menu_buttons = Hash.new
  self.head_buttons
end

Instance Attribute Details

#frameObject (readonly)

Returns the value of attribute frame.



707
708
709
# File 'lib/a-tkcommons.rb', line 707

def frame
  @frame
end

#topObject (readonly)

Returns the value of attribute top.



708
709
710
# File 'lib/a-tkcommons.rb', line 708

def top
  @top
end

Instance Method Details

#add_button(_label, _proc = nil, _image = nil, _side = 'right') ⇒ Object



734
735
736
737
738
739
740
741
742
743
744
745
746
# File 'lib/a-tkcommons.rb', line 734

def add_button(_label,_proc=nil,_image=nil, _side= 'right')
  TkButton.new(@button_frame, Arcadia.style('toolbarbutton')){
    text  _label if _label
    image  TkPhotoImage.new('dat' => _image) if _image
    #relief 'flat'
    font 'helvetica 8 bold'
    #borderwidth 0
    #background  '#303b50'
    #background  '#8080ff'
    pack('side'=> _side,'anchor'=> 'e')
    bind('1',_proc) if _proc
  }
end

#add_menu_button(_name = 'default', _image = nil, _side = 'right') ⇒ Object



748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
# File 'lib/a-tkcommons.rb', line 748

def add_menu_button(_name='default',_image=nil, _side= 'right')
  @menu_buttons[_name] = TkMenuButton.new(@button_frame, Arcadia.style('titlelabel')){|mb|
    indicatoron true
    menu TkMenu.new(mb, Arcadia.style('titlemenu'))
#      menu TkMenu.new(:parent=>mb, Arcadia.style('titlemenu'))
#      menu TkMenu.new(:parent=>mb,
#        :tearoff=>0,
#        :background=>Arcadia.style('titlelabel')['background'],
#        :foreground=>Arcadia.style('titlelabel')['foreground']
#      )
    if _image
      image TkPhotoImage.new('dat' => _image)
    end
    pack('side'=> _side,'anchor'=> 'e')
  }
  @menu_buttons[_name]
end

#create_frameObject



730
731
732
# File 'lib/a-tkcommons.rb', line 730

def create_frame
  return TkFrame.new(self,Arcadia.style('panel')).place('x'=>0, 'y'=>@title_height,'height'=>-@title_height,'relheight'=>1, 'relwidth'=>1)
end

#head_buttonsObject



770
771
772
# File 'lib/a-tkcommons.rb', line 770

def head_buttons
  @bmaxmin = add_button('[ ]',proc{resize}, W_MAX_GIF)
end


766
767
768
# File 'lib/a-tkcommons.rb', line 766

def menu_button(_name='default')
  @menu_buttons[_name]
end