summaryrefslogtreecommitdiff
path: root/src/gui/widgets/textpreview.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-03-12 22:07:29 -0600
committerIra Rice <irarice@gmail.com>2009-03-12 22:07:29 -0600
commit14fbd95172a6c41abc8e985680c684c40e9e50a8 (patch)
tree1a8a5c36af80a6a5ebd328cf9fbca025f020b625 /src/gui/widgets/textpreview.cpp
parentf0d5e3da15a308fcc962590330e7d8e39e8874b9 (diff)
downloadMana-14fbd95172a6c41abc8e985680c684c40e9e50a8.tar.gz
Mana-14fbd95172a6c41abc8e985680c684c40e9e50a8.tar.bz2
Mana-14fbd95172a6c41abc8e985680c684c40e9e50a8.tar.xz
Mana-14fbd95172a6c41abc8e985680c684c40e9e50a8.zip
Added in option for opacity for the text preview widget, which all of
the other widgets have as well. Also set the preview widget to have opacity off, like all of the other widgets (if it is on, then opacity can't be applied to it. Also looks rather tacky with it) Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/widgets/textpreview.cpp')
-rw-r--r--src/gui/widgets/textpreview.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index f77657c2..b13d12e4 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -2,7 +2,7 @@
* The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of The Mana World.
+ * This file is part of Aethyra based on code from The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,12 +35,16 @@ TextPreview::TextPreview(const std::string* text)
mTextColor = &guiPalette->getColor(Palette::TEXT);
mTextBGColor = NULL;
mBGColor = &guiPalette->getColor(Palette::BACKGROUND);
+ mOpaque = false;
}
void TextPreview::draw(gcn::Graphics* graphics)
{
- graphics->setColor(*mBGColor);
- graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
+ if (mOpaque)
+ {
+ graphics->setColor(*mBGColor);
+ graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
+ }
const std::string ttf = "TrueTypeFont";
@@ -50,7 +54,8 @@ void TextPreview::draw(gcn::Graphics* graphics)
graphics->setColor(*mTextBGColor);
int x = font->getWidth(*mText) + 1 + 2 * ((mOutline || mShadow) ? 1 :0);
int y = font->getHeight() + 1 + 2 * ((mOutline || mShadow) ? 1 : 0);
- graphics->fillRectangle(gcn::Rectangle(1, 1, x, y));
+ if (mOpaque)
+ graphics->fillRectangle(gcn::Rectangle(1, 1, x, y));
}
TextRenderer::renderText(graphics, *mText, 2, 2, gcn::Graphics::LEFT,