xoreos  0.0.5
quickchar.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 
27 
29 
30 namespace Engines {
31 
32 namespace KotOR {
33 
35  GUI(console), _charGen(charGenMenu) {
36 
37  load("quickpnl");
38 
39  setPosition(137, 15, 0);
40 
41  float width = getLabel("LBL_DECORATION")->getWidth();
42  float height = getLabel("LBL_DECORATION")->getHeight();
43  getLabel("LBL_DECORATION")->setScissor(5, 40, width - 5, height - 40 - 40);
44 
45  getButton("BTN_STEPNAME1")->setDisableHoverSound(true);
46  getButton("BTN_STEPNAME2")->setDisableHoverSound(true);
47  getButton("BTN_STEPNAME3")->setDisableHoverSound(true);
48 
49  updateButtons();
50 }
51 
53  if (widget.getTag() == "BTN_CANCEL") {
55  return;
56  }
57 
58  if (widget.getTag() == "BTN_BACK") {
59  _charGen->decStep();
60  updateButtons();
61  return;
62  }
63 
64  if (widget.getTag() == "BTN_STEPNAME1") {
66  updateButtons();
67  return;
68  }
69  if (widget.getTag() == "BTN_STEPNAME2") {
70  _charGen->showName();
71  updateButtons();
72  return;
73  }
74  if (widget.getTag() == "BTN_STEPNAME3") {
75  _charGen->start();
76  GfxMan.lockFrame();
77  _returnCode = 2;
78  return;
79  }
80 }
81 
83  switch (_charGen->getStep()) {
84  case 0:
85  getButton("BTN_STEPNAME1")->setDisabled(false);
86  getButton("BTN_STEPNAME2")->setDisabled(true);
87  getButton("BTN_STEPNAME3")->setDisabled(true);
88 
89  getButton("BTN_STEPNAME1")->setPermanentHighlight(true);
90  getButton("BTN_STEPNAME2")->setPermanentHighlight(false);
91  getButton("BTN_STEPNAME3")->setPermanentHighlight(false);
92 
93  getButton("BTN_STEPNAME1")->setDisableHighlight(false);
94  getButton("BTN_STEPNAME2")->setDisableHighlight(true);
95  getButton("BTN_STEPNAME3")->setDisableHighlight(true);
96  break;
97 
98  case 1:
99  getButton("BTN_STEPNAME1")->setDisabled(true);
100  getButton("BTN_STEPNAME2")->setDisabled(false);
101  getButton("BTN_STEPNAME3")->setDisabled(true);
102 
103  getButton("BTN_STEPNAME1")->setPermanentHighlight(false);
104  getButton("BTN_STEPNAME2")->setPermanentHighlight(true);
105  getButton("BTN_STEPNAME3")->setPermanentHighlight(false);
106 
107  getButton("BTN_STEPNAME1")->setDisableHighlight(true);
108  getButton("BTN_STEPNAME2")->setDisableHighlight(false);
109  getButton("BTN_STEPNAME3")->setDisableHighlight(true);
110  break;
111 
112  default:
113  case 2:
114  getButton("BTN_STEPNAME1")->setDisabled(true);
115  getButton("BTN_STEPNAME2")->setDisabled(true);
116  getButton("BTN_STEPNAME3")->setDisabled(false);
117 
118  getButton("BTN_STEPNAME1")->setPermanentHighlight(false);
119  getButton("BTN_STEPNAME2")->setPermanentHighlight(false);
120  getButton("BTN_STEPNAME3")->setPermanentHighlight(true);
121 
122  getButton("BTN_STEPNAME1")->setDisableHighlight(true);
123  getButton("BTN_STEPNAME2")->setDisableHighlight(true);
124  getButton("BTN_STEPNAME3")->setDisableHighlight(false);
125  break;
126  }
127 
128  if (_charGen->getStep() == 0) {
129  getWidget("BTN_BACK")->setDisabled(true);
130  } else {
131  getWidget("BTN_BACK")->setDisabled(false);
132  }
133 }
134 
135 } // End of namespace KotOR
136 
137 } // End of namespace Engines
void setDisableHighlight(bool)
Definition: button.cpp:75
CharacterGenerationMenu * _charGen
Definition: quickchar.h:44
void load(const Common::UString &resref)
Definition: gui.cpp:103
QuickCharPanel(CharacterGenerationMenu *charGenMenu, Console *console=0)
Definition: quickchar.cpp:34
Widget * getWidget(const Common::UString &tag, bool vital=false)
Return a widget in the GUI.
Definition: gui.cpp:314
void setScissor(int x, int y, int width, int height)
Create a scissor test over this widget.
A label widget for Star Wars: Knights of the Old Republic and Jade Empire.
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
void setPosition(float x, float y, float z)
Set the GUI&#39;s position.
Definition: gui.cpp:394
A button widget for Star Wars: Knights of the Old Republic and Jade Empire.
virtual void setDisabled(bool disabled)
Disable/Enable the widget.
Definition: widget.cpp:154
WidgetButton * getButton(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:228
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
The panel to customize a custom character.
WidgetLabel * getLabel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:204
void setDisableHoverSound(bool)
Definition: button.cpp:86
A widget in a GUI.
Definition: widget.h:40
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: quickchar.cpp:52
void setPermanentHighlight(bool)
Definition: button.cpp:64
A KotOR GUI.
Definition: gui.h:57
float getWidth() const
Get the widget&#39;s width.
#define GfxMan
Shortcut for accessing the graphics manager.
Definition: graphics.h:299
float getHeight() const
Get the widget&#39;s height.