diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-02-01 12:24:10 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-02-01 12:24:10 +0000 |
commit | 4490b8643f2449da159c9284503eb2c443aa2e9e (patch) | |
tree | d859ebeb3ee69b89c471793b76f9df7fe9546137 /src/gui/confirm_dialog.cpp | |
parent | 6bff53b318937999a70d775bb6ecea2b18576e0f (diff) | |
download | mana-4490b8643f2449da159c9284503eb2c443aa2e9e.tar.gz mana-4490b8643f2449da159c9284503eb2c443aa2e9e.tar.bz2 mana-4490b8643f2449da159c9284503eb2c443aa2e9e.tar.xz mana-4490b8643f2449da159c9284503eb2c443aa2e9e.zip |
Made the OkDialog and ConfirmDialog classes proxies for their buttons' events. Removed the RequestTradeWindow class, replaced with a plain ConfirmDialog. Fixed a memory leak along the way.
Diffstat (limited to 'src/gui/confirm_dialog.cpp')
-rw-r--r-- | src/gui/confirm_dialog.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp index 2babbf23..becb8859 100644 --- a/src/gui/confirm_dialog.cpp +++ b/src/gui/confirm_dialog.cpp @@ -29,7 +29,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, - gcn::ActionListener *listener, Window *parent): + Window *parent): Window(title, true, parent) { gcn::Label *textLabel = new gcn::Label(msg); @@ -57,10 +57,6 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, noButton->setEventId("no"); yesButton->addActionListener(this); noButton->addActionListener(this); - if (listener) { - yesButton->addActionListener(listener); - noButton->addActionListener(listener); - } add(textLabel); add(yesButton); @@ -75,6 +71,13 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, void ConfirmDialog::action(const std::string &eventId) { + // Proxy button events to our listeners + ActionListenerIterator i; + for (i = mActionListeners.begin(); i != mActionListeners.end(); ++i) + { + (*i)->action(eventId); + } + // Can we receive anything else anyway? if (eventId == "yes" || eventId == "no") { scheduleDelete(); |