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