summaryrefslogtreecommitdiff
path: root/src/gui/skin.cpp
diff options
context:
space:
mode:
authorBertram <bertram@cegetel.net>2009-09-02 23:40:45 +0200
committerBertram <bertram@cegetel.net>2009-09-02 23:40:45 +0200
commitefb541eeef2ad839c885c494c3a065f1f7d5dc03 (patch)
treef8f912a1aa62dfd902153a8dcb3e9d1549ae8e7c /src/gui/skin.cpp
parent63049c5bf3ed38c3cb67edf740ed67f7fed663dd (diff)
downloadmana-efb541eeef2ad839c885c494c3a065f1f7d5dc03.tar.gz
mana-efb541eeef2ad839c885c494c3a065f1f7d5dc03.tar.bz2
mana-efb541eeef2ad839c885c494c3a065f1f7d5dc03.tar.xz
mana-efb541eeef2ad839c885c494c3a065f1f7d5dc03.zip
Added a minimum alpha opacity value handle in SkinLoader and made use of it.
Part 1 of 3 for Mantis #847 Only a few controls follow minimum opacity value at login stage. Part 2 will make all other controls do the same. Part 3 will try to set default gui opacity value as a constant.
Diffstat (limited to 'src/gui/skin.cpp')
-rw-r--r--src/gui/skin.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gui/skin.cpp b/src/gui/skin.cpp
index 5881a073..f3f907e1 100644
--- a/src/gui/skin.cpp
+++ b/src/gui/skin.cpp
@@ -87,9 +87,10 @@ Skin::~Skin()
delete mStickyImageDown;
}
-void Skin::updateAlpha()
+void Skin::updateAlpha(float minimumOpacityAllowed)
{
- const float alpha = config.getValue("guialpha", 0.8);
+ const float alpha = std::max((double)minimumOpacityAllowed,
+ config.getValue("guialpha", 0.8f));
for_each(mBorder.grid, mBorder.grid + 9,
std::bind2nd(std::mem_fun(&Image::setAlpha), alpha));
@@ -112,7 +113,8 @@ int Skin::getMinHeight() const
}
SkinLoader::SkinLoader()
- : mSkinConfigListener(new SkinConfigListener(this))
+ : mSkinConfigListener(new SkinConfigListener(this)),
+ mMinimumOpacity(-1.0f)
{
}
@@ -174,10 +176,18 @@ Skin *SkinLoader::load(const std::string &filename,
return skin;
}
+void SkinLoader::setMinimumOpacity(float minimumOpacity)
+{
+ if (minimumOpacity > 1.0f) return;
+
+ mMinimumOpacity = minimumOpacity;
+ updateAlpha();
+}
+
void SkinLoader::updateAlpha()
{
for (SkinIterator iter = mSkins.begin(); iter != mSkins.end(); ++iter)
- iter->second->updateAlpha();
+ iter->second->updateAlpha(mMinimumOpacity);
}
Skin *SkinLoader::readSkin(const std::string &filename)
@@ -284,6 +294,6 @@ Skin *SkinLoader::readSkin(const std::string &filename)
Skin *skin = new Skin(border, closeImage, stickyImageUp, stickyImageDown,
filename);
- skin->updateAlpha();
+ skin->updateAlpha(mMinimumOpacity);
return skin;
}