X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhslider.cpp;h=2c6e968695439603031234b045dfb3ded26fc458;hb=7f5b8877ae1a73d3b664d7ee6f0041b602bdd049;hp=837b2ba5c2dae4a0344da91665661079c7e427ef;hpb=319cde3c06181ba1c3619567525002926d8b4889;p=libs%2Fgltk.git diff --git a/source/hslider.cpp b/source/hslider.cpp index 837b2ba..2c6e968 100644 --- a/source/hslider.cpp +++ b/source/hslider.cpp @@ -12,19 +12,14 @@ HSlider::HSlider(): slider_size(1) { } -void HSlider::autosize() +void HSlider::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*3/2+margin.left+margin.right); - geom.h = std::max(geom.h, pgeom.h+margin.top+margin.bottom); + const Sides &margin = part.get_margin(); + const Geometry &pgeom = part.get_geometry(); + ageom.w = std::max(ageom.w, pgeom.w*3/2+margin.left+margin.right); + ageom.h = std::max(ageom.h, pgeom.h+margin.top+margin.bottom); } } @@ -49,9 +44,9 @@ void HSlider::rebuild_special(const Part &part) } } -void HSlider::button_press(int x, int y, unsigned btn) +void HSlider::button_press(int x, int, unsigned btn) { - if(btn==1 && geom.is_inside_relative(x, y) && max>min) + if(btn==1 && max>min) { int sx = static_cast((geom.w-slider_size)*(value-min)/(max-min)); if(x