From ecf588b5ef86804b0074c54b6371cda9e8f346c2 Mon Sep 17 00:00:00 2001 From: Bertram Date: Thu, 3 Sep 2009 20:37:08 +0200 Subject: Resolved Mantis #847: Login stage Windows won't go less than the default gui opacity. Of course, in-game, the wanted opacity still shows up. --- src/gui/widgets/textfield.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/gui/widgets/textfield.cpp') diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 75144658..f19b4d82 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -29,6 +29,7 @@ #include "resources/image.h" #include "resources/resourcemanager.h" +#include "gui/skin.h" #include "utils/dtor.h" @@ -82,8 +83,23 @@ TextField::~TextField() for_each(skin.grid, skin.grid + 9, dtor()); } +void TextField::updateAlpha() +{ + float alpha = std::max(config.getValue("guialpha", 0.8), + (double)SkinLoader::instance()->getMinimumOpacity()); + + if (alpha != mAlpha) + { + mAlpha = alpha; + for (int a = 0; a < 9; a++) + skin.grid[a]->setAlpha(mAlpha); + } +} + void TextField::draw(gcn::Graphics *graphics) { + updateAlpha(); + if (isFocused()) { drawCaret(graphics, @@ -94,17 +110,12 @@ void TextField::draw(gcn::Graphics *graphics) graphics->setColor(guiPalette->getColor(Palette::TEXT)); graphics->setFont(getFont()); graphics->drawText(mText, 1 - mXScroll, 1); - - if (config.getValue("guialpha", 0.8) != mAlpha) - { - mAlpha = config.getValue("guialpha", 0.8); - for (int a = 0; a < 9; a++) - skin.grid[a]->setAlpha(mAlpha); - } } void TextField::drawFrame(gcn::Graphics *graphics) { + //updateAlpha(); -> Not useful... + int w, h, bs; bs = getFrameSize(); w = getWidth() + bs * 2; -- cgit v1.2.3-70-g09d2