ManaPlus
charcreatedialog.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef GUI_WINDOWS_CHARCREATEDIALOG_H
25 #define GUI_WINDOWS_CHARCREATEDIALOG_H
26 
27 #include "enums/being/gender.h"
28 
29 #include "gui/widgets/window.h"
30 
32 #include "listeners/keylistener.h"
33 
34 class Being;
35 class Button;
36 class CharSelectDialog;
37 class Label;
38 class PlayerBox;
39 class Slider;
40 class TabStrip;
41 class TextField;
42 
48 class CharCreateDialog final : public Window,
49  public ActionListener,
50  public KeyListener
51 {
52  public:
56  CharCreateDialog(CharSelectDialog *const parent, const int slot);
57 
59 
60 
63  ~CharCreateDialog() override final;
64 
65  void action(const ActionEvent &event) override final;
66 
70  void unlock();
71 
72  void setAttributes(const StringVect &labels,
73  int available,
74  const int min, const int max);
75 
76  void setDefaultGender(const GenderT gender);
77 
78  void logic() override final;
79 
80  void updatePlayer();
81 
82  void keyPressed(KeyEvent &event) override final;
83 
84  private:
86 
87  void updateSliders();
88 
89  void setButtonsPosition(const int w, const int h);
90 
94  std::string getName() const A_WARN_UNUSED;
95 
100 
101  void updateHair();
102 
103  void updateRace();
104 
105  void updateLook();
106 
108 
127 
130 
131  STD_VECTOR<Slider*> mAttributeSlider;
132  STD_VECTOR<Label*> mAttributeLabel;
133  STD_VECTOR<Label*> mAttributeValue;
135 
138 
141 
143 
146 
147  int mRace;
148  int mLook;
149  int mMinLook;
150  int mMaxLook;
151  int mMinRace;
152  int mMaxRace;
153 
156  uint32_t mMaxY;
157 
158  int mSlot;
159 
162 
163  unsigned int maxHairColor;
164  unsigned int minHairColor;
165  unsigned int maxHairStyle;
166  unsigned int minHairStyle;
167 
168  unsigned int mAction;
169  unsigned int mDirection;
170 };
171 
172 #endif // GUI_WINDOWS_CHARCREATEDIALOG_H
Definition: being.h:96
Definition: button.h:102
unsigned int mDirection
TabStrip * mGenderStrip
unsigned int mAction
void action(const ActionEvent &event)
unsigned int minHairStyle
void attemptCharCreate()
Button * mPrevHairStyleButton
Button * mPrevHairColorButton
std::vector< Label * > mAttributeLabel
Button * mNextHairStyleButton
unsigned int maxHairColor
CharSelectDialog * mCharSelectDialog
std::vector< Label * > mAttributeValue
Button * mNextHairColorButton
unsigned int minHairColor
int getDistributedPoints() const
void setButtonsPosition(const int w, const int h)
void keyPressed(KeyEvent &event)
TextField * mNameField
void setDefaultGender(const GenderT gender)
std::vector< Slider * > mAttributeSlider
void setAttributes(const StringVect &labels, int available, const int min, const int max)
std::string getName() const
PlayerBox * mPlayerBox
CharCreateDialog(CharSelectDialog *const parent, const int slot)
unsigned int maxHairStyle
Definition: label.h:91
Definition: slider.h:89
Definition: window.h:102
Gender ::T GenderT
Definition: gender.h:35
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define A_NONNULLPOINTER
Definition: localconsts.h:266
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
std::vector< std::string > StringVect
Definition: stringvector.h:29