+++ /dev/null
-#include <msp/gl/matrix.h>
-#include <msp/gl/meshbuilder.h>
-#include "graphic.h"
-#include "part.h"
-#include "style.h"
-#include "vslider.h"
-
-namespace Msp {
-namespace GLtk {
-
-VSlider::VSlider()
-{ }
-
-void VSlider::autosize_special(const Part &part, Geometry &ageom) const
-{
- if(part.get_name()=="slider")
- {
- 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)
-{
- 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);
-
- Geometry pgeom = part.get_geometry();
- align.apply(pgeom, geom, part.get_margin());
-
- GL::MeshBuilder bld(part_cache.create_mesh(part, *graphic->get_texture()));
- bld.matrix() *= GL::Matrix::translation(pgeom.x, pgeom.y, 0);
- graphic->build(pgeom.w, pgeom.h, bld);
- }
-}
-
-void VSlider::button_press(int, int y, unsigned btn)
-{
- if(btn==1 && max>min)
- click(y);
-}
-
-void VSlider::button_release(int, int, unsigned btn)
-{
- if(btn==1 && dragging)
- end_drag();
-}
-
-void VSlider::pointer_motion(int, int y)
-{
- if(dragging)
- drag(y);
-}
-
-void VSlider::on_geometry_change()
-{
- drag_area_size = geom.h-slider_size;
-}
-
-void VSlider::on_style_change()
-{
- if(!style)
- return;
-
- if(const Part *slider_part = style->get_part("slider"))
- slider_size = slider_part->get_geometry().h;
-
- on_geometry_change();
-}
-
-} // namespace GLtk
-} // namespace Msp
-