applaunchcmd.pp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. (******************************************************************************
  2. *
  3. * Copyright (c) 1996-2000 Palm, Inc. or its subsidiaries.
  4. * All rights reserved.
  5. *
  6. * File: AppLaunchCmd.h
  7. *
  8. * Release: Palm OS SDK 4.0 (63220)
  9. *
  10. * Description:
  11. * Pilot launch commands for applications. Some launch commands
  12. * are treated differently by different apps. The different
  13. * parameter blocks used by the apps are kept here.
  14. *
  15. * History:
  16. * 7/23/96 rsf - Created by Roger Flores
  17. * 7/28/98 dia - Added generic LaunchWithCommand. Made
  18. * AppLaunchWithCommand() use it.
  19. *
  20. *****************************************************************************)
  21. {$IFNDEF FPC_DOTTEDUNITS}
  22. unit applaunchcmd;
  23. {$ENDIF FPC_DOTTEDUNITS}
  24. interface
  25. {$IFDEF FPC_DOTTEDUNITS}
  26. uses PalmApi.Palmos, PalmApi.Systemmgr;
  27. {$ELSE FPC_DOTTEDUNITS}
  28. uses palmos, systemmgr;
  29. {$ENDIF FPC_DOTTEDUNITS}
  30. (*
  31. #define LaunchWithCommand(type, creator, command, commandParams) \
  32. { \
  33. UInt16 cardNo; \
  34. LocalID dbID; \
  35. DmSearchStateType searchState; \
  36. Err err; \
  37. DmGetNextDatabaseByTypeCreator(true, &searchState, type, \
  38. creator, true, &cardNo, &dbID); \
  39. ErrNonFatalDisplayIf(!dbID, "Could not find app"); \
  40. if (dbID) { \
  41. err = SysUIAppSwitch(cardNo, dbID, command, commandParams); \
  42. ErrNonFatalDisplayIf(err, "Could not launch app"); \
  43. } \
  44. }
  45. #define AppLaunchWithCommand(appCreator, appCommand, appCommandParams) \
  46. LaunchWithCommand (sysFileTApplication, appCreator, appCommand, appCommandParams)
  47. #define AppCallWithCommand(appCreator, appCommand, appCommandParams) \
  48. { \
  49. UInt16 cardNo; \
  50. LocalID dbID; \
  51. DmSearchStateType searchState; \
  52. UInt32 result; \
  53. Err err; \
  54. DmGetNextDatabaseByTypeCreator(true, &searchState, sysFileTApplication, \
  55. appCreator, true, &cardNo, &dbID); \
  56. ErrNonFatalDisplayIf(!dbID, "Could not find app"); \
  57. if (dbID) { \
  58. err = SysAppLaunch(cardNo, dbID, 0, appCommand, (MemPtr) appCommandParams, &result); \
  59. ErrNonFatalDisplayIf(err, "Could not launch app"); \
  60. } \
  61. }
  62. *)
  63. (************************************************************
  64. * Param Block passsed with the sysAppLaunchCmdLookup Command
  65. *************************************************************)
  66. //-------------------------------------------------------------------
  67. // sysAppLaunchCmdLookup parameter block for the Address Book
  68. //-------------------------------------------------------------------
  69. // This is a list of fields by which data may be looked up.
  70. type
  71. AddressLookupFields = Enum;
  72. const
  73. addrLookupName = 0;
  74. addrLookupFirstName = Succ(addrLookupName);
  75. addrLookupCompany = Succ(addrLookupFirstName);
  76. addrLookupAddress = Succ(addrLookupCompany);
  77. addrLookupCity = Succ(addrLookupAddress);
  78. addrLookupState = Succ(addrLookupCity);
  79. addrLookupZipCode = Succ(addrLookupState);
  80. addrLookupCountry = Succ(addrLookupZipCode);
  81. addrLookupTitle = Succ(addrLookupCountry);
  82. addrLookupCustom1 = Succ(addrLookupTitle);
  83. addrLookupCustom2 = Succ(addrLookupCustom1);
  84. addrLookupCustom3 = Succ(addrLookupCustom2);
  85. addrLookupCustom4 = Succ(addrLookupCustom3);
  86. addrLookupNote = Succ(addrLookupCustom4); // This field is assumed to be < 4K
  87. addrLookupWork = Succ(addrLookupNote);
  88. addrLookupHome = Succ(addrLookupWork);
  89. addrLookupFax = Succ(addrLookupHome);
  90. addrLookupOther = Succ(addrLookupFax);
  91. addrLookupEmail = Succ(addrLookupOther);
  92. addrLookupMain = Succ(addrLookupEmail);
  93. addrLookupPager = Succ(addrLookupMain);
  94. addrLookupMobile = Succ(addrLookupPager);
  95. addrLookupSortField = Succ(addrLookupMobile);
  96. addrLookupListPhone = Succ(addrLookupSortField);
  97. addrLookupFieldCount = Succ(addrLookupListPhone); // add new fields above this one
  98. addrLookupNoField = $ff;
  99. const
  100. addrLookupStringLength = 12;
  101. type
  102. AddrLookupParamsType = record
  103. title: PAnsiChar;
  104. // Title to appear in the title bar. If NULL the default is used.
  105. pasteButtonText: PAnsiChar;
  106. // Text to appear in paste button. If NULL "paste" is used.
  107. lookupString: array [0..addrLookupStringLength-1] of AnsiChar;
  108. // Buffer containing string to lookup. If the string matches
  109. // only one record then that record is used without
  110. // presenting the user with the lookup dialog.
  111. field1: AddressLookupFields;
  112. // Field to search by. This field appears on the left side
  113. // of the lookup dialog. If the field is the sort field then
  114. // searches use a binary search. If the field isn't the sort
  115. // field then the data does appear in sorted order and searching
  116. // is performed by a linear search (can get slow).
  117. field2: AddressLookupFields;
  118. // Field to display on the right. Often displays some
  119. // information about the person. If it is a phone field
  120. // and a record has multiple instances of the phone type
  121. // then the person appears once per instance of the phone
  122. // type. Either field1 or field2 may be a phone field but
  123. // not both.
  124. field2Optional: Boolean;
  125. // True means that the record need not have field2 for
  126. // the record to be listed. False means that field2 is
  127. // required in the record for it to be listed.
  128. userShouldInteract: Boolean;
  129. // True means that the user should resolve non unique
  130. // lookups. False means a non unique and complete lookup
  131. // returns resultStringH set to 0 and recordID set to 0;
  132. formatStringP: PAnsiChar;
  133. // When the user selects the paste button a string is generated
  134. // to return data from the record. The format of the result string
  135. // is controlled by this string. All characters which appear
  136. // in this string are copied straight to the result string unless
  137. // they are a field (a '^' follow by the field name). For
  138. // example, the format string "^first - ^home" might result in
  139. // "Roger - 123-4567".
  140. // The field arguments are name, first, company, address, city
  141. // state, zipcode, country, title, custom1, custom2, custom3,
  142. // custom4, work, home, fax, other, email, main, pager, mobile,
  143. // and listname.
  144. resultStringH: MemHandle;
  145. // If there is a format string a result string is allocated on
  146. // the dynamic heap and its handle is returned here.
  147. uniqueID: UInt32;
  148. // The unique ID of the found record or 0 if none was found.
  149. end;
  150. type
  151. AddrLookupParamsPtr = ^AddrLookupParamsType;
  152. (************************************************************
  153. * Param Block passsed with the sysAppLaunchCmdSetActivePanel Command
  154. *************************************************************)
  155. const
  156. prefAppLaunchCmdSetActivePanel = sysAppLaunchCmdCustomBase + 1;
  157. // Record this panel so switching to the Prefs app
  158. // causes this panel to execute.
  159. type
  160. PrefActivePanelParamsType = record
  161. activePanel: UInt32;
  162. // The creator ID of a panel. Usually sent by a panel so the prefs
  163. // apps will switch to it. This allows the last used panel to appear
  164. // when switching to the Prefs app.
  165. end;
  166. PrefActivePanelParamsPtr = ^PrefActivePanelParamsType;
  167. (************************************************************
  168. * Param Block passsed with the sysAppLaunchCmdAddRecord Command
  169. *************************************************************)
  170. //-------------------------------------------------------------------
  171. // sysAppLaunchCmdAddRecord parameter block for the Mail application
  172. //-------------------------------------------------------------------
  173. // Param Block passsed with the sysAppLaunchCmdAddRecord Command
  174. type
  175. MailMsgPriorityType = Enum;
  176. const
  177. mailPriorityHigh = 0;
  178. mailPriorityNormal = Succ(mailPriorityHigh);
  179. mailPriorityLow = Succ(mailPriorityNormal);
  180. type
  181. MailAddRecordParamsType = record
  182. secret: Boolean;
  183. // True means that the message should be marked secret
  184. signature: Boolean;
  185. // True means that signature from the Mail application's preferences
  186. // should be attached to the message.
  187. confirmRead: Boolean;
  188. // True means that a comfirmation should be sent when the message
  189. // is read.
  190. confirmDelivery: Boolean;
  191. // True means that a comfirmation should be sent when the message
  192. // is deliveried
  193. priority: MailMsgPriorityType;
  194. // high, normial, or low.
  195. padding: UInt8;
  196. subject: PAnsiChar;
  197. // Message's subject, a null-terminated string (optional).
  198. from: PAnsiChar;
  199. // Message's send, a null-terminated string (not currently used).
  200. to_: PAnsiChar;
  201. // Address the the recipient, a null-terminated string (required).
  202. cc: PAnsiChar;
  203. // Copy Addresses, a null-terminated string (required).
  204. bcc: PAnsiChar;
  205. // Blind copy Addresses, a null-terminated string (required).
  206. replyTo: PAnsiChar;
  207. // Reply to address, a null-terminated string (required).
  208. body: PAnsiChar;
  209. // The text of the message, a null-terminated string (required).
  210. end;
  211. MailAddRecordParamsPtr = ^MailAddRecordParamsType;
  212. //-------------------------------------------------------------------
  213. // sysAppLaunchCmdAddRecord parameter block for the Messaging application
  214. //-------------------------------------------------------------------
  215. // Param Block passsed with the sysAppLaunchCmdAddRecord Command
  216. //category defines
  217. const
  218. MsgInboxCategory = 0;
  219. MsgOutboxCategory = 1;
  220. MsgDeletedCategory = 2;
  221. MsgFiledCategory = 3;
  222. MsgDraftCategory = 4;
  223. type
  224. MsgAddRecordParamsType = record
  225. category: UInt16;
  226. //is this an outgoing mesage? Or should it be put into a different category
  227. edit: Boolean;
  228. // True means that the message should be opened in the editor,instead of
  229. // just dropped into the category (only applies to outBox category)
  230. signature: Boolean;
  231. // True means that signature from the Mail application's preferences
  232. // should be attached to the message.
  233. subject: PAnsiChar;
  234. // Message's subject, a null-terminated string (optional).
  235. from: PAnsiChar;
  236. // Message's send, a null-terminated string (not currently used).
  237. to_: PAnsiChar;
  238. // Address the the recipient, a null-terminated string (required).
  239. replyTo: PAnsiChar;
  240. // Reply to address, a null-terminated string (required).
  241. body: PAnsiChar;
  242. // The text of the message, a null-terminated string (required).
  243. end;
  244. MsgAddRecordParamsPtr = ^MsgAddRecordParamsType;
  245. implementation
  246. end.