summaryrefslogtreecommitdiff
path: root/src/gui/listbox.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-12-16 23:18:55 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-12-16 23:18:55 +0000
commitdc53baaaf65943c6768e3ad209129609334133e8 (patch)
treecfd4ba52d94e2f2238195addaa53f80f4013f36a /src/gui/listbox.cpp
parent35afca876ece89be5b282c73a200d0d3c5d27fe0 (diff)
downloadmana-dc53baaaf65943c6768e3ad209129609334133e8.tar.gz
mana-dc53baaaf65943c6768e3ad209129609334133e8.tar.bz2
mana-dc53baaaf65943c6768e3ad209129609334133e8.tar.xz
mana-dc53baaaf65943c6768e3ad209129609334133e8.zip
Subclassed ShopListBox from ListBox to get rid of some duplicated code, and
fixed a problem with scrolling to the current selection. Also aligned the text a bit better and put the price in parenthesis.
Diffstat (limited to 'src/gui/listbox.cpp')
-rw-r--r--src/gui/listbox.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index 14626d06..d4a2c6cb 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -38,9 +38,8 @@ ListBox::ListBox(gcn::ListModel *listModel):
void ListBox::draw(gcn::Graphics *graphics)
{
- if (mListModel == NULL) {
+ if (!mListModel)
return;
- }
graphics->setColor(gcn::Color(110, 160, 255));
graphics->setFont(getFont());
@@ -54,7 +53,9 @@ void ListBox::draw(gcn::Graphics *graphics)
}
// Draw the list elements
- for (int i = 0, y = 0; i < mListModel->getNumberOfElements(); ++i, y += fontHeight)
+ for (int i = 0, y = 0;
+ i < mListModel->getNumberOfElements();
+ ++i, y += fontHeight)
{
graphics->drawText(mListModel->getElementAt(i), 1, y);
}