summaryrefslogtreecommitdiff
path: root/src/gui/trade.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-18 14:20:14 -0600
committerIra Rice <irarice@gmail.com>2009-03-18 19:55:11 -0600
commit6f0d88e781c8b1a75858c769b3641aa8cd477314 (patch)
tree98891d219272074e437cd58087a7aaafc463c40a /src/gui/trade.cpp
parent74fa304602e0e7ad845e606db8868b32f1d10864 (diff)
downloadmana-client-6f0d88e781c8b1a75858c769b3641aa8cd477314.tar.gz
mana-client-6f0d88e781c8b1a75858c769b3641aa8cd477314.tar.bz2
mana-client-6f0d88e781c8b1a75858c769b3641aa8cd477314.tar.xz
mana-client-6f0d88e781c8b1a75858c769b3641aa8cd477314.zip
Fix up the NPC interraction widnows a bit
Diffstat (limited to 'src/gui/trade.cpp')
-rw-r--r--src/gui/trade.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index bae0b651..18b86d4b 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -54,6 +54,7 @@ TradeWindow::TradeWindow(Network *network):
setWindowName(_("Trade"));
setDefaultSize(342, 209, ImageRect::CENTER);
setResizable(true);
+ setCloseButton(true);
setMinWidth(342);
setMinHeight(209);
@@ -90,10 +91,10 @@ TradeWindow::TradeWindow(Network *network):
place(0, 0, mMoneyLabel2);
place(1, 0, mMoneyField);
place = getPlacer(0, 2);
- place(0, 0, mAddButton);
- place(1, 0, mOkButton);
- place(2, 0, mTradeButton);
- place(3, 0, mCancelButton);
+ place(4, 0, mCancelButton);
+ place(5, 0, mTradeButton);
+ place(6, 0, mAddButton);
+ place(7, 0, mOkButton);
Layout &layout = getLayout();
layout.extend(0, 2, 2, 1);
layout.setRowHeight(1, Layout::AUTO_SET);
@@ -108,14 +109,6 @@ TradeWindow::~TradeWindow()
{
}
-void TradeWindow::widgetResized(const gcn::Event &event)
-{
- mMyItemContainer->setWidth(mMyScroll->getWidth());
- mPartnerItemContainer->setWidth(mPartnerScroll->getWidth());
-
- Window::widgetResized(event);
-}
-
void TradeWindow::addMoney(int amount)
{
mMoneyLabel->setCaption(strprintf(_("You get %d GP."), amount));
@@ -212,6 +205,7 @@ void TradeWindow::receivedOk(bool own)
void TradeWindow::tradeItem(Item *item, int quantity)
{
+ addItem(item->getId(), true, quantity, item->isEquipment());
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeInt16(item->getInvIndex());
@@ -249,7 +243,8 @@ void TradeWindow::action(const gcn::ActionEvent &event)
if (mMyInventory->contains(item))
{
chatWindow->chatLog(_("Failed adding item. You can not "
- "overlap one kind of item on the window."), BY_SERVER);
+ "overlap one kind of item on the window."),
+ BY_SERVER);
return;
}
@@ -295,3 +290,9 @@ void TradeWindow::action(const gcn::ActionEvent &event)
outMsg.writeInt16(CMSG_TRADE_OK);
}
}
+
+void TradeWindow::close()
+{
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_TRADE_CANCEL_REQUEST);
+}