4
(******************************************************************************
6
* Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
11
* Release: Palm OS SDK 4.0 (63220)
14
* Header for the System Event Manager
17
* 03/22/95 RM Created by Ron Marianetti
18
* 07/23/98 kwk Changed UInt16 param in EvtEnqueueKey to WChar.
20
*****************************************************************************)
26
uses palmos, coretraps, rect, errorbase, sysevent;
28
(************************************************************
29
* System Event Manager Errors
30
*************************************************************)
33
evtErrParamErr = evtErrorClass or 1;
34
evtErrQueueFull = evtErrorClass or 2;
35
evtErrQueueEmpty = evtErrorClass or 3;
37
(************************************************************
38
* Commands for EvtSetAutoOffTimer()
39
*************************************************************)
41
EvtSetAutoOffCmd = Enum;
44
SetAtLeast = 0; // turn off in at least xxx seconds
45
SetExactly = Succ(SetAtLeast); // turn off in xxx seconds
46
SetAtMost = Succ(SetExactly); // turn off in at most xxx seconds
47
SetDefault = Succ(SetAtMost); // change default auto-off timeout to xxx seconds
48
ResetTimer = Succ(SetDefault); // reset the timer to the default auto-off timeout
50
(************************************************************
51
* Pen button info structure. This structure is used
52
* to hold the bounds of each button on the silk screen and
53
* the ascii code and modifiers byte that each will generate
54
* when tapped by the user.
55
*************************************************************)
58
PenBtnInfoType = record
59
boundsR: RectangleType; // bounding rectangle of button
60
asciiCode: WChar; // ascii code for key event
61
keyCode: UInt16; // virtual key code for key event
62
modifiers: UInt16; // modifiers for key event
64
PenBtnInfoPtr = ^PenBtnInfoType;
67
PenBtnListType = record
68
numButtons: UInt16; // Count of number of buttons
69
buttons: array [0..0] of PenBtnInfoType; // Placeholder for one or more buttons
72
(************************************************************
73
* Silkscreen area info structure. An array of these structures
74
* is returned by the EvtGetSilkscreenAreaList function.
75
*************************************************************)
77
// Different types of rectangles on the display. For new vendor areas,
78
// the type should be set to the vendor's creator code, as assigned
79
// by 3Com's Partner Engineering group.
82
silkscreenRectScreen = Rsc('scrn');
83
silkscreenRectGraffiti = Rsc('graf');
85
// Values for SilkscreenAreaType.index if areaType = silkscreenRectGraffiti
86
alphaGraffitiSilkscreenArea = 0;
87
numericGraffitiSilkscreenArea = 1;
89
// One silkscreen area. The areaType field tells us which type of
90
// area it is, while the index field has different meanings depending
94
SilkscreenAreaType = record
95
bounds: RectangleType;
96
areaType: UInt32; // four byte creator code.
99
SilkscreenAreaPtr = ^SilkscreenAreaType;
101
(************************************************************
102
* System Event Manager procedures
103
*************************************************************)
105
//-----------------------------------------------------------------
107
//------------------------------------------------------------------
109
function EvtSysInit: Err; syscall sysTrapEvtSysInit;
111
// Return next "System" event. This routine will send strokes to Graffiti as necessary
112
// and return a key event. Otherwise, it will return a simple pen down or pen
113
// up event, or put the processor to sleep for a max time of 'timeout' if
114
// no events are available.
115
procedure EvtGetSysEvent(var eventP: SysEventType; timeout: Int32); syscall sysTrapEvtGetSysEvent;
117
// Return true if there is a low level system event (pen or key) available
118
function EvtSysEventAvail(ignorePenUps: Boolean): Boolean; syscall sysTrapEvtSysEventAvail;
120
// Translate a stroke in the silk screen area to a key event
121
function EvtProcessSoftKeyStroke(var startPtP, endPtP: PointType): Err; syscall sysTrapEvtProcessSoftKeyStroke;
123
//-----------------------------------------------------------------
124
// Pen Queue Utilties
125
//------------------------------------------------------------------
127
// Replace current pen queue with another of the given size
128
function EvtSetPenQueuePtr(penQueueP: MemPtr; size: UInt32): Err; syscall sysTrapEvtSetPenQueuePtr;
130
// Return size of current pen queue in bytes
131
function EvtPenQueueSize: UInt32; syscall sysTrapEvtPenQueueSize;
133
// Flush the pen queue
134
function EvtFlushPenQueue: Err; syscall sysTrapEvtFlushPenQueue;
136
// Append a point to the pen queue. Passing -1 for x and y means
137
// pen-up (terminate the current stroke). Called by digitizer interrupt routine
138
function EvtEnqueuePenPoint(var ptP: PointType): Err; syscall sysTrapEvtEnqueuePenPoint;
140
// Return the stroke info for the next stroke in the pen queue. This MUST
141
// be the first call when removing a stroke from the queue
142
function EvtDequeuePenStrokeInfo(var startPtP, endPtP: PointType): Err; syscall sysTrapEvtDequeuePenStrokeInfo;
144
// Dequeue the next point from the pen queue. Returns non-0 if no
145
// more points. The point returned will be (-1,-1) at the end
147
function EvtDequeuePenPoint(var retP: PointType): Err; syscall sysTrapEvtDequeuePenPoint;
149
// Flush the entire stroke from the pen queue and dispose it
150
function EvtFlushNextPenStroke: Err; syscall sysTrapEvtFlushNextPenStroke;
152
//-----------------------------------------------------------------
153
// Key Queue Utilties
154
//------------------------------------------------------------------
156
// Replace current key queue with another of the given size. This routine will
157
// intialize the given key queue before installing it
158
function EvtSetKeyQueuePtr(keyQueueP: MemPtr; size: UInt32): Err; syscall sysTrapEvtSetKeyQueuePtr;
160
// Return size of current key queue in bytes
161
function EvtKeyQueueSize: UInt32; syscall sysTrapEvtKeyQueueSize;
163
// Flush the key queue
164
function EvtFlushKeyQueue: Err; syscall sysTrapEvtFlushKeyQueue;
166
// Append a key to the key queue.
167
function EvtEnqueueKey(ascii: WChar; keycode, modifiers: UInt16): Err; syscall sysTrapEvtEnqueueKey;
169
// Return true of key queue empty.
170
function EvtKeyQueueEmpty: Boolean; syscall sysTrapEvtKeyQueueEmpty;
172
// Pop off the next key event from the key queue and fill in the given
173
// event record structure. Returns non-zero if there aren't any keys in the
174
// key queue. If peek is non-zero, key will be left in key queue.
175
function EvtDequeueKeyEvent(var eventP: SysEventType; peek: UInt16): Err; syscall sysTrapEvtDequeueKeyEvent;
177
//-----------------------------------------------------------------
178
// Silkscreen information calls
179
//------------------------------------------------------------------
181
// Return pointer to the pen based button list
182
function EvtGetPenBtnList(var numButtons: UInt16): PenBtnInfoPtr; syscall sysTrapEvtGetPenBtnList;
184
// Return pointer to the silkscreen area list
185
function EvtGetSilkscreenAreaList(var numAreas: UInt16): SilkscreenAreaPtr; syscall sysTrapEvtGetSilkscreenAreaList;
187
//-----------------------------------------------------------------
189
//------------------------------------------------------------------
190
// Force the system to wake-up. This will result in a null event being
191
// sent to the current app.
192
function EvtWakeup: Err; syscall sysTrapEvtWakeup;
194
// Force the system to wake-up. This will NOT result in a null event being
195
// sent to the current app.
196
function EvtWakeupWithoutNilEvent: Err; syscall sysTrapEvtWakeupWithoutNilEvent;
198
// Reset the auto-off timer. This is called by the SerialLink Manager in order
199
// so we don't auto-off while receiving data over the serial port.
200
function EvtResetAutoOffTimer: Err; syscall sysTrapEvtResetAutoOffTimer;
202
function EvtSetAutoOffTimer(cmd: EvtSetAutoOffCmd; timeout: UInt16): Err; syscall sysTrapEvtSetAutoOffTimer;
204
// Set Graffiti enabled or disabled.
205
procedure EvtEnableGraffiti(enable: Boolean); syscall sysTrapEvtEnableGraffiti;
207
// Force a NullEvent at or before tick
208
function EvtSetNullEventTick(tick: UInt32): Boolean; syscall sysTrapEvtSetNullEventTick;
210
(************************************************************
211
* Assembly Function Prototypes
212
*************************************************************)
214
//#define _EvtEnqueuePenPoint ASM_SYS_TRAP(sysTrapEvtEnqueuePenPoint)