00001 /* 00002 * The Mana World 00003 * Copyright (C) 2004 The Mana World Development Team 00004 * 00005 * This file is part of The Mana World. 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef REGISTER_H 00023 #define REGISTER_H 00024 00025 #include "gui/widgets/window.h" 00026 00027 #include <guichan/actionlistener.hpp> 00028 #include <guichan/keylistener.hpp> 00029 00030 #include <string> 00031 00032 class LoginData; 00033 class OkDialog; 00034 00040 class WrongDataNoticeListener : public gcn::ActionListener 00041 { 00042 public: 00043 void setTarget(gcn::TextField *textField); 00044 void action(const gcn::ActionEvent &event); 00045 private: 00046 gcn::TextField *mTarget; 00047 }; 00048 00054 class RegisterDialog : public Window, public gcn::ActionListener, 00055 public gcn::KeyListener 00056 { 00057 public: 00064 RegisterDialog(LoginData *loginData); 00065 00069 ~RegisterDialog(); 00070 00074 void action(const gcn::ActionEvent &event); 00075 00079 void keyPressed(gcn::KeyEvent &keyEvent); 00080 00081 private: 00086 bool canSubmit() const; 00087 00088 #ifdef EATHENA_SUPPORT 00089 00096 static bool isUShort(const std::string &str); 00097 00105 static unsigned short getUShort(const std::string &str); 00106 #endif 00107 00108 gcn::TextField *mUserField; 00109 gcn::TextField *mPasswordField; 00110 gcn::TextField *mConfirmField; 00111 #ifdef EATHENA_SUPPORT 00112 gcn::TextField *mServerField; 00113 gcn::TextField *mPortField; 00114 #else 00115 gcn::TextField *mEmailField; 00116 #endif 00117 00118 gcn::Button *mRegisterButton; 00119 gcn::Button *mCancelButton; 00120 #ifdef EATHENA_SUPPORT 00121 gcn::RadioButton *mMaleButton; 00122 gcn::RadioButton *mFemaleButton; 00123 #endif 00124 00125 WrongDataNoticeListener *mWrongDataNoticeListener; 00126 00127 LoginData *mLoginData; 00128 }; 00129 00130 #endif