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 
26 
28 
29 namespace Engines {
30 
31 namespace KotOR2 {
32 
33 QuickCharPanel::QuickCharPanel(CharacterGeneration *chargen, Console *console) : GUI(console), _chargenMenu(chargen) {
34  load("quickpnl_p");
35 
36  getButton("BTN_STEPNAME1")->setDisableHoverSound(true);
37  getButton("BTN_STEPNAME2")->setDisableHoverSound(true);
38  getButton("BTN_STEPNAME3")->setDisableHoverSound(true);
39 
40  updateButtons();
41 }
42 
44  switch (_chargenMenu->getStep()) {
45  case 0:
46  getButton("BTN_STEPNAME1")->setDisabled(false);
47  getButton("BTN_STEPNAME2")->setDisabled(true);
48  getButton("BTN_STEPNAME3")->setDisabled(true);
49 
50  getButton("BTN_STEPNAME1")->setPermanentHighlight(true);
51  getButton("BTN_STEPNAME2")->setPermanentHighlight(false);
52  getButton("BTN_STEPNAME3")->setPermanentHighlight(false);
53 
54  getButton("BTN_STEPNAME1")->setDisableHighlight(false);
55  getButton("BTN_STEPNAME2")->setDisableHighlight(true);
56  getButton("BTN_STEPNAME3")->setDisableHighlight(true);
57  break;
58 
59  case 1:
60  getButton("BTN_STEPNAME1")->setDisabled(true);
61  getButton("BTN_STEPNAME2")->setDisabled(false);
62  getButton("BTN_STEPNAME3")->setDisabled(true);
63 
64  getButton("BTN_STEPNAME1")->setPermanentHighlight(false);
65  getButton("BTN_STEPNAME2")->setPermanentHighlight(true);
66  getButton("BTN_STEPNAME3")->setPermanentHighlight(false);
67 
68  getButton("BTN_STEPNAME1")->setDisableHighlight(true);
69  getButton("BTN_STEPNAME2")->setDisableHighlight(false);
70  getButton("BTN_STEPNAME3")->setDisableHighlight(true);
71  break;
72  default:
73  case 2:
74  getButton("BTN_STEPNAME1")->setDisabled(true);
75  getButton("BTN_STEPNAME2")->setDisabled(true);
76  getButton("BTN_STEPNAME3")->setDisabled(false);
77 
78  getButton("BTN_STEPNAME1")->setPermanentHighlight(false);
79  getButton("BTN_STEPNAME2")->setPermanentHighlight(false);
80  getButton("BTN_STEPNAME3")->setPermanentHighlight(true);
81 
82  getButton("BTN_STEPNAME1")->setDisableHighlight(true);
83  getButton("BTN_STEPNAME2")->setDisableHighlight(true);
84  getButton("BTN_STEPNAME3")->setDisableHighlight(false);
85  break;
86  }
87 
88  if (_chargenMenu->getStep() == 0) {
89  getWidget("BTN_BACK")->setDisabled(true);
90  } else {
91  getWidget("BTN_BACK")->setDisabled(false);
92  }
93 }
94 
96  if (widget.getTag() == "BTN_CANCEL") {
99  return;
100  }
101  if (widget.getTag() == "BTN_BACK") {
103  updateButtons();
104  return;
105  }
106 
107  if (widget.getTag() == "BTN_STEPNAME1") {
109  updateButtons();
110  return;
111  }
112  if (widget.getTag() == "BTN_STEPNAME2") {
114  updateButtons();
115  return;
116  }
117  if (widget.getTag() == "BTN_STEPNAME3") {
118  _chargenMenu->start();
119  _returnCode = 2;
120  return;
121  }
122 }
123 
124 } // End of namespace KotOR2
125 
126 } // End of namespace Engines
void setDisableHighlight(bool)
Definition: button.cpp:75
void load(const Common::UString &resref)
Definition: gui.cpp:103
Widget * getWidget(const Common::UString &tag, bool vital=false)
Return a widget in the GUI.
Definition: gui.cpp:314
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
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
The KotOR 2 quick character panel.
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
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: quickchar.cpp:95
void setDisableHoverSound(bool)
Definition: button.cpp:86
QuickCharPanel(CharacterGeneration *chargen, Console *console=0)
Definition: quickchar.cpp:33
A widget in a GUI.
Definition: widget.h:40
CharacterGeneration * _chargenMenu
Definition: quickchar.h:43
void setPermanentHighlight(bool)
Definition: button.cpp:64