xoreos  0.0.5
classselection.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #include "src/aurora/talkman.h"
26 
29 
30 namespace Engines {
31 
32 namespace KotOR2 {
33 
34 ClassSelection::ClassSelection(Module *module, Console *console) : GUI(console) {
35  load("classsel_p");
36 
37  _module = module;
38 
45 
46  Common::UString malePrefix, femalePrefix;
47  malePrefix = TalkMan.getString(646);
48  femalePrefix = TalkMan.getString(647);
49 
50  _guardianMaleTitle = malePrefix + " " + TalkMan.getString(355);
51  _guardianFemaleTitle = femalePrefix + " " + TalkMan.getString(355);
52  _consularMaleTitle = malePrefix + " " + TalkMan.getString(354);
53  _consularFemaleTitle = femalePrefix + " " + TalkMan.getString(354);
54  _sentinelMaleTitle = malePrefix + " " + TalkMan.getString(353);
55  _sentinelFemaleTitle = femalePrefix + " " + TalkMan.getString(353);
56 
57  _guardianDescription = TalkMan.getString(48032);
58  _sentinelDescription = TalkMan.getString(48033);
59  _consularDescription = TalkMan.getString(48031);
60 
61  _labelDesc = getLabel("LBL_DESC");
62  _labelDesc->setWrapped(true);
63 
64  _labelTitle = getLabel("LBL_CLASS");
65 
66  _consularMaleButton = getButton("BTN_SEL1");
67  _guardianMaleButton = getButton("BTN_SEL2");
68  _sentinelMaleButton = getButton("BTN_SEL3");
69  _sentinelFemaleButton = getButton("BTN_SEL4");
70  _guardianFemaleButton = getButton("BTN_SEL5");
71  _consularFemaleButton = getButton("BTN_SEL6");
72 
76 }
77 
79  delete _consularMaleInfo;
80  delete _guardianMaleInfo;
81  delete _sentinelMaleInfo;
82  delete _consularFemaleInfo;
83  delete _guardianFemaleInfo;
84  delete _sentinelFemaleInfo;
85 }
86 
112  }
113 }
114 
116  if (widget.getTag() == "BTN_SEL1") {
118  if (sub(*_chargen) == 2) {
119  _returnCode = 2;
120  }
121  return;
122  }
123  if (widget.getTag() == "BTN_SEL2") {
125  if (sub(*_chargen) == 2) {
126  _returnCode = 2;
127  }
128  return;
129  }
130  if (widget.getTag() == "BTN_SEL3") {
132  if (sub(*_chargen) == 2) {
133  _returnCode = 2;
134  }
135  return;
136  }
137  if (widget.getTag() == "BTN_SEL4") {
139  if (sub(*_chargen) == 2) {
140  _returnCode = 2;
141  }
142  return;
143  }
144  if (widget.getTag() == "BTN_SEL5") {
146  if (sub(*_chargen) == 2) {
147  _returnCode = 2;
148  }
149  return;
150  }
151  if (widget.getTag() == "BTN_SEL6") {
153  if (sub(*_chargen) == 2) {
154  _returnCode = 2;
155  }
156  return;
157  }
158 
159  if (widget.getTag() == "BTN_BACK") {
160  _returnCode = 1;
161  return;
162  }
163 }
164 
165 } // End of namespace KotOR2
166 
167 } // End of namespace Engines
void load(const Common::UString &resref)
Definition: gui.cpp:103
void callbackRun()
Callback that&#39;s triggered periodically in the run() method.
#define TalkMan
Shortcut for accessing the talk manager.
Definition: talkman.h:111
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
A class holding an UTF-8 string.
Definition: ustring.h:48
static CharacterGenerationInfo * createRandomMaleGuardian()
Definition: chargeninfo.cpp:81
bool isHovered() const
Definition: button.cpp:90
Common::UString _guardianDescription
Common::UString _guardianFemaleTitle
static CharacterGenerationInfo * createRandomMaleSentinel()
Common::UString _sentinelDescription
ClassSelection(Module *module, Engines::Console *console=0)
WidgetButton * getButton(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:228
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
The KotOR 2 class selection.
Common::UString _consularDescription
uint32 sub(GUI &gui, uint32 startCode=kStartCodeNone, bool showSelf=true, bool hideSelf=true)
Open up a sub GUI.
Definition: gui.cpp:349
static CharacterGenerationInfo * createRandomFemaleGuardian()
static CharacterGenerationInfo * createRandomMaleConsular()
Definition: chargeninfo.cpp:37
static CharacterGenerationInfo * createRandomFemaleSentinel()
WidgetLabel * getLabel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:204
CharacterGenerationInfo * _guardianMaleInfo
CharacterGenerationInfo * _sentinelMaleInfo
CharacterGenerationInfo * _consularFemaleInfo
Common::ScopedPtr< CharacterGeneration > _chargen
A widget in a GUI.
Definition: widget.h:40
The global talk manager for Aurora strings.
CharacterGenerationInfo * _consularMaleInfo
void setText(const Common::UString &text)
void setWrapped(bool wrapped)
static CharacterGenerationInfo * createRandomFemaleConsular()
Definition: chargeninfo.cpp:59
The KotOR 2 character generation.
CharacterGenerationInfo * _sentinelFemaleInfo
CharacterGenerationInfo * _guardianFemaleInfo
Common::UString _consularFemaleTitle
Common::UString _sentinelFemaleTitle