summaryrefslogtreecommitdiff
path: root/src/gui/trade.cpp
diff options
context:
space:
mode:
authorJan-Fabian Humann <malastare@gmx.net>2005-05-11 22:59:27 +0000
committerJan-Fabian Humann <malastare@gmx.net>2005-05-11 22:59:27 +0000
commita95de401e0a8b443865f2d25ecc70fe138ef7957 (patch)
tree72f1e6ead74adc39c3b0d048ca8ab4ea5be96d79 /src/gui/trade.cpp
parent732f50f7408a76e108d0af14aa3aaaa81391b1a9 (diff)
downloadmana-client-a95de401e0a8b443865f2d25ecc70fe138ef7957.tar.gz
mana-client-a95de401e0a8b443865f2d25ecc70fe138ef7957.tar.bz2
mana-client-a95de401e0a8b443865f2d25ecc70fe138ef7957.tar.xz
mana-client-a95de401e0a8b443865f2d25ecc70fe138ef7957.zip
another trade update: selecting items is more logical now, name and desc. are being displayed
Diffstat (limited to 'src/gui/trade.cpp')
-rw-r--r--src/gui/trade.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 1ca05ac0..859731a3 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -21,6 +21,7 @@
* $Id $
*/
+#include "../main.h"
#include "../graphics.h"
#include "trade.h"
#include "../resources/resourcemanager.h"
@@ -84,6 +85,7 @@ TradeWindow::TradeWindow():
myItems->setSize(getWidth() - 24 - 12 - 1, (INVENTORY_SIZE * 24) / (getWidth() / 24) - 1);
myScroll->setSize(getWidth() - 16, (getHeight() - 76) / 2);
+
partnerItems->setSize(getWidth() - 24 - 12 - 1, (INVENTORY_SIZE * 24) / (getWidth() / 24) - 1);
partnerScroll->setSize(getWidth() - 16, (getHeight() - 76) / 2);
@@ -178,12 +180,56 @@ void TradeWindow::receivedOk(bool own) {
}
}
+void TradeWindow::mouseClick(int x, int y, int button, int count)
+{
+
+ Window::mouseClick(x, y, button, count);
+
+ // myItems selected
+ if (x >= myScroll->getX() + 3
+ && x <= myScroll->getX() + myScroll->getWidth() - 10
+ && y >= myScroll->getY() + 16
+ && y <= myScroll->getY() + myScroll->getHeight() + 15)
+ {
+ if (myItems->getIndex() != -1)
+ {
+ partnerItems->selectNone();
+
+ // Show Name and Description
+ std::string SomeText;
+ SomeText = "Name: " + itemDb->getItemInfo(myItems->getId())->getName();
+ itemNameLabel->setCaption(SomeText);
+ itemNameLabel->adjustSize();
+ SomeText = "Description: " + itemDb->getItemInfo(myItems->getId())->getDescription();
+ itemDescriptionLabel->setCaption(SomeText);
+ itemDescriptionLabel->adjustSize();
+ }
+ // partnerItems selected
+ } else if (x >= partnerScroll->getX() + 3
+ && x <= partnerScroll->getX() + partnerScroll->getWidth() - 20
+ && y >= partnerScroll->getY() + 16
+ && y <= partnerScroll->getY() + partnerScroll->getHeight() + 15)
+ {
+ if (partnerItems->getIndex() != -1)
+ {
+ myItems->selectNone();
+
+ // Show Name and Description
+ std::string SomeText;
+ SomeText = "Name: " + itemDb->getItemInfo(partnerItems->getId())->getName();
+ itemNameLabel->setCaption(SomeText);
+ itemNameLabel->adjustSize();
+ SomeText = "Description: " + itemDb->getItemInfo(partnerItems->getId())->getDescription();
+ itemDescriptionLabel->setCaption(SomeText);
+ itemDescriptionLabel->adjustSize();
+ }
+ }
+}
+
void TradeWindow::action(const std::string &eventId)
{
if (eventId == "add") {
- // This is still kinda buggy, when ok is clicked, will need to play
- // RO a bit to review its trade behaviour
if (inventoryWindow->items->getIndex() >= 0 &&
inventoryWindow->items->getIndex() <= INVENTORY_SIZE) {
if (tradeWindow->myItems->getFreeSlot() >= 0) {