list.pp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. unit list;
  21. interface
  22. uses palmos, coretraps, rect, font, window, control;
  23. const
  24. noListSelection = -1;
  25. //-------------------------------------------------------------------
  26. // List structures
  27. //-------------------------------------------------------------------
  28. type
  29. ListAttrType = record
  30. {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_LISTS} // These fields will not be available in the next OS release!
  31. Bits: UInt16;
  32. {
  33. UInt16 usable :1; // set if part of ui
  34. UInt16 enabled :1; // set if interactable (not grayed out)
  35. UInt16 visible :1; // set if drawn
  36. UInt16 poppedUp :1; // set if choices displayed in popup win.
  37. UInt16 hasScrollBar:1; // set if the list has a scroll bar
  38. UInt16 search :1; // set if incremental search is enabled
  39. UInt16 reserved :2;
  40. }
  41. {$endif}
  42. end;
  43. ListAttrTag = ^ListAttrType;
  44. // Load data callback routine prototype
  45. type
  46. ListDrawDataFuncType = procedure (itemNum: Int16; bounds: RectanglePtr; var itemsText: PChar);
  47. ListDrawDataFuncPtr = ListDrawDataFuncType;
  48. type
  49. ListType = record
  50. {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_LISTS} // These fields will not be available in the next OS release!
  51. id: UInt16;
  52. bounds: RectangleType;
  53. attr: ListAttrType;
  54. itemsText: ^PChar;
  55. numItems: Int16; // number of choices in the list
  56. currentItem: Int16; // currently display choice
  57. topItem: Int16; // top item visible when poped up
  58. font: FontID; // font used to draw list
  59. reserved: UInt8;
  60. popupWin: WinHandle; // used only by popup lists
  61. drawItemsCallback: ListDrawDataFuncPtr; // 0 indicates no function
  62. {$endif}
  63. end;
  64. ListPtr = ^ListType;
  65. //-------------------------------------------------------------------
  66. // List routines
  67. //-------------------------------------------------------------------
  68. procedure LstDrawList(listP: ListPtr); syscall sysTrapLstDrawList;
  69. procedure LstEraseList(listP: ListPtr); syscall sysTrapLstEraseList;
  70. function LstGetSelection(const listP: ListPtr): Int16; syscall sysTrapLstGetSelection;
  71. function LstGetSelectionText(const listP: ListPtr; itemNum: Int16): PChar; syscall sysTrapLstGetSelectionText;
  72. function LstHandleEvent(listP: ListPtr; const eventP: EventPtr): Boolean; syscall sysTrapLstHandleEvent;
  73. procedure LstSetHeight(listP: ListPtr; visibleItems: Int16); syscall sysTrapLstSetHeight;
  74. procedure LstSetPosition(listP: ListPtr; x, y: Coord); syscall sysTrapLstSetPosition;
  75. procedure LstSetSelection(listP: ListPtr; itemNum: Int16); syscall sysTrapLstSetSelection;
  76. procedure LstSetListChoices(listP: ListPtr; var itemsText: PChar; numItems: Int16); syscall sysTrapLstSetListChoices;
  77. procedure LstSetDrawFunction(listP: ListPtr; func: ListDrawDataFuncPtr); syscall sysTrapLstSetDrawFunction;
  78. procedure LstSetTopItem(listP: ListPtr; itemNum: Int16); syscall sysTrapLstSetTopItem;
  79. procedure LstMakeItemVisible(listP: ListPtr; itemNum: Int16); syscall sysTrapLstMakeItemVisible;
  80. function LstGetNumberOfItems(const listP: ListPtr): Int16; syscall sysTrapLstGetNumberOfItems;
  81. function LstPopupList(listP: ListPtr): Int16; syscall sysTrapLstPopupList;
  82. function LstScrollList(listP: ListPtr; direction: WinDirectionType; itemCount: Int16): Boolean; syscall sysTrapLstScrollList;
  83. function LstGetVisibleItems(const listP: ListPtr): Int16; syscall sysTrapLstGetVisibleItems;
  84. function LstNewList(formPP: PointerPtr; id: UInt16; x, y, width, height: Coord;
  85. font: FontID; visibleItems, triggerId: Int16): Err; syscall sysTrapLstNewList;
  86. function LstGetTopItem(const listP: ListPtr): Int16; syscall sysTrapLstGetTopItem;
  87. implementation
  88. end.