summaryrefslogtreecommitdiff
path: root/src/gui/login.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2004-12-19 12:41:27 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2004-12-19 12:41:27 +0000
commit86e10f867bc0531cdc2007524aa7757d7d594e7d (patch)
tree0e37ad5c038ca930d6a8beba557427b9ad34de8b /src/gui/login.cpp
parent129040251c8242bd4b56f4fc6b107017d62bca3c (diff)
downloadmana-86e10f867bc0531cdc2007524aa7757d7d594e7d.tar.gz
mana-86e10f867bc0531cdc2007524aa7757d7d594e7d.tar.bz2
mana-86e10f867bc0531cdc2007524aa7757d7d594e7d.tar.xz
mana-86e10f867bc0531cdc2007524aa7757d7d594e7d.zip
More refining of windows.
Diffstat (limited to 'src/gui/login.cpp')
-rw-r--r--src/gui/login.cpp41
1 files changed, 16 insertions, 25 deletions
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index cd74e850..3748106b 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -28,8 +28,8 @@
#include "../graphic/graphic.h"
-LoginDialog::LoginDialog():
- Window("Login")
+LoginDialog::LoginDialog(gcn::Container *parent):
+ Window(parent, "Login")
{
userLabel = new gcn::Label("Name:");
passLabel = new gcn::Label("Password:");
@@ -69,21 +69,7 @@ LoginDialog::LoginDialog():
add(keepCheck);
add(okButton);
add(cancelButton);
-}
-
-LoginDialog::~LoginDialog()
-{
- delete userLabel;
- delete passLabel;
- delete userField;
- delete passField;
- delete keepCheck;
- delete okButton;
- delete cancelButton;
-}
-void LoginDialog::init()
-{
setLocationRelativeTo(getParent());
userField->requestFocus();
userField->setCaretPosition(userField->getText().length());
@@ -96,6 +82,17 @@ void LoginDialog::init()
}
}
+LoginDialog::~LoginDialog()
+{
+ delete userLabel;
+ delete passLabel;
+ delete userField;
+ delete passField;
+ delete keepCheck;
+ delete okButton;
+ delete cancelButton;
+}
+
void LoginDialog::action(const std::string& eventId)
{
if (eventId == "ok") {
@@ -124,13 +121,9 @@ void LoginDialog::action(const std::string& eventId)
}
}
-/**
- * Display login dialog
- */
+
void login() {
- LoginDialog *dialog = new LoginDialog();
- guiTop->add(dialog);
- dialog->init();
+ LoginDialog *dialog = new LoginDialog(guiTop);
while (state == LOGIN) {
clear_bitmap(buffer);
@@ -145,9 +138,7 @@ void login() {
delete dialog;
}
-/**
- * Attempt to login to login server
- */
+
void server_login(const std::string& user, const std::string& pass) {
strncpy(username, user.c_str(), LEN_USERNAME);
strncpy(password, pass.c_str(), LEN_PASSWORD);