47 _currentWidget(0), _startCode(kStartCodeNone), _returnCode(kReturnCodeNone),
48 _sub(0), _x(0.0f), _y(0.0f), _z(0.0f) {
54 for (WidgetList::iterator widget =
_widgets.begin(); widget !=
_widgets.end(); ++widget) {
84 for (WidgetList::iterator widget =
_widgets.begin(); widget !=
_widgets.end(); ++widget)
112 for (std::list<GUI *>::iterator iter = childGUIs.begin(); iter != childGUIs.end(); ++iter) {
113 (*iter)->callbackRun();
127 for (std::list<GUI *>::iterator iter = childGUIs.begin(); iter != childGUIs.end(); ++iter) {
128 (*iter)->addEvent(event);
133 for (std::list<GUI *>::iterator iter = childGUIs.begin(); iter != childGUIs.end(); ++iter) {
134 (*iter)->processEventQueue();
138 for (std::list<GUI *>::iterator iter = childGUIs.begin(); iter != childGUIs.end(); ++iter) {
144 (*iter)->_returnCode = 0;
168 bool hasMove =
false;
170 for (std::list<Events::Event>::const_iterator e =
_eventQueue.begin();
182 if ((e->key.keysym.sym == SDLK_d) && (e->key.keysym.mod & KMOD_CTRL)) {
290 (*i)->removeGroupMember(*widget);
297 for (WidgetList::iterator widget =
_widgets.begin(); widget !=
_widgets.end(); ++widget) {
316 WidgetMap::iterator widget =
_widgetMap.find(tag);
324 return widget->second;
329 WidgetMap::const_iterator widget =
_widgetMap.find(tag);
337 return widget->second;
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)
346 (*a)->addGroupMember(**b);
379 if (hideSelf && showSelf)
432 event.motion.state = state;
501 if (event.motion.state != 0) {
513 if (event.button.button != SDL_BUTTON_LMASK)
526 if (event.button.button != SDL_BUTTON_LMASK)
546 SDL_GetMouseState(&x, &y);
570 return (x - (sW / 2.0f));
576 return ((sH - y) - (sH / 2.0f));
591 uint8 button =
event.button.button;
592 float x =
toGUIX(event.button.x);
593 float y =
toGUIY(event.button.y);
614 widget->
mouseWheel(event.wheel.type, event.wheel.x, event.wheel.y);
const Common::UString & getTag() const
Get the object's tag.
virtual void mouseUp()
The mouse state has changed.
Widget * getWidget(const Common::UString &tag, bool vital=false)
Return a widget in the GUI.
The global graphics manager.
static const uint32 kReturnCodeAbort
void mouseMove(const Events::Event &event)
Mouse move event triggered.
uint32 _returnCode
The GUI's return code.
A class holding an UTF-8 string.
void setPosition(float x, float y, float z)
Set the GUI's position.
virtual void callbackActive(Widget &widget)
Callback that's triggered when a widget was activated.
Widget * getWidgetAt(float x, float y)
Return the widget at that position.
void removeFocus()
Forcefully remove the focus from the current widget.
virtual void callbackKeyInput(const Events::Key &key, const Events::EventType &type)
Callback that's triggered when a key is pressed or released.
static const uint32 kReturnCodeNone
void declareGroup(const std::list< Widget *> &group)
Put these widgets together into a group.
uint32 run(uint32 startCode=kStartCodeNone)
Run the GUI.
void checkWidgetActive(Widget *widget)
Check if a widget was activated.
WidgetMap _widgetMap
All widgets in the GUI, index by their tag.
Mouse button was pressed.
Keyboard key was pressed.
Mouse button was released.
Basic exceptions to throw.
void keyUp(const Events::Event &event)
Key up event triggeered.
const char * c_str() const
Return the (utf8 encoded) string data.
virtual void show()
Show the GUI.
void mouseWheel(const Events::Event &event)
Mouse wheel event triggered.
void removeChild(GUI *gui)
Remove a child GUI object from this GUI.
virtual void callbackRun()
Callback that's triggered periodically in the run() method.
The global events manager.
uint32 sub(GUI &gui, uint32 startCode=kStartCodeNone, bool showSelf=true, bool hideSelf=true)
Open up a sub GUI.
bool empty() const
Is the string empty?
Generic Aurora engines (debug) console.
void keyDown(const Events::Event &event)
Key down event triggered.
uint32 _startCode
The GUI's start code.
#define CursorMan
Shortcut for accessing the cursor manager.
virtual void abort()
Abort the currently running GUI.
#define EventMan
Shortcut for accessing the events manager.
The Aurora cursor manager.
std::list< GUI * > _childGUIs
float _x
The GUI X position.
void changedWidget(Widget *widget)
The current widget has changed.
An object that can be displayed by the graphics manager.
#define WindowMan
Shortcut for accessing the window manager.
void clearWidgets()
Clear all widgets.
void getPosition(float &x, float &y, float &z) const
Get the GUI's position.
WidgetList _widgets
All widgets in the GUI.
void updateMouse()
Force an update of the mouse position.
Widget * _currentWidget
The widget the mouse is currently on.
EventType
Custom event types.
Low-level detection of architecture/system properties.
bool processEvent(const Events::Event &event)
static const uint32 kStartCodeNone
virtual void callbackTextInput(const Common::UString &text)
Callback that's triggered when a text input is received.
float _z
The GUI Z position.
void addEvent(const Events::Event &event)
Add a single event for consideration into the GUI event queue.
void addWidget(Widget *widget)
Add a widget.
GUI * _sub
The currently running sub GUI.
virtual Common::UString getName() const
Keyboard key was released.
uint32 processEventQueue()
Process the current event queue.
An object that can be displayed by the graphics manager.
bool empty()
Check if the gui is currently empty.
void textInput(const Events::Event &event)
Text input event received.
#define GfxMan
Shortcut for accessing the graphics manager.
virtual void hide()
Hide the GUI.
static const uint32 kDoubleClickTime
Time between clicks to still be considered a double-click.
bool hasWidget(const Common::UString &tag) const
Does this specific widget exist within the GUI?
float _y
The GUI Y position.
std::list< Events::Event > _eventQueue
The GUI event queue.
void removeWidget(Widget *widget)
Remove a widget.
void addChild(GUI *gui)
Add a child GUI object to this GUI.