list.pp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. (******************************************************************************
  2. *
  3. * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
  4. * All rights reserved.
  5. *
  6. * File: List.h
  7. *
  8. * Release: Palm OS SDK 4.0 (63220)
  9. *
  10. * Description:
  11. * This file defines list structures and routines.
  12. *
  13. * History:
  14. * November 3, 1994 Created by Roger Flores
  15. * Name Date Description
  16. * ---- ---- -----------
  17. * bob 2/9/99 fixed const stuff
  18. *
  19. *****************************************************************************)
  20. {$IFNDEF FPC_DOTTEDUNITS}
  21. unit list;
  22. {$ENDIF FPC_DOTTEDUNITS}
  23. interface
  24. {$IFDEF FPC_DOTTEDUNITS}
  25. uses PalmApi.Palmos, PalmApi.Coretraps, PalmApi.Rect, PalmApi.Font, PalmApi.Window, PalmApi.Control;
  26. {$ELSE FPC_DOTTEDUNITS}
  27. uses palmos, coretraps, rect, font, window, control;
  28. {$ENDIF FPC_DOTTEDUNITS}
  29. const
  30. noListSelection = -1;
  31. //-------------------------------------------------------------------
  32. // List structures
  33. //-------------------------------------------------------------------
  34. type
  35. ListAttrType = record
  36. {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_LISTS} // These fields will not be available in the next OS release!
  37. Bits: UInt16;
  38. {
  39. UInt16 usable :1; // set if part of ui
  40. UInt16 enabled :1; // set if interactable (not grayed out)
  41. UInt16 visible :1; // set if drawn
  42. UInt16 poppedUp :1; // set if choices displayed in popup win.
  43. UInt16 hasScrollBar:1; // set if the list has a scroll bar
  44. UInt16 search :1; // set if incremental search is enabled
  45. UInt16 reserved :2;
  46. }
  47. {$endif}
  48. end;
  49. ListAttrTag = ^ListAttrType;
  50. // Load data callback routine prototype
  51. type
  52. ListDrawDataFuncType = procedure (itemNum: Int16; bounds: RectanglePtr; var itemsText: PAnsiChar);
  53. ListDrawDataFuncPtr = ListDrawDataFuncType;
  54. type
  55. ListType = record
  56. {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_LISTS} // These fields will not be available in the next OS release!
  57. id: UInt16;
  58. bounds: RectangleType;
  59. attr: ListAttrType;
  60. itemsText: ^PAnsiChar;
  61. numItems: Int16; // number of choices in the list
  62. currentItem: Int16; // currently display choice
  63. topItem: Int16; // top item visible when poped up
  64. font: FontID; // font used to draw list
  65. reserved: UInt8;
  66. popupWin: WinHandle; // used only by popup lists
  67. drawItemsCallback: ListDrawDataFuncPtr; // 0 indicates no function
  68. {$endif}
  69. end;
  70. ListPtr = ^ListType;
  71. //-------------------------------------------------------------------
  72. // List routines
  73. //-------------------------------------------------------------------
  74. procedure LstDrawList(listP: ListPtr); syscall sysTrapLstDrawList;
  75. procedure LstEraseList(listP: ListPtr); syscall sysTrapLstEraseList;
  76. function LstGetSelection(const listP: ListPtr): Int16; syscall sysTrapLstGetSelection;
  77. function LstGetSelectionText(const listP: ListPtr; itemNum: Int16): PAnsiChar; syscall sysTrapLstGetSelectionText;
  78. function LstHandleEvent(listP: ListPtr; const eventP: EventPtr): Boolean; syscall sysTrapLstHandleEvent;
  79. procedure LstSetHeight(listP: ListPtr; visibleItems: Int16); syscall sysTrapLstSetHeight;
  80. procedure LstSetPosition(listP: ListPtr; x, y: Coord); syscall sysTrapLstSetPosition;
  81. procedure LstSetSelection(listP: ListPtr; itemNum: Int16); syscall sysTrapLstSetSelection;
  82. procedure LstSetListChoices(listP: ListPtr; var itemsText: PAnsiChar; numItems: Int16); syscall sysTrapLstSetListChoices;
  83. procedure LstSetDrawFunction(listP: ListPtr; func: ListDrawDataFuncPtr); syscall sysTrapLstSetDrawFunction;
  84. procedure LstSetTopItem(listP: ListPtr; itemNum: Int16); syscall sysTrapLstSetTopItem;
  85. procedure LstMakeItemVisible(listP: ListPtr; itemNum: Int16); syscall sysTrapLstMakeItemVisible;
  86. function LstGetNumberOfItems(const listP: ListPtr): Int16; syscall sysTrapLstGetNumberOfItems;
  87. function LstPopupList(listP: ListPtr): Int16; syscall sysTrapLstPopupList;
  88. function LstScrollList(listP: ListPtr; direction: WinDirectionType; itemCount: Int16): Boolean; syscall sysTrapLstScrollList;
  89. function LstGetVisibleItems(const listP: ListPtr): Int16; syscall sysTrapLstGetVisibleItems;
  90. function LstNewList(formPP: PointerPtr; id: UInt16; x, y, width, height: Coord;
  91. font: FontID; visibleItems, triggerId: Int16): Err; syscall sysTrapLstNewList;
  92. function LstGetTopItem(const listP: ListPtr): Int16; syscall sysTrapLstGetTopItem;
  93. implementation
  94. end.