summaryrefslogtreecommitdiff
path: root/src/gui/widgets/extendedlistbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-24 22:32:04 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-24 22:32:04 +0300
commit4e95f451a793dbac5dbc31361cdc5049de48c3cc (patch)
tree02a1cc506638edd2deb2074abd97330a74435c3a /src/gui/widgets/extendedlistbox.cpp
parent22e4c80cc35e552ef39639a874f3c54f11fde747 (diff)
downloadplus-4e95f451a793dbac5dbc31361cdc5049de48c3cc.tar.gz
plus-4e95f451a793dbac5dbc31361cdc5049de48c3cc.tar.bz2
plus-4e95f451a793dbac5dbc31361cdc5049de48c3cc.tar.xz
plus-4e95f451a793dbac5dbc31361cdc5049de48c3cc.zip
Add color for selected text in listboxes.
New theme color: LISTBOX_SELECTED
Diffstat (limited to 'src/gui/widgets/extendedlistbox.cpp')
-rw-r--r--src/gui/widgets/extendedlistbox.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index bb138b456..bad1472ac 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -82,18 +82,37 @@ void ExtendedListBox::draw(gcn::Graphics *graphics)
for (int i = 0, y = 0; i < mListModel->getNumberOfElements();
++i, y += height)
{
- const Image *const image = model->getImageAt(i);
+ if (i != mSelected)
+ {
+ const Image *const image = model->getImageAt(i);
+ if (!image)
+ {
+ graphics->drawText(mListModel->getElementAt(i),
+ mPadding, y + textPos);
+ }
+ else
+ {
+ g->drawImage(image, mImagePadding, y + (height
+ - image->getHeight()) / 2 + mPadding);
+ graphics->drawText(mListModel->getElementAt(i),
+ image->getWidth() + mImagePadding + mSpacing, y + textPos);
+ }
+ }
+ }
+ if (mSelected >= 0)
+ {
+ const Image *const image = model->getImageAt(mSelected);
if (!image)
{
- graphics->drawText(mListModel->getElementAt(i),
- mPadding, y + textPos);
+ graphics->drawText(mListModel->getElementAt(mSelected),
+ mPadding, mSelected * height + textPos);
}
else
{
- g->drawImage(image, mImagePadding, y + (height
- - image->getHeight()) / 2 + mPadding);
- graphics->drawText(mListModel->getElementAt(i),
- image->getWidth() + mImagePadding + mSpacing, y + textPos);
+ graphics->setColor(mForegroundSelectedColor);
+ graphics->drawText(mListModel->getElementAt(mSelected),
+ image->getWidth() + mImagePadding + mSpacing,
+ mSelected * height + textPos);
}
}
BLOCK_END("ExtendedListBox::draw")