summaryrefslogtreecommitdiff
path: root/src/guichan/widgets/window.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-15 04:22:11 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-15 04:22:11 +0300
commitc91bc5201596eda73f9df2222d76d9f413426a85 (patch)
treecbdcf7fb76eee35baf7265e5c04da2f13633ab5d /src/guichan/widgets/window.cpp
parent255b1c29f47ef3b1e7a9b058c56ef72bfa10c5e3 (diff)
downloadmv-c91bc5201596eda73f9df2222d76d9f413426a85.tar.gz
mv-c91bc5201596eda73f9df2222d76d9f413426a85.tar.bz2
mv-c91bc5201596eda73f9df2222d76d9f413426a85.tar.xz
mv-c91bc5201596eda73f9df2222d76d9f413426a85.zip
Remove some diplicated code from embeded guichan.
Diffstat (limited to 'src/guichan/widgets/window.cpp')
-rw-r--r--src/guichan/widgets/window.cpp91
1 files changed, 0 insertions, 91 deletions
diff --git a/src/guichan/widgets/window.cpp b/src/guichan/widgets/window.cpp
index d0ba32f47..550b23749 100644
--- a/src/guichan/widgets/window.cpp
+++ b/src/guichan/widgets/window.cpp
@@ -125,97 +125,6 @@ namespace gcn
return mAlignment;
}
- void Window::draw(Graphics* graphics)
- {
- const Color &faceColor = getBaseColor();
- Color highlightColor, shadowColor;
- const int alpha = getBaseColor().a;
- highlightColor = faceColor + 0x303030;
- highlightColor.a = alpha;
- shadowColor = faceColor - 0x303030;
- shadowColor.a = alpha;
-
- Rectangle d = getChildrenArea();
-
- // Fill the background around the content
- graphics->setColor(faceColor);
- // Fill top
- graphics->fillRectangle(Rectangle(0, 0, getWidth(), d.y - 1));
- // Fill left
- graphics->fillRectangle(Rectangle(0, d.y - 1, d.x - 1,
- getHeight() - d.y + 1));
- // Fill right
- graphics->fillRectangle(Rectangle(d.x + d.width + 1, d.y - 1,
- getWidth() - d.x - d.width - 1, getHeight() - d.y + 1));
- // Fill bottom
- graphics->fillRectangle(Rectangle(d.x - 1, d.y + d.height + 1,
- d.width + 2, getHeight() - d.height - d.y - 1));
-
- if (isOpaque())
- graphics->fillRectangle(d);
-
- // Construct a rectangle one pixel bigger than the content
- d.x -= 1;
- d.y -= 1;
- d.width += 2;
- d.height += 2;
-
- // Draw a border around the content
- graphics->setColor(shadowColor);
- // Top line
- graphics->drawLine(d.x,
- d.y,
- d.x + d.width - 2,
- d.y);
-
- // Left line
- graphics->drawLine(d.x,
- d.y + 1,
- d.x,
- d.y + d.height - 1);
-
- graphics->setColor(highlightColor);
- // Right line
- graphics->drawLine(d.x + d.width - 1,
- d.y,
- d.x + d.width - 1,
- d.y + d.height - 2);
- // Bottom line
- graphics->drawLine(d.x + 1,
- d.y + d.height - 1,
- d.x + d.width - 1,
- d.y + d.height - 1);
-
- drawChildren(graphics);
-
- int textX;
- int textY;
-
- textY = ((int)getTitleBarHeight() - getFont()->getHeight()) / 2;
-
- switch (getAlignment())
- {
- case Graphics::LEFT:
- textX = 4;
- break;
- case Graphics::CENTER:
- textX = getWidth() / 2;
- break;
- case Graphics::RIGHT:
- textX = getWidth() - 4;
- break;
- default:
- throw GCN_EXCEPTION("Unknown alignment.");
- }
-
- graphics->setColor(getForegroundColor());
- graphics->setFont(getFont());
- graphics->pushClipArea(Rectangle(0, 0, getWidth(),
- getTitleBarHeight() - 1));
- graphics->drawText(getCaption(), textX, textY, getAlignment());
- graphics->popClipArea();
- }
-
void Window::mousePressed(MouseEvent& mouseEvent)
{
if (mouseEvent.getSource() != this)