summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-25 01:20:00 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-25 01:38:14 +0200
commit5322d978519f9d5677d2096e1167439c84b23cd1 (patch)
treedfe6324fb6d3b573290687716dd98e45efb76019 /src/gui/widgets
parent473dc9b1949ba7c51b59146815969b723a748d6d (diff)
downloadmv-5322d978519f9d5677d2096e1167439c84b23cd1.tar.gz
mv-5322d978519f9d5677d2096e1167439c84b23cd1.tar.bz2
mv-5322d978519f9d5677d2096e1167439c84b23cd1.tar.xz
mv-5322d978519f9d5677d2096e1167439c84b23cd1.zip
Add tabs to spells window. Now it 5 tabs.
Also dont save to configs default cell items for different item containers.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp19
-rw-r--r--src/gui/widgets/spellshortcutcontainer.h3
2 files changed, 14 insertions, 8 deletions
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 18482369d..d0f6931aa 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -48,10 +48,11 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
-SpellShortcutContainer::SpellShortcutContainer():
+SpellShortcutContainer::SpellShortcutContainer(unsigned number):
ShortcutContainer(),
mSpellClicked(false),
- mSpellMoved(NULL)
+ mSpellMoved(NULL),
+ mNumber(number)
{
mBoxWidth = mBoxWidth;
@@ -115,7 +116,7 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics)
g->drawImage(mBackgroundImg, itemX, itemY);
- int itemId = spellShortcut->getItem(i);
+ int itemId = spellShortcut->getItem((mNumber * SPELL_SHORTCUT_ITEMS) + i);
if (selectedId >= 0 && itemId == selectedId)
{
g->drawRectangle(gcn::Rectangle(
@@ -163,7 +164,8 @@ void SpellShortcutContainer::mouseDragged(gcn::MouseEvent &event)
if (index == -1)
return;
- const int itemId = spellShortcut->getItem(index);
+ const int itemId = spellShortcut->getItem(
+ (mNumber * SPELL_SHORTCUT_ITEMS) + index);
if (itemId < 0)
return;
@@ -195,7 +197,8 @@ void SpellShortcutContainer::mousePressed(gcn::MouseEvent &event)
if (!spellShortcut || !spellManager)
return;
- const int itemId = spellShortcut->getItem(index);
+ const int itemId = spellShortcut->getItem(
+ (mNumber * SPELL_SHORTCUT_ITEMS) + index);
spellManager->invoke(itemId);
}
}
@@ -210,7 +213,8 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event)
if (index == -1)
return;
- const int itemId = spellShortcut->getItem(index);
+ const int itemId = spellShortcut->getItem(
+ (mNumber * SPELL_SHORTCUT_ITEMS) + index);
if (event.getButton() == gcn::MouseEvent::LEFT)
{
@@ -263,7 +267,8 @@ void SpellShortcutContainer::mouseMoved(gcn::MouseEvent &event)
if (index == -1)
return;
- const int itemId = spellShortcut->getItem(index);
+ const int itemId = spellShortcut->getItem(
+ (mNumber * SPELL_SHORTCUT_ITEMS) + index);
mSpellPopup->setVisible(false);
TextCommand *spell = spellManager->getSpell(itemId);
diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h
index 8f1c4b221..a4ad1576a 100644
--- a/src/gui/widgets/spellshortcutcontainer.h
+++ b/src/gui/widgets/spellshortcutcontainer.h
@@ -49,7 +49,7 @@ class SpellShortcutContainer : public ShortcutContainer
/**
* Constructor. Initializes the graphic.
*/
- SpellShortcutContainer();
+ SpellShortcutContainer(unsigned number);
/**
* Destructor.
@@ -83,6 +83,7 @@ class SpellShortcutContainer : public ShortcutContainer
bool mSpellClicked;
TextCommand *mSpellMoved;
SpellPopup *mSpellPopup;
+ unsigned mNumber;
};
#endif