Class: TkFloatTitledFrame

Inherits:
TkBaseTitledFrame show all
Includes:
TkMovable, TkResizable
Defined in:
lib/a-tkcommons.rb

Constant Summary

Constants included from TkResizable

TkResizable::MIN_HEIGHT, TkResizable::MIN_WIDTH

Instance Attribute Summary

Attributes inherited from TkBaseTitledFrame

#frame, #top

Instance Method Summary collapse

Methods included from TkResizable

#resizing_do_move_obj, #resizing_do_press, #start_resizing, #stop_resizing

Methods included from TkMovable

#moving_do_move_obj, #moving_do_press, #start_moving, #stop_moving

Methods inherited from TkBaseTitledFrame

#add_fixed_button, #add_fixed_menu_button, #add_fixed_panel, #add_fixed_progress, #add_fixed_sep, #create_frame, #menu_button, #visible?

Constructor Details

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

Returns a new instance of TkFloatTitledFrame.



1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
# File 'lib/a-tkcommons.rb', line 1675

def initialize(parent=nil, *args)
  super(parent)
  frame.place('height'=>-32)
  borderwidth  2
  relief  'groove'
  @left_label = TkLabel.new(@top, Arcadia.style('titlelabel')){
    anchor 'w'
  }.place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1 ,'width'=>-20)
  #.pack('fill'=>'x', 'side'=>'top')
  @resizing_label=TkLabel.new(self, Arcadia.style('label')){
    text '-'
    image Arcadia.image_res(EXPAND_LIGHT_GIF)
  }.pack('side'=> 'right','anchor'=> 's')
  start_moving(@left_label, self)
  start_moving(frame, self)
  start_resizing(@resizing_label, self)
  @grabbed = false
  @event_loop = false
  #    frame.bind_append('KeyPress'){|e|
  #      p e.keysym
  #      case e.keysym
  #        when 'Escape'
  #          p "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW"
  #          hide
  #      end
  #    }
  Arcadia.instance.register_key_binding(self,"KeyPress[Escape]","ActionEvent.new(self, 'action'=>hide_if_visible)")
end

Instance Method Details

#head_buttonsObject

def show_modal

  # not implemented
end


1762
1763
# File 'lib/a-tkcommons.rb', line 1762

def head_buttons
end

#hideObject



1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
# File 'lib/a-tkcommons.rb', line 1716

def hide
  if @event_loop
    Arcadia.detach_listener(self, ArcadiaEvent)
    @event_loop = false
  end
  @manager = TkWinfo.manager(self)
  if @manager == 'place'
    @x_place = TkPlace.info(self)['x']
    @y_place = TkPlace.info(self)['y']
    @width_place = TkPlace.info(self)['width']
    @height_place = TkPlace.info(self)['height']
    self.unplace
  end

  if @grabbed
    self.grab("release")
    @grabbed = false
  end
  self
end

#hide_if_visibleObject



1712
1713
1714
# File 'lib/a-tkcommons.rb', line 1712

def hide_if_visible
  hide if visible?
end

#on_arcadia(_e) ⇒ Object



1737
1738
1739
# File 'lib/a-tkcommons.rb', line 1737

def on_arcadia(_e)
  self.raise
end

#on_close=(_proc) ⇒ Object



1708
1709
1710
# File 'lib/a-tkcommons.rb', line 1708

def on_close=(_proc)
  add_fixed_button('X', _proc, TAB_CLOSE_GIF)
end

#showObject



1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
# File 'lib/a-tkcommons.rb', line 1741

def show
  if @manager == 'place'
    self.place('x'=>@x_place, 'y'=>@y_place, 'width'=>@width_place, 'height'=>@height_place)
  end
  if @event_loop == false
    Arcadia.attach_listener(self, ArcadiaEvent)
    @event_loop = true
  end
  self.raise
end

#show_grabbedObject



1752
1753
1754
1755
1756
# File 'lib/a-tkcommons.rb', line 1752

def show_grabbed
  show
  @grabbed = true
  self.grab("set")
end

#title(_text) ⇒ Object



1704
1705
1706
# File 'lib/a-tkcommons.rb', line 1704

def title(_text)
  @left_label.text(_text)
end