summaryrefslogtreecommitdiff
path: root/src/gui/listbox.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-30 12:32:48 -0700
committerIra Rice <irarice@gmail.com>2009-01-30 12:32:48 -0700
commite2e23a5889c6b4a9a94e27c04ad8e5f60c7137b9 (patch)
treedf1deed68e3b1052839448993abec66fefce24e7 /src/gui/listbox.cpp
parent3cd6930d1417ae9cf087de8d3a9f40f053e75bf0 (diff)
downloadMana-e2e23a5889c6b4a9a94e27c04ad8e5f60c7137b9.tar.gz
Mana-e2e23a5889c6b4a9a94e27c04ad8e5f60c7137b9.tar.bz2
Mana-e2e23a5889c6b4a9a94e27c04ad8e5f60c7137b9.tar.xz
Mana-e2e23a5889c6b4a9a94e27c04ad8e5f60c7137b9.zip
Found a few more gui elements that didn't get exposed to transparency
updating. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/listbox.cpp')
-rw-r--r--src/gui/listbox.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index 990a0ade..1de57593 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -26,6 +26,10 @@
#include "listbox.h"
+#include "../configuration.h"
+
+float ListBox::mAlpha = config.getValue("guialpha", 0.8);
+
ListBox::ListBox(gcn::ListModel *listModel):
gcn::ListBox(listModel)
{
@@ -36,19 +40,23 @@ void ListBox::draw(gcn::Graphics *graphics)
if (!mListModel)
return;
- graphics->setColor(gcn::Color(235, 200, 115));
+ if (config.getValue("guialpha", 0.8) != mAlpha)
+ mAlpha = config.getValue("guialpha", 0.8);
+
+ const int alpha = mAlpha * 255;
+
+ graphics->setColor(gcn::Color(235, 200, 115, alpha));
graphics->setFont(getFont());
- int fontHeight = getFont()->getHeight();
+ const int fontHeight = getFont()->getHeight();
// Draw rectangle below the selected list element
- if (mSelected >= 0) {
+ if (mSelected >= 0)
graphics->fillRectangle(gcn::Rectangle(0, fontHeight * mSelected,
getWidth(), fontHeight));
- }
// Draw the list elements
- graphics->setColor(gcn::Color(0, 0, 0));
+ graphics->setColor(gcn::Color(0, 0, 0, 255));
for (int i = 0, y = 0;
i < mListModel->getNumberOfElements();
++i, y += fontHeight)