diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-16 03:22:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-16 03:25:37 +0300 |
commit | 82cc576b7896f39bcf71aa85c8c4b3ef786c065b (patch) | |
tree | 2207f3bb4a0b1fa896fe183da245287525d65117 /src/gui/widgets/extendedlistbox.cpp | |
parent | 6bbe09af6faa77df40112e7cf876877ef11ce74b (diff) | |
download | mv-82cc576b7896f39bcf71aa85c8c4b3ef786c065b.tar.gz mv-82cc576b7896f39bcf71aa85c8c4b3ef786c065b.tar.bz2 mv-82cc576b7896f39bcf71aa85c8c4b3ef786c065b.tar.xz mv-82cc576b7896f39bcf71aa85c8c4b3ef786c065b.zip |
Add listbox padding.
New theme file: listbox.xml
Theme option: padding
Diffstat (limited to 'src/gui/widgets/extendedlistbox.cpp')
-rw-r--r-- | src/gui/widgets/extendedlistbox.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index 610b4360c..249254cde 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -61,7 +61,7 @@ void ExtendedListBox::draw(gcn::Graphics *graphics) graphics->setFont(getFont()); const int height = getRowHeight(); - int textPos = (height - getFont()->getHeight()) / 2; + int textPos = (height - getFont()->getHeight()) / 2 + mPadding; if (textPos < 0) textPos = 0; @@ -70,8 +70,9 @@ void ExtendedListBox::draw(gcn::Graphics *graphics) { mHighlightColor.a = static_cast<int>(mAlpha * 255.0f); graphics->setColor(mHighlightColor); - graphics->fillRectangle(gcn::Rectangle(0, height * mSelected, - getWidth(), height)); + graphics->fillRectangle(gcn::Rectangle(mPadding, + height * mSelected + mPadding, + getWidth() - 2 * mPadding, height)); } // Draw the list elements @@ -82,13 +83,14 @@ void ExtendedListBox::draw(gcn::Graphics *graphics) const Image *const image = model->getImageAt(i); if (!image) { - graphics->drawText(mListModel->getElementAt(i), 1, y + textPos); + graphics->drawText(mListModel->getElementAt(i), mPadding, y + textPos); } else { - g->drawImage(image, 1, y + (height - image->getHeight()) / 2); + g->drawImage(image, mPadding, y + (height - image->getHeight()) + / 2 + mPadding); graphics->drawText(mListModel->getElementAt(i), - image->getWidth() + 2, y + textPos); + image->getWidth() + mPadding, y + textPos); } } } |