25#include "common/array.h"
26#include "common/stack.h"
27#include "graphics/screen.h"
28#include "mm/mm1/messages.h"
29#include "mm/mm1/utils/mouse.h"
35#define FRAME_DELAY (1000 / FRAME_RATE)
57 operator const Common::Rect &()
const {
return _bounds; }
59 void setBorderSize(
size_t borderSize);
60 size_t borderSize()
const {
return _borderSize; }
61 int16 width()
const {
return _bounds.
width(); }
62 int16 height()
const {
return _bounds.
height(); }
77 bool _needsRedraw =
true;
98 return _timeoutCtr != 0;
157 bool isFocused()
const;
226 #define MESSAGE(NAME) \
228 virtual bool msg##NAME(const NAME##Message &e) { \
229 for (Common::Array<UIElement *>::iterator it = _children.begin(); \
230 it != _children.end(); ++it) { \
231 if ((*it)->msg##NAME(e)) return true; \
236 bool send(const Common::String &viewName, const NAME##Message &msg) { \
237 UIElement *view = UIElement::findViewGlobally(viewName); \
239 return view->msg##NAME(msg); \
241 bool send(const NAME##Message &msg) { \
242 return send("Root", msg); \
255 MESSAGE(DrawGraphic);
287 #define MESSAGE(NAME) \
288 bool msg##NAME(const NAME##Message &e) override { \
289 return !_views.empty() ? focusedView()->msg##NAME(e) : false; \
298 MESSAGE(DrawGraphic);
301 Events(
bool enhancedMode);
342 return _views.empty() ? nullptr : _views.top();
349 return _views.size() < 2 ? nullptr :
350 _views[_views.size() - 2];
370 void drawElements() {
404extern Events *g_events;
Definition: managed_surface.h:51
void addKeypress(const Common::KeyCode kc)
void addView(UIElement *ui)
bool isPresent(const Common::String &name) const
bool isKeypressPending() const
bool isInCombat() const
Definition: events.h:362
void replaceView(UIElement *ui, bool replaceAllViews=false)
void draw() override
Definition: events.h:390
bool tick() override
Definition: events.h:392
virtual bool shouldQuit() const =0
void processEvent(Common::Event &ev)
UIElement * focusedView() const
Definition: events.h:341
void addAction(KeybindingAction action)
void close() override
Definition: events.h:399
UIElement * priorView() const
Definition: events.h:348
Common::Rect getBounds() const
Definition: events.h:194
void addView(UIElement *ui)
virtual UIElement * findView(const Common::String &name)
bool needsRedraw() const
Definition: events.h:136
Graphics::ManagedSurface getSurface() const
void delaySeconds(uint seconds)
void replaceView(UIElement *ui, bool replaceAllViews=false)
void cancelDelay()
Definition: events.h:104
void delayFrames(uint frames)
Common::String getName() const
Definition: events.h:182
bool isDelayActive() const
Definition: events.h:97
virtual void clearSurface()
int getRandomNumber(int minNumber, int maxNumber)
virtual void setBounds(const Common::Rect &r)
Definition: events.h:187
Definition: detection.h:27
T height() const
Definition: rect.h:218
T width() const
Definition: rect.h:217