summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp22
-rw-r--r--src/gui/widgets/itemshortcutcontainer.h7
2 files changed, 19 insertions, 10 deletions
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 6a2480bae..50155fa92 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -30,6 +30,7 @@
#include "input/inputmanager.h"
+#include "gui/skin.h"
#include "gui/viewport.h"
#include "gui/fonts/font.h"
@@ -56,13 +57,15 @@
ItemShortcutContainer::ItemShortcutContainer(Widget2 *const widget,
const unsigned number) :
ShortcutContainer(widget),
- mItemClicked(false),
- mNumber(number),
mEquipedColor(getThemeColor(ThemeColorId::ITEM_EQUIPPED, 255U)),
mEquipedColor2(getThemeColor(ThemeColorId::ITEM_EQUIPPED_OUTLINE, 255U)),
mUnEquipedColor(getThemeColor(ThemeColorId::ITEM_NOT_EQUIPPED, 255U)),
mUnEquipedColor2(getThemeColor(ThemeColorId::ITEM_NOT_EQUIPPED_OUTLINE,
- 255U))
+ 255U)),
+ mNumber(number),
+ mKeyOffsetX(2),
+ mKeyOffsetY(2),
+ mItemClicked(false)
{
mMaxItems = ItemShortcut::getItemCount();
}
@@ -82,6 +85,11 @@ void ItemShortcutContainer::setSkin(const Widget2 *const widget,
255U);
mForegroundColor = getThemeColor(ThemeColorId::TEXT, 255U);
mForegroundColor2 = getThemeColor(ThemeColorId::TEXT_OUTLINE, 255U);
+ if (mSkin != nullptr)
+ {
+ mKeyOffsetX = mSkin->getOption("keyOffsetX", 2);
+ mKeyOffsetY = mSkin->getOption("keyOffsetY", 2);
+ }
}
void ItemShortcutContainer::draw(Graphics *const graphics)
@@ -124,8 +132,8 @@ void ItemShortcutContainer::draw(Graphics *const graphics)
mForegroundColor,
mForegroundColor,
key,
- itemX + mTextOffsetX,
- itemY + mTextOffsetY);
+ itemX + mKeyOffsetX,
+ itemY + mKeyOffsetY);
const int itemId = selShortcut->getItem(i);
const ItemColor itemColor = selShortcut->getItemColor(i);
@@ -271,8 +279,8 @@ void ItemShortcutContainer::safeDraw(Graphics *const graphics)
mForegroundColor,
mForegroundColor,
key,
- itemX + mTextOffsetX,
- itemY + mTextOffsetY);
+ itemX + mKeyOffsetX,
+ itemY + mKeyOffsetY);
const int itemId = selShortcut->getItem(i);
const ItemColor itemColor = selShortcut->getItemColor(i);
diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h
index 73f599add..ee1242b80 100644
--- a/src/gui/widgets/itemshortcutcontainer.h
+++ b/src/gui/widgets/itemshortcutcontainer.h
@@ -78,13 +78,14 @@ class ItemShortcutContainer final : public ShortcutContainer
Skin *const skin) override final;
private:
- bool mItemClicked;
- unsigned mNumber;
-
Color mEquipedColor;
Color mEquipedColor2;
Color mUnEquipedColor;
Color mUnEquipedColor2;
+ unsigned mNumber;
+ int mKeyOffsetX;
+ int mKeyOffsetY;
+ bool mItemClicked;
};
#endif // GUI_WIDGETS_ITEMSHORTCUTCONTAINER_H