From 55372882029946d8193ca4414091b65abd64a6ae Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sat, 18 Dec 2004 13:40:58 +0000 Subject: Made login dialog and server select dialog into classes. --- src/gui/char_server.h | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'src/gui/char_server.h') diff --git a/src/gui/char_server.h b/src/gui/char_server.h index 2d694ef4..6a11c589 100644 --- a/src/gui/char_server.h +++ b/src/gui/char_server.h @@ -26,31 +26,51 @@ #ifndef _CHAR_SEL_SERVER_H #define _CHAR_SEL_SERVER_H -#include - #include "../main.h" #include "../net/network.h" #include "gui.h" +#include "window.h" + +#include + /** - * The action listener for the server select dialog. + * The list model for the server list. * * \ingroup GUI */ -class ServerSelectListener : public gcn::ActionListener { +class ServerListModel : public gcn::ListModel { public: - void action(const std::string& eventId); + int getNumberOfElements(); + std::string getElementAt(int i); }; /** - * The list model for the server list. + * The server select dialog. * * \ingroup GUI */ -class ServerListModel : public gcn::ListModel { +class ServerSelectDialog : public Window, public gcn::ActionListener { public: - int getNumberOfElements(); - std::string getElementAt(int i); + ServerSelectDialog(); + ~ServerSelectDialog(); + + /** + * Initializes the dialog. Should be called after adding it to the GUI. + */ + void init(); + + /** + * Called when receiving actions from the widgets. + */ + void action(const std::string& eventId); + + private: + ServerListModel *serverListModel; + gcn::ListBox *serverList; + gcn::Button *okButton; + gcn::Button *cancelButton; + gcn::ScrollArea *scrollArea; }; void char_server(); -- cgit v1.2.3-70-g09d2