void MSVGauge::drawGauge(void) { if (mapped()==MSTrue) { int x=sliderAreaRect().x()+SliderAreaShadowThickness; int y=y_end(); int curValue=valueToPixel(currentValue())+slider()->height(); int startValue; if(_startValue.isSet()==MSTrue) { double sv=_startValue; if(sv<valueMin()) sv=valueMin(); else if(sv>valueMax()) sv=valueMax(); startValue=valueToPixel(sv)+slider()->height(); } else startValue=y-SliderAreaShadowThickness; Direction direction=curValue<startValue?Up:Down; int thickness=slider()->shadowThickness(); int h=abs(startValue-curValue); int starty=(direction==Up)?startValue:curValue; if (h>=thickness&&slider()->width()>thickness*2) { int height=h-(h>thickness*2?thickness*2:thickness); XBFillRectangle(display(),window(),slider()->backgroundShadowGC(), x+thickness,starty-h+thickness,slider()->width()-2*thickness,height); } if (h>thickness&&thickness>0) { drawGaugeShadow(x,starty,h,thickness,direction); } gaugeHeight(h); _direction=direction; } }
virtual void Render() { // Draw the axes outside th3e client area GG::Pt begin(ClientUpperLeft().x - AXIS_WIDTH/2, ClientLowerRight().y + AXIS_HEIGHT/2); GG::Pt x_end(ClientLowerRight().x, begin.y); GG::Pt y_end(begin.x, ClientUpperLeft().y); DrawArrow(begin, x_end); DrawArrow(begin, y_end); }
void MSVGauge::updateGauge(int h_) { if (mapped()==MSTrue) { int x=sliderAreaRect().x()+SliderAreaShadowThickness; int y=y_end(); int curValue=valueToPixel(h_)+slider()->height(); int startValue; if(_startValue.isSet()==MSTrue) { double sv=_startValue; if(sv<valueMin()) sv=valueMin(); else if(sv>valueMax()) sv=valueMax(); startValue=valueToPixel(sv)+slider()->height(); } else startValue=y-SliderAreaShadowThickness; Direction direction=curValue<startValue?Up:Down; int thickness=slider()->shadowThickness(); int h=abs(startValue-curValue); int starty=startValue; int height=abs(h-gaugeHeight()); if (h==gaugeHeight() && direction==_direction) return; else if (direction==_direction) { if (h<gaugeHeight()) { // value is smaller, clear area starty=direction==Up?starty-gaugeHeight():starty+h-thickness; XFillRectangle(display(),window(),selectShadowGC(),x,starty,slider()->width(),height+thickness); } else { // value is bigger, add area starty=direction==Up?starty-h+thickness:starty+gaugeHeight()-thickness; XFillRectangle(display(),window(),slider()->backgroundShadowGC(),x+thickness, starty,slider()->width()-2*thickness,height); } if (h>thickness&&thickness>0) updateGaugeShadow(x,starty,h,thickness,direction); } else { // direction changed, redraw drawSliderArea(); drawGauge(); } gaugeHeight(h); _direction=direction; } }