summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/setup_colors.cpp4
-rw-r--r--src/gui/widgets/textpreview.cpp13
-rw-r--r--src/gui/widgets/textpreview.h17
3 files changed, 26 insertions, 8 deletions
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 5019a61a..f0f7a529 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -60,7 +60,7 @@ Setup_Colors::Setup_Colors() :
mTextPreview = new TextPreview(&rawmsg);
mPreview = new BrowserBox(BrowserBox::AUTO_WRAP);
- mPreview->setOpaque(true);
+ mPreview->setOpaque(false);
// Replace this later with a more appropriate link handler. For now, this'll
// do, as it'll do nothing when clicked on.
@@ -212,8 +212,6 @@ void Setup_Colors::action(const gcn::ActionEvent &event)
case Palette::HYPERLINK:
mPreviewBox->setContent(mPreview);
mPreview->clearRows();
- //char ch = guiPalette->getColorCharAt(mSelected);
- //std::string msg;
if (ch == '<')
{
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,
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index 12db9f3f..7e7e461c 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -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
@@ -102,12 +102,27 @@ class TextPreview : public gcn::Widget
*/
void draw(gcn::Graphics *graphics);
+ /**
+ * Set opacity for this widget (whether or not to show the background
+ * color)
+ *
+ * @param opaque Whether the widget should be opaque or not
+ */
+ void setOpaque(bool opaque) { mOpaque = opaque; }
+
+ /**
+ * Gets opacity for this widget (whether or not the background color
+ * is shown below the widget)
+ */
+ bool isOpaque() { return mOpaque; }
+
private:
gcn::Font *mFont;
const std::string* mText;
const gcn::Color* mTextColor;
const gcn::Color* mBGColor;
const gcn::Color* mTextBGColor;
+ bool mOpaque;
bool mShadow;
bool mOutline;
};