From 8554d0e4db0662785e419a2aa20b985de32b561c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 3 Nov 2012 20:00:28 +0300 Subject: Fix paddings in skills list. --- src/gui/skilldialog.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/gui/skilldialog.cpp') 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) -- cgit v1.2.3-60-g2f50