xoreos  0.0.5
editbox.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 
28 
30 
32 
33 namespace Engines {
34 
35 namespace NWN {
36 
38  const Common::UString &model) :
39  WidgetListBox(gui, tag, model){
40 }
41 
43 }
44 
47 
48  if (_title)
49  _title->show();
50 }
51 
54 
55  if (_title)
56  _title->hide();
57 }
58 
59 void WidgetEditBox::setTitle(const Common::UString &font, const Common::UString &title) {
60  if (!_title)
61  _title.reset(new Graphics::Aurora::Text(FontMan.get(font), title));
62 
63  _title->set(title);
64 
65  // Get text node position.
66  float tX, tY, tZ, wX, wY, wZ;
67  getPosition(wX, wY, wZ);
68  _model->getNode("title0")->getPosition(tX, tY, tZ);
69 
70  tY -= _title->getHeight();
71 
72  _title->setPosition(wX + tX, wY + tY, wZ - tZ);
73 
74  if (this->isVisible())
75  _title->show();
76 }
77 
78 } // End of namespace NWN
79 
80 } // End of namespace Engines
A NWN editbox widget.
void hide()
Hide the widget.
Definition: editbox.cpp:52
A class holding an UTF-8 string.
Definition: ustring.h:48
void show()
Show the widget.
Definition: editbox.cpp:45
void reset(PointerType o=0)
Resets the pointer with the new value.
Definition: scopedptr.h:87
A text object.
virtual void getPosition(float &x, float &y, float &z) const
Get the widget&#39;s position.
Definition: widget.cpp:140
bool isVisible() const
Is the widget visible?
Definition: widget.cpp:59
void getPosition(float &x, float &y, float &z) const
Get the position of the node.
Definition: modelnode.cpp:181
void hide()
Hide the widget.
Definition: listbox.cpp:332
The Aurora font manager.
A GUI.
Definition: gui.h:43
A text object.
Definition: text.h:42
A node within a 3D model.
A 3D model of an object.
A NWN listbox widget.
Definition: listbox.h:116
Graphics::Aurora::Model * _model
Definition: modelwidget.h:64
void setTitle(const Common::UString &font, const Common::UString &title)
Set title text if available.
Definition: editbox.cpp:59
void show()
Show the widget.
Definition: listbox.cpp:317
WidgetEditBox(::Engines::GUI &gui, const Common::UString &tag, const Common::UString &model)
Definition: editbox.cpp:37
Common::ScopedPtr< Graphics::Aurora::Text > _title
Definition: editbox.h:59
ModelNode * getNode(const Common::UString &node)
Get the specified node, from the current state.
Definition: model.cpp:379
#define FontMan
Shortcut for accessing the font manager.
Definition: fontman.h:105