sysevtmgr.pp 8.6 KB

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