PalmAPI.pas

Un article de Wikipedia.

  1. { PalmAPI
  2. Version 7 - November 24, 2004
  3.  
  4. PalmAPI is a set of common
  5. Palm OS API calls and types
  6. definitions for the
  7. Palm OS Pascal Compiler
  8.  
  9. Made by Laurent Duveau
  10.   & Philippe Guillot
  11.   web site = www.aldweb.com
  12.   web site = http://ppcompiler.free.fr
  13.   e-Mail = info@aldweb.com
  14.   e-Mail = ph.guillot@wanadoo.fr
  15.  
  16.  
  17. Use: insert {$i PalmAPI.pas}
  18. in your PP source code
  19. }
  20.  
  21.  
  22. // Palm OS Types Definitions
  23.  
  24. Const
  25. SYSTRAP = $4E4F;
  26. HIGH_DENSITY_TRAP = $A3EC;
  27. VFS_TRAP = $A348;
  28.  
  29. nilEvent = 0;
  30. penDownEvent = 1;
  31. penUpEvent = 2;
  32. penMoveEvent = 3;
  33. keyDownEvent = 4;
  34. winEnterEvent = 5;
  35. winExitEvent = 6;
  36. ctlEnterEvent = 7;
  37. ctlExitEvent = 8;
  38. ctlSelectEvent = 9;
  39. ctlRepeatEvent = 10;
  40. lstEnterEvent = 11;
  41. lstSelectEvent = 12;
  42. lstExitEvent = 13;
  43. popSelectEvent = 14;
  44. fldEnterEvent = 15;
  45. fldHeightChangedEvent = 16;
  46. fldChangedEvent = 17;
  47. tblEnterEvent = 18;
  48. tblSelectEvent = 19;
  49. daySelectEvent = 20;
  50. menuEvent = 21;
  51. appStopEvent = 22;
  52. frmLoadEvent = 23;
  53. frmOpenEvent = 24;
  54. frmGotoEvent = 25;
  55. frmUpdateEvent = 26;
  56. frmSaveEvent = 27;
  57. frmCloseEvent = 28;
  58. frmTitleEnterEvent = 29;
  59. frmTitleSelectEvent = 30;
  60. tblExitEvent = 31;
  61. sclEnterEvent = 32;
  62. sclExitEvent = 33;
  63. sclRepeatEvent = 34;
  64.  
  65. firstUserEvent = $6000;
  66.  
  67. dmModeReadOnly = 1;
  68. dmModeWrite = 2;
  69. dmModeReadWrite = 3;
  70.  
  71. evtWaitForever = -1;
  72.  
  73. noPreferenceFound = -1;
  74.  
  75. sndInfo = 1;
  76. sndWarning = 2;
  77. sndError = 3;
  78. sndStartUp = 4;
  79. sndAlarm = 5;
  80. sndConfirmation = 6;
  81. sndClick = 7;
  82.  
  83. sysAppLaunchCmdNormalLaunch = 0;
  84. sysAppLaunchCmdOpenDB = 52;
  85.  
  86. noFrame = 0;
  87. simpleFrame = 1;
  88. rectangleFrame = 1;
  89. simple3DFrame = $12;
  90. roundFrame = $401;
  91. boldRoundFrame = $702;
  92. popupFrame = $205;
  93. dialogFrame = $302;
  94.  
  95. noFocus = $FFFF;
  96.  
  97. stdFont = 0;
  98. boldFont = 1;
  99. largeFont = 2;
  100. symbolFont = 3;
  101. symbol11Font = 4;
  102. symbol7Font = 5;
  103. ledFont = 6;
  104. largeBoldFont = 7;
  105. fntAppFontCustomBase = 128;
  106.  
  107. sysFtrCreator = $70737973; // 'psys'
  108. sysFtrNumWinVersion = 24;
  109.  
  110. vfsIteratorStart = 0;
  111. vfsIteratorStop = $FFFFFFFF;
  112. vfsFtrIDVersion = 0;
  113.  
  114. Type
  115. Byte = 0..255;
  116. Int16 = -32768..32767;
  117. UInt16 = 0..65535;
  118. Int8 = -128..127;
  119. UInt8 = 0..255;
  120. Int32 = Integer;
  121. UInt32 = 0..MaxInt;
  122. WChar = UInt16;
  123. StringPtr = ^String;
  124. LocalID = UInt32;
  125. Err = UInt16;
  126. Coord = UInt16;
  127.  
  128. Opaque = record end;
  129. MemHandle = ^Opaque;
  130. ListPtr = ^Opaque;
  131. FieldPtr = ^Opaque;
  132.  
  133. MemPtr = Pointer;
  134. DmOpenRef = Pointer;
  135.  
  136. PointType = record
  137. x,y:Coord;
  138. end;
  139.  
  140. EventType = record
  141. eType:UInt16;
  142. penDown:Boolean;
  143. tapCount:UInt8;
  144. screenX,screenY:Int16;
  145. case integer of
  146. 0: (datum:array[0..7] of UInt16);
  147. 1: (PenUp:record start,finish:PointType end);
  148. 2: (chrc:WChar;keyCode,modifiers:UInt16);
  149. 3: (FrmLoad:record FormID:UInt16 end);
  150. 4: (ctlSelect:record controlID:UInt16;pControl:pointer;on:Boolean;reserved1:UInt8;value:UInt16 end);
  151. 5: (menu:record itemID:UInt16 end);
  152. 6: (ctlEnter:record controlID:UInt16;pControl:pointer end);
  153. 7: (ctlRepeat:record controlID:UInt16;pControl:pointer;time:UInt32;value:UInt16 end);
  154. 8: (sclRepeat:record scrollBarID:UInt16;pScrollbar:pointer;value,newValue:Int16;time:UInt32 end);
  155. 9: (popSelect:record controlID:UInt16;pcontrol:pointer;listID:UInt16;plist:pointer;selection,priorselection:Int16 end);
  156. 10:(frmTitleEnter:record formID:UInt16 end);
  157. end;
  158.  
  159. AbsRectType = record
  160. left,top,right,bottom:Coord;
  161. end;
  162.  
  163. FrameType = UInt16;
  164.  
  165. RectangleType = record
  166. topLeft,extent:PointType;
  167. end;
  168.  
  169. BitmapType = record end;
  170. BitmapPtr = ^BitmapType;
  171.  
  172. RGBColorType = record
  173. index,r,g,b:UInt8;
  174. end;
  175.  
  176. IndexedColorType = UInt8;
  177. // 0..215 combination of
  178. // ff cc 99 66 33 00
  179. // B : 0 6 12 108 114 120
  180. // R : 0 18 36 54 72 90
  181. // G : 0 1 2 3 4 5
  182. // e.g 12+54+5 = $99 B + $66 R +$0 G
  183. // 216..224
  184. // gray 22 44 55 77 88 aa bb dd
  185. // 225..229 = specials: light gray,marron,purple,green,cyan
  186. // 230..255 = unused (black)
  187.  
  188. FrameBitsType = record
  189. bits,word:UInt16;
  190. end;
  191.  
  192. WinHandle = ^WindowType;
  193. WindowType = record end;
  194.  
  195. FormObjListType = record end;
  196.  
  197. FormType = record end;
  198. FormPtr = ^FormType;
  199.  
  200. MenuBarPtr = ^MenuBarType;
  201. MenuBarType = record end;
  202.  
  203. ControlPtr = ^ControlType;
  204. ControlType = record end;
  205.  
  206. DmSearchStateType = record
  207. info:array[0..7] of UInt32;
  208. end;
  209.  
  210. clipboardFormatType=(
  211. clipboardText,
  212. clipboardInk,
  213. clipboardBitmap);
  214.  
  215. FontID=UInt8;
  216.  
  217. UnderlineModeType=(
  218. noUnderline,
  219. grayUnderline,
  220. solidUnderline,
  221. colorUnderline);
  222.  
  223. WinScreenModeOperation=(
  224. winScreenModeGetDefaults,
  225. winScreenModeGet,
  226. winScreenModeSetToDefaults,
  227. winScreenModeSet,
  228. winScreenModeGetSupportedDepths,
  229. winScreenModeGetSupportsColor);
  230.  
  231. WinDirectionType=(
  232. WinUp,
  233. WinDown,
  234. WinLeft,
  235. WinRight);
  236.  
  237. WinDrawOperation=(
  238. winPaint,
  239. winErase,
  240. winMask,
  241. winInvert,
  242. winOverlay,
  243. winPaintInverse,
  244. winSwap);
  245.  
  246. ScrollBarType = opaque;
  247. ScrollBarPtr = ^ScrollBarType;
  248.  
  249. DateTimeType = record
  250. second,minute,hour,day,month,year,weekDay:Int16;
  251. end;
  252. DateTimePtr = ^DateTimeType;
  253.  
  254. DateFormatType=(
  255. dfMDYWithSlashes, // 12/31/95
  256. dfDMYWithSlashes, // 31/12/95
  257. dfDMYWithDots, // 31.12.95
  258. dfDMYWithDashes, // 31-12-95
  259. dfYMDWithSlashes, // 95/12/31
  260. dfYMDWithDots, // 95.12.31
  261. dfYMDWithDashes, // 95-12-31
  262. dfMDYLongWithComma, // Dec 31, 1995
  263. dfDMYLong, // 31 Dec 1995
  264. dfDMYLongWithDot, // 31. Dec 1995
  265. dfDMYLongNoDay, // Dec 1995
  266. dfDMYLongWithComma, // 31 Dec, 1995
  267. dfYMDLongWithDot, // 1995.12.31
  268. dfYMDLongWithSpace, // 1995 Dec 31
  269. dfMYMed, // Dec '95
  270. dfMYMedNoPost); // Dec 95 (added for French 2.0 ROM)
  271.  
  272. TimeFormatType=(
  273. tfColon,
  274. tfColonAMPM, // 1:00 pm
  275. tfColon24h, // 13:00
  276. tfDot,
  277. tfDotAMPM, // 1.00 pm
  278. tfDot24h, // 13.00
  279. tfHoursAMPM, // 1 pm
  280. tfHours24h, // 13
  281. tfComma24h); // 13,00
  282.  
  283. SelectDayType=(
  284. selectDayByDay, // return d/m/y
  285. selectDayByWeek, // return d/m/y with d as same day of the week
  286. selectDayByMonth); // return d/m/y with d as same day of the month
  287.  
  288. SysBatteryKind=(
  289. sysBatteryKindAlkaline=0,
  290. sysBatteryKindNiCad,
  291. sysBatteryKindLiIon,
  292. sysBatteryKindRechAlk,
  293. sysBatteryKindNiMH,
  294. sysBatteryKindLiIon1400,
  295. sysBatteryKindLast=255); // insert new battery types BEFORE this one
  296.  
  297. DlkSyncStateType=(
  298. dlkSyncStateNeverSynced=0, // never synced
  299. dlkSyncStateInProgress, // sync is in progress
  300. dlkSyncStateLostConnection, // connection lost during sync
  301. dlkSyncStateLocalCan, // cancelled by local user on handheld
  302. dlkSyncStateRemoteCan, // cancelled by user from desktop
  303. dlkSyncStateLowMemoryOnTD, // sync ended due to low memory on handheld
  304. dlkSyncStateAborted, // sync was aborted for some other reason
  305. dlkSyncStateCompleted, // sync completed normally
  306. // Added in PalmOS v3.0:
  307. dlkSyncStateIncompatibleProducts); // sync ended because desktop HotSync product
  308. // is incompatible with this version
  309. // of the handheld HotSync
  310. LocalIDKind=(
  311. memIDPtr,
  312. memIDHandle);
  313.  
  314. FileInfoPtr = ^FileInfoType;
  315. FileInfoType = record
  316. attributes:UInt32;
  317. nameP:Pointer; // buffer to receive full name; pass NULL to avoid getting name
  318. nameBufLen:UInt16; // size of nameP buffer, in bytes
  319. end;
  320.  
  321. WinScreenAttrType=(
  322. winScreenWidth,
  323. winScreenHeight,
  324. winScreenRowBytes,
  325. winScreenDepth,
  326. winScreenAllDepths,
  327. winScreenDensity,
  328. winScreenPixelFormat,
  329. winScreenResolutionX,
  330. winScreenResolutionY);
  331.  
  332.  
  333. // Palm OS API calls
  334.  
  335. function BmpCreate(width,height:Coord;depth:UInt8;colortableP:pointer;var error:UInt16):BitmapPtr; inline(SYSTRAP,$A3DD);
  336.  
  337. procedure ClipboardAddItem(format:ClipboardFormatType;var ptr;length:UInt16); inline(SYSTRAP,$A10A);
  338. function ClipboardGetItem(format:ClipboardFormatType;var length:UInt16):MemHandle;inline(SYSTRAP,$A10C);
  339.  
  340. function CtlGetLabel(const controlP: ControlPtr):StringPtr; inline(SYSTRAP,$A113);
  341. function CtlGetValue(controlP:ControlPtr):UInt16;inline(SYSTRAP,$A111);
  342. function CtlNewControl(formP:FormPtr;objID:UInt16;style:Byte;const text:String;x,y,width,height:Coord;font:FontID;group:UInt8;leftAnchor:Boolean):ControlPtr; inline(SYSTRAP,$A32C);
  343. function CtlNewGraphicControl(formP:FormPtr;objID:UInt16;style:Byte;bitmapID,selectedBitmapID:UInt16;x,y,width,height:Coord;group:UInt8;leftAnchor:Boolean):ControlPtr; inline(SYSTRAP,$A3A9);
  344. procedure CtlSetLabel(controlP:ControlPtr;const newLabel:StringPtr); inline(SYSTRAP,$A114);
  345. procedure CtlSetValue(ControlP:ControlPtr;newValue:Int16); inline(SYSTRAP,$A112);
  346.  
  347. procedure DateToAscii(months,days:UInt8;years:UInt16;dateFormat:DateFormatType;var pString:String); inline(SYSTRAP,$A266);
  348.  
  349. function DlkGetSyncInfo(var succSyncDateP,lastSyncDateP:UInt32;var syncStateP:DlkSyncStateType;var nameBufP,logBufP:string;var logLenP:Int32):UInt16; inline(SYSTRAP,$A2A9);
  350.  
  351. function DmCloseDatabase(dbP:DmOpenRef):UInt16; inline(SYSTRAP,$A04A);
  352. function DmCreateDatabase(cardNo:UInt16;const name:String;c,t:UInt32;resDB:Boolean):UInt16; inline(SYSTRAP,$A041);
  353. 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);
  354. function DmDatabaseSize(cardNo:UInt16;dbID:LocalID;var numRecords,totalBytes,dataBytes:UInt32):Err; inline(SYSTRAP,$A048);
  355. function DmDeleteDatabase(cardNo:UInt16;dbID:LocalID):UInt16; inline(SYSTRAP,$A042);
  356. function DmFindDatabase(cardNo:UInt16;const name:String):LocalID; inline(SYSTRAP,$A045);
  357. function DmFindResource(dbP:DmOpenRef;ResType:UInt32;ResID:UInt16;resH:MemHandle):UInt16; inline(SYSTRAP,$A065);
  358. function DmGetDatabase(cardNo:UInt16;index:UInt16):LocalID; inline(SYSTRAP,$A044);
  359. function DmGetNextDatabaseByTypeCreator(newSearch:Boolean;var stateInfo:DmSearchStateType;t,c:UInt32;onlyLastVers:Boolean;var cardNo:UInt16;var dbIDP:LocalID):UInt16; inline(SYSTRAP,$A078);
  360. function DmGetRecord(dbP:DmOpenRef;index:UInt16):MemHandle; inline(SYSTRAP,$A05C);
  361. function DmGetResource(typ:UInt32;resID:UInt16):Memhandle; inline(SYSTRAP,$A05F);
  362. function DmGetResourceIndex(dbP:DmOpenRef;index:UInt16):MemHandle; inline(SYSTRAP,$A06E);
  363. function DmGet1Resource(resType: UInt32;resID: UInt16): MemHandle; inline(SYSTRAP,$A060);
  364. function DmNewRecord(dbP:DmOpenRef;var at:UInt16;size:UInt32):MemHandle; inline(SYSTRAP,$A055);
  365. function DmNewResource(dbP:DmOpenRef;ResType:UInt32;ResID:UInt16;size:UInt32):MemHandle; inline(SYSTRAP,$A06C);
  366. function DmNumDatabases(cardNo:UInt16):UInt16;inline(SYSTRAP,$A043);
  367. function DmNumRecords(dbP:DmOpenRef):UInt16; inline(SYSTRAP,$A04F);
  368. function DmNumRecordsInCategory(dbP:DmOpenRef;category:UInt16):UInt16; inline(SYSTRAP,$A071);
  369. function DmNumResources(dbP:DmOpenRef):UInt16; inline(SYSTRAP,$A067);
  370. function DmOpenDatabase(cardNo:UInt16;dbID:LocalID;mode:UInt16):DmOpenRef; inline(SYSTRAP,$A049);
  371. function DmOpenDatabaseByTypeCreator(typo,creator:UInt32;mode:UInt16):DmOpenRef; inline(SYSTRAP,$A075);
  372. function DmOpenDatabaseInfo(dbP:DmOpenRef;var dbIDP:LocalID;var openCountP,modeP,cardNoP:UInt16; var resDBP: Boolean):Err; inline(SYSTRAP,$A04C);
  373. function DmQueryRecord(dbP:DmOpenRef;index:UInt16):MemHandle; inline(SYSTRAP,$A05B);
  374. function DmRecordInfo(dbP:DmOpenRef;index:UInt16;var attrP:UInt16;var uniqueIDP:UInt32;var chunkIDP:LocalID):Err; inline(SYSTRAP,$A050);
  375. function DmReleaseRecord(dbP:DmOpenRef;index:UInt16;dirty:Boolean):UInt16; inline(SYSTRAP,$A05E);
  376. function DmReleaseResource(resourceH:MemHandle):Err; inline(SYSTRAP,$A061);
  377. function DmRemoveRecord(dbP:DmOpenRef;index:UInt16):Err; inline(SYSTRAP,$A056);
  378. function DmRemoveResource(dbP:DmOpenRef;index:UInt16):Err; inline(SYSTRAP,$A06D);
  379. function DmResourceInfo(dbP:DmOpenRef;index:UInt16;var ResTypeP:UInt32;var ResID:UInt16;var chunkLocalIDP:LocalID):Err; inline(SYSTRAP,$A068);
  380. function DmSet(rec:Pointer;offset:UInt32;bytes:UInt32;value:UInt8):UInt16; inline(SYSTRAP,$A07E);
  381. function DmSetDatabaseInfo(cardNo:UInt16;dbID:LocalID;const name:String;var attributes,version:UInt16;var crDate,modDate,bkpUpDate,modNum:UInt32;var appInfoID,sortInfoID:LocalID;var t,c:UInt32):UInt16; inline(SYSTRAP,$A047);
  382. function DmWrite(recordP:Pointer;offset:UInt32;srcP:Pointer;bytes:UInt32):UInt16; inline(SYSTRAP,$A076);
  383.  
  384. procedure EvtGetEvent(var event:EventType;timeout:UInt32); inline(SYSTRAP,$A11D);
  385.  
  386. procedure FldDrawField(fldP:FieldPtr); inline(SYSTRAP,$A135);
  387. procedure FldGetAttributes(fldP:FieldPtr;var attrP:UInt16); inline(SYSTRAP,$A14F);
  388. function FldGetTextHandle(fldP:FieldPtr):MemHandle;inline(SYSTRAP,$A153);
  389. function FldGetTextLength(fldP:FieldPtr):UInt16;inline(SYSTRAP,$A14B);
  390. function FldGetTextPtr(fldP:FieldPtr):StringPtr; inline(SYSTRAP,$A139);
  391. function FldNewField(formP:FormPtr;ObjID:UInt16;x,y,width,height:Coord;font:FontID;maxChars:UInt32;editable:Boolean;underlined:UnderlineModeType;singleLine,dynamicSize:Boolean;justification:Byte;autoShift,hasScrollBar,numeric:Boolean):FieldPtr; inline(SYSTRAP,$A32D);
  392. procedure FldSetAttributes(fldP:FieldPtr;var attrP:UInt16); inline(SYSTRAP,$A150);
  393. procedure FldSetSelection(fldP:FieldPtr;startPosition,endPosition:UInt16); inline(SYSTRAP,$A142);
  394. procedure FldSetTextHandle(fldP:FieldPtr;textHandle:MemHandle); inline(SYSTRAP,$A158);
  395.  
  396. procedure FntCharsInWidth(const Chars:String;var stringWidthP,stringLengthP:Int16;var fitWithinWidth:Boolean); inline(SYSTRAP,$A16D);
  397. function FntCharsWidth(const Chars:String;Len:Int16):Int16; inline(SYSTRAP,$A16B);
  398. function FntDefineFont(font:FontID;fontP:pointer):UInt16; inline(SYSTRAP,$A321);
  399. function FntGetFont:FontID; inline(SYSTRAP,$A163);
  400. function FntSetFont(font:FontID):FontID; inline(SYSTRAP,$A164);
  401. function FontSelect(font:FontID):FontID; inline(SYSTRAP,$A320);
  402.  
  403. function FrmAlert(alertId:UInt16):UInt16; inline(SYSTRAP,$A192);
  404. procedure FrmCloseAllForms;inline(SYSTRAP,$A1A1);
  405. procedure FrmCopyLabel(FormP:FormPtr;labelID:UInt16;Const newLabel:String); inline(SYSTRAP,$A18C);
  406. function FrmCustomAlert(alertId:UInt16;const s1,s2,s3:String):UInt16; inline(SYSTRAP,$A194);
  407. procedure FrmDeleteForm(FormP:FormPtr); inline(SYSTRAP,$A170);
  408. function FrmDispatchEvent(var event:EventType):Boolean; inline(SYSTRAP,$A1A0);
  409. function FrmDoDialog(formP:FormPtr):UInt16; inline(SYSTRAP,$A193);
  410. procedure FrmDrawForm(FormP:FormPtr); inline(SYSTRAP,$A171);
  411. procedure FrmEraseForm(FormP:FormPtr); inline(SYSTRAP,$A172);
  412. function FrmGetActiveForm:FormPtr; inline(SYSTRAP,$A173);
  413. function FrmGetFocus(formP:FormPtr):UInt16;inline(SYSTRAP,$A178);
  414. function FrmGetFormId(const formP:FormPtr):UInt16; inline(SYSTRAP,$A17D);
  415. function FrmGetFormPtr(formId:UInt16):FormPtr; inline(SYSTRAP,$A17E);
  416. function FrmGetLabel(formP:FormPtr;labelID:UInt16):StringPtr; inline(SYSTRAP,$A18E);
  417. procedure FrmGetObjectBounds(formP:FormPtr;objIndex:UInt16;var r:RectangleType); inline(SYSTRAP,$A199);
  418. function FrmGetObjectId(formP:FormPtr;objIndex:UInt16):UInt16; inline(SYSTRAP,$A181);
  419. function FrmGetObjectIndex(formP:FormPtr;objID:UInt16):UInt16; inline(SYSTRAP,$A180);
  420. function FrmGetObjectPtr(formP:FormPtr;objIndex:UInt16):pointer; inline(SYSTRAP,$A183);
  421. procedure FrmGotoForm(FormID:UInt16); inline(SYSTRAP,$A19B);
  422. function FrmHandleEvent(formP:FormPtr;var event:EventType):Boolean; inline(SYSTRAP,$A17A);
  423. procedure FrmHelp(helpMsgId:UInt16); inline(SYSTRAP,$A195);
  424. procedure FrmHideObject(formP:FormPtr;objIndex:UInt16); inline(SYSTRAP,$A184);
  425. function FrmInitForm(rscID:UInt16):FormPtr; inline(SYSTRAP,$A16F);
  426. function FrmNewLabel(formP:FormPtr;objID:UInt16;const textP:String;x,y:Coord;font:FontID):ControlPtr; inline(SYSTRAP,$A32F);
  427. procedure FrmPopupForm(formId:UInt16); inline(SYSTRAP,$A19C);
  428. function FrmRemoveObject(formP:FormPtr;objIndex:UInt16):Err; inline(SYSTRAP,$A345);
  429. procedure FrmReturnToForm(formId:UInt16); inline(SYSTRAP,$A19E);
  430. procedure FrmSetActiveForm(FormP:FormPtr); inline(SYSTRAP,$A174);
  431. procedure FrmSetControlGroupSelection(formP:FormPtr;groupNum:UInt8;controlID:UInt16); inline(SYSTRAP,$A18B);
  432. procedure FrmSetControlValue(formP:FormPtr;objIndex:UInt16;newValue:UInt16); inline(SYSTRAP,$A189);
  433. procedure FrmSetEventHandler(FormP:FormPtr;function handler(var event:Eventtype):Boolean); inline(SYSTRAP,$A19F);
  434. procedure FrmSetFocus(formP:FormPtr;fieldIndex:UInt16);inline(SYSTRAP,$A179);
  435. procedure FrmSetObjectBounds(formP:FormPtr;objIndex:UInt16;var r:RectangleType); inline(SYSTRAP,$A303);
  436. procedure FrmSetObjectPosition(FormP:FormPtr;objIndex:UInt16;x,y:Coord); inline(SYSTRAP,$A187);
  437. procedure FrmSetTitle(formP:FormPtr;const newTitle:string);inline(SYSTRAP,$A191);
  438. procedure FrmShowObject(formP:FormPtr;objIndex:UInt16); inline(SYSTRAP,$A185);
  439.  
  440. function FtrGet(creator:UInt32;featureNum:UInt16;var valueP:UInt32):Err; inline(SYSTRAP,$A27B);
  441.  
  442. function GetCharCaselessValue:pointer; inline(SYSTRAP,$A296);
  443.  
  444. Procedure GsiInitialize; inline(SYSTRAP,$A29B);
  445. Procedure GsiSetLocation(x,y:Int16); inline(SYSTRAP,$A29C);
  446. Procedure GsiEnable(enableIt:Boolean); inline(SYSTRAP,$A29D);
  447. Function GsiEnabled:Boolean; inline(SYSTRAP,$A29E);
  448. Procedure GsiSetShiftState(lockFlags,tempShift:UInt16); inline(SYSTRAP,$A29F);
  449.  
  450. procedure InsPtEnable(enableIt:Boolean); inline(SYSTRAP,$A1AB);
  451. procedure InsPtSetHeight(Height:Int16); inline(SYSTRAP,$A1AD);
  452. procedure InsPtSetLocation(x,y:Int16); inline(SYSTRAP,$A1A9);
  453.  
  454. function KeyCurrentState:UInt32;inline(SYSTRAP,$A2A2);
  455.  
  456. procedure LstDrawList(ListP:ListPtr);inline(SYSTRAP,$A1B1);
  457. procedure LstEraseList(ListP:ListPtr);inline(SYSTRAP,$A1B2);
  458. function LstGetNumberOfItems(ListP:ListPtr):Int16;inline(SYSTRAP,$A1BA);
  459. function LstGetSelection(ListP:ListPtr):Int16; inline(SYSTRAP,$A1B3);
  460. function LstGetSelectionText(ListP:ListPtr;intemNum:Int16):StringPtr; inline(SYSTRAP,$A1B4);
  461. function LstGetVisibleItems(ListP:ListPtr):Int16;inline(SYSTRAP,$A2FF);
  462. procedure LstMakeItemVisible(ListP:ListPtr;itemNum:Int16); inline(SYSTRAP,$A0B9);
  463. function LstNewList(formP:FormPtr;id:UInt16;x,y,width,height:Coord;font:FontID;visibleItems,triggerId:Int16):Err; inline(SYSTRAP,$A32E);
  464. function LstPopupList(listP:ListPtr):Int16; inline(SYSTRAP,$A1BB);
  465. function LstScrollList(ListP:ListPtr;direction:WinDirectionType;itemCount:Int16):Boolean;inline(SYSTRAP,$A2FB);
  466. procedure LstSetListChoices(listP:ListPtr;itemsText:Pointer;numItems:Int16); inline(SYSTRAP,$A1B8);
  467. procedure LstSetSelection(ListP:ListPtr;itemNum:Int16); inline(SYSTRAP,$A1B7);
  468. procedure LstSetTopItem(ListP:ListPtr;itemNum:Int16);inline(SYSTRAP,$A2B5);
  469.  
  470. function MemCardInfo(cardNo:UInt16;var cardNameP,manufNameP:String;var versionP:UInt16;var crDateP,romSizeP,ramSizeP,freeBytesP:UInt32):Err; inline(SYSTRAP,$A004);
  471. function MemHandleFree(h: MemHandle):UInt16; inline(SYSTRAP,$A02B);
  472. function MemHandleLock(h:MemHandle):MemPtr; inline(SYSTRAP,$A021);
  473. function MemHandleNew(size:UInt32):MemHandle;inline(SYSTRAP,$A01E);
  474. function MemHandleSize(h:MemHandle):UInt32; inline(SYSTRAP,$A02D);
  475. function MemHandleUnlock(h:MemHandle):UInt16; inline(SYSTRAP,$A022);
  476. function MemHeapDynamic(heapID:UInt16):Boolean; inline(SYSTRAP,$A03E);
  477. function MemHeapFlags(heapID:UInt16):UInt16; inline(SYSTRAP,$A00D);
  478. function MemHeapFreeBytes(heapID:UInt16;var freeP,maxP:UInt32):Err; inline(SYSTRAP,$A00B);
  479. function MemHeapID(cardNo,heapIndex:UInt16):UInt16; inline(SYSTRAP,$A009);
  480. function MemHeapSize(heapID:UInt16):UInt32; inline(SYSTRAP,$A00C);
  481. function MemLocalIDKind(local:LocalID):LocalIDKind; inline(SYSTRAP,$A024);
  482. function MemLocalIDToPtr(local:LocalID;cardNo:UInt16):Pointer; inline(SYSTRAP,$A025);
  483. procedure MemMove(var dst,s;numBytes:Int32); inline(SYSTRAP,$A026);
  484. function MemNumCards:UInt16; inline(SYSTRAP,$A03A);
  485. function MemNumHeaps(cardNo:UInt16):UInt16; inline(SYSTRAP,$A007);
  486. function MemPtrFree(p:MemPtr):UInt16; inline(SYSTRAP,$A012);
  487. function MemPtrHeapID(p:Pointer):UInt16; inline(SYSTRAP,$A018);
  488. function MemPtrNew(size:UInt32):MemPtr; inline(SYSTRAP,$A013);
  489. function MemPtrSetOwner(p:MemPtr;owner:UInt16):UInt16; inline(SYSTRAP,$A01B);
  490. procedure MemSet(var dst;numBytes:integer;value:UInt8); inline(SYSTRAP,$A027);
  491.  
  492. procedure MenuEraseStatus(menuP:Pointer); inline(SYSTRAP,$A1C1);
  493. function MenuHandleEvent(menuP:Pointer;var event:EventType;var error:UInt16):Boolean; inline(SYSTRAP,$A1BF);
  494.  
  495. function PrefGetAppPreferences(creator:UInt32;id:UInt16;var prefs;var prefsSize:UInt16;saved:Boolean):Int16; inline(SYSTRAP,$A2D3);
  496. procedure PrefSetAppPreferences(creator:UInt32;id,version:UInt16;var prefs;prefsSize:UInt16;saved:Boolean); inline(SYSTRAP,$A2D4);
  497.  
  498. function RctPtInRectangle(x,y:Coord;var r:RectangleType):Boolean; inline(SYSTRAP,$A1C8);
  499. procedure RctSetRectangle(var r:RectangleType;left,top,width,height:Coord); inline(SYSTRAP,$A1C4);
  500.  
  501. procedure SclSetScrollBar(barP:ScrollBarPtr;value,min,max,pageSize:Int16); inline(SYSTRAP,$A2B6);
  502.  
  503. function SelectDay(selectDayBy:SelectDayType;var month,day,year:Int16;Const title:String):Boolean; inline(SYSTRAP,$A2D0);
  504. function SelectOneTime(var hour,minute:Int16;Const title:String):Boolean; inline(SYSTRAP,$A34F);
  505.  
  506. procedure SndPlaySystemSound(beepID:Int8); inline(SYSTRAP,$A234);
  507.  
  508. function StrAToI(const S:string):integer; inline(SYSTRAP,$a0ce);
  509. function StrCaselessCompare(const s1,s2:string):Int16; inline(SYSTRAP,$A0CA);
  510. procedure StrCopy(dst:MemPtr;const src:String); inline(SYSTRAP,$A0C5);
  511. procedure StrIToA(var S:string;N:integer); inline(SYSTRAP,$A0C9);
  512. function StrIToH(var s:String;i:UInt32):StringPtr; inline(SYSTRAP,$A0CB);
  513. procedure StrNCopy(var dst:String;src:MemPtr;n:Int16); inline(SYSTRAP,$A2CE);
  514. function StrStr(const str,token:String):Pointer; inline(SYSTRAP,$A0CD);
  515.  
  516. function SysBatteryInfo(doSet:Boolean;var warnThresholdP,criticalThresholdP:UInt16;var maxTicksP:Int16;var kindP:SysBatteryKind;var pluggedIn:Boolean;var percentP:UInt8):UInt16; inline(SYSTRAP,$A324);
  517. function SysCurAppDatabase(var cardNo:UInt16;var dbID:LocalID):UInt16; inline(SYSTRAP,$A0AC);
  518. function SysFormPointerArrayToStrings(c:Pointer;StringCount:Int16):MemHandle; inline(SYSTRAP,$A0C1);
  519. function SysHandleEvent(var event:EventType):Boolean; inline(SYSTRAP,$A0A9);
  520. function SysTaskDelay(delay:Int32):Err; inline(SYSTRAP,$A0A0);
  521. function SysTicksPerSecond:UInt16; inline(SYSTRAP,$A2E9);
  522. function SysUIAppSwitch(cardNo:UInt16;dbID:LocalID;cmd:UInt16;cmdPBP:Pointer):UInt16; inline(SYSTRAP,$A0A7);
  523.  
  524. Procedure TimeToAscii(hours,minutes:UInt8;timeFormat:TimeFormatType;var pString:String); inline(SYSTRAP,$A268);
  525.  
  526. function TimGetSeconds:UInt32; inline(SYSTRAP,$A0F5);
  527. function TimGetTicks:UInt32; inline(SYSTRAP,$A0F7);
  528. procedure TimSecondsToDateTime(seconds:UInt32;dateTimeP:DateTimePtr); inline(SYSTRAP,$A0FC);
  529.  
  530. function UIPickColor(var indexP:IndexedColorType;var rgbP:RGBColorType;start:UInt16;const titleP,tipP:String):Boolean; inline(SYSTRAP,$A3AC);
  531.  
  532. function WinCreateBitmapWindow(bitmapP:BitmapPtr;var error:UInt16):WinHandle; inline(SYSTRAP,$A3E4);
  533. procedure WinDeleteWindow(win:WinHandle;eraseIt:boolean); inline(SYSTRAP,$A1F8);
  534. procedure WinDrawBitmap(bitmapP:BitmapPtr;x,y:Coord); inline(SYSTRAP,$A226);
  535. procedure WinDrawChars(const chars:string;len:Int16;x,y:Coord); inline(SYSTRAP,$A220);
  536. procedure WinDrawChar(theChar:WChar;x,y:Coord); inline(SYSTRAP,$A350);
  537. procedure WinDrawLine(x1,y1,x2,y2:Coord); inline(SYSTRAP,$A213);
  538. procedure WinDrawRectangle(var r:RectangleType;cornerDiam:UInt16); inline(SYSTRAP,$A218);
  539. procedure WinDrawRectangleFrame(frame:FrameType;var rP:RectangleType); inline(SYSTRAP,$A21B);
  540. procedure WinDrawTruncChars(const chars:String;len:Int16;x,y,maxWidth:Coord); inline(SYSTRAP,$A351);
  541. procedure WinEraseLine(x1,y1,x2,y2:Coord); inline(SYSTRAP,$A215);
  542. procedure WinEraseRectangle(var r:RectangleType;cornerDiam:UInt16); inline(SYSTRAP,$A219);
  543. procedure WinEraseRectangleFrame(frame:FrameType;var rP:RectangleType); inline(SYSTRAP,$A21D);
  544. procedure WinIndexToRGB(i:IndexedColorType;var rgbP:RGBColorType); inline(SYSTRAP,$A39F);
  545. procedure WinPopDrawState; inline(SYSTRAP,$A396);
  546. procedure WinPushDrawState; inline(SYSTRAP,$A395);
  547. function WinRGBToIndex(var rgbP:RGBColorType):IndexedColorType; inline(SYSTRAP,$A39E);
  548. function WinScreenMode(operation:WinScreenModeOperation;var widthP,heightP,depthP:UInt32;var enableColorP:Boolean):Err; inline(SYSTRAP,$A33E);
  549. function WinSetDrawWindow(win:WinHandle):WinHandle; inline(SYSTRAP,$A1FD);
  550. function WinSetForeColor(foreColor:IndexedColorType):IndexedColorType; inline(SYSTRAP,$A398);
  551. function WinSetBackColor(foreColor:IndexedColorType):IndexedColorType; inline(SYSTRAP,$A399);
  552. function WinSetTextColor(foreColor:IndexedColorType):IndexedColorType; inline(SYSTRAP,$A39A);
  553. function WinSetDrawMode(newMode:WinDrawOperation):WinDrawOperation; inline(SYSTRAP,$A397);
  554.  
  555. // VFS functions
  556. function VFSDirEntryEnumerate(dirRef:UInt32;var dirEntryIteratorP:UInt32;var infoP:FileInfoType):Err; inline($7414,SYSTRAP,VFS_TRAP);
  557. function VFSFileClose(fileRefP:UInt32):Err; inline($7404,SYSTRAP,VFS_TRAP);
  558. function VFSFileOpen(volRefNum:UInt16;pathNameP:Pointer;openMode:UInt16;var fileRefP:UInt32):Err; inline($7403,SYSTRAP,VFS_TRAP);
  559. function VFSFileSize(fileRefP:UInt32;var fileSizeP:UInt32):Err; inline($7412,SYSTRAP,VFS_TRAP);
  560. function VFSVolumeEnumerate(var volRefNumP:UInt16;var volIteratorP:UInt32):Err; inline($741B,SYSTRAP,VFS_TRAP);
  561. function VFSVolumeGetLabel(volRefNum:UInt16;const labelP:String;bufLen:UInt16):Err; inline($741D,SYSTRAP,VFS_TRAP);
  562. function VFSVolumeSize(volRefNum:UInt16;var volumeUsedP:UInt32;var volumeTotalP:UInt32):Err; inline($741F,SYSTRAP,VFS_TRAP);
  563.  
  564. // HighRes functions
  565. function WinScreenGetAttribute(selector:WinScreenAttrType;var attrP:UInt32):Err; inline($740E,SYSTRAP,HIGH_DENSITY_TRAP);
  566.  
  567.  
  568. // Special Functions
  569.  
  570. const
  571. V100 = $0100;
  572. V200 = $0200;
  573. V300 = $0300;
  574. V310 = $0310;
  575. V320 = $0320;
  576. V330 = $0330;
  577. V350 = $0350;
  578. V400 = $0400;
  579. V410 = $0410;
  580. V500 = $0500;
  581.  
  582. function VersionSupported(MinVersion:UInt32):boolean;
  583. var
  584. ErrNo:Err;
  585. ROMVersion:UInt32;
  586. begin
  587. ErrNo:=FtrGet(sysFtrCreator,1,ROMVersion);
  588. VersionSupported:=ROMVersion>=MinVersion*$10000;
  589. end;
  590.  
  591. function HandlerNONE(var e:EventType):boolean;
  592. // Needed for Palm OS < v3
  593. begin
  594. HandlerNONE:=false;
  595. end;