attentionmgr.pp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. {$MACRO ON}
  2. {$define Rsc := }
  3. (******************************************************************************
  4. *
  5. * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
  6. * All rights reserved.
  7. *
  8. * File: AttentionMgr.h
  9. *
  10. * Release: Palm OS SDK 4.0 (63220)
  11. *
  12. * Description:
  13. * Include file for Attention Manager
  14. *
  15. * History:
  16. * Name Date Description
  17. * ---- ---- -----------
  18. * peter 06/12/00 Initial Revision
  19. * gap 07/21/00 Change parameter list and data structures to support
  20. * specification of card number as well as dbID.
  21. *
  22. *****************************************************************************)
  23. unit attentionmgr;
  24. interface
  25. uses palmos, coretraps, rect, errorbase;
  26. (************************************************************
  27. * Attention Manager result codes
  28. * (attnErrorClass is defined in ErrorBase)
  29. *************************************************************)
  30. const
  31. attnErrMemory = attnErrorClass or 1; // ran out of memory
  32. (************************************************************
  33. * Attention Indicator bounds
  34. *************************************************************)
  35. const
  36. kAttnIndicatorLeft = 0;
  37. kAttnIndicatorTop = 0;
  38. kAttnIndicatorWidth = 16;
  39. kAttnIndicatorHeight = 15;
  40. (************************************************************
  41. * Constants used for list view drawing.
  42. *
  43. * Applications should use the following constants to format
  44. * the display of information in attention manager list view.
  45. *
  46. * The application's small icon should be drawn centered within
  47. * the first kAttnListMaxIconWidth pixels of the drawing bounds.
  48. *
  49. * Two lines of text information describing the attention should
  50. * then be drawn left justified starting at kAttnListTextOffset
  51. * from the left edge of the drawing bounds.
  52. *************************************************************)
  53. const
  54. kAttnListMaxIconWidth = 15;
  55. kAttnListTextOffset = 17;
  56. (********************************************************************
  57. * Attention Manager Structures
  58. ********************************************************************)
  59. type
  60. AttnFlagsType = UInt32;
  61. const
  62. kAttnFlagsSoundBit = AttnFlagsType($1);
  63. kAttnFlagsLEDBit = AttnFlagsType($2);
  64. kAttnFlagsVibrateBit = AttnFlagsType($4);
  65. kAttnFlagsCustomEffectBit = AttnFlagsType($8);
  66. // Note: More bits can be defined if/when hardware capability increases
  67. kAttnFlagsAllBits = AttnFlagsType($FFFF);
  68. // The following are passed to AttnGetAttention() and AttnUpdate to specify
  69. // overrides from the user settings for an attention request.
  70. kAttnFlagsUseUserSettings = AttnFlagsType($0);
  71. kAttnFlagsAlwaysSound = kAttnFlagsSoundBit;
  72. kAttnFlagsAlwaysLED = kAttnFlagsLEDBit;
  73. kAttnFlagsAlwaysVibrate = kAttnFlagsVibrateBit;
  74. kAttnFlagsAlwaysCustomEffect = kAttnFlagsCustomEffectBit;
  75. kAttnFlagsEverything = kAttnFlagsAllBits;
  76. kAttnFlagsNoSound = kAttnFlagsSoundBit shl 16;
  77. kAttnFlagsNoLED = kAttnFlagsLEDBit shl 16;
  78. kAttnFlagsNoVibrate = kAttnFlagsVibrateBit shl 16;
  79. kAttnFlagsNoCustomEffect = kAttnFlagsCustomEffectBit shl 16;
  80. kAttnFlagsNothing = kAttnFlagsAllBits shl 16;
  81. // The following are used to interpret the feature.
  82. kAttnFtrCreator = Rsc('attn');
  83. kAttnFtrCapabilities = 0; // Read to determine device capabilities and user settings.
  84. kAttnFlagsUserWantsSound = kAttnFlagsSoundBit;
  85. kAttnFlagsUserWantsLED = kAttnFlagsLEDBit;
  86. kAttnFlagsUserWantsVibrate = kAttnFlagsVibrateBit;
  87. kAttnFlagsUserWantsCustomEffect = kAttnFlagsCustomEffectBit; // Always false
  88. kAttnFlagsUserSettingsMask = kAttnFlagsAllBits;
  89. kAttnFlagsHasSound = kAttnFlagsSoundBit shl 16;
  90. kAttnFlagsHasLED = kAttnFlagsLEDBit shl 16;
  91. kAttnFlagsHasVibrate = kAttnFlagsVibrateBit shl 16;
  92. kAttnFlagsHasCustomEffect = kAttnFlagsCustomEffectBit shl 16; // Always true
  93. kAttnFlagsCapabilitiesMask = kAttnFlagsAllBits shl 16;
  94. type
  95. AttnLevelType = UInt16;
  96. const
  97. kAttnLevelInsistent = AttnLevelType(0);
  98. kAttnLevelSubtle = AttnLevelType(1);
  99. type
  100. AttnCommandType = UInt16;
  101. const
  102. kAttnCommandDrawDetail = AttnCommandType(1);
  103. kAttnCommandDrawList = AttnCommandType(2);
  104. kAttnCommandPlaySound = AttnCommandType(3);
  105. kAttnCommandCustomEffect = AttnCommandType(4);
  106. kAttnCommandGoThere = AttnCommandType(5);
  107. kAttnCommandGotIt = AttnCommandType(6);
  108. kAttnCommandSnooze = AttnCommandType(7);
  109. kAttnCommandIterate = AttnCommandType(8);
  110. type
  111. AttnCommandArgsDrawDetailTag = record
  112. bounds: RectangleType;
  113. firstTime: Boolean;
  114. flags: AttnFlagsType;
  115. end;
  116. AttnCommandArgsDrawListTag = record
  117. bounds: RectangleType;
  118. firstTime: Boolean;
  119. flags: AttnFlagsType;
  120. selected: Boolean;
  121. end;
  122. AttnCommandArgsGotItTag = record
  123. dismissedByUser: Boolean;
  124. end;
  125. AttnCommandArgsIterateTag = record
  126. iterationData: UInt32;
  127. end;
  128. AttnCommandArgsTag = record
  129. case Integer of
  130. 1: (drawDetail: AttnCommandArgsDrawDetailTag);
  131. 2: (drawList: AttnCommandArgsDrawListTag);
  132. 3: (gotIt: AttnCommandArgsGotItTag);
  133. 4: (iterate: AttnCommandArgsIterateTag);
  134. end;
  135. AttnCommandArgsType = AttnCommandArgsTag;
  136. type
  137. AttnLaunchCodeArgsType = record
  138. command: AttnCommandType;
  139. userData: UInt32;
  140. commandArgsP: ^AttnCommandArgsType;
  141. end;
  142. type
  143. AttnCallbackProc = function(command: AttnCommandType; userData: UInt32; var commandArgsP: AttnCommandArgsType): Err;
  144. // These details go with the sysNotifyGotUsersAttention notification.
  145. type
  146. AttnNotifyDetailsType = record
  147. flags: AttnFlagsType;
  148. end;
  149. (********************************************************************
  150. * Public Attention Manager Routines
  151. ********************************************************************)
  152. function AttnGetAttention(cardNo: UInt16; dbID: LocalID; userData: UInt32;
  153. callbackFnP: AttnCallbackProc; level: AttnLevelType; flags: AttnFlagsType;
  154. nagRateInSeconds, nagRepeatLimit: UInt16): Err; syscall sysTrapAttnGetAttention;
  155. function AttnUpdate(cardNo: UInt16; dbID: LocalID; userData: UInt32;
  156. callbackFnP: AttnCallbackProc; var flagsP: AttnFlagsType;
  157. var nagRateInSecondsP, nagRepeatLimitP: UInt16): Boolean; syscall sysTrapAttnUpdate;
  158. function AttnForgetIt(cardNo: UInt16; dbID: LocalID; userData: UInt32): Boolean; syscall sysTrapAttnForgetIt;
  159. function AttnGetCounts(cardNo: UInt16; dbID: LocalID; var insistentCountP, subtleCountP: UInt16): UInt16; syscall sysTrapAttnGetCounts;
  160. procedure AttnListOpen; syscall sysTrapAttnListOpen;
  161. procedure AttnIterate(cardNo: UInt16; dbID: LocalID; iterationData: UInt32); syscall sysTrapAttnIterate;
  162. function AttnDoSpecialEffects(flags: AttnFlagsType): Err; syscall sysTrapAttnDoSpecialEffects;
  163. procedure AttnIndicatorEnable(enableIt: Boolean); syscall sysTrapAttnIndicatorEnable;
  164. function AttnIndicatorEnabled: Boolean; syscall sysTrapAttnIndicatorEnabled;
  165. implementation
  166. end.