51#include <mcp/syscalls.h>
59#define EVENT_QUEUE_SIZE 128
66typedef enum event_kind
92typedef enum event_mask
94 mouseDownMask = 1 << mouseDown,
95 mouseUpMask = 1 << mouseUp,
96 keyDownMask = 1 << keyDown,
97 keyUpMask = 1 << keyUp,
98 autoKeyMask = 1 << autoKey,
99 updateMask = 1 << updateEvt,
100 diskEvtMask = 1 << diskEvt,
101 activateEvtMask = 1 << activateEvt,
102 inactivateEvtMask = 1 << inactivateEvt,
103 rMouseDownMask = 1 << rMouseDown,
104 rMouseUpMask = 1 << rMouseUp,
105 menuOpenedMask = 1 << menuOpened,
106 menuSelectedMask = 1 << menuSelected,
107 menuCanceledMask = 1 << menuCanceled,
108 controlClickedMask = 1 << controlClicked,
109 mouseMovedMask = 1 << mouseMoved,
110 windowChangedMask = 1 << windowChanged,
111 mMouseDownMask = 1 << mMouseDown,
112 mMouseUpMask = 1 << mMouseUp,
117typedef enum event_modifiers
127 rightShiftKeyBit = 13,
128 rightOptionKeyBit = 14,
129 rightControlKeyBit = 15
132typedef enum event_modifier_flags
134 activeFlag = 1 << activeFlagBit,
135 btnState = 1 << btnStateBit,
136 foenixKey = 1 << foenixKeyBit,
137 shiftKey = 1 << shiftKeyBit,
138 alphaLock = 1 << alphaLockBit,
139 optionKey = 1 << optionKeyBit,
140 controlKey = 1 << controlKeyBit,
141 rightShiftKey = 1 << rightShiftKeyBit,
142 rightOptionKey = 1 << rightOptionKeyBit,
143 rightControlKey = 1 << rightControlKeyBit
144} event_modifier_flags;
156 kBackspaceCharCode = 8,
158 kLineFeedCharCode = 10,
159 kVerticalTabCharCode = 11,
160 kPageUpCharCode = 11,
161 kFormFeedCharCode = 12,
162 kPageDownCharCode = 12,
163 kReturnCharCode = 13,
164 kFunctionKeyCharCode = 16,
165 kEscapeCharCode = 27,
167 kLeftArrowCharCode = 28,
168 kRightArrowCharCode = 29,
169 kUpArrowCharCode = 30,
170 kDownArrowCharCode = 31,
171 kDeleteCharCode = 127,
172 kNonBreakingSpaceCharCode = 202
196 event_modifiers modifiers_;
203 event_modifiers modifiers_;
266bool EventManager_Destroy(
EventManager** the_event_manager);
322void EventManager_Print(
EventManager* the_event_manager);
void EventManager_RemoveEventsForWindow(Window *the_window)
Nulls out any events associated with the window pointer passed Call this when a window has been close...
Definition: event.c:322
void EventManager_WaitForEvent(void)
Wait for an event to happen, do system-processing of it, then if appropriate, give the window respons...
Definition: event.c:1151
void EventManager_AddMenuEvent(event_kind the_what, int16_t menu_selection, int16_t x, int16_t y, Window *the_window)
Add a new menu event to the event queue NOTE: this does not actually insert a new record,...
Definition: event.c:521
EventRecord * EventManager_NextEvent(void)
Checks to see if there is an event in the queue returns NULL if no event (not the same as returning a...
Definition: event.c:369
EventRecord * Event_New(void)
Allocate an EventManager object.
Definition: event.c:188
EventManager * EventManager_New(void)
Allocate an EventManager object.
Definition: event.c:236
void EventManager_AddWindowEvent(event_kind the_what, int16_t x, int16_t y, int16_t width, int16_t height, Window *the_window, Control *the_control)
Add a new window event to the event queue NOTE: this does not actually insert a new record,...
Definition: event.c:473
void EventManager_AddMouseEvent(event_kind the_what)
Add a new mouse event to the event queue NOTE: this does not actually insert a new record,...
Definition: event.c:415
This structure describes an instantiated control on a window.
Definition: control.h:130
uint8_t modifiers_
the character code resulting from the key, after mapping. e.g, 1 may return 49, ALT-1 may return 145,...
Definition: event.h:185
uint8_t source_
bit flags for shift, ctrl, meta, etc.
Definition: event.h:186
uint8_t char_
the key code of the key pushed. eg, KEY_BKSP (0x92), not CH_BKSP (0x08). Most useful for handling act...
Definition: event.h:184
MouseTracker * mouse_tracker_
index to queue_: where the next event record will be read from
Definition: event.h:229
uint16_t read_idx_
index to queue_: where the next event record will be slotted
Definition: event.h:228
uint16_t write_idx_
circular buffer for the event queue
Definition: event.h:227
int16_t x_
set for keyboard and mouse events
Definition: event.h:197
Control * control_
for mouse events: the global y position of mouse.
Definition: event.h:199
int16_t y_
for mouse events: the global x position of mouse.
Definition: event.h:198
Control * control_
The affected window (if any). May be NULL.
Definition: event.h:215
event_kind what_
ticks
Definition: event.h:213
int16_t height_
for window events: the new width of the window.
Definition: event.h:207
int16_t x_
set for keyboard and mouse events
Definition: event.h:204
int16_t y_
for window events: the new global x position of the window.
Definition: event.h:205
int16_t width_
for window events: the new global y position of the window.
Definition: event.h:206