xoreos  0.0.5
options.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/version/version.h"
26 
28 
31 
36 
38 
39 namespace Engines {
40 
41 namespace NWN {
42 
43 OptionsMenu::OptionsMenu(const Version &gameVersion, ::Engines::Console *console) : GUI(console),
44  _gameVersion(&gameVersion) {
45 
46  load("options_pregame");
47 
48  WidgetPanel *backdrop = new WidgetPanel(*this, "PNL_MAINMENU", "pnl_mainmenu");
49  backdrop->setPosition(0.0f, 0.0f, 100.0f);
50  addWidget(backdrop);
51 
52  _game.reset (new OptionsGameMenu (true, _console));
53  _video.reset (new OptionsVideoMenu (true, _console));
54  _sound.reset (new OptionsSoundMenu (true, _console));
55  _controls.reset(new OptionsControlsMenu(true, _console));
56 }
57 
59 }
60 
62  if (widget.getTag() == "BuildNumber") {
64 
65  if (_gameVersion->hasVersion())
66  version += " v" + _gameVersion->getVersionString();
67 
68  dynamic_cast<WidgetLabel &>(widget).setText(version);
69  dynamic_cast<WidgetLabel &>(widget).setColor(0.6f, 0.6f, 0.6f, 1.0f);
70  return;
71  }
72 }
73 
75  if ((widget.getTag() == "CloseButton") ||
76  (widget.getTag() == "XButton")) {
77  _returnCode = 1;
78  return;
79  }
80 
81  if (widget.getTag() == "GameButton") {
82  sub(*_game);
83  return;
84  }
85 
86  if (widget.getTag() == "VideoOptsButton") {
87  sub(*_video);
88  return;
89  }
90 
91  if (widget.getTag() == "SoundButton") {
92  sub(*_sound);
93  return;
94  }
95 
96  if (widget.getTag() == "ControlButton") {
97  sub(*_controls);
98  return;
99  }
100 }
101 
102 } // End of namespace NWN
103 
104 } // End of namespace Engines
A NWN panel widget.
Definition: panel.h:41
The NWN controls options menu.
Definition: controls.h:35
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
A class holding an UTF-8 string.
Definition: ustring.h:48
The NWN video options menu.
The NWN game options menu.
Console * _console
Definition: gui.h:70
Neverwinter Nights installation version detection.
The NWN video options menu.
Definition: video.h:37
Common::ScopedPtr< GUI > _controls
Definition: options.h:54
Common::ScopedPtr< GUI > _sound
Definition: options.h:53
Common::UString getVersionString() const
Definition: version.cpp:94
A NWN GUI.
Definition: gui.h:54
Basic xoreos version information.
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
const char * getProjectNameVersion()
Definition: version.cpp:92
uint32 sub(GUI &gui, uint32 startCode=kStartCodeNone, bool showSelf=true, bool hideSelf=true)
Open up a sub GUI.
Definition: gui.cpp:349
void load(const Common::UString &resref)
Definition: gui.cpp:77
The NWN sound options menu.
OptionsMenu(const Version &gameVersion, ::Engines::Console *console=0)
Definition: options.cpp:43
The NWN sound options menu.
Definition: sound.h:39
A NWN label widget.
Definition: label.h:41
Common::ScopedPtr< GUI > _game
Definition: options.h:51
A widget in a GUI.
Definition: widget.h:40
void setPosition(float x, float y, float z)
Set the widget&#39;s position.
Definition: modelwidget.cpp:71
Common::ScopedPtr< GUI > _video
Definition: options.h:52
void initWidget(Widget &widget)
Definition: options.cpp:61
The NWN controls options menu.
bool hasVersion() const
Did we detect a version?
Definition: version.cpp:66
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: options.cpp:74
void addWidget(Widget *widget)
Add a widget.
Definition: gui.cpp:250
A NWN panel widget.
const Version * _gameVersion
Definition: options.h:49
The NWN game options menu.
Definition: game.h:37
A NWN label widget.
The options menu.