From c91bc5201596eda73f9df2222d76d9f413426a85 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Sep 2011 04:22:11 +0300 Subject: Remove some diplicated code from embeded guichan. --- src/guichan/widgets/slider.cpp | 68 ------------------------------------------ 1 file changed, 68 deletions(-) (limited to 'src/guichan/widgets/slider.cpp') diff --git a/src/guichan/widgets/slider.cpp b/src/guichan/widgets/slider.cpp index eba88382c..f0eabd627 100644 --- a/src/guichan/widgets/slider.cpp +++ b/src/guichan/widgets/slider.cpp @@ -117,74 +117,6 @@ namespace gcn mScaleEnd = scaleEnd; } - void Slider::draw(gcn::Graphics* graphics) - { - Color shadowColor = getBaseColor() - 0x101010; - int alpha = getBaseColor().a; - shadowColor.a = alpha; - - graphics->setColor(shadowColor); - graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight())); - - drawMarker(graphics); - } - - void Slider::drawMarker(gcn::Graphics* graphics) - { - gcn::Color faceColor = getBaseColor(); - Color highlightColor, shadowColor; - int alpha = getBaseColor().a; - highlightColor = faceColor + 0x303030; - highlightColor.a = alpha; - shadowColor = faceColor - 0x303030; - shadowColor.a = alpha; - - graphics->setColor(faceColor); - - if (getOrientation() == HORIZONTAL) - { - int v = getMarkerPosition(); - graphics->fillRectangle(gcn::Rectangle(v + 1, 1, - getMarkerLength() - 2, getHeight() - 2)); - graphics->setColor(highlightColor); - graphics->drawLine(v, 0, v + getMarkerLength() - 1, 0); - graphics->drawLine(v, 0, v, getHeight() - 1); - graphics->setColor(shadowColor); - graphics->drawLine(v + getMarkerLength() - 1, 1, - v + getMarkerLength() - 1, getHeight() - 1); - graphics->drawLine(v + 1, getHeight() - 1, - v + getMarkerLength() - 1, getHeight() - 1); - - if (isFocused()) - { - graphics->setColor(getForegroundColor()); - graphics->drawRectangle(Rectangle(v + 2, 2, - getMarkerLength() - 4, getHeight() - 4)); - } - } - else - { - int v = (getHeight() - getMarkerLength()) - getMarkerPosition(); - graphics->fillRectangle(gcn::Rectangle(1, v + 1, getWidth() - 2, - getMarkerLength() - 2)); - graphics->setColor(highlightColor); - graphics->drawLine(0, v, 0, v + getMarkerLength() - 1); - graphics->drawLine(0, v, getWidth() - 1, v); - graphics->setColor(shadowColor); - graphics->drawLine(1, v + getMarkerLength() - 1, getWidth() - 1, - v + getMarkerLength() - 1); - graphics->drawLine(getWidth() - 1, v + 1, getWidth() - 1, - v + getMarkerLength() - 1); - - if (isFocused()) - { - graphics->setColor(getForegroundColor()); - graphics->drawRectangle(Rectangle(2, v + 2, getWidth() - 4, - getMarkerLength() - 4)); - } - } - } - void Slider::mousePressed(MouseEvent& mouseEvent) { if (mouseEvent.getButton() == gcn::MouseEvent::LEFT -- cgit v1.2.3-70-g09d2