summaryrefslogtreecommitdiff
path: root/src/gui/itemcontainer.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-01-14 16:45:13 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-01-14 16:45:13 +0000
commitd1395845cdc678db2a71326f2e6f20253ed14cac (patch)
tree9a75fe0591fc7bd74f828aa048aa027f59a4ae66 /src/gui/itemcontainer.cpp
parent6c3a2550813c14290307f2ad91e1d76eea3e6a02 (diff)
downloadmana-d1395845cdc678db2a71326f2e6f20253ed14cac.tar.gz
mana-d1395845cdc678db2a71326f2e6f20253ed14cac.tar.bz2
mana-d1395845cdc678db2a71326f2e6f20253ed14cac.tar.xz
mana-d1395845cdc678db2a71326f2e6f20253ed14cac.zip
Merged 0.0 changes from revision 2988 to 3035 to trunk.
Diffstat (limited to 'src/gui/itemcontainer.cpp')
-rw-r--r--src/gui/itemcontainer.cpp35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index 2c84b19b..308311b7 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -58,7 +58,8 @@ ItemContainer::~ItemContainer()
mSelImg->decRef();
}
-void ItemContainer::logic()
+void
+ItemContainer::logic()
{
gcn::Widget::logic();
@@ -70,7 +71,8 @@ void ItemContainer::logic()
}
}
-void ItemContainer::draw(gcn::Graphics* graphics)
+void
+ItemContainer::draw(gcn::Graphics *graphics)
{
int gridWidth = 36; //(item icon width + 4)
int gridHeight = 42; //(item icon height + 10)
@@ -124,7 +126,8 @@ void ItemContainer::draw(gcn::Graphics* graphics)
}
}
-void ItemContainer::setWidth(int width)
+void
+ItemContainer::setWidth(int width)
{
gcn::Widget::setWidth(width);
@@ -140,17 +143,20 @@ void ItemContainer::setWidth(int width)
setHeight((mMaxItems + columns - 1) / columns * gridHeight);
}
-Item* ItemContainer::getItem()
+Item*
+ItemContainer::getItem()
{
return mSelectedItem;
}
-void ItemContainer::selectNone()
+void
+ItemContainer::selectNone()
{
setSelectedItem(NULL);
}
-void ItemContainer::setSelectedItem(Item *item)
+void
+ItemContainer::setSelectedItem(Item *item)
{
if (mSelectedItem != item)
{
@@ -159,7 +165,8 @@ void ItemContainer::setSelectedItem(Item *item)
}
}
-void ItemContainer::fireSelectionChangedEvent()
+void
+ItemContainer::fireSelectionChangedEvent()
{
SelectionEvent event(this);
SelectionListeners::iterator i_end = mListeners.end();
@@ -171,14 +178,18 @@ void ItemContainer::fireSelectionChangedEvent()
}
}
-void ItemContainer::mousePress(int mx, int my, int button)
+void
+ItemContainer::mousePressed(gcn::MouseEvent &event)
{
- int gridWidth = 36; //(item icon width + 4)
- int gridHeight = 42; //(item icon height + 10)
- int columns = getWidth() / gridWidth;
+ int button = event.getButton();
- if (button == gcn::MouseInput::LEFT || gcn::MouseInput::RIGHT)
+ if (button == gcn::MouseEvent::LEFT || button == gcn::MouseEvent::RIGHT)
{
+ int gridWidth = 36; //(item icon width + 4)
+ int gridHeight = 42; //(item icon height + 10)
+ int columns = getWidth() / gridWidth;
+ int mx = event.getX();
+ int my = event.getY();
int index = mx / gridWidth + ((my / gridHeight) * columns);
if (index > INVENTORY_SIZE) {