1 #include <msp/gl/meshbuilder.h>
4 #include "progressbar.h"
11 void ProgressBar::set_range(float r)
14 throw invalid_argument("ProgressBar::set_range");
20 void ProgressBar::set_value(float v)
23 throw invalid_argument("ProgressBar::set_value");
29 void ProgressBar::autosize_special(const Part &part, Geometry &ageom) const
31 const Geometry &pgeom = part.get_geometry();
32 const Sides &pmargin = part.get_margin();
33 ageom.w = max(ageom.w, pgeom.w+pmargin.left+pmargin.right);
34 ageom.h = max(ageom.h, pgeom.h+pmargin.top+pmargin.bottom);
37 void ProgressBar::rebuild_special(const Part &part)
39 if(part.get_name()=="bar")
41 const Graphic *graphic = part.get_graphic(state);
42 if(!graphic || !graphic->get_texture())
45 Geometry rgeom = part.get_geometry();
46 Alignment align = part.get_alignment();
47 align.w += (1-align.w)*fraction;
48 align.h += (1-align.h)*fraction;
49 align.apply(rgeom, geom, part.get_margin());
51 GL::MeshBuilder bld(part_cache.create_mesh(part, *graphic->get_texture()));
52 bld.transform(GL::Matrix::translation(rgeom.x, rgeom.y, 0));
53 graphic->build(rgeom.w, rgeom.h, bld);