X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhslider.cpp;h=18a163c844258d503f4cb2601387fcc191e4bf81;hb=2b70e8801c43875ed3f4135bdd0141265cff0312;hp=e86cc4b17da02f56f8d26906eb2382ab59af0761;hpb=2bdaf4955fdb94e73704adcdcf0adc2b353f0ff0;p=libs%2Fgltk.git diff --git a/source/hslider.cpp b/source/hslider.cpp index e86cc4b..18a163c 100644 --- a/source/hslider.cpp +++ b/source/hslider.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspgltk -Copyright © 2007-2008, 2010-2011 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include #include #include "graphic.h" @@ -19,6 +12,22 @@ HSlider::HSlider(): slider_size(1) { } +void HSlider::autosize() +{ + if(!style) + return; + + Widget::autosize(); + + if(const Part *slider_part = style->get_part("slider")) + { + const Sides &margin = slider_part->get_margin(); + const Geometry &pgeom = slider_part->get_geometry(); + geom.w = std::max(geom.w, pgeom.w*3/2+margin.left+margin.right); + geom.h = std::max(geom.h, pgeom.h+margin.top+margin.bottom); + } +} + void HSlider::render_special(const Part &part) const { if(part.get_name()=="slider")