sysevent.pp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. (******************************************************************************
  2. *
  3. * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
  4. * All rights reserved.
  5. *
  6. * File: SysEvent.h
  7. *
  8. * Release: Palm OS SDK 4.0 (63220)
  9. *
  10. * Description:
  11. * This file defines event structures and routines.
  12. *
  13. * History:
  14. * September 26, 1994 Created by Art Lamb
  15. * 05/05/98 art Add Text Services event.
  16. * 07/23/98 kwk Changed UInt16 field in keyDown event to WChar.
  17. * 08/20/98 kwk Split tsmEvent into tsmConfirmEvent & tsmFepButtonEvent.
  18. * 09/07/98 kwk Added EvtPeekEvent routine declaration.
  19. * 10/13/98 kwk Removed EvtPeekEvent until API can be finalized.
  20. * 03/11/99 grant Fixed types of pointers in SysEventType data fields.
  21. * 05/31/99 kwk Added tsmFepModeEvent event.
  22. * 07/14/99 jesse Moved UI structures & constants to Event.h
  23. * defined ranges for future UI & system events.
  24. * 07/30/99 kwk Moved TSM events here from Event.h
  25. * 09/12/99 gap Add new multi-tap implementation
  26. * 09/14/99 gap Removed EvtGetTrapState.
  27. *
  28. *****************************************************************************)
  29. unit sysevent;
  30. interface
  31. uses palmos, coretraps, rect, window;
  32. type
  33. SysEventsEnum = WordEnum;
  34. const
  35. sysEventNilEvent = 0;
  36. sysEventPenDownEvent = Succ(sysEventNilEvent);
  37. sysEventPenUpEvent = Succ(sysEventPenDownEvent);
  38. sysEventPenMoveEvent = Succ(sysEventPenUpEvent);
  39. sysEventKeyDownEvent = Succ(sysEventPenMoveEvent);
  40. sysEventWinEnterEvent = Succ(sysEventKeyDownEvent);
  41. sysEventWinExitEvent = Succ(sysEventWinEnterEvent);
  42. sysEventAppStopEvent = 22;
  43. sysEventTsmConfirmEvent = 35;
  44. sysEventTsmFepButtonEvent = Succ(sysEventTsmConfirmEvent);
  45. sysEventTsmFepModeEvent = Succ(sysEventTsmFepButtonEvent);
  46. sysEventFrmTitleChangedEvent = Succ(sysEventTsmFepModeEvent);
  47. // add future UI level events in this numeric space
  48. // to save room for new system level events
  49. sysEventNextUIEvent = $0800;
  50. // <chg 2-25-98 RM> Equates added for library events
  51. sysEventFirstINetLibEvent = $1000;
  52. sysEventFirstWebLibEvent = $1100;
  53. // <chg 10/9/98 SCL> Changed firstUserEvent from 32767 (0x7FFF) to 0x6000
  54. // Enums are signed ints, so 32767 technically only allowed for ONE event.
  55. sysEventFirstUserEvent = $6000;
  56. sysEventLastUserEvent = $7FFF;
  57. // keyDownEvent modifers
  58. const
  59. shiftKeyMask = $0001;
  60. capsLockMask = $0002;
  61. numLockMask = $0004;
  62. commandKeyMask = $0008;
  63. optionKeyMask = $0010;
  64. controlKeyMask = $0020;
  65. autoRepeatKeyMask = $0040; // True if generated due to auto-repeat
  66. doubleTapKeyMask = $0080; // True if this is a double-tap event
  67. poweredOnKeyMask = $0100; // True if this is a double-tap event
  68. appEvtHookKeyMask = $0200; // True if this is an app hook key
  69. libEvtHookKeyMask = $0400; // True if this is a library hook key
  70. // define mask for all "virtual" keys
  71. virtualKeyMask = appEvtHookKeyMask or libEvtHookKeyMask or commandKeyMask;
  72. // Event timeouts
  73. evtWaitForever = -1;
  74. evtNoWait = 0;
  75. type
  76. _GenericEventType = record
  77. datum: array [0..7] of UInt16;
  78. end;
  79. _PenUpEventType = record
  80. start: PointType; // display coord. of stroke start
  81. end_: PointType; // display coord. of stroke start
  82. end;
  83. _KeyDownEventType = record
  84. chr: WChar; // ascii code
  85. keyCode: UInt16; // virtual key code
  86. modifiers: UInt16;
  87. end;
  88. _WinEnterEventType = record
  89. enterWindow: WinHandle;
  90. exitWindow: WinHandle;
  91. end;
  92. _WinExitEventType = record
  93. enterWindow: WinHandle;
  94. exitWindow: WinHandle;
  95. end;
  96. _TSMConfirmType = record
  97. yomiText: PChar;
  98. formID: UInt16;
  99. end;
  100. _TSMFepButtonType = record
  101. buttonID: UInt16;
  102. end;
  103. _TSMFepModeEventType = record
  104. mode: UInt16; // DOLATER kwk - use real type for mode?
  105. end;
  106. // The event record.
  107. SysEventType = record
  108. eType: SysEventsEnum;
  109. penDown: Boolean;
  110. tapCount: UInt8;
  111. screenX: Coord;
  112. screenY: Coord;
  113. case Integer of
  114. 1: (generic: _GenericEventType);
  115. 2: (penUp: _PenUpEventType);
  116. 3: (keyDown: _KeyDownEventType);
  117. 4: (winEnter: _WinEnterEventType);
  118. 5: (winExit: _WinExitEventType);
  119. 6: (tsmConfirm: _TSMConfirmType);
  120. 7: (tsmFepButton: _TSMFepButtonType);
  121. 8: (tsmFepMode: _TSMFepModeEventType);
  122. end;
  123. // Events are stored in the event queue with some extra fields:
  124. SysEventStoreType = record
  125. event: SysEventType;
  126. id: UInt32; // used to support EvtAddUniqueEvent
  127. end;
  128. procedure PenGetPoint(var pScreenX, pScreenY: Int16; var pPenDown: Boolean); syscall sysTrapEvtGetPen;
  129. implementation
  130. end.