22#ifndef GRAPHICS_VIEWS_EVENTS_H
23#define GRAPHICS_VIEWS_EVENTS_H
25#include "common/array.h"
26#include "common/random.h"
27#include "common/stack.h"
28#include "graphics/font.h"
29#include "graphics/views/gfx_surface.h"
30#include "graphics/views/messages.h"
31#include "graphics/views/rect.h"
32#include "graphics/screen.h"
62 void setBorderSize(
size_t borderSize);
63 size_t borderSize()
const {
67 return _bounds.
width();
69 int16 height()
const {
91 bool _needsRedraw =
true;
112 return _timeoutCtr != 0;
132 virtual void drawElements();
247#define MESSAGE(NAME) \
249 virtual bool msg##NAME(const NAME##Message &e) { \
250 for (Common::Array<UIElement *>::iterator it = _children.begin(); \
251 it != _children.end(); ++it) { \
252 if ((*it)->msg##NAME(e)) \
259 bool send(const Common::String &viewName, const NAME##Message &msg) { \
260 UIElement *view = UIElement::findViewGlobally(viewName); \
262 return view->msg##NAME(msg); \
264 bool send(const NAME##Message &msg) { \
265 return msg##NAME(msg); \
290 it != _children.
end(); ++it) {
291 if ((*it)->msgCustom(msg))
311 UIElement *view = UIElement::findViewGlobally(viewName);
330 uint _nextFrameTime = 0;
348#define MESSAGE(NAME) \
349 bool msg##NAME(const NAME##Message &e) override { \
350 return !_views.empty() ? focusedView()->msg##NAME(e) : false; \
427 return _views.empty() ? nullptr : _views.top();
434 return _views.size() < 2 ? nullptr : _views[_views.size() - 2];
441 return _views.empty() ? nullptr : _views[0];
iterator end()
Definition: array.h:380
T * iterator
Definition: array.h:54
iterator begin()
Definition: array.h:375
UIElement * priorView() const
Definition: events.h:433
uint getFrameRate() const
Definition: events.h:380
void drawElements() override
bool tick() override
Definition: events.h:471
UIElement * focusedView() const
Definition: events.h:426
Graphics::Screen * getScreen() const
Definition: events.h:453
void replaceView(UIElement *ui, bool replaceAllViews=false) override
virtual bool shouldQuit() const =0
int getRandomNumber(int minNumber, int maxNumber)
void draw() override
Definition: events.h:465
Events(const Common::String &engineName, uint frameRate=20)
virtual Graphics::Font * createFont() const
UIElement * baseView() const
Definition: events.h:440
void close() override
Definition: events.h:478
bool msgCustom(const Message &msg) override
Definition: events.h:366
void addView(UIElement *ui) override
bool isPresent(const Common::String &name) const
Definition: gfx_surface.h:34
virtual bool msgCustom(const Message &msg)
Definition: events.h:288
const Common::String & getName() const
Definition: events.h:202
GfxSurface getSurface(bool innerBounds=false) const
bool send(const T &msg)
Definition: events.h:306
int getRandomNumber(int minNumber, int maxNumber)
virtual bool msgMouseMove(const MouseMoveMessage &msg)
Definition: events.h:231
virtual void addView(UIElement *ui)
bool isDelayActive() const
Definition: events.h:111
void cancelDelay()
Definition: events.h:118
void delaySeconds(uint seconds)
bool needsRedraw() const
Definition: events.h:148
void delayFrames(uint frames)
virtual void replaceView(UIElement *ui, bool replaceAllViews=false)
virtual UIElement * findView(const Common::String &name)
virtual void setBounds(const Common::Rect &r)
Definition: events.h:188
Common::Rect getBounds() const
Definition: events.h:195
Definition: formatinfo.h:28
T height() const
Definition: rect.h:218
bool contains(T x, T y) const
Definition: rect.h:246
T width() const
Definition: rect.h:217
Definition: messages.h:37
Definition: messages.h:61