From 82cc576b7896f39bcf71aa85c8c4b3ef786c065b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 16 Oct 2012 03:22:50 +0300 Subject: Add listbox padding. New theme file: listbox.xml Theme option: padding --- src/gui/widgets/shoplistbox.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/gui/widgets/shoplistbox.cpp') diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 480f220ea..79fca30d5 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -95,7 +95,6 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) Graphics *graphics = static_cast(gcnGraphics); graphics->setFont(getFont()); -// graphics->setColor(mForegroundColor); // Draw the list elements for (int i = 0, y = 0; @@ -139,8 +138,8 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) if (needDraw) { graphics->setColor(*backgroundColor); - graphics->fillRectangle(gcn::Rectangle( - 0, y, getWidth(), mRowHeight)); + graphics->fillRectangle(gcn::Rectangle(mPadding, y + mPadding, + getWidth() - 2 * mPadding, mRowHeight)); } if (mShopItems) @@ -149,12 +148,13 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) if (icon) { icon->setAlpha(1.0f); - graphics->drawImage(icon, 1, y); + graphics->drawImage(icon, mPadding, y + mPadding); } } graphics->setColor(mForegroundColor); - graphics->drawText(mListModel->getElementAt(i), ITEM_ICON_SIZE + 5, - y + (ITEM_ICON_SIZE - getFont()->getHeight()) / 2); + graphics->drawText(mListModel->getElementAt(i), + ITEM_ICON_SIZE + mPadding, + y + (ITEM_ICON_SIZE - getFont()->getHeight()) / 2 + mPadding); } } -- cgit v1.2.3-60-g2f50