X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fwidget.cpp;h=1113c971974f84779a3ca863df1b57f4ddf973ea;hb=1021ce203ab092edf5f94770e742d56a3b8cd23b;hp=bbd2e8877af608b1255d21eb10d9b23d2506fba4;hpb=5d219b2f7e8ce196486c225e971f76ceab5538c5;p=libs%2Fgltk.git diff --git a/source/widget.cpp b/source/widget.cpp index bbd2e88..1113c97 100644 --- a/source/widget.cpp +++ b/source/widget.cpp @@ -30,18 +30,12 @@ Widget::~Widget() void Widget::set_position(int x, int y) { - geom.x = x; - geom.y = y; - on_geometry_change(); - rebuild(); + set_geometry(Geometry(x, y, geom.w, geom.h)); } void Widget::set_size(unsigned w, unsigned h) { - geom.w = w; - geom.h = h; - on_geometry_change(); - rebuild(); + set_geometry(Geometry(geom.x, geom.y, w, h)); } void Widget::autosize() @@ -52,8 +46,10 @@ void Widget::autosize() 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); } }