diff options
author | Bertram <bertram@cegetel.net> | 2009-09-03 20:37:08 +0200 |
---|---|---|
committer | Bertram <bertram@cegetel.net> | 2009-09-03 20:37:08 +0200 |
commit | ecf588b5ef86804b0074c54b6371cda9e8f346c2 (patch) | |
tree | bff015ac332d0bfd359ebd932236f37003a578e6 /src/gui/widgets/textfield.cpp | |
parent | efb541eeef2ad839c885c494c3a065f1f7d5dc03 (diff) | |
download | mana-ecf588b5ef86804b0074c54b6371cda9e8f346c2.tar.gz mana-ecf588b5ef86804b0074c54b6371cda9e8f346c2.tar.bz2 mana-ecf588b5ef86804b0074c54b6371cda9e8f346c2.tar.xz mana-ecf588b5ef86804b0074c54b6371cda9e8f346c2.zip |
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.
Diffstat (limited to 'src/gui/widgets/textfield.cpp')
-rw-r--r-- | src/gui/widgets/textfield.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
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<Image*>()); } +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; |