PalmAPI2.pas

Un article de Wikipedia.

  1. {
  2.   PalmAPI2 = PalmAPI + PalmAPI1 + more API...:)
  3.  
  4.   PalmAPI (Version 5 - May 11, 2004 - from PP v2.10 distribution) and-
  5.   PalmAPI1 (Version 1.04 - January 6, 2005 - from PIAF v1.17) were made by:
  6.   Laurent Duveau & Philippe Guillot (http://ppcompiler.org/?lng=en)
  7.  
  8.   PalmAPI2 v0.9 - 25-Jul-2006 (see changes.txt) by Yuval Melamed.
  9.  
  10.   Everyone is welcome to update this, but PLEASE follow these guidelines:
  11.   1. Update also version number/date & "changes.txt" file (by APPEND),
  12.   2. Maintain proper credits/copyrights & downgrade-compatibility,
  13.   3. Publish your PalmAPI2.pas seperately as "news" in English PP site!
  14.  
  15.   Tip: I have used regular-expressions to convert C into pascal...;)
  16. }
  17.  
  18. const
  19. SYSTRAP = $4E4F;
  20. {Mode flags passed to DmOpenDatabase}
  21. dmModeReadOnly = $0001; // read access
  22. dmModeWrite = $0002; // write access
  23. dmModeReadWrite = $0003; // read & write access
  24. dmModeLeaveOpen = $0004; // leave open when app quits
  25. dmModeExclusive = $0008; // don't let anyone else open it
  26. dmModeShowSecret = $0010; // force show of secret records
  27.  
  28. // keyDownEvent modifers
  29. shiftKeyMask = $0001;
  30. capsLockMask = $0002;
  31. numLockMask = $0004;
  32. commandKeyMask = $0008;
  33. optionKeyMask = $0010;
  34. controlKeyMask = $0020;
  35. autoRepeatKeyMask = $0040; // True if generated due to auto-repeat
  36. doubleTapKeyMask = $0080; // True if this is a double-tap event
  37. poweredOnKeyMask = $0100; // True if this is a double-tap event
  38. appEvtHookKeyMask = $0200; // True if this is an app hook key
  39. libEvtHookKeyMask = $0400; // True if this is a library hook key
  40.  
  41. // define mask for all "virtual" keys
  42. virtualKeyMask = (appEvtHookKeyMask or libEvtHookKeyMask or commandKeyMask);
  43.  
  44. evtWaitForever = -1;
  45. evtNoWait = 0;
  46.  
  47. noPreferenceFound = -1;
  48.  
  49. // System SysAppLaunch Commands
  50. sysAppLaunchCmdNormalLaunch = 0; // Normal Launch
  51. sysAppLaunchCmdSyncNotify = 3; // Sent to apps whose databases changed during
  52. // HotSync after the sync has been completed,
  53. // including when the app itself has been installed
  54. // by HotSync. The data database(s) must have the
  55. // same creator ID as the application for this
  56. // mechanism to function correctly. This is a
  57. // good opportunity to update/initialize/validate
  58. // the app's data, such as resorting records,
  59. // setting alarms, etc.
  60. //
  61. // Parameter block: None.
  62. // Restrictions: No accessing of global or
  63. // static variables; no User Interface calls.
  64. // Notes: This action code is sent via a
  65. // direct function call into the app's
  66. // PilotMain function from the background
  67. // thread of the HotSync application.
  68. sysAppLaunchCmdTimeChange = 4; // Sent to all applications and preference
  69. // panels when the system time is changed.
  70. // This notification is the right place to
  71. // update alarms and other time-related
  72. // activities and resources.
  73. //
  74. // Parameter block: None.
  75. // Restrictions: No accessing of global or
  76. // static variables; no User Interface calls.
  77. // Notes: This action code is sent via a direct
  78. // function call into the app's PilotMain
  79. // function without "launching" the app.
  80. sysAppLaunchCmdSystemReset = 5; // Sent to all applications and preference
  81. // panels when the system is either soft-reset
  82. // or hard-reset. This notification is the
  83. // right place to initialize and/or validate
  84. // your application's preferences/features/
  85. // database(s) as well as to update alarms and
  86. // other time-related activities and resources.
  87. //
  88. // Parameter block: SysAppLaunchCmdSystemResetType
  89. // Restrictions: No accessing of global or
  90. // static variables; no User Interface calls.
  91. // Notes: This action code is sent via a direct
  92. // function call into the app's PilotMain
  93. // function without "launching" the app.
  94. sysAppLaunchCmdAlarmTriggered = 6; // Sent to an application at the time its
  95. // alarm time expires (even when another app
  96. // is already displaying its alarm dialog box).
  97. // This call is intended to allow the app to
  98. // perform some very quick activity, such as
  99. // scheduling the next alarm or performing a
  100. // quick maintenance task. The handler for
  101. // sysAppLaunchCmdAlarmTriggered must take as
  102. // little time as possible and is *not* allowed
  103. // to block (this would delay notification for
  104. // alarms set by other applications).
  105. //
  106. // Parameter block: SysAlarmTriggeredParamType
  107. // (defined in AlarmMgr.h)
  108. // Restrictions: No accessing of global or
  109. // static variables unless sysAppLaunchFlagSubCall
  110. // flag is set, as discussed above.
  111. // Notes: This action code is sent via a direct
  112. // function call into the app's PilotMain
  113. // function without "launching" the app.
  114. sysAppLaunchCmdDisplayAlarm = 7; // Sent to an application when it is time
  115. // to display the alarm UI. The application
  116. // is responsible for making any alarm sounds
  117. // and for displaying the alarm UI.
  118. // sysAppLaunchCmdDisplayAlarm calls are ordered
  119. // chronoligically and are not overlapped.
  120. // This means that your app will receive
  121. // sysAppLaunchCmdDisplayAlarm only after
  122. // all earlier alarms have been displayed.
  123. //
  124. // Parameter block: SysDisplayAlarmParamType
  125. // (defined in AlarmMgr.h)
  126. // Restrictions: No accessing of global or
  127. // static variables unless sysAppLaunchFlagSubCall
  128. // flag is set, as discussed above. UI calls are
  129. // allowed to display the app's alarm dialog.
  130. // Notes: This action code is sent via a direct
  131. // function call into the app's PilotMain
  132. // function without "launching" the app.
  133. sysAppLaunchCmdPanelCalledFromApp = 13; // The panel should display a done
  134. // button instead of the pick list.
  135. // The Done button will return the user
  136. // to the last app.
  137. sysAppLaunchCmdReturnFromPanel = 14; // A panel returned to this app
  138. sysAppLaunchCmdSystemLock = 16; // Lock the system until a password is entered.
  139. sysAppLaunchCmdNotify = 51; // This is a NotifyMgr notification sent
  140. // via SysNotifyBroadcast. The cmdPBP parameter
  141. // points to a SysNotifyParamType structure
  142. // containing more specific information
  143. // about the notification (e.g., what it's for).
  144. sysAppLaunchCmdOpenDB = 52; // Sent to switch to an application and have it
  145. // "open" up the given data file. The cmdPBP
  146. // pointer is a pointer to a SysAppLaunchCmdOpenDBType
  147. // structure that has the cardNo and localID of the database
  148. // to open. This action code is used by the Launcher
  149. // to launch data files, like Eleven PQA files that
  150. // have the dmHdrAttrLaunchableData bit set in their
  151. // database attributes.
  152. sysAppLaunchCmdCardLaunch = 58; // Sent to an application by the Launcher when the
  153. // application is being run from a card.
  154.  
  155. // Standard Frame Types
  156. noFrame = 0;
  157. simpleFrame = 1;
  158. rectangleFrame = 1;
  159. simple3DFrame = $0012; // 3d, frame = 2
  160. roundFrame = $0401; // corner = 7, frame = 1
  161. boldRoundFrame = $0702; // corner = 7, frame = 2
  162. popupFrame = $0205; // corner = 2, frame = 1, shadow = 1
  163. dialogFrame = $0302; // corner = 3, frame = 2
  164. menuFrame = popupFrame;
  165.  
  166. noFocus = $FFFF;
  167.  
  168. stdFont=0;
  169. boldFont=1;
  170. largeFont=2;
  171. symbolFont=3;
  172. symbol11Font=4;
  173. symbol7Font=5;
  174. ledFont=6;
  175. largeBoldFont=7;
  176. fntAppFontCustomBase=128;
  177.  
  178. sysFtrCreator = Ord('p') shl 24 + Ord('s') shl 16 + Ord('y') shl 8 + Ord('s');
  179. sysFtrNumROMVersion = 1;
  180. sysFtrNumWinVersion = 24;
  181.  
  182. V100 = $01003001;
  183. V200 = $02003000;
  184. V300 = $03003000;
  185. V310 = $03103000;
  186. V320 = $03203000;
  187. V330 = $03303000;
  188. V350 = $03503000;
  189. V351 = $03513000;
  190. V400 = $04003000;
  191. V410 = $04100000;
  192. V500 = $05003000;
  193. V510 = $05103000;
  194. V530 = $05303000;
  195. V600 = $06003000;
  196.  
  197. // Definition of bit field returned from KeyCurrentState
  198. keyBitPower = $0001; // Power key
  199. keyBitPageUp = $0002; // Page-up
  200. keyBitPageDown = $0004; // Page-down
  201. keyBitHard1 = $0008; // App #1
  202. keyBitHard2 = $0010; // App #2
  203. keyBitHard3 = $0020; // App #3
  204. keyBitHard4 = $0040; // App #4
  205. keyBitCradle = $0080; // Button on cradle
  206. keyBitAntenna = $0100; // Antenna "key" <chg 3-31-98 RM>
  207. keyBitContrast = $0200; // Contrast key
  208. keyBitsAll = $FFFFFFFF; // all keys
  209.  
  210. dmDBNameLength = 32; // 31 chars + 1 null terminator
  211. {note: use string[dmDBNameLength-1] as PP doesn't count the null terminator!}
  212.  
  213. errNone = 0;
  214. frmNoSelectedControl = $ff;
  215.  
  216. type
  217. SndSysBeepType = (
  218. sndInfo = 1,
  219. sndWarning,
  220. sndError,
  221. sndStartUp,
  222. sndAlarm,
  223. sndConfirmation,
  224. sndClick
  225. );
  226. SndCmdIDType = (
  227. sndCmdFreqDurationAmp = 1,
  228. sndCmdNoteOn,
  229. sndCmdFrqOn,
  230. sndCmdQuiet
  231. );
  232.  
  233. Byte = 0..255;
  234. Int16 = -32768..32767;
  235. UInt16 = 0..65535;
  236. Int8 = -128..127;
  237. UInt8 = 0..255;
  238. Int32 = Integer;
  239. UInt32 = 0..MaxInt;
  240. WChar = UInt16;
  241. StringPtr = ^String;
  242. FontID = UInt8;
  243. LocalID = UInt32;
  244. Err = UInt16;
  245. Coord = Int16;
  246. Opaque = record end;
  247. MemHandle = ^Opaque;
  248. itemsTextType = array[0..255] of StringPtr;
  249. itemsTextPtr = ^ItemsTextType;
  250. FieldPtr = ^Opaque;
  251. TablePtr = ^Opaque;
  252. MemPtr = Pointer;
  253. DmOpenRef = Pointer;
  254. ScrollBarPtr=^opaque;
  255. FormGadgetPtr=^opaque;
  256. FrameType = UInt16;
  257.  
  258. PointType = record
  259. x,y:Coord;
  260. end;
  261.  
  262. AbsRectType = record
  263. left,top,right,bottom:Coord;
  264. end;
  265.  
  266. RectangleType = record
  267. topLeft,extent:PointType;
  268. end;
  269.  
  270. ListType=record
  271. {$ifdef allowInternalaccess}
  272. id : UInt16;
  273. bounds : rectangleType;
  274. attr : UInt16;
  275. itemsText : itemsTextPtr;
  276. numItems : Int16;
  277. currentItem : Int16;
  278. topItem : Int16;
  279. font : FontID;
  280. reserved : UInt8;
  281. popupwin : MemHandle;
  282. drawItemsCallback : pointer;
  283. {$endif}
  284. end;
  285.  
  286. ListPtr = ^ListType;
  287.  
  288. RGBColorType = record
  289. index,r,g,b:UInt8;
  290. end;
  291. IndexedColorType = UInt8;
  292. // 0..215 combination of
  293. // ff cc 99 66 33 00
  294. // B : 0 6 12 108 114 120
  295. // R : 0 18 36 54 72 90
  296. // G : 0 1 2 3 4 5
  297. // e.g 12+54+5 = $99 B + $66 R +$0 G
  298. // 216..224
  299. // gray 22 44 55 77 88 aa bb dd
  300. // 225..229 = specials: light gray,marron,purple,green,cyan
  301. // 230..255 = unused (black)
  302.  
  303. WinHandle = ^Opaque;
  304. FormPtr = ^Opaque;
  305. MenuBarPtr = ^opaque;
  306.  
  307. ControlStyleType = (
  308. buttonCtl,
  309. pushButtonCtl,
  310. CheckBoxCtl,
  311. popupTriggerCtl,
  312. selectorTriggerCtl,
  313. repeatingButtonCtl,
  314. SliderCtl,
  315. feedbackSliderCtl
  316. );
  317. ControlType=record
  318. {$ifdef allowInternalaccess}
  319. id : UInt16;
  320. bounds : RectangleType;
  321. text : StringPtr;
  322. attr : UInt16;
  323. style : ControlStyleType; // ( enum )
  324. font : FontID;
  325. group : UInt8;
  326. reserved : UInt8;
  327. {$endif}
  328. end;
  329. ControlPtr = ^ControlType;
  330. DmSearchStateType = record
  331. info:array[0..7] of UInt32;
  332. end;
  333. clipboardFormatType = (
  334. clipboardText,
  335. clipboardInk,
  336. clipboardBitmap
  337. );
  338.  
  339. eventsEnum = (
  340. nilEvent = 0, // system level
  341. penDownEvent, // system level
  342. penUpEvent, // system level
  343. penMoveEvent, // system level
  344. keyDownEvent, // system level
  345. winEnterEvent, // system level
  346. winExitEvent, // system level
  347. ctlEnterEvent,
  348. ctlExitEvent,
  349. ctlSelectEvent,
  350. ctlRepeatEvent,
  351. lstEnterEvent,
  352. lstSelectEvent,
  353. lstExitEvent,
  354. popSelectEvent,
  355. fldEnterEvent,
  356. fldHeightChangedEvent,
  357. fldChangedEvent,
  358. tblEnterEvent,
  359. tblSelectEvent,
  360. daySelectEvent,
  361. menuEvent,
  362. appStopEvent = 22, // system level
  363. frmLoadEvent,
  364. frmOpenEvent,
  365. frmGotoEvent,
  366. frmUpdateEvent,
  367. frmSaveEvent,
  368. frmCloseEvent,
  369. frmTitleEnterEvent,
  370. frmTitleSelectEvent,
  371. tblExitEvent,
  372. sclEnterEvent,
  373. sclExitEvent,
  374. sclRepeatEvent,
  375. tsmConfirmEvent = 35, // system level
  376. tsmFepButtonEvent, // system level
  377. tsmFepModeEvent, // system level
  378. attnIndicatorEnterEvent, // for attention manager's indicator
  379. attnIndicatorSelectEvent, // for attention manager's indicator
  380.  
  381. // add future UI level events in this numeric space
  382. // to save room for new system level events
  383. menuCmdBarOpenEvent = $0800,
  384. menuOpenEvent,
  385. menuCloseEvent,
  386. frmGadgetEnterEvent,
  387. frmGadgetMiscEvent,
  388.  
  389. // <chg 2-25-98 RM> Equates added for library events
  390. firstINetLibEvent = $1000,
  391. firstWebLibEvent = $1100,
  392.  
  393. // GFa, 07/20/01 : integrated the bellagio telephony events.
  394. telAsyncReplyEvent = $1200,
  395.  
  396. // Can't add these to the system event range because PACE won't pass them through,
  397. // add them to the licensee range here:
  398. keyUpEvent = $4000,
  399. keyHoldEvent = $4001,
  400. frmObjectFocusTakeEvent = $4002,
  401. frmObjectFocusLostEvent = $4003,
  402.  
  403. winDisplayChangedEvent = $4101,
  404.  
  405. // BGT, 06/24/2003 Clarify the range reserved for licensees
  406. firstLicenseeEvent = $5000,
  407. lastLicenseeEvent = $5FFF,
  408.  
  409. // <chg 10/9/98 SCL> Changed firstUserEvent from 32767 (0x7FFF) to 0x6000
  410. // Enums are signed ints, so 32767 technically only allowed for ONE event.
  411. firstUserEvent = $6000,
  412.  
  413. lastUserEvent = $7FFF
  414. );
  415.  
  416. LmLocaleType = record
  417. language, // Language spoken in locale (LanguageType)
  418. country:UInt16; // Specifies "dialect" of language (CountryType)
  419. end;
  420. DateTimeType = record
  421. second,minute,hour,day,month,year,
  422. weekDay: Int16; // Days since Sunday (0 to 6)
  423. end;
  424. DateTimePtr = ^DateTimeType;
  425. SelectDayType = (
  426. selectDayByDay, // return d/m/y
  427. selectDayByWeek, // return d/m/y with d as same day of the week
  428. selectDayByMonth // return d/m/y with d as same day of the month
  429. );
  430. DaySelectorType = record
  431. bounds: RectangleType;
  432. visible: Boolean;
  433. reserved1: UInt8;
  434. visibleMonth: Int16; // month actually displayed
  435. visibleYear: Int16; // year actually displayed
  436. selected: DateTimeType;
  437. selectDayBy: SelectDayType;
  438. reserved2: UInt8;
  439. end;
  440. DaySelectorPtr = ^DaySelectorType;
  441.  
  442. {_}KeyDownEventType = record
  443. chr:WChar; // ascii code
  444. keyCode, // virtual key code
  445. modifiers:UInt16;
  446. end;
  447.  
  448. EventType = record
  449. eType : eventsEnum;
  450. penDown : Boolean;
  451. tapCount : UInt8;
  452. screenX, screenY : Int16;
  453. case integer of
  454. 0: (generic : record datum : array[0..7] of Int16 end);
  455. 1: (penUp : record start, finish : PointType end);
  456. 2: (keyDown : KeyDownEventType);
  457. 3: (winEnter : record enterWindow,exitWindow:winHandle end);
  458. 4: (winExit : record enterWindow, exitWindow:winHandle end);
  459. 5: (tsmConfirm : record yomiText:StringPtr;formID:UInt16 end);
  460. 6: (tsmFepButton : record buttonID:UInt16 end);
  461. 7: (tsmFepMode: record mode : UInt16 end);
  462. 8: (ctlEnter: record controlID:UInt16; pControl:ControlPtr end);
  463. 9: (ctlSelect: record controlID: UInt16; pControl: ControlPtr; on: Boolean; reserved1:UInt8; value: UInt16 end);
  464. 10: (ctlRepeat: record controlID:UInt16; pControl:ControlPtr; time:UInt32; value: UInt16 end);
  465. 11: (ctlExit: record controlID:UInt16; pControl:ControlPtr end);
  466. 12: (fldEnter: record fieldID:UInt16; pField:FieldPtr end);
  467. 13: (fldHeightChanged: record fieldID:UInt16; pField:FieldPtr; newHeight:Int16; currentPos:UInt16 end);
  468. 14: (fldChanged: record FieldID:UInt16; pField:FieldPtr end);
  469. 15: (fldExit: record FieldID:UInt16;pField:FieldPtr end);
  470. 16: (lstEnter: record listID:UInt16; pList:ListPtr; selection:Int16 end);
  471. 17: (lstExit: record listID:UInt16; pList:ListPtr end);
  472. 18: (lstSelect: record listID:UInt16; pList:ListPtr; selection:Int16 end);
  473. 19: (tblEnter: record tableID:UInt16; pTable:TablePtr; row,column:Int16 end);
  474. 20: (tblExit: record tableID:UInt16; pTable:TablePtr; row,column:Int16 end);
  475. 21: (tblSelect: record tableID:UInt16; pTable:TablePtr; row,column:Int16 end);
  476. 22: (frmLoad: record formID:UInt16 end);
  477. 23: (frmOpen: record formID:UInt16 end);
  478. 24: (frmGoto: record formID, recordNum,matchPos,matchLen,matchFieldNum:UInt16; matchCustom:UInt32 end);
  479. 25: (frmClose: record formID:UInt16 end);
  480. 26: (frmUpdate: record formID:UInt16; updateCode:UInt16 end);
  481. 27: (frmTitleEnter: record formID: UInt16 end);
  482. 28: (frmTitleSelect: record formID:UInt16 end);
  483. 29: (attnIndicatorEnter: record formID:UInt16 end);
  484. 30: (attnIndicatorSelect: record formID:UInt16 end);
  485. 31: (daySelect: record pSelector:DaySelectorPtr; selection:Int16; UseThisDate:Boolean; reserved1:UInt8 end);
  486. 32: (menu: record itemID:UInt16 end);
  487. 33: (popSelect: record controlID:UInt16;controlP:ControlPtr;listID:UInt16;listP:ListPtr; selection, priorselection:Int16 end);
  488. 34: (sclEnter: record scrollBarID:UInt16; pScrollBar:ScrollBarPtr end);
  489. 35: (sclExit: record scrollBarID:UInt16; pScrollBar:ScrollBarPtr; value, newvalue:Int16 end);
  490. 36: (sclRepeat: record scrollBarID:UInt16; pScrollBar:ScrollBarPtr; value, newvalue:Int16; time:Int32 end);
  491. 37: (menuCmdBarOpen: record preventFieldButton:Boolean; reserved:UInt8 end);
  492. 38: (menuOpen: record menuRscID:UInt16; cause:Int16 end);
  493. 39: (gadgetEnter: record gadgetID:UInt16; gadgetP:FormGadgetPtr end);
  494. 40: (gadgetMisc: record gadgetID:UInt16; gadgetP:FormGadgetPtr; selector:UInt16; dataP:pointer end);
  495. 41: (winDisplayChanged: record newBounds:RectangleType end);
  496. end;
  497. EventPtr = ^EventType;
  498. {$ifdef AllowInternalAccess}
  499. bitmapCompressionType = (
  500. BitmapCompressionTypeScanLine,
  501. BitmapCompressionTypeRLE,
  502. BitmapCompressionTypePackBits,
  503. BitmapCompressionTypeEnd,
  504. BitmapCompressionTypeBest=$64,
  505. BitmapCompressionTypeNone=255
  506. );
  507. PixelFormatType = (
  508. PixelFormatIndexed,
  509. PixelFormat565,
  510. PixelFormat565LE,
  511. PixelFormatIndexedLE
  512. );
  513. {$endif}
  514. DensityType = (
  515. kDensityLow = 72,
  516. kDensityOneAndAHalf = 108,
  517. kDensityDouble=144,
  518. kDensityTriple=216,
  519. kDensityQuadruple=288
  520. );
  521. // bitmap flags:
  522. // 15 : compressed
  523. // 14 : has color table
  524. // 13 : has transparency
  525. // 12 : indirect
  526. // 11 : for screen
  527. // 10 : direct color
  528. // 9 :indirect color table
  529. // 8 : no dither
  530. // other unused (0)
  531. BitmapType = record
  532. {$ifdef AllowInternalAccess}
  533. width : Int16; // in pixel
  534. height : Int16; // in pixel
  535. rowBytes : UInt16; // number of byte stored for each row
  536. flags : UInt16;
  537. pixelSize : UInt8; // pixel deptnh : 1,2,4,8-bit
  538. case version:UInt8 of
  539. 0,1:(
  540. // uses nextDepthOffset
  541. reserved3 : array[0..2] of UInt16;
  542. );
  543. 2:(
  544. nextDepthOffset : UInt16; // number of 4-bytes words to the next bitmap from the beginning of this one
  545. transparentIndex : UInt8;
  546. // compression type
  547. reserved1 : UInt16;
  548. );
  549. 3:(
  550. size : UInt8; // size of this structure in byte (24)
  551. pixelFormat : PixelFormatType;
  552. unused : UInt8;
  553. compressionType : BitmapCompressionType;
  554. density : DensityType;
  555. transparentValue : UInt32;
  556. nextBitmapOffset : UInt32; // number of byte to tne next bitmap
  557. );
  558. {$endif}
  559. end;
  560. BitmapPtr = ^BitmapType;
  561. UnderlineModeType = (
  562. noUnderline,
  563. grayUnderline,
  564. solidUnderline,
  565. colorUnderline
  566. );
  567. WinScreenModeOperation = (
  568. winScreenModeGetDefaults,
  569. winScreenModeGet,
  570. winScreenModeSetToDefaults,
  571. winScreenModeSet,
  572. winScreenModeGetSupportedDepths,
  573. winScreenModeGetSupportsColor
  574. );
  575. WinDirectionType = (
  576. winUp,
  577. winDown,
  578. winLeft,
  579. winRight
  580. );
  581. WinDrawOperation = (
  582. winPaint,
  583. winErase,
  584. winMask,
  585. winInvert,
  586. winOverlay,
  587. winPaintInverse,
  588. winSwap
  589. );
  590. SysLibTblEntryType = record
  591. dispatchTblP : Pointer;
  592. globalsP : Pointer;
  593. dbID : LocalID;
  594. CodeRscH : Pointer;
  595. end;
  596. SysLibTblEntryPtr=^SysLibTblEntryType;
  597. EvtSetAutoOffCmd = (
  598. SetAtLeast, // turn off in at least xxx seconds
  599. SetExactly, // turn off in xxx seconds
  600. SetAtMost, // turn off in at most xxx seconds
  601. SetDefault, // change default auto-off timeout to xxx seconds
  602. ResetTimer // reset the timer to the default auto-off timeout
  603. );
  604. SystemPreferencesChoice = (
  605. prefVersion,
  606. prefCountry,
  607. prefDateFormat,
  608. prefLongDateFormat,
  609. prefWeekStartDay,
  610. prefTimeFormat,
  611. prefNumberFormat,
  612. prefAutoOffDuration, // prefAutoOffDurationSecs is now preferred (prefAutoOffDuration is in minutes)
  613. prefSysSoundLevelV20, // slOn or slOff - error beeps and other non-alarm/game sounds
  614. prefGameSoundLevelV20, // slOn or slOff - game sound effects
  615. prefAlarmSoundLevelV20, // slOn or slOff - alarm sound effects
  616. prefHidePrivateRecordsV33,
  617. prefDeviceLocked,
  618. prefLocalSyncRequiresPassword,
  619. prefRemoteSyncRequiresPassword,
  620. prefSysBatteryKind,
  621. prefAllowEasterEggs,
  622. prefMinutesWestOfGMT, // deprecated old unsigned minutes EAST of GMT
  623. prefDaylightSavings, // deprecated old daylight saving time rule
  624. prefRonamaticChar,
  625. prefHard1CharAppCreator, // App creator for hard key #1
  626. prefHard2CharAppCreator, // App creator for hard key #2
  627. prefHard3CharAppCreator, // App creator for hard key #3
  628. prefHard4CharAppCreator, // App creator for hard key #4
  629. prefCalcCharAppCreator, // App creator for calculator soft key
  630. prefHardCradleCharAppCreator, // App creator for hard cradle key
  631. prefLauncherAppCreator, // App creator for launcher soft key
  632. prefSysPrefFlags,
  633. prefHardCradle2CharAppCreator, // App creator for 2nd hard cradle key
  634. prefAnimationLevel,
  635.  
  636. // Additions for PalmOS 3.0:
  637. prefSysSoundVolume, // actual amplitude - error beeps and other non-alarm/game sounds
  638. prefGameSoundVolume, // actual amplitude - game sound effects
  639. prefAlarmSoundVolume, // actual amplitude - alarm sound effects
  640. prefBeamReceive, // not used - use ExgLibControl with ir(Get/Set)ScanningMode instead
  641. prefCalibrateDigitizerAtReset, // True makes the user calibrate at soft reset time
  642. prefSystemKeyboardID, // ID of the preferred keyboard resource
  643. prefDefSerialPlugIn, // creator ID of the default serial plug-in
  644.  
  645. // Additions for PalmOS 3.1:
  646. prefStayOnWhenPluggedIn, // don't sleep after timeout when using line current
  647. prefStayLitWhenPluggedIn, // keep backlight on when not sleeping on line current
  648.  
  649. // Additions for PalmOS 3.2:
  650. prefAntennaCharAppCreator, // App creator for antenna key
  651.  
  652. // Additions for PalmOS 3.3:
  653. prefMeasurementSystem, // English, Metric, etc.
  654.  
  655. // Additions for PalmOS 3.5:
  656. prefShowPrivateRecords, // returns privateRecordViewEnum
  657. prefAutoOffDurationSecs, // auto-off duration in seconds
  658.  
  659. // Additions for PalmOS 4.0:
  660. prefTimeZone, // GMT offset in minutes, + for east of GMT, - for west
  661. prefDaylightSavingAdjustment, // current DST adjustment in minutes (typically 0 or 60)
  662.  
  663. prefAutoLockType, // Never, on poweroff, after preset delay or at preset time.
  664. prefAutoLockTime, // Auto lock preset time or delay.
  665. prefAutoLockTimeFlag, // For Minutes or Hours.
  666.  
  667. prefLanguage, // Language spoken in country selected via Setup app/Formats panel
  668. prefLocale, // Locale for country selected via Setup app/Formats panel
  669.  
  670. prefTimeZoneCountry, // Country used to specify time zone.
  671.  
  672. prefAttentionFlags, // User prefs for getting user's attention
  673.  
  674. prefDefaultAppCreator // Default application launched on reset.
  675. );
  676.  
  677. SndCommandType = record
  678. cmd: SndCmdIDType;
  679. reserved: UInt8;
  680. param1: Int32;
  681. param2,
  682. param3: UInt16;
  683. end;
  684. SndCommandPtr=^SndCommandType;
  685.  
  686. SysBatteryKind = (
  687. sysBatteryKindAlkaline=0,
  688. sysBatteryKindNiCad,
  689. sysBatteryKindLiIon,
  690. sysBatteryKindRechAlk,
  691. sysBatteryKindNiMH,
  692. sysBatteryKindLiIon1400
  693. );
  694. KeyboardType = (
  695. kbdAlpha = 0,
  696. kbdNumbersAndPunc = 1,
  697. kbdAccent = 2,
  698. kbdDefault = $ff // based on graffiti mode (usually alphaKeyboard)
  699. );
  700. privateRecordViewEnum = (
  701. showPrivateRecords = 0,
  702. maskPrivateRecords,
  703. hidePrivateRecords
  704. );
  705. SysDBListItemType = record
  706. name: string[dmDBNameLength-1];
  707. creator: UInt32;
  708. {type} db_type: UInt32;
  709. version: UInt16;
  710. dbID: LocalID;
  711. cardNo: UInt16;
  712. iconP: BitmapPtr;
  713. end;
  714.  
  715. FormCheckResponseFuncPtr = function(button: Int16; attempt: string): Boolean;
  716.  
  717. // =================
  718. // Palm OS API calls
  719. // =================
  720. function BmpCreate(width,height:Coord;depth:UInt8;colortableP:pointer;var error:UInt16):BitmapPtr; inline(SYSTRAP,$A3DD);
  721. function BmpDelete(bitmapP:BitmapPtr):Err; inline(SYSTRAP,$A3DE);
  722. procedure ClipboardAddItem(format:ClipboardFormatType;var ptr;length:UInt16); inline(SYSTRAP,$A10A);
  723. function ClipboardAppendItem(format:ClipboardFormatType;var ptr;length:UInt16):Err; inline(SYSTRAP,$A370);
  724. function ClipboardGetItem(format:ClipboardFormatType;var length:UInt16):MemHandle;inline(SYSTRAP,$A10C);
  725. // control
  726. function CtlGetLabel(const controlP: ControlPtr):StringPtr; inline(SYSTRAP,$A113);
  727. procedure CtlGetSliderValues(ctlP:ControlPtr;minValueP,maxValueP,pageSizeP,valueP:Pointer); inline(SYSTRAP,$A3DA);
  728. function CtlGetValue(controlP:ControlPtr):UInt16;inline(SYSTRAP,$A111);
  729. procedure CtlSetLabel(controlP:ControlPtr;const newLabel:StringPtr); inline(SYSTRAP,$A114);
  730. procedure CtlSetSliderValues(ctlP:ControlPtr;minValueP,maxValueP,pageSizeP,valueP:Pointer); inline(SYSTRAP,$A3DB);
  731. procedure CtlSetValue(ControlP:ControlPtr;newValue:Int16); inline(SYSTRAP,$A112);
  732. // data
  733. function DmCloseDatabase(dbP:DmOpenRef):UInt16; inline(SYSTRAP,$A04A);
  734. function DmCreateDatabase(cardNo:UInt16;const name:String;c,t:UInt32;resDB:Boolean):UInt16; inline(SYSTRAP,$A041);
  735. function DmDatabaseInfo(cardNo:UInt16;dbID:LocalID;var name:String;var attributes,version:UInt16;var crDate,modDate,bkpUpDate,modNum:UInt32;var appInfoID,sortInfoID:LocalID;var t,c:UInt32):UInt16; inline(SYSTRAP,$A046);
  736. function DmDatabaseProtect(cardNo:UInt16;dbID:LocalID;protect:Boolean):Err; inline(SYSTRAP,$A2EB);
  737. function DmDeleteDatabase(cardNo:UInt16;dbID:LocalID):UInt16; inline(SYSTRAP,$A042);
  738. function DmFindDatabase(cardNo:UInt16;const name:String):LocalID; inline(SYSTRAP,$A045);
  739. function DmFindResource(dbP:DmOpenRef;ResType:UInt32;ResID:UInt16;resH:MemHandle):UInt16; inline(SYSTRAP,$A065);
  740. function DmGet1Resource(resType: UInt32;resID: UInt16): MemHandle; inline(SYSTRAP,$A060);
  741. Function DmGetDatabase (cardNo: UInt16; index: UInt16): LocalID; inline(SYSTRAP,$A044);
  742. function DmGetNextDatabaseByTypeCreator(newSearch:Boolean;var stateInfo:DmSearchStateType;t,c:UInt32;onlyLastVers:Boolean;var cardNo:UInt16;var dbIDP:LocalID):UInt16; inline(SYSTRAP,$A078);
  743. function DmGetRecord(dbP:DmOpenRef;index:UInt16):MemHandle; inline($4E4F,$A05C);
  744. function DmGetResource(typ:UInt32;resID:UInt16):Memhandle; inline(SYSTRAP,$A05F);
  745. function DmGetResourceIndex(dbP:DmOpenRef;index:UInt16):MemHandle; inline(SYSTRAP,$A06E);
  746. function DmNewRecord(dbP:DmOpenRef;var at:UInt16;size:UInt32):MemHandle; inline(SYSTRAP,$A055);
  747. function DmNewResource(dbP:DmOpenRef;ResType:UInt32;ResID:UInt16;size:UInt32):MemHandle; inline(SYSTRAP,$A06C);
  748. function DmNumDatabase(cardNo:UInt16):UInt16;inline(SYSTRAP,$A043); //TYPO - left for compatibility!
  749. function DmNumDatabases(cardNo:UInt16):UInt16;inline(SYSTRAP,$A043);
  750. function DmNumRecords (dbP: DmOpenRef): UInt16; inline(SYSTRAP,$A04F);
  751. function DmNumRecordsInCategory(dbP:DmOpenRef;category:UInt16):UInt16; inline(SYSTRAP,$A071);
  752. function DmNumResources(dbP:DmOpenRef):UInt16; inline(SYSTRAP,$A067);
  753. function DmOpenDatabase(cardNo:UInt16;dbID:LocalID;mode:UInt16):DmOpenRef; inline(SYSTRAP,$A049);
  754. function DmOpenDatabaseByTypeCreator(typo,creator:UInt32;mode:UInt16):DmOpenRef; inline(SYSTRAP,$A075);
  755. function DmOpenDatabaseInfo(dbP:DmOpenRef;var dbIDP:LocalID;var openCountP,modeP,cardNoP:UInt16; var resDBP: Boolean):Err; inline(SYSTRAP,$A04C);
  756. function DmQueryRecord(dbP:DmOpenRef;index:UInt16):MemHandle; inline($4E4F,$A05B);
  757. function DmReleaseRecord(dbP:DmOpenRef;index:UInt16;dirty:Boolean):UInt16; inline(SYSTRAP,$A05E);
  758. function DmReleaseResource(resourceH:MemHandle):Err; inline(SYSTRAP,$A061);
  759. function DmRemoveResource(dbP:DmOpenRef;index:UInt16):Err; inline(SYSTRAP,$A06D);
  760. function DmResourceInfo(dbP:DmOpenRef;index:UInt16;var ResTypeP:UInt32;var ResID:UInt16;var chunkLocalIDP:LocalID):Err; inline(SYSTRAP,$A068);
  761. function DmSet(rec:Pointer;offset:UInt32;bytes:UInt32;value:UInt8):UInt16; inline(SYSTRAP,$A07E);
  762. function DmSetDatabaseInfo(cardNo:UInt16;dbID:LocalID;var name:String;var attributes,version:UInt16;var crDate,modDate,bkpUpDate,modNum:UInt32;var appInfoID,sortInfoID:LocalID;var t,c:UInt32):UInt16; inline(SYSTRAP,$A047);
  763. function DmWrite(recordP:Pointer;offset:UInt32;srcP:Pointer;bytes:UInt32):UInt16; inline(SYSTRAP,$A076);
  764. // events
  765. procedure EvtAddEventToQueue(event:EventPtr); inline(SYSTRAP, $A11B);
  766. procedure EvtEnableGraffiti(enable: Boolean); inline(SYSTRAP, $A132);
  767. function EvtEnqueueKey(ascii:WChar;keycode,modifiers:UInt16):Err; inline(SYSTRAP,$A12D);
  768. function EvtEventAvail:Boolean; inline(SYSTRAP,$A2CC);
  769. function EvtFlushKeyQueue:Err; inline(SYSTRAP,$A12C);
  770. function EvtFlushPenQueue:Err; inline(SYSTRAP,$A125);
  771. procedure EvtGetEvent(var event:EventType;timeout:UInt32); inline(SYSTRAP,$A11D);
  772. function EvtKeyQueueEmpty:Boolean; inline(SYSTRAP,$A131);
  773. function EvtSetAutoOffTimer(cmd:EvtSetAutoOffCmd;timeout:UInt16):Err; inline(SYSTRAP,$A3AD);
  774. function EvtSetNullEventTick(tick: UInt32): Boolean; inline(SYSTRAP, $A3E5);
  775. function EvtSysEventAvail(ignorePenUps: Boolean): Boolean; inline(SYSTRAP, $A2CD);
  776. function EvtWakeup: Err; inline(SYSTRAP, $A12F);
  777. // fields
  778. procedure FldCopy(fldP: FieldPtr); inline(SYSTRAP, $A133);
  779. procedure FldCut(fldP: FieldPtr); inline(SYSTRAP, $A134);
  780. procedure FldDelete(fldP: FieldPtr; start, end_: UInt16); inline(SYSTRAP, $A15E);
  781. function FldDirty(fldP: FieldPtr): Boolean; inline(SYSTRAP, $A155);
  782. procedure FldDrawField(fldP:FieldPtr);inline($4e4f,$a135);
  783. procedure FldGetAttributes(fldP:pointer;var attrP:UInt16); inline(SYSTRAP,$A14F);
  784. function FldGetInsPtPosition(fldP: FieldPtr): UInt16; inline(SYSTRAP, $A145);
  785. procedure FldGetSelection(fldP:FieldPtr;var startPosition,endPosition:UInt16);inline(SYSTRAP,$A13A);
  786. function FldGetTextHandle(fldP:FieldPtr):MemHandle;inline(SYSTRAP,$A153);
  787. function FldGetTextLength(fldP:FieldPtr):UInt16;inline(SYSTRAP,$A14B);
  788. function FldGetTextPtr(fldP:FieldPtr):StringPtr; inline(SYSTRAP,$A139);
  789. function FldHandleEvent(fldP:FieldPtr;var event:EventType):Boolean;inline(SYSTRAP,$A13B);
  790. function FldInsert(fldP:FieldPtr;insertChars:StringPtr;insertLen:UInt16):Boolean;inline(SYSTRAP,$A15D);
  791. procedure FldPaste(fldP: FieldPtr); inline(SYSTRAP, $A13C);
  792. procedure FldReleaseFocus(fldP:FieldPtr);inline(SYSTRAP,$A144);
  793. procedure FldSetAttributes(fldP:pointer; var attrP:UInt16); inline(SYSTRAP,$A150);
  794. procedure FldSetDirty(fldP: FieldPtr; dirty: Boolean); inline(SYSTRAP, $A160);
  795. procedure FldSetInsPtPosition(fldP: FieldPtr; pos: UInt16); inline(SYSTRAP, $A146);
  796. procedure FldSetSelection(fldP:FieldPtr;startPosition,endPosition:UInt16);inline(SYSTRAP,$A142);
  797. procedure FldSetText(fldP:FieldPtr;textHandle:MemHandle;offset,size:UInt16);inline(SYSTRAP,$A13F);
  798. procedure FldSetTextHandle(fldP:FieldPtr;textHandle:MemHandle);inline(SYSTRAP,$A158);
  799. procedure FldSetTextPtr(fldP:FieldPtr;textP:StringPtr); inline(SYSTRAP,$A159);
  800. procedure FldUndo(fldP: FieldPtr); inline(SYSTRAP, $A15F);
  801. // fonts
  802. function FntCharHeight:Int16;inline(SYSTRAP,$A167);
  803. function FntCharsWidth(const Chars:String;Len:Int16):Int16; inline(SYSTRAP,$A16B);
  804. function FntCharWidth(ch:char):Int16;inline(SYSTRAP,$A16A);
  805. function FntDefineFont(font:FontID;fontP:pointer):UInt16;inline($4e4f,$a321);
  806. function FntGetFont: FontID; inline(SYSTRAP, $A163);
  807. function FntSetFont(font:FontID):FontID;inline($4e4f,$a164);
  808. function FontSelect(fntID: FontID): FontID; inline(SYSTRAP, $A320);
  809. // Insersion Point
  810. procedure InsPtEnable(enableIt : Boolean);inline(SYSTRAP,$a1ab);
  811. procedure InsPtSetHeight(Height:Int16); inline(SYSTRAP,$A1AD);
  812. procedure InsPtSetLocation(x,y:Int16); inline(SYSTRAP,$a1a9);
  813. // Forms
  814. function FrmAlert(alertId:UInt16):UInt16; inline(SYSTRAP,$A192);
  815. procedure FrmCloseAllForms;inline(SYSTRAP,$A1A1);
  816. procedure FrmCopyLabel(FormP:FormPtr;labelID:UInt16;Const newLabel:String); inline(SYSTRAP,$A18C);
  817. procedure FrmCopyTitle(formP:FormPtr;const newTitle:string);inline(SYSTRAP,$A19A);
  818. function FrmCustomAlert(alertId:UInt16;const s1,s2,s3:String):UInt16; inline(SYSTRAP,$A194);
  819. function FrmCustomResponseAlert(alertId:UInt16;const s1,s2,s3,entryStringBuf:String;entryStringBufLength:Int16;callback:FormCheckResponseFuncPtr):UInt16;inline(SYSTRAP,$A3D3);
  820. procedure FrmDeleteForm(FormP:FormPtr); inline(SYSTRAP,$A170);
  821. function FrmDispatchEvent(var event:EventType):Boolean; inline(SYSTRAP,$A1A0);
  822. function FrmDoDialog(formP:FormPtr):UInt16; inline(SYSTRAP,$A193);
  823. procedure FrmDrawForm(FormP:FormPtr); inline(SYSTRAP,$A171);
  824. procedure FrmEraseForm(FormP:FormPtr); inline(SYSTRAP,$A172);
  825. function FrmGetActiveForm:FormPtr; inline(SYSTRAP,$A173);
  826. function FrmGetControlGroupSelection(formP: FormPtr; groupNum: UInt8): UInt16; inline(SYSTRAP, $A18A);
  827. function FrmGetFocus(formP:FormPtr):UInt16;inline(SYSTRAP,$A178);
  828. function FrmGetFormId(const formP:FormPtr):UInt16; inline(SYSTRAP,$A17D);
  829. function FrmGetFormPtr(formId:UInt16):FormPtr; inline(SYSTRAP,$A17E);
  830. function FrmGetLabel(formP:FormPtr;labelID:UInt16):StringPtr; inline(SYSTRAP,$A18E);
  831. procedure FrmGetObjectBounds(formP:FormPtr;objIndex:UInt16;var r:RectangleType);inline(SYSTRAP,$A199);
  832. function FrmGetObjectIndex(formP:FormPtr;objID:UInt16):UInt16; inline(SYSTRAP,$A180);
  833. procedure FrmGetObjectPosition(formP:FormPtr;objIndex:UInt16;var x,y:Coord);inline(SYSTRAP,$A186);
  834. function FrmGetObjectPtr(formP:FormPtr;objIndex:UInt16):pointer; inline(SYSTRAP,$A183);
  835. function FrmGetTitle(formP: FormPtr): StringPtr; inline(SYSTRAP,$A190);
  836. procedure FrmGotoForm(FormID:UInt16); inline(SYSTRAP,$A19B);
  837. function FrmHandleEvent(formP:FormPtr;var event:EventType):Boolean; inline(SYSTRAP,$A17A);
  838. procedure FrmHelp(helpMsgId:UInt16); inline(SYSTRAP,$A195);
  839. procedure FrmHideObject(formP:FormPtr;objIndex:UInt16); inline(SYSTRAP,$A184);
  840. function FrmInitForm(rscID:UInt16):FormPtr; inline(SYSTRAP,$A16F);
  841. function FrmPointInTitle(formP: FormPtr; x, y: Coord): Boolean; inline(SYSTRAP, $A2D5);
  842. procedure FrmPopupForm(formId : UInt16); inline(SYSTRAP,$A19C);
  843. procedure FrmReturnToForm(formId : UInt16); inline(SYSTRAP,$A19E);
  844. procedure FrmSetActiveForm(FormP:FormPtr); inline(SYSTRAP,$A174);
  845. procedure FrmSetControlGroupSelection(formP:FormPtr;groupNum:UInt8;controlID:UInt16); inline(SYSTRAP,$A18B);
  846. procedure FrmSetControlValue(formP:FormPtr;objIndex:UInt16;newValue:UInt16); inline(SYSTRAP,$A189);
  847. procedure FrmSetEventHandler(FormP:FormPtr;function handler(var event:Eventtype):Boolean); inline(SYSTRAP,$A19F);
  848. procedure FrmSetFocus(formP:FormPtr;fieldIndex:UInt16);inline(SYSTRAP,$A179);
  849. procedure FrmSetObjectBounds(formP:FormPtr;objIndex:UInt16;var r:RectangleType);inline(SYSTRAP,$A303);
  850. procedure FrmSetObjectPosition(FormP:FormPtr;objIndex:UInt16;x,y:Coord); inline(SYSTRAP,$A187);
  851. procedure FrmSetTitle(formP:FormPtr;const newTitle:string);inline(SYSTRAP,$A191);
  852. procedure FrmShowObject(formP:FormPtr;objIndex:UInt16); inline(SYSTRAP,$A185);
  853. // features
  854. function FtrGet(creator:UInt32;featureNum:UInt16;var valueP:UInt32):Err; inline(SYSTRAP,$A27B);
  855. function FtrSet(creator:UInt32;featureNum:UInt16;valueP:UInt32):Err; inline(SYSTRAP,$A27C);
  856. function FtrUnregister(creator:UInt32;featureNum:UInt16):Err; inline(SYSTRAP, $A27A);
  857. // List
  858. procedure LstDrawList(ListP:ListPtr);inline(SYSTRAP,$A1B1);
  859. procedure LstEraseList(ListP:ListPtr);inline(SYSTRAP,$A1B2);
  860. function LstGetNumberOfItems(ListP:ListPtr):Int16;inline(SYSTRAP,$A1BA);
  861. function LstGetSelection(ListP:ListPtr):Int16; inline(SYSTRAP,$A1B3);
  862. function LstGetSelectionText(ListP:ListPtr;intemNum:Int16):StringPtr; inline(SYSTRAP,$A1B4);
  863. function LstGetVisibleItems(ListP:ListPtr):Int16;inline(SYSTRAP,$A2FF);
  864. procedure LstMakeItemVisible(ListP:ListPtr;itemNum:Int16); inline(SYSTRAP,$A0B9);
  865. function LstScrollList(ListP:ListPtr;direction:WinDirectionType;itemCount:Int16):Boolean;inline(SYSTRAP,$A2FB);
  866. procedure LstSetListChoices(listP:ListPtr;itemsText:Pointer;numItems:Int16); inline(SYSTRAP,$A1B8);
  867. procedure LstSetSelection(ListP:ListPtr;itemNum:Int16); inline(SYSTRAP,$A1B7);
  868. procedure LstSetTopItem(ListP:ListPtr;itemNum:Int16);inline(SYSTRAP,$A2B5);
  869. // Memory
  870. function MemCmp(var s1, s2; numBytes: Int32): Int16; inline(SYSTRAP,$A2D7);
  871. function MemHandleFree(h: MemHandle): UInt16; inline(SYSTRAP,$A02B);
  872. function MemHandleLock(h:MemHandle):MemPtr; inline(SYSTRAP,$A021);
  873. function MemHandleNew(size:UInt32):MemHandle;inline(SYSTRAP,$A01E);
  874. function MemHandleResize(h:MemHandle; newSize: UInt32):Err; inline(SYSTRAP,$A033);
  875. function MemHandleSetOwner(h:MemHandle;owner:UInt16): Err; inline(SYSTRAP,$A032);
  876. function MemHandleSize(h:MemHandle):UInt32; inline(SYSTRAP,$A02D);
  877. function MemHandleUnlock(h:MemHandle):UInt16; inline(SYSTRAP,$A022);
  878. function MemMove(var dst,s;numBytes:integer):err; inline($4E4F,$A026);
  879. function MemPtrFree(p : MemPtr): UInt16; inline(SYSTRAP,$A012);
  880. function MemPtrNew(size: UInt32): MemPtr; inline(SYSTRAP,$A013);
  881. function MemPtrResize(p: MemPtr; newSize: UInt32): Err; inline(SYSTRAP,$A01C);
  882. function MemPtrSetOwner(p:MemPtr;owner:UInt16):UInt16; inline(SYSTRAP,$A01B);
  883. function MemPtrSize(p: MemPtr): UInt32; inline(SYSTRAP,$A016);
  884. function MemPtrUnlock(p: MemPtr): Err; inline(SYSTRAP,$A035);
  885. function MemSet(var dst;numBytes:integer;value:UInt8):err; inline($4E4F,$A027);
  886. // menu
  887. function MenuHandleEvent(menuP:Pointer;var event:EventType;var error:UInt16):Boolean; inline(SYSTRAP,$A1BF);
  888. procedure MenuEraseStatus(menuP:Pointer); inline(SYSTRAP,$A1C1);
  889. // prefs
  890. function PrefGetAppPreferences(creator:UInt32;id:UInt16;var prefs;var prefsSize:UInt16;saved:Boolean):Int16; inline(SYSTRAP,$A2D3);
  891. procedure PrefSetAppPreferences(creator:UInt32;id,version:UInt16;var prefs;prefsSize:UInt16;saved:Boolean); inline(SYSTRAP,$A2D4);
  892. function PrefGetPreference(choice:SystemPreferencesChoice):UInt32; inline(SYSTRAP,$A2D1);
  893. procedure PrefSetPreference(choice:SystemPreferencesChoice;value:UInt32); inline(SYSTRAP,$A2D2);
  894. // rectangle
  895. function RctPtInRectangle(x,y:Coord;var r:RectangleType):Boolean; inline(SYSTRAP,$A1C8);
  896. procedure RctSetRectangle(var r:RectangleType;left,top,width,height:Coord); inline(SYSTRAP,$A1C4);
  897. // sound
  898. function SndDoCmd(channelP:Pointer;commandP:SndCmdIDType;noWait:Boolean):Err;inline(SYSTRAP,$A233);
  899. procedure SndPlaySystemSound(beepID:SndSysBeepType); inline(SYSTRAP,$A234);
  900. // strings
  901. function StrAToI(const S:string):integer; inline(SYSTRAP,$a0ce);
  902. function StrCaselessCompare(const s1,s2:string):Int16; inline(SYSTRAP,$A0CA);
  903. procedure StrCopy(dst:MemPtr;const src:String); inline(SYSTRAP,$A0C5);
  904. procedure StrIToA(var S:string;N:integer); inline(SYSTRAP,$A0C9);
  905. function StrIToH(var s:String;i:UInt32):StringPtr; inline(SYSTRAP,$A0CB);
  906. function StrStr(const str,token:String):StringPtr; inline(SYSTRAP,$A0CD);
  907. // system
  908. function SysAppLaunch(cardNo:UInt16;dbID:LocalID;launchFlags,cmd:UInt16;cmdPBP:MemPtr;var resultP:UInt32):Err;inline(SYSTRAP,$A08E);
  909. function SysBatteryInfo(setTresholds:Boolean;var warnThresholdP,criticalThresholdP:UInt16;var maxTicksP:Int16;kindP:SysBatteryKind;pluggedIn:Boolean;var percentP:UInt8):UInt16; inline(SYSTRAP,$A324);
  910. function SysBroadcastActionCode(cmd: UInt16; cmdPBP: MemPtr): Err; inline(SYSTRAP, $A089);
  911. procedure SysCopyStringResource(var s: string; theID: Int16); inline(SYSTRAP, $A0BC);
  912. function SysCreateDataBaseList(typ, cre: UInt32; var dbCount: UInt16; var dbIDs: MemHandle; lookupName: Boolean): Boolean; inline(SYSTRAP, $A2DB);
  913. function SysCreatePanelList(var panelCount: UInt16; var panelIDs: MemHandle): Boolean; inline(SYSTRAP, $A2DC);
  914. function SysCurAppDatabase(var cardNo:UInt16;var dbID:LocalID):UInt16;inline(SYSTRAP,$A0AC);
  915. function SysErrString(error: Err; strP: StringPtr; maxLen: UInt16): string; inline(SYSTRAP, $A2F4);
  916. function SysFormPointerArrayToStrings(c:Pointer;StringCount:Int16):MemHandle; inline(SYSTRAP,$A0C1);
  917. function SysGetOSVersionString:StringPtr; inline(SYSTRAP,$A323);
  918. function SysGetStackInfo(var startPP, endPP: MemPtr): Boolean; inline(SYSTRAP, $A33D);
  919. function SysHandleEvent(var event:EventType):Boolean; inline(SYSTRAP,$A0A9);
  920. procedure SysKeyboardDialog(kbd: KeyboardType); inline(SYSTRAP, $A2E2);
  921. function SysLibFind(const name:string;var refnum:UInt16):Err;inline($4E4F,$A0BA);
  922. function SysLibLoad(libType,libCreator:UInt32;var refnum:UInt16):Err;inline($4E4F,$A2AC);
  923. function SysLibRemove(refnum:UInt16):Err;inline($4E4F,$A0B8);
  924. function SysLibTblEntry(refnum:UInt16):SysLibTblEntryPtr;inline(SYSTRAP,$A0B9);
  925. function SysLibTrapClose(refnum:UInt16;var usecount:UInt16):Err;inline($4E4F,$A802);
  926. function SysLibTrapOpen(refnum,version:UInt16):Err;inline($4E4F,$A801);
  927. procedure SysReset; inline(SYSTRAP,$A08C);
  928. function SysSetAutoOffTime(seconds:UInt16):UInt16; inline(SYSTRAP,$A0C0);
  929. function SysTaskDelay(delay:Int32):Err; inline(SYSTRAP,$A0A0);
  930. function SysTicksPerSecond:UInt16; inline(SYSTRAP,$A2E9);
  931. function SysUIAppSwitch(cardNo:UInt16;dbID:LocalID;cmd:UInt16;cmdPBP:Pointer):UInt16; inline(SYSTRAP,$A0A7);
  932. // time
  933. function TimGetSeconds:UInt32; inline(SYSTRAP,$A0F5);
  934. function TimGetTicks:UInt32; inline(SYSTRAP,$A0F7);
  935. procedure TimSecondsToDateTime(seconds:UInt32;dateTimeP:DateTimePtr); inline(SYSTRAP,$A0FC);
  936. function TimDateTimeToSeconds(dateTimeP:DateTimePtr):UInt32; inline(SYSTRAP,$A0FD);
  937. procedure TimAdjust(dateTimeP:DateTimePtr;adjustment:Int32); inline(SYSTRAP,$A0FE);
  938. // window
  939. function WinCreateBitmapWindow(bitmapP:BitmapPtr;var error:UInt16):WinHandle; inline(SYSTRAP,$A3E4);
  940. procedure WinDeleteWindow(win:WinHandle;eraseIt:boolean); inline(SYSTRAP,$A1F8);
  941. procedure WinDrawBitmap(bitmapP:BitmapPtr;x,y:Coord); inline(SYSTRAP,$A226);
  942. procedure WinDrawChars(const chars : string;len:Int16;x,y:Coord); inline(SYSTRAP,$A220);
  943. procedure WinDrawChar(theChar : WChar; x,y:Coord); inline(SYSTRAP,$A350);
  944. procedure WinDrawLine(x1,y1,x2,y2:Coord); inline(SYSTRAP,$A213);
  945. procedure WinDrawRectangle(var r:RectangleType;cornerDiam:UInt16); inline(SYSTRAP,$A218);
  946. procedure WinDrawRectangleFrame(frame:FrameType;var rP:RectangleType); inline(SYSTRAP,$A21B);
  947. procedure WinEraseLine(x1,y1,x2,y2:Coord); inline(SYSTRAP,$A215);
  948. procedure WinEraseRectangle(var r:RectangleType;cornerDiam:UInt16); inline(SYSTRAP,$A219);
  949. function WinRGBToIndex(var rgbP:RGBColorType):IndexedColorType; inline(SYSTRAP,$A39E);
  950. function WinScreenMode(operation:WinScreenModeOperation;var widthP,heightP,depthP:UInt32;var enableColorP:Boolean):Err; inline(SYSTRAP,$A33E);
  951. function WinSetDrawWindow(win:WinHandle):WinHandle; inline(SYSTRAP,$A1FD);
  952. function WinSetForeColor(foreColor:IndexedColorType):IndexedColorType; inline(SYSTRAP,$A398);
  953. function WinSetBackColor(foreColor:IndexedColorType):IndexedColorType; inline(SYSTRAP,$A399);
  954. function WinSetTextColor(foreColor:IndexedColorType):IndexedColorType; inline(SYSTRAP,$A39A);
  955. function WinSetDrawMode(newMode:WinDrawOperation):WinDrawOperation; inline(SYSTRAP,$A397);
  956. procedure WinSetClip(const r:RectangleType);inline(SYSTRAP,$A210);
  957. procedure WinScrollRectangle(const r:RectangleType;direction:WinDirectionType;distance:Coord;var vacated:RectangleType);inline(SYSTRAP,$A20A);
  958. // scroll bars
  959. procedure SclSetScrollBar(barP:ScrollBarPtr;value,min,max,pageSize:Int16);inline(SYSTRAP,$A2B6);
  960. // Special functions
  961. function GetCharCaselessValue:pointer;inline(SYSTRAP,$A296);
  962. function KeyCurrentState:UInt32;inline(SYSTRAP,$A2A2);
  963. function KeySetMask(keyMask:UInt32):UInt32; inline(SYSTRAP,$A2CF);
  964. function SecSelectViewStatus: privateRecordViewEnum; inline(SYSTRAP, $A3CF);
  965. function SecVerifyPW(newSecLevel: privateRecordViewEnum): Boolean; inline(SYSTRAP, $A3CE);
  966.  
  967. function VersionSupported(MinVersion:UInt32):boolean;
  968. var
  969. ErrNo:Err;
  970. ROMVersion:UInt32;
  971. begin
  972. ErrNo:=FtrGet(sysFtrCreator, sysFtrNumROMVersion, ROMVersion);
  973. VersionSupported:=ROMVersion>=MinVersion;
  974. end;
  975.  
  976. function HandlerNONE(var e:EventType):boolean;
  977. begin
  978. HandlerNONE:=false;
  979. end;
  980.  
  981. // push and pop registers for callback functions
  982. procedure PushRegs; inline($48e7,$1F38); // push registers A2-A4, D3-D7
  983. procedure PopRegs; inline($4cdf,$1CF8); // pop registers A2-A4, D3-D7