From 4490b8643f2449da159c9284503eb2c443aa2e9e Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Wed, 1 Feb 2006 12:24:10 +0000 Subject: 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. --- src/gui/ok_dialog.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/gui/ok_dialog.cpp') diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp index 2e2594d1..8d2ebc23 100644 --- a/src/gui/ok_dialog.cpp +++ b/src/gui/ok_dialog.cpp @@ -29,7 +29,7 @@ OkDialog::OkDialog(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); @@ -49,9 +49,6 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, okButton->setEventId("ok"); okButton->addActionListener(this); - if (listener) { - okButton->addActionListener(listener); - } add(textLabel); add(okButton); @@ -62,6 +59,13 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, void OkDialog::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 == "ok") { scheduleDelete(); -- cgit v1.2.3-70-g09d2