void Widget::autosize()
{
+ if(!style)
+ return;
+
geom.w = 0;
geom.h = 0;
const Style::PartSeq &parts = style->get_parts();
for(Style::PartSeq::const_iterator i=parts.begin(); i!=parts.end(); ++i)
if(i->get_name().empty())
{
- geom.w = max(geom.w, i->get_geometry().w);
- geom.h = max(geom.h, i->get_geometry().h);
+ const Geometry &pgeom = i->get_geometry();
+ const Sides &pmargin = i->get_margin();
+ geom.w = max(geom.w, pgeom.w+pmargin.left+pmargin.right);
+ geom.h = max(geom.h, pgeom.h+pmargin.top+pmargin.bottom);
}
}