summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJan-Fabian Humann <malastare@gmx.net>2005-05-22 19:36:19 +0000
committerJan-Fabian Humann <malastare@gmx.net>2005-05-22 19:36:19 +0000
commit4852d95f4bd03f2e258744e2dc7ef91d4aa9f349 (patch)
tree9e0efde60adf4b96395290495062d63f9046b45e /src/gui
parent2a1af1a5dbcca1c890f38f20385e5d2639fd48db (diff)
downloadmana-4852d95f4bd03f2e258744e2dc7ef91d4aa9f349.tar.gz
mana-4852d95f4bd03f2e258744e2dc7ef91d4aa9f349.tar.bz2
mana-4852d95f4bd03f2e258744e2dc7ef91d4aa9f349.tar.xz
mana-4852d95f4bd03f2e258744e2dc7ef91d4aa9f349.zip
requestTradeDialog is modal now
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/requesttrade.cpp30
-rw-r--r--src/gui/requesttrade.h7
2 files changed, 14 insertions, 23 deletions
diff --git a/src/gui/requesttrade.cpp b/src/gui/requesttrade.cpp
index 9cbdf7b2..66ca6480 100644
--- a/src/gui/requesttrade.cpp
+++ b/src/gui/requesttrade.cpp
@@ -26,8 +26,8 @@
#include "../game.h"
#include "../net/network.h"
-RequestTradeDialog::RequestTradeDialog():
- Window("Request for Trade")
+RequestTradeDialog::RequestTradeDialog(const char *name):
+ Window("Request for Trade", true)
{
nameLabel[0] = new gcn::Label("");
nameLabel[1] = new gcn::Label("");
@@ -56,6 +56,15 @@ RequestTradeDialog::RequestTradeDialog():
add(acceptButton);
add(cancelButton);
+ std::stringstream cap[2];
+ cap[0] << name << " wants to trade with you.";
+ cap[1] << "Do you want to accept?";
+
+ nameLabel[0]->setCaption(cap[0].str());
+ nameLabel[0]->adjustSize();
+ nameLabel[1]->setCaption(cap[1].str());
+ nameLabel[1]->adjustSize();
+
setLocationRelativeTo(getParent());
}
@@ -66,19 +75,6 @@ RequestTradeDialog::~RequestTradeDialog()
for (int i = 0; i < 2; i++) {
delete nameLabel[i];
}
-}
-
-void RequestTradeDialog::request(const char *name)
-{
- std::stringstream cap;
- std::stringstream captwo;
- cap << name << " wants to trade with you.";
- captwo << "Do you want to accept?";
- nameLabel[0]->setCaption(cap.str());
- nameLabel[0]->adjustSize();
- nameLabel[1]->setCaption(captwo.str());
- nameLabel[1]->adjustSize();
- setVisible(true);
}
void RequestTradeDialog::action(const std::string& eventId)
@@ -88,13 +84,13 @@ void RequestTradeDialog::action(const std::string& eventId)
WFIFOW(0) = net_w_value(0x00e6);
WFIFOB(2) = net_b_value(3);
WFIFOSET(3);
- setVisible(false);
+ scheduleDelete();
}
else if (eventId == "cancel") {
// 0xff packet means cancel
WFIFOW(0) = net_w_value(0x00e6);
WFIFOB(2) = net_b_value(4);
WFIFOSET(3);
- setVisible(false);
+ scheduleDelete();
}
}
diff --git a/src/gui/requesttrade.h b/src/gui/requesttrade.h
index 3d6c4c22..3573cb69 100644
--- a/src/gui/requesttrade.h
+++ b/src/gui/requesttrade.h
@@ -43,7 +43,7 @@ class RequestTradeDialog : public Window, public gcn::ActionListener
*
* @see Window::Window
*/
- RequestTradeDialog();
+ RequestTradeDialog(const char *name);
/**
* Destructor.
@@ -51,11 +51,6 @@ class RequestTradeDialog : public Window, public gcn::ActionListener
~RequestTradeDialog();
/**
- * Changes caption and brings window to the top
- */
- void request(const char *name);
-
- /**
* Called when receiving actions from the widgets.
*/
void action(const std::string& eventId);