xoreos  0.0.5
confirm.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 
29 
30 namespace Engines {
31 
32 namespace KotOR {
33 
34 ConfirmDialog::ConfirmDialog(Console *console) : GUI(console), _accepted(false) {
35  load("confirm");
36 
37  WidgetPanel *guiPanel = getPanel("TGuiPanel");
38  guiPanel->setPosition(-guiPanel->getWidth()/2, -guiPanel->getHeight()/2, 0);
39 
40  WidgetListBox *lbMessage = getListBox("LB_MESSAGE");
41  lbMessage->createItemWidgets(1);
42 }
43 
45  WidgetListBox *lbMessage = getListBox("LB_MESSAGE");
46  lbMessage->removeAllItems();
47  lbMessage->addItem(text);
48  lbMessage->refreshItemWidgets();
49 }
50 
52  return _accepted;
53 }
54 
56  if (widget.getTag() == "BTN_OK") {
57  _accepted = true;
59  return;
60  }
61  if (widget.getTag() == "BTN_CANCEL") {
62  _accepted = false;
64  return;
65  }
66 }
67 
68 } // End of namespace KotOR
69 
70 } // End of namespace Engines
void load(const Common::UString &resref)
Definition: gui.cpp:103
static const uint32 kReturnCodeAbort
Definition: gui.h:47
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
A class holding an UTF-8 string.
Definition: ustring.h:48
void createItemWidgets(uint32 count)
Definition: listbox.cpp:131
Confirmation dialog.
A panel widget for Star Wars: Knights of the Old Republic and Jade Empire.
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
A list box widget for Star Wars: Knights of the Old Republic and Jade Empire.
void addItem(const Common::UString &contents)
Definition: listbox.cpp:122
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: confirm.cpp:55
A widget in a GUI.
Definition: widget.h:40
WidgetListBox * getListBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:288
A KotOR GUI.
Definition: gui.h:57
ConfirmDialog(::Engines::Console *console=0)
Definition: confirm.cpp:34
WidgetPanel * getPanel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:192
float getWidth() const
Get the widget&#39;s width.
void setText(const Common::UString &text)
Definition: confirm.cpp:44
virtual void setPosition(float x, float y, float z)
Set the widget&#39;s position.
float getHeight() const
Get the widget&#39;s height.