diff options
author | Ira Rice <irarice@gmail.com> | 2009-01-30 10:56:54 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-30 10:56:54 -0700 |
commit | d57be9d49c55bc0b85eb8f539ff2029518cfafc0 (patch) | |
tree | df3726aab3d3a4227330496e3b54803a713b1e7d /src/gui/checkbox.cpp | |
parent | cc37b4a9153379d5c5529ba85305d36efba2cd85 (diff) | |
download | mana-d57be9d49c55bc0b85eb8f539ff2029518cfafc0.tar.gz mana-d57be9d49c55bc0b85eb8f539ff2029518cfafc0.tar.bz2 mana-d57be9d49c55bc0b85eb8f539ff2029518cfafc0.tar.xz mana-d57be9d49c55bc0b85eb8f539ff2029518cfafc0.zip |
Exposed most gui elements to take alpha values. There are still a few
spots that could also be fixed up as well, but require other methods to
fix them (the filled color rectangles on the progress bars, as well as
the text on them as well, as an example).
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/checkbox.cpp')
-rw-r--r-- | src/gui/checkbox.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp index b8fca2b8..7fa4fa81 100644 --- a/src/gui/checkbox.cpp +++ b/src/gui/checkbox.cpp @@ -21,12 +21,14 @@ #include "checkbox.h" +#include "../configuration.h" #include "../graphics.h" #include "../resources/image.h" #include "../resources/resourcemanager.h" int CheckBox::instances = 0; +float CheckBox::mAlpha = config.getValue("guialpha", 0.8); Image *CheckBox::checkBoxNormal; Image *CheckBox::checkBoxChecked; Image *CheckBox::checkBoxDisabled; @@ -43,6 +45,10 @@ CheckBox::CheckBox(const std::string& caption, bool selected): checkBoxChecked = checkBox->getSubImage(9, 0, 9, 10); checkBoxDisabled = checkBox->getSubImage(18, 0, 9, 10); checkBoxDisabledChecked = checkBox->getSubImage(27, 0, 9, 10); + checkBoxNormal->setAlpha(mAlpha); + checkBoxChecked->setAlpha(mAlpha); + checkBoxDisabled->setAlpha(mAlpha); + checkBoxDisabledChecked->setAlpha(mAlpha); checkBox->decRef(); } @@ -66,16 +72,25 @@ void CheckBox::drawBox(gcn::Graphics* graphics) { Image *box; - if (isSelected()) { - if (isEnabled()) { + if (isSelected()) + { + if (isEnabled()) box = checkBoxChecked; - } else { + else box = checkBoxDisabledChecked; - } - } else if (isEnabled()) { + } + else if (isEnabled()) box = checkBoxNormal; - } else { + else box = checkBoxDisabled; + + if (config.getValue("guialpha", 0.8) != mAlpha) + { + mAlpha = config.getValue("guialpha", 0.8); + checkBoxNormal->setAlpha(mAlpha); + checkBoxChecked->setAlpha(mAlpha); + checkBoxDisabled->setAlpha(mAlpha); + checkBoxDisabledChecked->setAlpha(mAlpha); } static_cast<Graphics*>(graphics)->drawImage(box, 2, 2); |