summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 7da504ec..c192b041 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -64,6 +64,7 @@
#include "gui/ok_dialog.h"
#include "gui/progressbar.h"
#include "gui/register.h"
+#include "gui/setup.h"
#include "gui/updatewindow.h"
#include "gui/textfield.h"
@@ -86,6 +87,16 @@
#include <SDL_syswm.h>
#endif
+namespace {
+ struct SetupListener : public gcn::ActionListener
+ {
+ /**
+ * Called when receiving actions from widget.
+ */
+ void action(const gcn::ActionEvent &event);
+ } listener;
+}
+
// Account infos
char n_server, n_character;
@@ -111,6 +122,8 @@ LoginData loginData;
LockedArray<LocalPlayer*> charInfo(MAX_SLOT + 1);
+extern Window *setupWindow;
+
// This anonymous namespace hides whatever is inside from other modules.
namespace {
@@ -408,6 +421,7 @@ void exit_engine()
delete gui;
delete graphics;
+ delete setupWindow;
// Shutdown libxml
xmlCleanupParser();
@@ -675,6 +689,7 @@ int main(int argc, char *argv[])
Game *game = NULL;
Window *currentDialog = NULL;
Image *login_wallpaper = NULL;
+ setupWindow = new Setup();
gcn::Container *top = static_cast<gcn::Container*>(gui->getTop());
#ifdef PACKAGE_VERSION
@@ -687,6 +702,9 @@ int main(int argc, char *argv[])
top->add(progressLabel, 15 + progressBar->getWidth(),
progressBar->getY() + 4);
progressBar->setVisible(false);
+ gcn::Button *setup = new Button("Setup", "Setup", &listener);
+ setup->setPosition(top->getWidth() - setup->getWidth() - 3, 3);
+ top->add(setup);
sound.playMusic("Magick - Real.ogg");
@@ -964,3 +982,22 @@ int main(int argc, char *argv[])
PHYSFS_deinit();
return 0;
}
+
+void SetupListener::action(const gcn::ActionEvent &event)
+{
+ Window *window = NULL;
+
+ if (event.getId() == "Setup")
+ {
+ window = setupWindow;
+ }
+
+ if (window)
+ {
+ window->setVisible(!window->isVisible());
+ if (window->isVisible())
+ {
+ window->requestMoveToTop();
+ }
+ }
+}