]> git.tdb.fi Git - libs/gltk.git/commitdiff
Consider part margins when autosizing
authorMikko Rasa <tdb@tdb.fi>
Sun, 9 Jun 2013 15:07:09 +0000 (18:07 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 9 Jun 2013 15:07:09 +0000 (18:07 +0300)
source/widget.cpp

index e73e5cf56ef89630c0b36944792ed7a225018e58..1113c971974f84779a3ca863df1b57f4ddf973ea 100644 (file)
@@ -46,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);
                }
 }