aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/Palm/Platform/Incs/Core/System/SysEvent.h
blob: 7f676245ade86b1e0cb85b567dd8f5919a894812 (plain)
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
/******************************************************************************
 *
 * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
 * All rights reserved.
 *
 * File: SysEvent.h
 *
 * Description:
 *        This file defines event structures and routines.
 *
 * History:
 *		September 26, 1994	Created by Art Lamb
 *       05/05/98 art   Add Text Services event.
 *       07/23/98 kwk   Changed UInt16 field in keyDown event to WChar.
 *       08/20/98 kwk   Split tsmEvent into tsmConfirmEvent & tsmFepButtonEvent.
 *       09/07/98 kwk   Added EvtPeekEvent routine declaration.
 *       10/13/98 kwk   Removed EvtPeekEvent until API can be finalized.
 *       03/11/99 grant Fixed types of pointers in SysEventType data fields.
 *       05/31/99 kwk   Added tsmFepModeEvent event.
 *       07/14/99 jesse Moved UI structures & constants to Event.h
 *                      defined ranges for future UI & system events.
 *			07/30/99	kwk	Moved TSM events here from Event.h
 *			09/12/99	gap	Add new multi-tap implementation
 *			09/14/99	gap	Removed EvtGetTrapState.
 *
 *****************************************************************************/

#ifndef __SYSEVENT_H__
#define __SYSEVENT_H__

#include <PalmTypes.h>
#include <CoreTraps.h>
#include <Font.h>
#include <Rect.h>
#include <Window.h>

#ifndef PUBLIC_STUFF_STRIPPED
// DOLATER ¥¥¥ Don't use an enum for this, as convenient as it is, there's namespace
// pollution, size issues, no way to manage componentization, blah blah blah.
#endif // PUBLIC_STUFF_STRIPPED

typedef enum {
	sysEventNilEvent = 0,
	sysEventPenDownEvent,
	sysEventPenUpEvent,
	sysEventPenMoveEvent,
	sysEventKeyDownEvent,
	sysEventWinEnterEvent,
	sysEventWinExitEvent,
	sysEventAppStopEvent = 22,
	sysEventTsmConfirmEvent = 35,
	sysEventTsmFepButtonEvent,
	sysEventTsmFepModeEvent,

	// add future UI level events in this numeric space
	// to save room for new system level events
	sysEventNextUIEvent = 0x0800,

	// <chg 2-25-98 RM> Equates added for library events
	sysEventFirstINetLibEvent = 0x1000,
	sysEventFirstWebLibEvent = 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.
	sysEventFirstUserEvent = 0x6000
} SysEventsEnum;



// keyDownEvent modifers
#define shiftKeyMask       0x0001
#define capsLockMask       0x0002
#define numLockMask        0x0004
#define commandKeyMask     0x0008
#define optionKeyMask      0x0010
#define controlKeyMask     0x0020
#define autoRepeatKeyMask  0x0040      // True if generated due to auto-repeat
#define doubleTapKeyMask   0x0080      // True if this is a double-tap event
#define poweredOnKeyMask   0x0100      // True if this is a double-tap event
#define appEvtHookKeyMask  0x0200      // True if this is an app hook key
#define libEvtHookKeyMask  0x0400      // True if this is a library hook key

// define mask for all "virtual" keys
#define virtualKeyMask	(appEvtHookKeyMask | libEvtHookKeyMask | commandKeyMask)


// Event timeouts
#define  evtWaitForever    -1
#define  evtNoWait          0

struct _GenericEventType {
	UInt16         datum[8];
   };

struct _PenUpEventType {
   PointType      start;            // display coord. of stroke start
   PointType      end;              // display coord. of stroke start
   };

struct _KeyDownEventType {
   WChar          chr;              // ascii code
   UInt16         keyCode;          // virtual key code
   UInt16         modifiers;
   };

struct _WinEnterEventType {
   WinHandle      enterWindow;
   WinHandle      exitWindow;
   };

struct _WinExitEventType {
   WinHandle      enterWindow;
   WinHandle      exitWindow;
   };

struct _TSMConfirmType {
	Char *			yomiText;
	UInt16			formID;
   };

struct _TSMFepButtonType {
	UInt16			buttonID;
   };

struct _TSMFepModeEventType {
	UInt16         mode;					// DOLATER kwk - use real type for mode?
   };


// The event record.
typedef struct SysEventType {
   SysEventsEnum  eType;
   Boolean        penDown;
   UInt8          tapCount;
   Coord          screenX;
   Coord          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;

      } data;

} SysEventType;


// Events are stored in the event queue with some extra fields:
typedef  struct {
   SysEventType   event;
   UInt32         id;                  // used to support EvtAddUniqueEvent
   } SysEventStoreType;

#ifndef PUBLIC_STUFF_STRIPPED		// removed header that should be moved into private area

//---------------------------------------------------------------------
// Event Functions
//---------------------------------------------------------------------

#ifdef REMOVE_FOR_EMULATOR
#ifdef __cplusplus
extern "C" {
#endif

/* DOLATER: jwm: This lot should be in a private header file, no? */

void     SysEventInitialize (void)
                     SYS_TRAP(sysTrapEvtInitialize);

void     SysEventAddToQueue (const SysEventType *event)
                     SYS_TRAP(sysTrapEvtAddEventToQueue);

void     SysEventAddUniqueToQueue(const SysEventType *eventP, UInt32 id,
            Boolean inPlace)
                     SYS_TRAP(sysTrapEvtAddUniqueEventToQueue);

void     SysEventCopy (const SysEventType *source, SysEventType *dest)
                     SYS_TRAP(sysTrapEvtCopyEvent);

void     SysEventGet (SysEventType *event, Int32 timeout)
                     SYS_TRAP(sysTrapEvtGetEvent);

Boolean  SysEventAvail (void)
                     SYS_TRAP(sysTrapEvtEventAvail);


#ifdef __cplusplus
}
#endif
#endif


// For Compatibility.. DOLATER... source modules should use EvtGetPen instead.
#endif // PUBLIC_STUFF_STRIPPED
#define     PenGetPoint(a,b,c)    EvtGetPen(a,b,c)



#endif // __SYSEVENT_H__