1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
/******************************************************************************
*
* Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
* All rights reserved.
*
* File: Event.h
*
* Description:
* This file defines UI event structures and routines.
*
* History:
* September 26, 1994 Created by Art Lamb
* 07/14/99 jesse Separated from Event.h
* 09/12/99 gap Add for new multi-tap implementation
* 09/14/99 gap Removed EvtGetTrapState.
* 10/28/99 kwk Added EvtKeydownIsVirtual macro.
*
*****************************************************************************/
#ifndef __EVENT_H__
#define __EVENT_H__
#include <PalmTypes.h>
#include <CoreTraps.h>
#include <Font.h>
#include <Rect.h>
#include <SysEvent.h>
#include <Window.h>
typedef enum {
nilEvent = 0, // system level
penDownEvent, // system level
penUpEvent, // system level
penMoveEvent, // system level
keyDownEvent, // system level
winEnterEvent, // system level
winExitEvent, // system level
ctlEnterEvent,
ctlExitEvent,
ctlSelectEvent,
ctlRepeatEvent,
lstEnterEvent,
lstSelectEvent,
lstExitEvent,
popSelectEvent,
fldEnterEvent,
fldHeightChangedEvent,
fldChangedEvent,
tblEnterEvent,
tblSelectEvent,
daySelectEvent,
menuEvent,
appStopEvent = 22, // system level
frmLoadEvent,
frmOpenEvent,
frmGotoEvent,
frmUpdateEvent,
frmSaveEvent,
frmCloseEvent,
frmTitleEnterEvent,
frmTitleSelectEvent,
tblExitEvent,
sclEnterEvent,
sclExitEvent,
sclRepeatEvent,
tsmConfirmEvent = 35, // system level
tsmFepButtonEvent, // system level
tsmFepModeEvent, // system level
//DOLATER - peter: remove this: frmTitleChangedEvent, // system level
attnIndicatorEnterEvent, // for attention manager's indicator
attnIndicatorSelectEvent, // for attention manager's indicator
// add future UI level events in this numeric space
// to save room for new system level events
menuCmdBarOpenEvent = 0x0800,
menuOpenEvent,
menuCloseEvent,
frmGadgetEnterEvent,
frmGadgetMiscEvent,
// <chg 2-25-98 RM> Equates added for library events
firstINetLibEvent = 0x1000,
firstWebLibEvent = 0x1100,
// <chg 10/9/98 SCL> Changed firstUserEvent from 32767 (0x7FFF) to 0x6000
// Enums are signed ints, so 32767 technically only allowed for ONE event.
firstUserEvent = 0x6000
} eventsEnum;
// The event record.
typedef struct EventType {
// eventsEnum eType;
Int16 eType;
Boolean penDown;
UInt8 tapCount;
Int16 screenX;
Int16 screenY;
union {
struct _GenericEventType generic;
struct _PenUpEventType penUp;
struct _KeyDownEventType keyDown;
struct _WinEnterEventType winEnter;
struct _WinExitEventType winExit;
struct _TSMConfirmType tsmConfirm;
struct _TSMFepButtonType tsmFepButton;
struct _TSMFepModeEventType tsmFepMode;
struct ctlEnter {
UInt16 controlID;
struct ControlType *pControl;
} ctlEnter;
struct ctlSelect {
UInt16 controlID;
struct ControlType *pControl;
Boolean on;
UInt8 reserved1;
UInt16 value; // used for slider controls only
} ctlSelect;
struct ctlRepeat {
UInt16 controlID;
struct ControlType *pControl;
UInt32 time;
UInt16 value; // used for slider controls only
} ctlRepeat;
struct ctlExit {
UInt16 controlID;
struct ControlType *pControl;
} ctlExit;
struct fldEnter {
UInt16 fieldID;
struct FieldType *pField;
} fldEnter;
struct fldHeightChanged {
UInt16 fieldID;
struct FieldType *pField;
Int16 newHeight;
UInt16 currentPos;
} fldHeightChanged;
struct fldChanged {
UInt16 fieldID;
struct FieldType *pField;
} fldChanged;
struct fldExit {
UInt16 fieldID;
struct FieldType *pField;
} fldExit;
struct lstEnter {
UInt16 listID;
struct ListType *pList;
Int16 selection;
} lstEnter;
struct lstExit {
UInt16 listID;
struct ListType *pList;
} lstExit;
struct lstSelect {
UInt16 listID;
struct ListType *pList;
Int16 selection;
} lstSelect;
struct tblEnter {
UInt16 tableID;
struct TableType *pTable;
Int16 row;
Int16 column;
} tblEnter;
struct tblExit {
UInt16 tableID;
struct TableType *pTable;
Int16 row;
Int16 column;
} tblExit;
struct tblSelect {
UInt16 tableID;
struct TableType *pTable;
Int16 row;
Int16 column;
} tblSelect;
struct frmLoad {
UInt16 formID;
} frmLoad;
struct frmOpen {
UInt16 formID;
} frmOpen;
struct frmGoto {
UInt16 formID;
UInt16 recordNum; // index of record that contain a match
UInt16 matchPos; // postion in record of the match.
UInt16 matchLen; // length of match.
UInt16 matchFieldNum; // field number string was found int
UInt32 matchCustom; // application specific info
} frmGoto;
struct frmClose {
UInt16 formID;
} frmClose;
struct frmUpdate {
UInt16 formID;
UInt16 updateCode; // Application specific
} frmUpdate;
struct frmTitleEnter {
UInt16 formID;
} frmTitleEnter;
struct frmTitleSelect {
UInt16 formID;
} frmTitleSelect;
struct attnIndicatorEnter {
UInt16 formID;
} attnIndicatorEnter;
struct attnIndicatorSelect {
UInt16 formID;
} attnIndicatorSelect;
struct daySelect {
struct DaySelectorType *pSelector;
Int16 selection;
Boolean useThisDate;
UInt8 reserved1;
} daySelect;
struct menu {
UInt16 itemID;
} menu;
struct popSelect {
UInt16 controlID;
struct ControlType *controlP;
UInt16 listID;
struct ListType *listP;
Int16 selection;
Int16 priorSelection;
} popSelect;
struct sclEnter {
UInt16 scrollBarID;
struct ScrollBarType *pScrollBar;
} sclEnter;
struct sclExit {
UInt16 scrollBarID;
struct ScrollBarType *pScrollBar;
Int16 value;
Int16 newValue;
} sclExit;
struct sclRepeat {
UInt16 scrollBarID;
struct ScrollBarType *pScrollBar;
Int16 value;
Int16 newValue;
Int32 time;
} sclRepeat;
struct menuCmdBarOpen {
Boolean preventFieldButtons; // set to stop the field from automatically adding cut/copy/paste
UInt8 reserved; // alignment padding
} menuCmdBarOpen;
struct menuOpen {
UInt16 menuRscID;
//struct MenuBarType *pMenu;
Int16 cause;
} menuOpen;
struct gadgetEnter {
UInt16 gadgetID; // must be same as gadgetMisc
struct FormGadgetType * gadgetP; // must be same as gadgetMisc
} gadgetEnter;
struct gadgetMisc {
UInt16 gadgetID; // must be same as gadgetEnter
struct FormGadgetType * gadgetP; // must be same as gadgetEnter
UInt16 selector;
void * dataP;
} gadgetMisc;
} data;
} EventType;
typedef EventType *EventPtr;
// Evaluate to true if <eventP> is a pointer to a virtual character key-
// down event. We assume that the caller has already determined the event
// is a keydown. WARNING!!! This macro is only safe to use on Palm OS 3.5
// or later. With earlier versions of the OS, use TxtGlueCharIsVirtual()
// in PalmOSGlue.lib
#define EvtKeydownIsVirtual(eventP) (((eventP)->data.keyDown.modifiers & virtualKeyMask) != 0)
#ifdef REMOVE_FOR_EMULATOR
#ifdef __cplusplus
extern "C" {
#endif
//---------------------------------------------------------------------
// Event Functions
//---------------------------------------------------------------------
void EvtAddEventToQueue (const EventType *event)
SYS_TRAP(sysTrapEvtAddEventToQueue);
void EvtAddUniqueEventToQueue(const EventType *eventP, UInt32 id,
Boolean inPlace)
SYS_TRAP(sysTrapEvtAddUniqueEventToQueue);
void EvtCopyEvent (const EventType *source, EventType *dest)
SYS_TRAP(sysTrapEvtCopyEvent);
void EvtGetEvent (EventType *event, Int32 timeout)
SYS_TRAP(sysTrapEvtGetEvent);
Boolean EvtEventAvail (void)
SYS_TRAP(sysTrapEvtEventAvail);
void EvtGetPen(Int16 *pScreenX, Int16 *pScreenY, Boolean *pPenDown)
SYS_TRAP(sysTrapEvtGetPen);
#ifdef __cplusplus
}
#endif
#endif
#endif // __EVENT_H__
|