summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/palmunits/src/sysevent.pp
blob: be62b8559a1a0055c656f094d780ef9d695e9380 (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
(******************************************************************************
 *
 * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
 * All rights reserved.
 *
 * File: SysEvent.h
 *
 * Release: Palm OS SDK 4.0 (63220)
 *
 * 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.
 *
 *****************************************************************************)
unit sysevent;

interface

uses palmos, coretraps, rect, window;

type
  SysEventsEnum = WordEnum;

const
  sysEventNilEvent = 0;
  sysEventPenDownEvent = Succ(sysEventNilEvent);
  sysEventPenUpEvent = Succ(sysEventPenDownEvent);
  sysEventPenMoveEvent = Succ(sysEventPenUpEvent);
  sysEventKeyDownEvent = Succ(sysEventPenMoveEvent);
  sysEventWinEnterEvent = Succ(sysEventKeyDownEvent);
  sysEventWinExitEvent = Succ(sysEventWinEnterEvent);
  sysEventAppStopEvent = 22;
  sysEventTsmConfirmEvent = 35;
  sysEventTsmFepButtonEvent = Succ(sysEventTsmConfirmEvent);
  sysEventTsmFepModeEvent = Succ(sysEventTsmFepButtonEvent);
  sysEventFrmTitleChangedEvent = Succ(sysEventTsmFepModeEvent);

  // add future UI level events in this numeric space
  // to save room for new system level events
  sysEventNextUIEvent = $0800;

  // <chg 2-25-98 RM> Equates added for library events
  sysEventFirstINetLibEvent = $1000;
  sysEventFirstWebLibEvent = $1100;

  // <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 = $6000;
  sysEventLastUserEvent  = $7FFF;

// keyDownEvent modifers
const
  shiftKeyMask      = $0001;
  capsLockMask      = $0002;
  numLockMask       = $0004;
  commandKeyMask    = $0008;
  optionKeyMask     = $0010;
  controlKeyMask    = $0020;
  autoRepeatKeyMask = $0040; // True if generated due to auto-repeat
  doubleTapKeyMask  = $0080; // True if this is a double-tap event
  poweredOnKeyMask  = $0100; // True if this is a double-tap event
  appEvtHookKeyMask = $0200; // True if this is an app hook key
  libEvtHookKeyMask = $0400; // True if this is a library hook key

// define mask for all "virtual" keys
  virtualKeyMask    = appEvtHookKeyMask or libEvtHookKeyMask or commandKeyMask;

// Event timeouts
  evtWaitForever    = -1;
  evtNoWait         = 0;

type
  _GenericEventType = record
    datum: array [0..7] of UInt16;
  end;

  _PenUpEventType = record
    start: PointType;            // display coord. of stroke start
    end_: PointType;             // display coord. of stroke start
  end;

  _KeyDownEventType = record
    chr: WChar;               // ascii code
    keyCode: UInt16;          // virtual key code
    modifiers: UInt16;
  end;

  _WinEnterEventType = record
    enterWindow: WinHandle;
    exitWindow: WinHandle;
  end;

  _WinExitEventType = record
    enterWindow: WinHandle;
    exitWindow: WinHandle;
  end;

  _TSMConfirmType = record
    yomiText: PChar;
    formID: UInt16;
  end;

  _TSMFepButtonType = record
    buttonID: UInt16;
  end;

  _TSMFepModeEventType = record
    mode: UInt16;     // DOLATER kwk - use real type for mode?
  end;

// The event record.
  SysEventType = record
    eType: SysEventsEnum;
    penDown: Boolean;
    tapCount: UInt8;
    screenX: Coord;
    screenY: Coord;
    case Integer of
      1: (generic: _GenericEventType);
      2: (penUp: _PenUpEventType);
      3: (keyDown: _KeyDownEventType);
      4: (winEnter: _WinEnterEventType);
      5: (winExit: _WinExitEventType);
      6: (tsmConfirm: _TSMConfirmType);
      7: (tsmFepButton: _TSMFepButtonType);
      8: (tsmFepMode: _TSMFepModeEventType);
  end;

// Events are stored in the event queue with some extra fields:
  SysEventStoreType = record
    event: SysEventType;
    id: UInt32; // used to support EvtAddUniqueEvent
  end;

procedure PenGetPoint(var pScreenX, pScreenY: Int16; var pPenDown: Boolean); syscall sysTrapEvtGetPen;

implementation

end.