require 'booh/booh-lib'
include Booh
+class Gtk::Allocation
+ def to_s
+ "width:#{width} heigth:#{height}"
+ end
+end
+
class Gtk::AutoTable < Gtk::VBox
def initialize(row_spacings)
return
else
- maxwidth = allocation.width
- xpix = 5 + @children[0][:allocation][:width] + 5
+ totalwidth = allocation.width
+ maxwidth = @children.collect { |chld| chld[:allocation][:width] }.max
+ xpix = 5 + maxwidth + 5
x = 1
y = 0
@children[1..-1].each { |e|
- if xpix + 5 + e[:allocation][:width] + 5 > maxwidth - 1
+ if xpix + 5 + maxwidth + 5 > totalwidth - 1
x = 0
y += 1
xpix = 0
e[:xnew] = x
e[:ynew] = y
x += 1
- xpix += 5 + e[:allocation][:width] + 5
+ xpix += 5 + maxwidth + 5
}
if @children[1..-1].find { |e| e[:xnew] != e[:x] || e[:ynew] != e[:y] } || force
msg 3, "I can proceed with #{allocation}"