summaryrefslogtreecommitdiff
path: root/src/gui/itemcontainer.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-27 18:54:04 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-27 18:57:04 +0100
commit4b70908a529317ce4e57448fe4f4a59e75416537 (patch)
treea041eeed198708bf5f558f595f716c7814961daf /src/gui/itemcontainer.cpp
parent372f6493d07cbffb601ecb775ebecd51267725cf (diff)
downloadmana-4b70908a529317ce4e57448fe4f4a59e75416537.tar.gz
mana-4b70908a529317ce4e57448fe4f4a59e75416537.tar.bz2
mana-4b70908a529317ce4e57448fe4f4a59e75416537.tar.xz
mana-4b70908a529317ce4e57448fe4f4a59e75416537.zip
Fixed inventory window. Not resizable though.
Resizing of the inventory window may come back later. Also did some more code cleanups, moving defines to enums, getting rid of eAthena-specific offset handling (to be done in the network layer), etc. Mantis-issue: 666
Diffstat (limited to 'src/gui/itemcontainer.cpp')
-rw-r--r--src/gui/itemcontainer.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index 960f58ad..abce257d 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -49,23 +49,12 @@
static const int BOX_WIDTH = 36;
static const int BOX_HEIGHT = 44;
-enum
-{
- SEL_NONE = 0,
- SEL_SELECTED,
- SEL_SELECTING,
- SEL_DESELECTING,
- SEL_DRAGGING
-};
-
ItemContainer::ItemContainer(Inventory *inventory,
int gridColumns,
- int gridRows,
- int offset):
+ int gridRows):
mInventory(inventory),
mGridColumns(gridColumns),
mGridRows(gridRows),
- mOffset(offset),
mSelectedItem(NULL),
mHighlightedItem(NULL),
mSelectionStatus(SEL_NONE),
@@ -188,16 +177,16 @@ void ItemContainer::keyPressed(gcn::KeyEvent &event)
switch (event.getKey().getValue())
{
case Key::LEFT:
- moveHighlight(MOVE_SELECTED_LEFT);
+ moveHighlight(Left);
break;
case Key::RIGHT:
- moveHighlight(MOVE_SELECTED_RIGHT);
+ moveHighlight(Right);
break;
case Key::UP:
- moveHighlight(MOVE_SELECTED_UP);
+ moveHighlight(Up);
break;
case Key::DOWN:
- moveHighlight(MOVE_SELECTED_DOWN);
+ moveHighlight(Down);
break;
case Key::SPACE:
keyAction();
@@ -372,7 +361,7 @@ void ItemContainer::keyAction()
}
}
-void ItemContainer::moveHighlight(int direction)
+void ItemContainer::moveHighlight(Direction direction)
{
if (!mHighlightedItem)
{
@@ -387,14 +376,14 @@ void ItemContainer::moveHighlight(int direction)
switch (direction)
{
- case MOVE_SELECTED_LEFT:
+ case Left:
if (mHighlightedItem->getInvIndex() % mGridColumns == 0)
{
mHighlightedItem += mGridColumns;
}
mHighlightedItem--;
break;
- case MOVE_SELECTED_RIGHT:
+ case Right:
if ((mHighlightedItem->getInvIndex() % mGridColumns) ==
(mGridColumns - 1))
{
@@ -402,14 +391,14 @@ void ItemContainer::moveHighlight(int direction)
}
mHighlightedItem++;
break;
- case MOVE_SELECTED_UP:
+ case Up:
if (mHighlightedItem->getInvIndex() / mGridColumns == 0)
{
mHighlightedItem += (mGridColumns * mGridRows);
}
mHighlightedItem -= mGridColumns;
break;
- case MOVE_SELECTED_DOWN:
+ case Down:
if ((mHighlightedItem->getInvIndex() / mGridColumns) ==
(mGridRows - 1))
{