xoreos  0.0.5
gui.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 <cassert>
26 
27 #include "src/common/system.h"
28 #include "src/common/error.h"
29 
30 #include "src/events/events.h"
31 
32 #include "src/graphics/graphics.h"
34 
36 
37 #include "src/engines/aurora/gui.h"
40 
42 static const uint32 kDoubleClickTime = 500;
43 
44 namespace Engines {
45 
46 GUI::GUI(Console *console) : _console(console),
47  _currentWidget(0), _startCode(kStartCodeNone), _returnCode(kReturnCodeNone),
48  _sub(0), _x(0.0f), _y(0.0f), _z(0.0f) {
49 
50 }
51 
53  // Delete all widgets
54  for (WidgetList::iterator widget = _widgets.begin(); widget != _widgets.end(); ++widget) {
55  delete *widget;
56  *widget = 0;
57  }
58 
59  _widgets.clear();
60 }
61 
62 void GUI::show() {
63  GfxMan.lockFrame();
64 
65  // Show all widgets
66  for (WidgetList::iterator w = _widgets.begin(); w != _widgets.end(); ++w) {
67  Widget &widget = **w;
68 
69  if (!widget._owner)
70  widget.show();
71  }
72 
73  for (std::list<GUI *>::iterator iter = _childGUIs.begin(); iter != _childGUIs.end(); ++iter) {
74  (*iter)->show();
75  }
76 
77  GfxMan.unlockFrame();
78 }
79 
80 void GUI::hide() {
81  GfxMan.lockFrame();
82 
83  // Hide all widgets
84  for (WidgetList::iterator widget = _widgets.begin(); widget != _widgets.end(); ++widget)
85  (*widget)->hide();
86 
87  for (std::list<GUI *>::iterator iter = _childGUIs.begin(); iter != _childGUIs.end(); ++iter) {
88  (*iter)->hide();
89  }
90 
91  GfxMan.unlockFrame();
92 }
93 
94 uint32 GUI::run(uint32 startCode) {
95  _startCode = startCode;
97 
98  EventMan.flushEvents();
99 
100  removeFocus();
101  updateMouse();
102 
103  // Run as long as we don't have a return code
104  while (_returnCode == kReturnCodeNone) {
105 
106  std::list<GUI *> childGUIs = _childGUIs;
107 
108  // Call the periodic run callback
109  callbackRun();
110 
111  // Call the periodic run callback of the child GUIs
112  for (std::list<GUI *>::iterator iter = childGUIs.begin(); iter != childGUIs.end(); ++iter) {
113  (*iter)->callbackRun();
114  }
115 
117  break;
118 
119  // But return immediately when an engine quit was requested
120  if (EventMan.quitRequested())
121  return kReturnCodeNone;
122 
123  // Handle events
124  Events::Event event;
125  while (EventMan.pollEvent(event)) {
126  addEvent(event);
127  for (std::list<GUI *>::iterator iter = childGUIs.begin(); iter != childGUIs.end(); ++iter) {
128  (*iter)->addEvent(event);
129  }
130  }
131 
133  for (std::list<GUI *>::iterator iter = childGUIs.begin(); iter != childGUIs.end(); ++iter) {
134  (*iter)->processEventQueue();
135  }
136 
137  // If the _returnCode changed of a child GUI we propagate it to the main GUI
138  for (std::list<GUI *>::iterator iter = childGUIs.begin(); iter != childGUIs.end(); ++iter) {
139  if ((*iter)->_returnCode == kReturnCodeNone)
140  continue;
141 
142  if ((*iter)->_returnCode != _returnCode) {
143  _returnCode = (*iter)->_returnCode;
144  (*iter)->_returnCode = 0;
145  }
146  }
147 
148  // Delay for a while
149  if (!EventMan.quitRequested() && (_returnCode != kReturnCodeNone))
150  EventMan.delay(10);
151  }
152 
153  return _returnCode;
154 }
155 
156 void GUI::abort() {
158 
159  if (_sub)
160  _sub->abort();
161 }
162 
163 void GUI::addEvent(const Events::Event &event) {
164  _eventQueue.push_back(event);
165 }
166 
168  bool hasMove = false;
169 
170  for (std::list<Events::Event>::const_iterator e = _eventQueue.begin();
171  e != _eventQueue.end(); ++e) {
172 
173  if (EventMan.quitRequested() || (_returnCode != kReturnCodeNone)) {
174  removeFocus();
175  hasMove = false;
176  break;
177  }
178 
179  // Handle debug console, if we have one
180  if (_console) {
181  if (e->type == Events::kEventKeyDown) {
182  if ((e->key.keysym.sym == SDLK_d) && (e->key.keysym.mod & KMOD_CTRL)) {
183  removeFocus();
184  _console->show();
185  continue;
186  }
187  }
188 
189  if (_console->isVisible()) {
190  _console->processEvent(*e);
191 
192  if (!_console->isVisible())
193  hasMove = true;
194 
195  continue;
196  }
197  }
198 
199  if (e->type == Events::kEventMouseMove)
200  hasMove = true;
201  else if (e->type == Events::kEventMouseDown)
202  mouseDown(*e);
203  else if (e->type == Events::kEventMouseUp)
204  mouseUp(*e);
205  else if (e->type == Events::kEventMouseWheel)
206  mouseWheel(*e);
207  else if (e->type == Events::kEventTextInput)
208  textInput(*e);
209  else if (e->type == Events::kEventKeyDown)
210  keyDown(*e);
211  else if (e->type == Events::kEventKeyUp)
212  keyUp(*e);
213  }
214 
215  _eventQueue.clear();
216 
217  if (hasMove)
218  updateMouse();
219 
220  return _returnCode;
221 }
222 
224  return "";
225 }
226 
229 }
230 
232 }
233 
235 }
236 
238 }
239 
240 void GUI::addChild(GUI *gui) {
241  _childGUIs.push_back(gui);
242  gui->show();
243 }
244 
245 void GUI::removeChild(GUI *gui) {
246  gui->hide();
247  _childGUIs.remove(gui);
248 }
249 
250 void GUI::addWidget(Widget *widget) {
251  if (!widget)
252  return;
253 
254  assert(!widget->getTag().empty());
255  if (hasWidget(widget->getTag())) {
256  if (getWidget(widget->getTag()) != widget) {
257  throw Common::Exception("Widget with the same tag, \"%s\", already exists", widget->getTag().c_str());
258  } else {
259  return;
260  }
261  }
262 
263  _widgets.push_back(widget);
264  _widgetMap[widget->getTag()] = widget;
265 }
266 
267 void GUI::removeWidget(Widget *widget) {
268  if (!widget)
269  return;
270 
271  widget->hide();
272 
273  for (WidgetList::iterator i = _widgets.begin(); i != _widgets.end(); ++i) {
274  if (*i == widget) {
275  _widgets.erase(i);
276  break;
277  }
278  }
279 
280  WidgetMap::iterator w = _widgetMap.find(widget->getTag());
281  if (w != _widgetMap.end())
282  _widgetMap.erase(w);
283 
284  if (widget->_parent)
285  widget->_parent->removeChild(*widget);
286  if (widget->_owner)
287  widget->_owner->removeSub(*widget);
288 
289  for (std::list<Widget *>::iterator i = widget->_groupMembers.begin(); i != widget->_groupMembers.end(); ++i)
290  (*i)->removeGroupMember(*widget);
291 
292  delete widget;
293 }
294 
296  // Delete all widgets
297  for (WidgetList::iterator widget = _widgets.begin(); widget != _widgets.end(); ++widget) {
298  delete *widget;
299  *widget = 0;
300  }
301 
302  _widgets.clear();
303  _widgetMap.clear();
304 }
305 
306 bool GUI::empty() {
307  return _widgets.empty();
308 }
309 
310 bool GUI::hasWidget(const Common::UString &tag) const {
311  return getWidget(tag) != 0;
312 }
313 
314 Widget *GUI::getWidget(const Common::UString &tag, bool vital) {
315  // Look up the widget in the map
316  WidgetMap::iterator widget = _widgetMap.find(tag);
317  if (widget == _widgetMap.end()) {
318  if (vital)
319  throw Common::Exception("Vital widget \"%s\" doesn't exist", tag.c_str());
320 
321  return 0;
322  }
323 
324  return widget->second;
325 }
326 
327 const Widget *GUI::getWidget(const Common::UString &tag, bool vital) const {
328  // Look up the widget in the map
329  WidgetMap::const_iterator widget = _widgetMap.find(tag);
330  if (widget == _widgetMap.end()) {
331  if (vital)
332  throw Common::Exception("Vital widget \"%s\" doesn't exist", tag.c_str());
333 
334  return 0;
335  }
336 
337  return widget->second;
338 }
339 
340 void GUI::declareGroup(const std::list<Widget *> &group) {
341  // Mutually add each widget to each widget's group member list
342 
343  for (std::list<Widget *>::const_iterator a = group.begin(); a != group.end(); ++a)
344  for (std::list<Widget *>::const_iterator b = group.begin(); b != group.end(); ++b)
345  if (*a && *b)
346  (*a)->addGroupMember(**b);
347 }
348 
349 uint32 GUI::sub(GUI &gui, uint32 startCode, bool showSelf, bool hideSelf) {
350  GfxMan.lockFrame();
351 
352  _sub = &gui;
353 
354  removeFocus();
355 
356  // Show the sub GUI
357  if (startCode == 0)
358  gui.show();
359 
360  if (hideSelf)
361  hide();
362 
363  // Move the gui a bit behind the sub gui
364  float x, y, z;
365  getPosition(x, y, z);
366  setPosition(x, y, z + 100.0f);
367 
368  GfxMan.unlockFrame();
369 
370  // Run the sub GUI
371  uint32 code = gui.run(startCode);
372 
373  GfxMan.lockFrame();
374 
375  // Reset the position
376  setPosition(x, y, z);
377 
378  // Hide the sub GUI
379  if (hideSelf && showSelf)
380  show();
381  gui.hide();
382 
383  // Update the mouse position
384  removeFocus();
385  updateMouse();
386 
387  _sub = 0;
388 
389  GfxMan.unlockFrame();
390 
391  return code;
392 }
393 
394 void GUI::setPosition(float x, float y, float z) {
395  for (WidgetList::iterator w = _widgets.begin(); w != _widgets.end(); ++w) {
396  Widget &widget = **w;
397 
398  if (widget._parent)
399  continue;
400 
401  float wX, wY, wZ;
402  widget.getPosition(wX, wY, wZ);
403 
404  wX -= _x;
405  wY -= _y;
406  wZ -= _z;
407 
408  widget.setPosition(wX + x, wY + y, wZ + z);
409  }
410 
411  _x = x;
412  _y = y;
413  _z = z;
414 }
415 
416 void GUI::getPosition(float &x, float &y, float &z) const {
417  x = _x;
418  y = _y;
419  z = _z;
420 }
421 
423  changedWidget(0);
424 }
425 
427  // Fabricate a mouse move event at the current position
428  int x, y, state;
429  state = CursorMan.getPosition(x, y);
430 
431  Events::Event event;
432  event.motion.state = state;
433  event.motion.x = x;
434  event.motion.y = y;
435 
436  // Trigger a mouse move
437  mouseMove(event);
438 }
439 
441 }
442 
443 void GUI::mouseUp() {
444 }
445 
446 Widget *GUI::getWidgetAt(float x, float y) {
447  // Get the GFX object at the position
448  Graphics::Renderable *obj = GfxMan.getObjectAt(x, y);
449  if (!obj)
450  return 0;
451 
452  // And return the widget with the same tag
453  return getWidget(obj->getTag());
454 }
455 
456 void GUI::changedWidget(Widget *widget) {
457  // Leave the now obsolete current widget
458  if (_currentWidget)
460 
461  // Update the current widget
462  _currentWidget = widget;
463 
464  // Enter the new current widget
465  if (_currentWidget)
467 }
468 
470  if (!widget)
471  // No widget => not active => return
472  return;
473 
474  if (!widget->isActive()) {
475  // Not active, check if the owner's active instead
476 
477  if (widget->_owner)
478  checkWidgetActive(widget->_owner);
479 
480  return;
481  }
482 
483  if (widget->_owner) {
484  // This is a subwidget, call the owner's active callback
485  widget->_owner->subActive(*widget);
486 
487  // Check whether the owner's active now
488  checkWidgetActive(widget->_owner);
489 
490  } else
491  // This is a standalone widget, call the GUI's active callback
492  callbackActive(*widget);
493 
494  // We now handled that active trigger, reset the active state to false
495  widget->setActive(false);
496 }
497 
498 void GUI::mouseMove(const Events::Event &event) {
499  Widget *widget = getWidgetAt(event.motion.x, event.motion.y);
500 
501  if (event.motion.state != 0) {
502  // Moves with a mouse button pressed sends move events to the current widget
503  mouseMove(_currentWidget, event);
504 
506  } else
507  // Moves without a mouse button can change the current widget
508  if (widget != _currentWidget)
509  changedWidget(widget);
510 }
511 
512 void GUI::mouseDown(const Events::Event &event) {
513  if (event.button.button != SDL_BUTTON_LMASK)
514  // We only care about left mouse button presses.
515  return;
516 
517  mouseDown();
518  Widget *widget = getWidgetAt(event.button.x, event.button.y);
519  if (widget != _currentWidget)
520  changedWidget(widget);
521 
522  mouseDown(_currentWidget, event);
523 }
524 
525 void GUI::mouseUp(const Events::Event &event) {
526  if (event.button.button != SDL_BUTTON_LMASK)
527  // We only care about left mouse button presses
528  return;
529 
530  mouseUp();
531  Widget *widget = getWidgetAt(event.button.x, event.button.y);
532  if (widget != _currentWidget) {
533  changedWidget(widget);
534  return;
535  }
536 
537  mouseUp(_currentWidget, event);
538 
540 
541  updateMouse();
542 }
543 
544 void GUI::mouseWheel(const Events::Event &event) {
545  int x,y;
546  SDL_GetMouseState(&x, &y);
547  Widget *widget = getWidgetAt(x, y);
548 
549  if (widget != _currentWidget)
550  changedWidget(widget);
551 
552  mouseWheel(_currentWidget, event);
553 }
554 
555 void GUI::textInput(const Events::Event &event) {
556  callbackTextInput(event.text.text);
557 }
558 
559 void GUI::keyDown(const Events::Event &event) {
560  callbackKeyInput(Events::Key(event.key.keysym.sym), Events::kEventKeyDown);
561 }
562 
563 void GUI::keyUp(const Events::Event &event) {
564  callbackKeyInput(Events::Key(event.key.keysym.sym), Events::kEventKeyUp);
565 }
566 
567 float GUI::toGUIX(int x) {
568  float sW = WindowMan.getWindowWidth();
569 
570  return (x - (sW / 2.0f));
571 }
572 
573 float GUI::toGUIY(int y) {
574  float sH = WindowMan.getWindowHeight();
575 
576  return ((sH - y) - (sH / 2.0f));
577 }
578 
579 void GUI::mouseMove(Widget *widget, const Events::Event &event) {
580  if (widget)
581  widget->mouseMove(event.motion.state, toGUIX(event.motion.x), toGUIY(event.motion.y));
582 }
583 
584 void GUI::mouseDown(Widget *widget, const Events::Event &event) {
585  if (widget)
586  widget->mouseDown(event.button.button, toGUIX(event.button.x), toGUIY(event.button.y));
587 }
588 
589 void GUI::mouseUp(Widget *widget, const Events::Event &event) {
590  if (widget) {
591  uint8 button = event.button.button;
592  float x = toGUIX(event.button.x);
593  float y = toGUIY(event.button.y);
594 
595  widget->mouseUp(button, x, y);
596 
597  uint32 curTime = EventMan.getTimestamp();
598  if (((curTime - widget->_lastClickTime) < kDoubleClickTime) &&
599  (widget->_lastClickButton == button) &&
600  (widget->_lastClickX == x) && (widget->_lastClickY == y)) {
601 
602  widget->mouseDblClick(button, x, y);
603  }
604 
605  widget->_lastClickButton = button;
606  widget->_lastClickTime = curTime;
607  widget->_lastClickX = x;
608  widget->_lastClickY = y;
609  }
610 }
611 
612 void GUI::mouseWheel(Widget *widget, const Events::Event &event) {
613  if (widget) {
614  widget->mouseWheel(event.wheel.type, event.wheel.x, event.wheel.y);
615  }
616 
617 }
618 
619 } // End of namespace Engines
const Common::UString & getTag() const
Get the object&#39;s tag.
Definition: renderable.cpp:98
virtual void mouseDblClick(uint8 state, float x, float y)
A mouse button was double-clicked on the widget.
Definition: widget.cpp:200
virtual void mouseUp()
The mouse state has changed.
Definition: gui.cpp:443
Widget * getWidget(const Common::UString &tag, bool vital=false)
Return a widget in the GUI.
Definition: gui.cpp:314
uint8 _lastClickButton
Definition: widget.h:135
float toGUIX(int x)
Definition: gui.cpp:567
bool isVisible() const
Definition: console.cpp:797
float toGUIY(int y)
Definition: gui.cpp:573
The global graphics manager.
static const uint32 kReturnCodeAbort
Definition: gui.h:47
void mouseMove(const Events::Event &event)
Mouse move event triggered.
Definition: gui.cpp:498
uint32 _returnCode
The GUI&#39;s return code.
Definition: gui.h:75
Widget * _owner
The widget&#39;s owner, if any.
Definition: widget.h:113
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 callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: gui.cpp:231
float _lastClickX
Definition: widget.h:137
bool isActive() const
Was the widget activated?
Definition: widget.cpp:55
uint8_t uint8
Definition: types.h:200
virtual void subActive(Widget &widget)
A sub-widget was activated.
Definition: widget.cpp:203
virtual void setPosition(float x, float y, float z)
Set the widget&#39;s position.
Definition: widget.cpp:119
virtual void enter()
The mouse entered the widget.
Definition: widget.cpp:182
void setActive(bool active)
The widget&#39;s active state.
Definition: widget.cpp:268
Console * _console
Definition: gui.h:70
virtual void getPosition(float &x, float &y, float &z) const
Get the widget&#39;s position.
Definition: widget.cpp:140
Widget * getWidgetAt(float x, float y)
Return the widget at that position.
Definition: gui.cpp:446
Text was written.
Definition: types.h:52
virtual void mouseUp(uint8 state, float x, float y)
A mouse button was released on the widget.
Definition: widget.cpp:194
void removeFocus()
Forcefully remove the focus from the current widget.
Definition: gui.cpp:422
virtual void callbackKeyInput(const Events::Key &key, const Events::EventType &type)
Callback that&#39;s triggered when a key is pressed or released.
Definition: gui.cpp:237
static const uint32 kReturnCodeNone
Definition: gui.h:46
void declareGroup(const std::list< Widget *> &group)
Put these widgets together into a group.
Definition: gui.cpp:340
uint32 run(uint32 startCode=kStartCodeNone)
Run the GUI.
Definition: gui.cpp:94
Mouse was moved.
Definition: types.h:48
A GUI.
void checkWidgetActive(Widget *widget)
Check if a widget was activated.
Definition: gui.cpp:469
SDL_Event Event
Definition: types.h:42
virtual ~GUI()
Definition: gui.cpp:52
WidgetMap _widgetMap
All widgets in the GUI, index by their tag.
Definition: gui.h:141
Mouse button was pressed.
Definition: types.h:49
Keyboard key was pressed.
Definition: types.h:46
A GUI.
Definition: gui.h:43
Mouse button was released.
Definition: types.h:50
virtual void mouseDown(uint8 state, float x, float y)
A mouse button was pressed on the widget.
Definition: widget.cpp:191
Basic exceptions to throw.
void keyUp(const Events::Event &event)
Key up event triggeered.
Definition: gui.cpp:563
const char * c_str() const
Return the (utf8 encoded) string data.
Definition: ustring.cpp:249
virtual void show()
Show the GUI.
Definition: gui.cpp:62
void mouseWheel(const Events::Event &event)
Mouse wheel event triggered.
Definition: gui.cpp:544
void removeChild(GUI *gui)
Remove a child GUI object from this GUI.
Definition: gui.cpp:245
#define UNUSED(x)
Definition: system.h:170
virtual void callbackRun()
Callback that&#39;s triggered periodically in the run() method.
Definition: gui.cpp:227
const Common::UString & getTag() const
Get the widget&#39;s tag.
Definition: widget.cpp:45
The global events manager.
uint32 sub(GUI &gui, uint32 startCode=kStartCodeNone, bool showSelf=true, bool hideSelf=true)
Open up a sub GUI.
Definition: gui.cpp:349
bool empty() const
Is the string empty?
Definition: ustring.cpp:245
Generic Aurora engines (debug) console.
float _lastClickY
Definition: widget.h:138
virtual void mouseDown()
Definition: gui.cpp:440
void keyDown(const Events::Event &event)
Key down event triggered.
Definition: gui.cpp:559
StackException Exception
Definition: error.h:59
uint32 _startCode
The GUI&#39;s start code.
Definition: gui.h:74
#define CursorMan
Shortcut for accessing the cursor manager.
Definition: cursorman.h:129
virtual void removeChild(Widget &widget)
Remove a child from the widget.
Definition: widget.cpp:238
virtual void abort()
Abort the currently running GUI.
Definition: gui.cpp:156
#define EventMan
Shortcut for accessing the events manager.
Definition: events.h:210
A widget in a GUI.
The Aurora cursor manager.
std::list< GUI * > _childGUIs
Definition: gui.h:138
float _x
The GUI X position.
Definition: gui.h:143
void changedWidget(Widget *widget)
The current widget has changed.
Definition: gui.cpp:456
virtual void hide()
Hide the widget.
Definition: widget.cpp:90
An object that can be displayed by the graphics manager.
Definition: renderable.h:42
virtual void leave()
The mouse left the widget.
Definition: widget.cpp:185
#define WindowMan
Shortcut for accessing the window manager.
Definition: windowman.h:137
void clearWidgets()
Clear all widgets.
Definition: gui.cpp:295
void getPosition(float &x, float &y, float &z) const
Get the GUI&#39;s position.
Definition: gui.cpp:416
virtual void mouseWheel(uint8 state, int x, int y)
A mouse wheel was used on the widget.
Definition: widget.cpp:197
virtual void removeSub(Widget &widget)
Remove a sub-widget from the widget.
Definition: widget.cpp:227
WidgetList _widgets
All widgets in the GUI.
Definition: gui.h:140
A widget in a GUI.
Definition: widget.h:40
void updateMouse()
Force an update of the mouse position.
Definition: gui.cpp:426
virtual void show()
Show the widget.
Definition: widget.cpp:71
uint32_t uint32
Definition: types.h:204
Widget * _currentWidget
The widget the mouse is currently on.
Definition: gui.h:72
EventType
Custom event types.
Definition: types.h:45
Low-level detection of architecture/system properties.
Key
Definition: types.h:78
bool processEvent(const Events::Event &event)
Definition: console.cpp:817
std::list< Widget * > _groupMembers
The widget&#39;s fellow group members.
Definition: widget.h:117
uint32 _lastClickTime
Definition: widget.h:136
static const uint32 kStartCodeNone
Definition: gui.h:45
virtual void callbackTextInput(const Common::UString &text)
Callback that&#39;s triggered when a text input is received.
Definition: gui.cpp:234
float _z
The GUI Z position.
Definition: gui.h:145
GUI(Console *console=0)
Definition: gui.cpp:46
void addEvent(const Events::Event &event)
Add a single event for consideration into the GUI event queue.
Definition: gui.cpp:163
void addWidget(Widget *widget)
Add a widget.
Definition: gui.cpp:250
Widget * _parent
The widget&#39;s parent, if any.
Definition: widget.h:112
GUI * _sub
The currently running sub GUI.
Definition: gui.h:77
virtual Common::UString getName() const
Definition: gui.cpp:223
Keyboard key was released.
Definition: types.h:47
uint32 processEventQueue()
Process the current event queue.
Definition: gui.cpp:167
An object that can be displayed by the graphics manager.
bool empty()
Check if the gui is currently empty.
Definition: gui.cpp:306
virtual void mouseMove(uint8 state, float x, float y)
The mouse was moved over the widget.
Definition: widget.cpp:188
void textInput(const Events::Event &event)
Text input event received.
Definition: gui.cpp:555
#define GfxMan
Shortcut for accessing the graphics manager.
Definition: graphics.h:299
virtual void hide()
Hide the GUI.
Definition: gui.cpp:80
static const uint32 kDoubleClickTime
Time between clicks to still be considered a double-click.
Definition: gui.cpp:42
bool hasWidget(const Common::UString &tag) const
Does this specific widget exist within the GUI?
Definition: gui.cpp:310
Mouse wheel was used.
Definition: types.h:51
float _y
The GUI Y position.
Definition: gui.h:144
std::list< Events::Event > _eventQueue
The GUI event queue.
Definition: gui.h:147
void removeWidget(Widget *widget)
Remove a widget.
Definition: gui.cpp:267
void addChild(GUI *gui)
Add a child GUI object to this GUI.
Definition: gui.cpp:240