xoreos  0.0.5
charhelp.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 
31 
32 namespace Engines {
33 
34 namespace NWN {
35 
36 CharHelp::CharHelp(const Common::UString &GUIResRef, ::Engines::Console *console) : GUI(console) {
37  load(GUIResRef);
38 
39  setPosition(0, 0, -220);
40 
41  _icon.reset(new PortraitWidget(*this, "FeatIcon", "", Portrait::kSizeIcon));
42 
43  float pX, pY, pZ;
44  getEditBox("EditBox", true)->getPosition(pX, pY, pZ);
45  _icon->setPosition(-200, 145, pZ - 10);
46 
47  getEditBox("EditBox", true)->addChild(*_icon);
48 
49  // Remove unnecessary button.
50  if (hasWidget("OkButton")) {
51  getButton("OkButton", true)->remove();
52  }
53 }
54 
56 }
57 
58 void CharHelp::setContent(const Common::UString title, const Common::UString desc, const Common::UString icon) {
59  getLabel("Title", true)->setText(title);
60  getEditBox("EditBox", true)->setText("fnt_galahad14", desc);
61  _icon->setPortrait(icon);
62 }
63 
65  if (widget.getTag() == "OkButton" || widget.getTag() == "CloseButton")
66  _returnCode = 1;
67 }
68 
69 } // End of namespace NWN
70 
71 } // End of namespace Engines
A NWN editbox widget.
A NWN button widget.
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
A class holding an UTF-8 string.
Definition: ustring.h:48
void setPosition(float x, float y, float z)
Set the GUI&#39;s position.
Definition: gui.cpp:394
virtual void getPosition(float &x, float &y, float &z) const
Get the widget&#39;s position.
Definition: widget.cpp:140
void remove()
Remove the widget from the GUI.
Definition: widget.cpp:258
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: charhelp.cpp:64
WidgetButton * getButton(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:306
void setText(const Common::UString &font, const Common::UString &text, float spacing=0.0f)
Definition: listbox.cpp:523
WidgetLabel * getLabel(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:270
A NWN GUI.
Definition: gui.h:54
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
void setContent(const Common::UString title, const Common::UString desc, const Common::UString icon)
Definition: charhelp.cpp:58
The feats selection GUI.
void load(const Common::UString &resref)
Definition: gui.cpp:77
virtual void addChild(Widget &widget)
Add a child to the widget.
Definition: widget.cpp:215
WidgetEditBox * getEditBox(const Common::UString &tag, bool vital=false)
Definition: gui.cpp:294
Help popup GUI.
A widget in a GUI.
Definition: widget.h:40
CharHelp(const Common::UString &GUIResRef, ::Engines::Console *console=0)
Definition: charhelp.cpp:36
A portrait model and widget.
A NWN portrait widget.
Definition: portrait.h:121
Common::ScopedPtr< PortraitWidget > _icon
Definition: charhelp.h:48
A NWN label widget.
bool hasWidget(const Common::UString &tag) const
Does this specific widget exist within the GUI?
Definition: gui.cpp:310
void setText(const Common::UString &text)
Definition: label.cpp:67