xoreos  0.0.5
quickchat.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/common/system.h"
26 
27 #include "src/aurora/talkman.h"
28 
29 #include "src/graphics/graphics.h"
30 
33 
36 
38 
39 namespace Engines {
40 
41 namespace NWN {
42 
44  const Common::UString &model, ChatMode mode) :
45  WidgetButton(gui, tag, model) {
46 
47  initCaption("fnt_dialog16x16", "", 1.0f, 1.0f, 1.0f, 0.6f);
48 
49  setMode(mode);
50 
51  setPosition(0.0f, 0.0f, 0.0f);
52 }
53 
55 }
56 
58  _mode = mode;
59 
60  setText(TalkMan.getString(66751 + (uint) _mode) + ":");
61 }
62 
63 Quickchat::Quickchat(float position) {
64  // Prompt
65 
66  _prompt = new WidgetPanel(*this, "QCPrompt", "pnl_chat_prompt");
67 
68  _prompt->setPosition(0.0f, position, 0.0f);
69 
71 
72 
73  // Mode button
74 
75  ChatModeButton *modeButton =
76  new ChatModeButton(*this, "QCMode", "ctl_btn_chatmode", kModeTalk);
77 
78  modeButton->setPosition(0.0f, position, -10.0f);
79 
80  addWidget(modeButton);
81 
82 
83  notifyResized(0, 0, WindowMan.getWindowWidth(), WindowMan.getWindowHeight());
84 }
85 
87 }
88 
89 float Quickchat::getWidth() const {
90  return _prompt->getWidth();
91 }
92 
93 float Quickchat::getHeight() const {
94  return _prompt->getHeight();
95 }
96 
98 }
99 
100 void Quickchat::notifyResized(int UNUSED(oldWidth), int UNUSED(oldHeight),
101  int newWidth, int newHeight) {
102 
103  setPosition(- (newWidth / 2.0f), - (newHeight / 2.0f), -10.0f);
104 }
105 
106 } // End of namespace NWN
107 
108 } // End of namespace Engines
A NWN panel widget.
Definition: panel.h:41
void setPosition(float x, float y, float z)
Set the widget&#39;s position.
Definition: button.cpp:72
The global graphics manager.
float getHeight() const
Definition: quickchat.cpp:93
WidgetPanel * _prompt
Definition: quickchat.h:76
#define TalkMan
Shortcut for accessing the talk manager.
Definition: talkman.h:111
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
float getHeight() const
Get the widget&#39;s height.
Definition: modelwidget.cpp:82
void setText(const Common::UString &text)
The NWN ingame quickchat.
A NWN button widget.
Definition: button.h:39
A GUI.
Definition: gui.h:43
#define UNUSED(x)
Definition: system.h:170
Quickchat(float position)
Definition: quickchat.cpp:63
virtual void initCaption(const Common::UString &font, const Common::UString &text, float r=1.0f, float g=1.0f, float b=1.0f, float a=1.0f, float halign=Graphics::Aurora::kHAlignLeft, float valign=Graphics::Aurora::kVAlignTop)
A node within a 3D model.
A 3D model of an object.
void setMode(ChatMode mode)
Definition: quickchat.cpp:57
#define WindowMan
Shortcut for accessing the window manager.
Definition: windowman.h:137
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
void notifyResized(int oldWidth, int oldHeight, int newWidth, int newHeight)
Definition: quickchat.cpp:100
The global talk manager for Aurora strings.
Low-level detection of architecture/system properties.
ChatModeButton(::Engines::GUI &gui, const Common::UString &tag, const Common::UString &model, ChatMode mode)
Definition: quickchat.cpp:43
float getWidth() const
Get the widget&#39;s width.
Definition: modelwidget.cpp:78
void addWidget(Widget *widget)
Add a widget.
Definition: gui.cpp:250
The chat mode button within the NWN ingame quickchat.
Definition: quickchat.h:51
float getWidth() const
Definition: quickchat.cpp:89
A NWN panel widget.
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: quickchat.cpp:97
A NWN label widget.
unsigned int uint
Definition: types.h:211