void Layout::update()
{
- for(list<Slot *>::iterator i=slots.begin(); i!=slots.end(); ++i)
- {
- (*i)->widget.autosize();
- (*i)->geom = (*i)->widget.get_geometry();
- }
-
solve_constraints(HORIZONTAL);
solve_constraints(VERTICAL);
LinearProgram::Row row = linprog.add_row();
row[(*i)->index*5+1] = 1;
row[(*i)->index*5+4] = -1;
- row.back() = (*i)->geom.*(ptrs.dim);
+ row.back() = (*i)->autosize_geom.*(ptrs.dim);
}
/* Add rows for user-defined constraints. Below/above and left/right of
{
vert_pack.gravity = 1;
widget.signal_autosize_changed.connect(sigc::mem_fun(this, &Slot::autosize_changed));
+ widget.autosize();
+ autosize_geom = widget.get_geometry();
}
void Layout::Slot::autosize_changed()
{
- layout.update();
+ widget.autosize();
+ autosize_geom = widget.get_geometry();
+
+ // If the widget fits in the area it had, just leave it there.
+ if(autosize_geom.w<=geom.w && autosize_geom.h<=geom.h)
+ widget.set_geometry(geom);
+ else
+ layout.update();
}