summaryrefslogtreecommitdiff
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
parentc09113fe5d46feb56954fe6e43ef84a5001aa650 (diff)
downloadmv-8554d0e4db0662785e419a2aa20b985de32b561c.tar.gz
mv-8554d0e4db0662785e419a2aa20b985de32b561c.tar.bz2
mv-8554d0e4db0662785e419a2aa20b985de32b561c.tar.xz
mv-8554d0e4db0662785e419a2aa20b985de32b561c.zip
Fix paddings in skills list.
-rw-r--r--data/graphics/gui/listbox.xml1
-rw-r--r--src/gui/skilldialog.cpp16
-rw-r--r--src/gui/skilldialog.h3
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 @@
<widget type="Window">
<option name="padding" value="1" />
<option name="imagePadding" value="1" />
+ <option name="textPadding" value="34" />
<option name="spacing" value="2" />
</widget>
</skinset>
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<SkillInfo*> SkillList;