xoreos  0.0.5
main.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 
27 #include "src/aurora/talkman.h"
28 
30 
33 
36 
41 
43 
44 namespace Engines {
45 
46 namespace NWN {
47 
48 IngameMainMenu::IngameMainMenu(const Version &gameVersion, ::Engines::Console *console) :
49  GUI(console), _gameVersion(&gameVersion) {
50 
51  load("options_main");
52 
53  // TODO: Load game
54  getWidget("LoadButton", true)->setDisabled(true);
55 
56  // TODO: Save game
57  getWidget("SaveButton", true)->setDisabled(true);
58 
59  // TODO: Save character
60  getWidget("SaveCharButton", true)->setDisabled(true);
61 
62  _game.reset (new OptionsGameMenu (false, _console));
63  _video.reset (new OptionsVideoMenu (false, _console));
64  _sound.reset (new OptionsSoundMenu (false, _console));
65  _controls.reset(new OptionsControlsMenu(false, _console));
66 
67  _quitPrompt.reset(new OKCancelDialog(TalkMan.getString(10308),
68  TalkMan.getString(8274), TalkMan.getString(8275)));
69 }
70 
72 }
73 
75  if (widget.getTag() == "BuildNumber") {
78 
79  dynamic_cast<WidgetLabel &>(widget).setText(version);
80  dynamic_cast<WidgetLabel &>(widget).setColor(0.6f, 0.6f, 0.6f, 1.0f);
81  return;
82  }
83 
84  if (widget.getTag() == "SaveCharButton") {
85  dynamic_cast<WidgetButton &>(widget).setText(TalkMan.getString(6560));
86  return;
87  }
88 }
89 
91  if ((widget.getTag() == "ResumeGameButton") ||
92  (widget.getTag() == "XButton")) {
93  _returnCode = 1;
94  return;
95  }
96 
97  if (widget.getTag() == "ExitButton") {
98  if (sub(*_quitPrompt, 0, false) == 1) {
99  _returnCode = 2;
100  return;
101  }
102 
103  show();
104  return;
105  }
106 
107  if (widget.getTag() == "GameButton") {
108  sub(*_game);
109  return;
110  }
111 
112  if (widget.getTag() == "VideoOptionsButton") {
113  sub(*_video);
114  return;
115  }
116 
117  if (widget.getTag() == "SoundOptionsButton") {
118  sub(*_sound);
119  return;
120  }
121 
122  if (widget.getTag() == "ControlsButton") {
123  sub(*_controls);
124  return;
125  }
126 
127 }
128 
129 } // End of namespace NWN
130 
131 } // End of namespace Engines
The NWN ingame main menu.
Widget * getWidget(const Common::UString &tag, bool vital=false)
Return a widget in the GUI.
Definition: gui.cpp:314
#define TalkMan
Shortcut for accessing the talk manager.
Definition: talkman.h:111
void initWidget(Widget &widget)
Definition: main.cpp:74
A NWN button widget.
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.
virtual void setDisabled(bool disabled)
Disable/Enable the widget.
Definition: widget.cpp:154
Console * _console
Definition: gui.h:70
const Version * _gameVersion
Definition: main.h:50
IngameMainMenu(const Version &gameVersion, ::Engines::Console *console=0)
Definition: main.cpp:48
Neverwinter Nights installation version detection.
The yes/no/cancel dialog.
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: main.cpp:90
A NWN button widget.
Definition: button.h:39
The NWN video options menu.
Definition: video.h:37
virtual void show()
Show the GUI.
Definition: gui.cpp:62
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
Common::ScopedPtr< GUI > _game
Definition: main.h:52
Common::ScopedPtr< GUI > _controls
Definition: main.h:55
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.
The NWN okay/cancel dialog.
Definition: okcancel.h:37
The NWN sound options menu.
Definition: sound.h:39
A NWN label widget.
Definition: label.h:41
A widget in a GUI.
Definition: widget.h:40
Common::ScopedPtr< GUI > _video
Definition: main.h:53
The global talk manager for Aurora strings.
Common::ScopedPtr< GUI > _sound
Definition: main.h:54
The NWN controls options menu.
The okay/cancel dialog.
Common::ScopedPtr< GUI > _quitPrompt
Definition: main.h:57
The NWN game options menu.
Definition: game.h:37
A NWN label widget.