22 #ifndef COMMON_EVENTS_H 23 #define COMMON_EVENTS_H 25 #include "common/keyboard.h" 26 #include "common/path.h" 27 #include "common/queue.h" 28 #include "common/rect.h" 29 #include "common/noncopyable.h" 31 #include "common/list.h" 32 #include "common/singleton.h" 57 EVENT_LBUTTONDOWN = 4,
59 EVENT_RBUTTONDOWN = 6,
63 EVENT_MBUTTONDOWN = 13,
67 EVENT_RETURN_TO_LAUNCHER = 16,
71 EVENT_SCREEN_CHANGED = 11,
86 EVENT_CUSTOM_BACKEND_ACTION_START = 18,
87 EVENT_CUSTOM_BACKEND_ACTION_END = 19,
88 EVENT_CUSTOM_BACKEND_ACTION_AXIS = 34,
89 EVENT_CUSTOM_ENGINE_ACTION_START = 20,
90 EVENT_CUSTOM_ENGINE_ACTION_END = 21,
92 EVENT_VIRTUAL_KEYBOARD = 22,
96 EVENT_JOYAXIS_MOTION = 24,
97 EVENT_JOYBUTTON_DOWN = 25,
98 EVENT_JOYBUTTON_UP = 26,
100 EVENT_CLIPBOARD_UPDATE = 27,
102 EVENT_CUSTOM_BACKEND_HARDWARE = 28,
112 EVENT_X1BUTTONUP = 31,
113 EVENT_X2BUTTONDOWN = 32,
114 EVENT_X2BUTTONUP = 33,
118 EVENT_FOCUS_LOST = 37
121 const int16 JOYAXIS_MIN = -32768;
122 const int16 JOYAXIS_MAX = 32767;
147 JOYSTICK_BUTTON_INVALID,
152 JOYSTICK_BUTTON_BACK,
153 JOYSTICK_BUTTON_GUIDE,
154 JOYSTICK_BUTTON_START,
155 JOYSTICK_BUTTON_LEFT_STICK,
156 JOYSTICK_BUTTON_RIGHT_STICK,
157 JOYSTICK_BUTTON_LEFT_SHOULDER,
158 JOYSTICK_BUTTON_RIGHT_SHOULDER,
159 JOYSTICK_BUTTON_DPAD_UP,
160 JOYSTICK_BUTTON_DPAD_DOWN,
161 JOYSTICK_BUTTON_DPAD_LEFT,
162 JOYSTICK_BUTTON_DPAD_RIGHT,
163 JOYSTICK_BUTTON_DPAD_CENTER
170 JOYSTICK_AXIS_LEFT_STICK_X,
171 JOYSTICK_AXIS_LEFT_STICK_Y,
172 JOYSTICK_AXIS_RIGHT_STICK_X,
173 JOYSTICK_AXIS_RIGHT_STICK_Y,
174 JOYSTICK_AXIS_LEFT_TRIGGER,
175 JOYSTICK_AXIS_RIGHT_TRIGGER,
184 MOUSE_BUTTON_LEFT = 0,
185 MOUSE_BUTTON_RIGHT = 1,
186 MOUSE_BUTTON_MIDDLE = 2,
188 MOUSE_WHEEL_DOWN = 4,
242 Event() : type(EVENT_INVALID), kbdRepeat(false), customType(0) {
269 virtual bool pollEvent(
Event &event) = 0;
294 _artificialEventQueue.push(ev);
298 if (!_artificialEventQueue.empty()) {
299 ev = _artificialEventQueue.pop();
335 virtual bool notifyEvent(
const Event &event) = 0;
393 void registerMapper(
EventMapper *mapper,
bool autoFree);
405 void registerSource(
EventSource *source,
bool autoFree);
418 void ignoreSources(
bool ignore);
426 void registerObserver(
EventObserver *obs, uint priority,
bool autoFree,
bool listenPolls =
false);
440 struct MapperEntry :
public Entry {
446 struct SourceEntry :
public Entry {
452 struct ObserverEntry :
public Entry {
460 void dispatchEvent(
const Event &event);
477 LBUTTON = 1 << MOUSE_BUTTON_LEFT,
478 RBUTTON = 1 << MOUSE_BUTTON_RIGHT
493 virtual bool pollEvent(
Event &event) = 0;
498 virtual void pushEvent(
const Event &event) = 0;
503 virtual void purgeMouseEvents() = 0;
508 virtual void purgeKeyboardEvents() = 0;
511 virtual Point getMousePos()
const = 0;
518 virtual int getButtonState()
const = 0;
521 virtual int getModifierState()
const = 0;
526 virtual int shouldQuit()
const = 0;
531 virtual int shouldReturnToLauncher()
const = 0;
537 virtual void resetReturnToLauncher() = 0;
538 virtual void resetQuit() = 0;
549 virtual Keymap *getGlobalKeymap() = 0;
556 kEventManPriority = 0,
561 kEventRecorderPriority = 1,
566 kEventRemapperPriority = 999
bool isMouseEvent(const Event &event)
Common::Path path
Definition: events.h:229
void addEvent(const Event &ev)
Definition: events.h:293
uint8 button
Definition: events.h:138
bool kbdRepeat
Definition: events.h:209
Common::Point relMouse
Definition: events.h:234
CustomEventType customType
Definition: events.h:226
EventType
Definition: events.h:49
EventSource * makeKeyboardRepeatingEventSource(EventSource *eventSource)
uint32 CustomEventType
Definition: events.h:193
int16 position
Definition: events.h:131
EventDispatcher * getEventDispatcher()
Definition: events.h:572
Point mouse
Definition: events.h:223
Definition: keymapper.h:44
JoystickAxis
Definition: events.h:169
Definition: noncopyable.h:39
MouseButton
Definition: events.h:183
KeyState kbd
Definition: events.h:215
bool pollEvent(Event &ev)
Definition: events.h:297
JoystickState joystick
Definition: events.h:240
Definition: algorithm.h:29
virtual bool allowMapping() const
Definition: events.h:279
Definition: keyboard.h:294
EventType type
Definition: events.h:202
JoystickButton
Definition: events.h:146
virtual void notifyPoll()
Definition: events.h:340
virtual void init()
Definition: events.h:486
byte axis
Definition: events.h:129
virtual bool allowMapping() const
Definition: events.h:310