X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhslider.cpp;h=3b68dacfa1b142eafe31851ed6f8dfc6fcd5d64e;hb=8f6f543758fb1b2b17ae2db519198d420eb9982d;hp=f19eafee419db334409007df3eb1e02be402856a;hpb=c2635c5a3dca6a6cea5562fd387beb0662b18cf0;p=libs%2Fgltk.git diff --git a/source/hslider.cpp b/source/hslider.cpp index f19eafe..3b68dac 100644 --- a/source/hslider.cpp +++ b/source/hslider.cpp @@ -55,27 +55,28 @@ void HSlider::pointer_motion(int x, int) } } -void HSlider::render_part(const Part &part) const +void HSlider::render_special(const Part &part) const { if(part.get_name()=="slider") { - unsigned gw=part.get_width(); - unsigned gh=(part.get_fill_y() ? geom.h : part.get_height()); + Alignment align=part.get_alignment(); + align.x=(value-min)/(max-min); + + Geometry pgeom=part.get_geometry(); + align.apply(pgeom, geom, part.get_margin()); + GL::push_matrix(); - GL::translate((geom.w-gw)*(value-min)/(max-min), (geom.h-gh)*(part.get_alignment().y+1)/2, 0); - const Graphic *graphic=part.get_graphic(state); - graphic->render(gw, gh); + GL::translate(pgeom.x, pgeom.y, 0); + part.get_graphic(state)->render(pgeom.w, pgeom.h); GL::pop_matrix(); } - else - Widget::render_part(part); } unsigned HSlider::get_slider_width() const { for(PartSeq::const_iterator i=style->get_parts().begin(); i!=style->get_parts().end(); ++i) if(i->get_name()=="slider") - return i->get_width(); + return i->get_geometry().w; return 0; }