]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/hslider.cpp
Strip copyright messages and id tags from individual files
[libs/gltk.git] / source / hslider.cpp
index e86cc4b17da02f56f8d26906eb2382ab59af0761..18a163c844258d503f4cb2601387fcc191e4bf81 100644 (file)
@@ -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 <msp/gl/matrix.h>
 #include <msp/gl/transform.h>
 #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")