From 14fbd95172a6c41abc8e985680c684c40e9e50a8 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Thu, 12 Mar 2009 22:07:29 -0600 Subject: 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 --- src/gui/widgets/textpreview.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/gui/widgets/textpreview.cpp') 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, -- cgit v1.2.3-60-g2f50