00001 /* 00002 * The Mana World 00003 * Copyright (C) 2009 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 CHAR_CREATE_H 00023 #define CHAR_CREATE_H 00024 00025 #include "being.h" 00026 #include "guichanfwd.h" 00027 #include "lockedarray.h" 00028 00029 #include "gui/widgets/window.h" 00030 00031 #include <guichan/actionlistener.hpp> 00032 00033 #include <string> 00034 #include <vector> 00035 00036 class LocalPlayer; 00037 class Player; 00038 class PlayerBox; 00039 00045 class CharCreateDialog : public Window, public gcn::ActionListener 00046 { 00047 public: 00051 CharCreateDialog(Window *parent, int slot); 00052 00056 ~CharCreateDialog(); 00057 00058 void action(const gcn::ActionEvent &event); 00059 00063 void unlock(); 00064 00065 void setAttributes(std::vector<std::string> labels, int available, 00066 int min, int max); 00067 00068 void setFixedGender(bool fixed, Gender gender = GENDER_FEMALE); 00069 00070 private: 00071 int getDistributedPoints() const; 00072 00073 void updateSliders(); 00074 00078 std::string getName() const; 00079 00083 void attemptCharCreate(); 00084 00085 gcn::TextField *mNameField; 00086 gcn::Label *mNameLabel; 00087 gcn::Button *mNextHairColorButton; 00088 gcn::Button *mPrevHairColorButton; 00089 gcn::Label *mHairColorLabel; 00090 gcn::Button *mNextHairStyleButton; 00091 gcn::Button *mPrevHairStyleButton; 00092 gcn::Label *mHairStyleLabel; 00093 00094 gcn::RadioButton *mMale; 00095 gcn::RadioButton *mFemale; 00096 00097 std::vector<gcn::Slider*> mAttributeSlider; 00098 std::vector<gcn::Label*> mAttributeLabel; 00099 std::vector<gcn::Label*> mAttributeValue; 00100 gcn::Label *mAttributesLeft; 00101 00102 int mMaxPoints; 00103 int mUsedPoints; 00104 00105 gcn::Button *mCreateButton; 00106 gcn::Button *mCancelButton; 00107 00108 Player *mPlayer; 00109 PlayerBox *mPlayerBox; 00110 00111 int mSlot; 00112 }; 00113 00114 #endif // CHAR_CREATE_H