summaryrefslogtreecommitdiff
path: root/src/gui/skilldialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-11-03 20:00:28 +0300
committerAndrei Karas <akaras@inbox.ru>2012-11-03 20:01:51 +0300
commit8554d0e4db0662785e419a2aa20b985de32b561c (patch)
tree63c9dd691f53c466b4a10b9f01aa3cae39391e8e /src/gui/skilldialog.cpp
parentc09113fe5d46feb56954fe6e43ef84a5001aa650 (diff)
downloadmv-8554d0e4db0662785e419a2aa20b985de32b561c.tar.gz
mv-8554d0e4db0662785e419a2aa20b985de32b561c.tar.bz2
mv-8554d0e4db0662785e419a2aa20b985de32b561c.tar.xz
mv-8554d0e4db0662785e419a2aa20b985de32b561c.zip
Fix paddings in skills list.
Diffstat (limited to 'src/gui/skilldialog.cpp')
-rw-r--r--src/gui/skilldialog.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 08a98db66..02a177f4e 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -100,6 +100,8 @@ class SkillListBox final : public ListBox
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
mTextColor(getThemeColor(Theme::TEXT))
{
+ if (mSkin)
+ mTextPadding = mSkin->getOption("textPadding", 34);
}
A_DELETE_COPY(SkillListBox)
@@ -148,13 +150,14 @@ class SkillListBox final : public ListBox
// Draw the list elements
graphics->setColor(mTextColor);
+ const int width2 = getWidth() - mPadding;
for (int i = 0, y = 1;
i < model->getNumberOfElements();
++i, y += getRowHeight())
{
SkillInfo *const e = model->getSkillAt(i);
if (e)
- e->draw(graphics, y + mPadding, getWidth() + mPadding);
+ e->draw(graphics, mPadding, mTextPadding, y, width2);
}
}
@@ -188,6 +191,7 @@ class SkillListBox final : public ListBox
TextPopup *mPopup;
gcn::Color mHighlightColor;
gcn::Color mTextColor;
+ int mTextPadding;
};
class SkillTab final : public Tab
@@ -626,10 +630,12 @@ void SkillInfo::update()
model->updateVisibilities();
}
-void SkillInfo::draw(Graphics *const graphics, const int y, const int width)
+void SkillInfo::draw(Graphics *const graphics, const int padding,
+ const int paddingText, const int y, const int width)
{
- graphics->drawImage(icon, 1, y);
- graphics->drawText(name, 34, y);
+ const int yPad = y + padding;
+ graphics->drawImage(icon, padding, yPad);
+ graphics->drawText(name, paddingText, yPad);
if (skillLevelWidth < 0)
{
@@ -637,7 +643,7 @@ void SkillInfo::draw(Graphics *const graphics, const int y, const int width)
skillLevelWidth = graphics->getFont()->getWidth(skillLevel) + 1;
}
- graphics->drawText(skillLevel, width - skillLevelWidth, y);
+ graphics->drawText(skillLevel, width - skillLevelWidth, yPad);
}
SkillInfo* SkillDialog::getSkill(int id)