summaryrefslogtreecommitdiff
path: root/src/gui/scrollarea.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-10 07:46:41 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-10 07:46:41 +0000
commit7bbe721a23b9caba7a67ac806be10aa536f7f46d (patch)
treed87383830d132ca08b472abed69b20f3f3eee58a /src/gui/scrollarea.cpp
parent4d338e801f8b1175585de6b5e7b8b2ca331b682f (diff)
downloadmana-7bbe721a23b9caba7a67ac806be10aa536f7f46d.tar.gz
mana-7bbe721a23b9caba7a67ac806be10aa536f7f46d.tar.bz2
mana-7bbe721a23b9caba7a67ac806be10aa536f7f46d.tar.xz
mana-7bbe721a23b9caba7a67ac806be10aa536f7f46d.zip
Moved knowledge about whether we use OpenGL into the Graphics class. Added helper function for being creation to reduce code duplication. Some code simplifications.
Diffstat (limited to 'src/gui/scrollarea.cpp')
-rw-r--r--src/gui/scrollarea.cpp78
1 files changed, 9 insertions, 69 deletions
diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp
index 3350a252..05fb49ce 100644
--- a/src/gui/scrollarea.cpp
+++ b/src/gui/scrollarea.cpp
@@ -179,33 +179,16 @@ void ScrollArea::draw(gcn::Graphics *graphics)
if (mHBarVisible && mVBarVisible)
{
graphics->setColor(getBaseColor());
- if (useOpenGL) {
-#ifdef USE_OPENGL
- dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle(gcn::Rectangle(getWidth() - mScrollbarWidth,
+ graphics->fillRectangle(gcn::Rectangle(getWidth() - mScrollbarWidth,
getHeight() - mScrollbarWidth,
mScrollbarWidth,
mScrollbarWidth));
-#endif
- }
- else {
- dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle(gcn::Rectangle(getWidth() - mScrollbarWidth,
- getHeight() - mScrollbarWidth,
- mScrollbarWidth,
- mScrollbarWidth));
- }
}
if (mContent)
{
gcn::Rectangle contdim = mContent->getDimension();
- if (useOpenGL) {
-#ifdef USE_OPENGL
- dynamic_cast<gcn::OpenGLGraphics*>(graphics)->pushClipArea(getContentDimension());
-#endif
- }
- else {
- dynamic_cast<gcn::SDLGraphics*>(graphics)->pushClipArea(getContentDimension());
- }
+ graphics->pushClipArea(getContentDimension());
if (mContent->getBorderSize() > 0)
{
@@ -214,44 +197,15 @@ void ScrollArea::draw(gcn::Graphics *graphics)
rec.y -= mContent->getBorderSize();
rec.width += 2 * mContent->getBorderSize();
rec.height += 2 * mContent->getBorderSize();
- if (useOpenGL) {
-#ifdef USE_OPENGL
- dynamic_cast<gcn::OpenGLGraphics*>(graphics)->pushClipArea(rec);
-#endif
- }
- else {
- dynamic_cast<gcn::SDLGraphics*>(graphics)->pushClipArea(rec);
- }
+ graphics->pushClipArea(rec);
mContent->drawBorder(graphics);
- if (useOpenGL) {
-#ifdef USE_OPENGL
- dynamic_cast<gcn::OpenGLGraphics*>(graphics)->popClipArea();
-#endif
- }
- else {
- dynamic_cast<gcn::SDLGraphics*>(graphics)->popClipArea();
- }
+ graphics->popClipArea();
}
- if (useOpenGL) {
-#ifdef USE_OPENGL
- dynamic_cast<gcn::OpenGLGraphics*>(graphics)->pushClipArea(contdim);
-#endif
- }
- else {
- dynamic_cast<gcn::SDLGraphics*>(graphics)->pushClipArea(contdim);
- }
+ graphics->pushClipArea(contdim);
mContent->draw(graphics);
- if (useOpenGL) {
-#ifdef USE_OPENGL
- dynamic_cast<gcn::OpenGLGraphics*>(graphics)->popClipArea();
- dynamic_cast<gcn::OpenGLGraphics*>(graphics)->popClipArea();
-#endif
- }
- else {
- dynamic_cast<gcn::SDLGraphics*>(graphics)->popClipArea();
- dynamic_cast<gcn::SDLGraphics*>(graphics)->popClipArea();
- }
+ graphics->popClipArea();
+ graphics->popClipArea();
}
}
@@ -341,14 +295,7 @@ void ScrollArea::drawVBar(gcn::Graphics *graphics)
{
gcn::Rectangle dim = getVerticalBarDimension();
graphics->setColor(gcn::Color(0, 0, 0, 32));
- if (useOpenGL) {
-#ifdef USE_OPENGL
- dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle(dim);
-#endif
- }
- else {
- dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle(dim);
- }
+ graphics->fillRectangle(dim);
graphics->setColor(gcn::Color(255, 255, 255));
}
@@ -356,14 +303,7 @@ void ScrollArea::drawHBar(gcn::Graphics *graphics)
{
gcn::Rectangle dim = getHorizontalBarDimension();
graphics->setColor(gcn::Color(0, 0, 0, 32));
- if (useOpenGL) {
-#ifdef USE_OPENGL
- dynamic_cast<gcn::OpenGLGraphics*>(graphics)->fillRectangle(dim);
-#endif
- }
- else {
- dynamic_cast<gcn::SDLGraphics*>(graphics)->fillRectangle(dim);
- }
+ graphics->fillRectangle(dim);
graphics->setColor(gcn::Color(255, 255, 255));
}