diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-09 12:56:02 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-03-09 12:56:02 +0000 |
commit | 8a9e607d36b9b22cfb22002a3bbeb1bf86810337 (patch) | |
tree | 032f20fff6f1371548d279c7cfad8e550ca75128 /src/gui | |
parent | 76185faa619fd06576f2e67e1f2d5f1fb659e340 (diff) | |
download | mana-client-8a9e607d36b9b22cfb22002a3bbeb1bf86810337.tar.gz mana-client-8a9e607d36b9b22cfb22002a3bbeb1bf86810337.tar.bz2 mana-client-8a9e607d36b9b22cfb22002a3bbeb1bf86810337.tar.xz mana-client-8a9e607d36b9b22cfb22002a3bbeb1bf86810337.zip |
Made all local action listeners structs and moved them into anonymous namespaces.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/connection.cpp | 20 | ||||
-rw-r--r-- | src/gui/menuwindow.cpp | 18 |
2 files changed, 17 insertions, 21 deletions
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp index 89f145c4..4bd619ea 100644 --- a/src/gui/connection.cpp +++ b/src/gui/connection.cpp @@ -32,25 +32,19 @@ #include "../main.h" -class ConnectionActionListener : public gcn::ActionListener -{ - public: - void action(const std::string& eventId) - { - if (eventId == "cancel") - { - state = EXIT_STATE; - } - } -} connectionActionListener; +namespace { + struct ConnectionActionListener : public gcn::ActionListener + { + void action(const std::string& eventId) { state = EXIT_STATE; } + } listener; +} ConnectionDialog::ConnectionDialog(): Window("Info"), mProgress(0) { setContentSize(200, 100); - Button *cancelButton = new Button("Cancel", "cancelButton", - &connectionActionListener); + Button *cancelButton = new Button("Cancel", "cancelButton", &listener); mProgressBar = new ProgressBar(0.0, 200 - 10, 20, 128, 128, 128); gcn::Label *label = new gcn::Label("Connecting..."); diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp index c18132cf..871a50d3 100644 --- a/src/gui/menuwindow.cpp +++ b/src/gui/menuwindow.cpp @@ -35,13 +35,15 @@ extern Graphics *graphics; extern Window *setupWindow, *inventoryWindow, *equipmentWindow, *skillDialog, *statusWindow; -struct MenuWindowListener : public gcn::ActionListener -{ - /** - * Called when receiving actions from widget. - */ - void action(const std::string& eventId); -} menuWindowListener; +namespace { + struct MenuWindowListener : public gcn::ActionListener + { + /** + * Called when receiving actions from widget. + */ + void action(const std::string& eventId); + } listener; +} MenuWindow::MenuWindow(): Window("") @@ -59,7 +61,7 @@ MenuWindow::MenuWindow(): int x = 0, y = 3, h = 0; for (const char **curBtn = buttonNames; *curBtn; curBtn++) { - gcn::Button *btn = new Button(*curBtn, *curBtn, &menuWindowListener); + gcn::Button *btn = new Button(*curBtn, *curBtn, &listener); btn->setPosition(x, y); add(btn); x += btn->getWidth() + 3; |