slider_size(1)
{ }
-void HSlider::autosize()
+void HSlider::autosize_special(const Part &part, Geometry &ageom) const
{
- 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);
}
}
}
}
-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<int>((geom.w-slider_size)*(value-min)/(max-min));
if(x<sx)