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. --- data/graphics/gui/listbox.xml | 1 + src/gui/skilldialog.cpp | 16 +++++++++++----- src/gui/skilldialog.h | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/data/graphics/gui/listbox.xml b/data/graphics/gui/listbox.xml index c1de64f2e..6e7cf6080 100644 --- a/data/graphics/gui/listbox.xml +++ b/data/graphics/gui/listbox.xml @@ -2,6 +2,7 @@ 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) diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h index 6b33207b7..9e956703a 100644 --- a/src/gui/skilldialog.h +++ b/src/gui/skilldialog.h @@ -73,7 +73,8 @@ struct SkillInfo final void update(); - void draw(Graphics *const graphics, const int y, const int width); + void draw(Graphics *const graphics, const int padding, + const int paddingText, const int y, const int width); }; typedef std::vector SkillList; -- cgit v1.2.3-70-g09d2