Methods
Attributes
[RW] | propagate |
Class Public methods
new(*args)
Link
# 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)
Link
add(*widgets)
Link
# 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()
Link
# 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)
Link
insert(idx, widget)
Link
# 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)
Link