]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/vslider.cpp
Remove obsolete inside checks
[libs/gltk.git] / source / vslider.cpp
index a32e484906c19b0944599a47f8b0932adde24b0b..e4c40d8123385ed283c1a1089a1c1346c627d946 100644 (file)
@@ -12,26 +12,25 @@ VSlider::VSlider():
        slider_size(1)
 { }
 
-void VSlider::autosize()
+void VSlider::autosize_special(const Part &part, Geometry &ageom)
 {
-       if(!style)
-               return;
-
-       Widget::autosize();
-
-       if(const Part *slider_part = style->get_part("slider"))
+       if(part.get_name()=="slider")
        {
-               const Sides &margin = slider_part->get_margin();
-               const Geometry &pgeom = slider_part->get_geometry();
-               geom.w = std::max(geom.w, pgeom.w+margin.left+margin.right);
-               geom.h = std::max(geom.h, pgeom.h*3/2+margin.top+margin.bottom);
+               const Sides &margin = part.get_margin();
+               const Geometry &pgeom = part.get_geometry();
+               ageom.w = std::max(ageom.w, pgeom.w+margin.left+margin.right);
+               ageom.h = std::max(ageom.h, pgeom.h*3/2+margin.top+margin.bottom);
        }
 }
 
-void VSlider::rebuild_special(const Part &part, CachedPart &cache)
+void VSlider::rebuild_special(const Part &part)
 {
        if(part.get_name()=="slider")
        {
+               const Graphic *graphic = part.get_graphic(state);
+               if(!graphic || !graphic->get_texture())
+                       return;
+
                Alignment align = part.get_alignment();
                if(max>min)
                        align.y = (value-min)/(max-min);
@@ -39,18 +38,15 @@ void VSlider::rebuild_special(const Part &part, CachedPart &cache)
                Geometry pgeom = part.get_geometry();
                align.apply(pgeom, geom, part.get_margin());
 
-               cache.texture = part.get_graphic(state)->get_texture();
-               cache.clear_mesh();
-
-               GL::MeshBuilder bld(*cache.mesh);
+               GL::MeshBuilder bld(part_cache.create_mesh(part, *graphic->get_texture()));
                bld.matrix() *= GL::Matrix::translation(pgeom.x, pgeom.y, 0);
-               part.get_graphic(state)->build(pgeom.w, pgeom.h, bld);
+               graphic->build(pgeom.w, pgeom.h, bld);
        }
 }
 
-void VSlider::button_press(int x, int y, unsigned btn)
+void VSlider::button_press(int, int y, unsigned btn)
 {
-       if(btn==1 && geom.is_inside_relative(x, y) && max>min)
+       if(btn==1 && max>min)
        {
                int sy = static_cast<int>((geom.h-slider_size)*(value-min)/(max-min));
                if(y<sy)