Mana
Loading...
Searching...
No Matches
charcreatedialog.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "being.h"
25#include "guichanfwd.h"
26
28
29#include "gui/widgets/window.h"
30
31#include <guichan/actionlistener.hpp>
32
33#include <string>
34#include <vector>
35
36class Button;
37class LocalPlayer;
38class PlayerBox;
39
45class CharCreateDialog : public Window, public gcn::ActionListener
46{
47 public:
48 CharCreateDialog(CharSelectDialog *parent, int slot);
49
50 ~CharCreateDialog() override;
51
52 void action(const gcn::ActionEvent &event) override;
53
57 void unlock();
58
59 void setAttributes(const std::vector<std::string> &labels,
60 unsigned available,
61 unsigned min, unsigned max);
62
63 void setDefaultGender(Gender gender);
64
65 private:
66 void updateSliders();
67
71 std::string getName() const;
72
77
78 void updateHair();
79
81
82 gcn::TextField *mNameField;
83 gcn::Label *mNameLabel;
84
85 gcn::RadioButton *mMale;
86 gcn::RadioButton *mFemale;
87
88 std::vector<int> mAttributes;
89 std::vector<gcn::Slider*> mAttributeSlider;
90 std::vector<gcn::Label*> mAttributeLabel;
91 std::vector<gcn::Label*> mAttributeValue;
92 gcn::Label *mAttributesLeft;
93
94 unsigned mMaxPoints;
95
96 gcn::Button *mCreateButton;
97 gcn::Button *mCancelButton;
98
101
102 // A vector containing the available hair color or style ids
103 std::vector<int> mHairColorsIds;
104 std::vector<int> mHairStylesIds;
107
108 int mSlot;
109};
Gender
Definition being.h:58
Definition being.h:65
Button widget.
Definition button.h:38
Character creation dialog.
void setAttributes(const std::vector< std::string > &labels, unsigned available, unsigned min, unsigned max)
void attemptCharCreate()
Communicate character creation to the server.
std::vector< int > mAttributes
CharSelectDialog * mCharSelectDialog
gcn::RadioButton * mFemale
gcn::Label * mAttributesLeft
std::vector< gcn::Label * > mAttributeLabel
gcn::RadioButton * mMale
gcn::TextField * mNameField
std::vector< gcn::Label * > mAttributeValue
std::vector< gcn::Slider * > mAttributeSlider
gcn::Button * mCancelButton
std::string getName() const
Returns the name of the character to create.
void setDefaultGender(Gender gender)
gcn::Button * mCreateButton
gcn::Label * mNameLabel
std::vector< int > mHairColorsIds
std::vector< int > mHairStylesIds
void unlock()
Unlocks the dialog, enabling the create character button again.
void action(const gcn::ActionEvent &event) override
Character selection dialog.
The local player character.
Definition localplayer.h:75
A box showing a player character.
Definition playerbox.h:34
A window.
Definition window.h:59