Methods
#
A
D
I
N
P
Attributes
[RW] propagate
Class Public methods
new(*args)
# File ext/tk/sample/tkalignbox.rb, line 21
def initialize(*args)
  if self.class == Tk::RbWidget::AlignBox
    fail RuntimeError, "Tk::AlignBox is an abstract class"
  end
  @padx = 0
  @pady = 0
  if args[-1].kind_of? Hash
    keys = _symbolkey2str(args.pop)
    @padx = keys.delete('padx') || 0
    @pady = keys.delete('pady') || 0
    args.push(keys)
  end
  super(*args)
  @max_width = 0
  @max_height = 0
  @propagate = true
  @widgets = []
end
Instance Public methods
<<(widget)
# File ext/tk/sample/tkalignbox.rb, line 76
def <<(widget)
  add(widget)
end
add(*widgets)
# File ext/tk/sample/tkalignbox.rb, line 61
def add(*widgets)
  widgets.each{|w|
    unless w.kind_of? TkWindow
      fail RuntimeError, "#{w.inspect} is not a widget instance."
    end
    @widgets.delete(w)
    @widgets << w
    sz = w.winfo_reqwidth
    @max_width = sz if @max_width < sz
    sz = w.winfo_reqheight
    @max_height = sz if @max_height < sz
  }
  align
end
align()
# File ext/tk/sample/tkalignbox.rb, line 50
def align
  widgets = []
  @widgets.each{|w| widgets << w if w.winfo_exist?}
  @widgets = widgets
  cnt = @widgets.size.to_f
  @widgets.each_with_index{|w, idx| _place_config(w, idx, cnt)}
  @widgets = widgets
  _set_framesize if @propagate
  self
end
delete(idx)
# File ext/tk/sample/tkalignbox.rb, line 93
def delete(idx)
  ret = @widgets.delete_at(idx)
  @req_size = 0
  @widget.each{|w|
    sz = w.winfo_reqwidth
    @max_width = sz if @max_width < sz
    sz = w.winfo_reqheight
    @max_height = sz if @max_height < sz
  }
  align
  ret
end
insert(idx, widget)
# File ext/tk/sample/tkalignbox.rb, line 80
def insert(idx, widget)
  unless widget.kind_of? TkWindow
    fail RuntimeError, "#{widget.inspect} is not a widget instance."
  end
  @widgets.delete(widget)
  @widgets[idx,0] = widget
  sz = widget.winfo_reqwidth
  @max_width = sz if @max_width < sz
  sz = widget.winfo_reqheight
  @max_height = sz if @max_height < sz
  align
end
padx(size = nil)
# File ext/tk/sample/tkalignbox.rb, line 106
def padx(size = nil)
  if size
    @padx = size
    align
  else
    @padx
  end
end
pady(size = nil)
# File ext/tk/sample/tkalignbox.rb, line 115
def pady(size = nil)
  if size
    @pady = size
    align
  else
    @pady
  end
end