home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / out-of-phase-102-c / OutOfPhase 1.02 Source / OutOfPhase Folder / Level 1 Extensions 29Sep94 / StringList.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-23  |  4.2 KB  |  115 lines  |  [TEXT/KAHL]

  1. /* StringList.h */
  2.  
  3. #ifndef Included_StringList_h
  4. #define Included_StringList_h
  5.  
  6. /* StringList module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* Screen */
  12. /* Memory */
  13. /* DataMunging */
  14. /* Scroll */
  15. /* EventLoop */
  16. /* Array */
  17.  
  18. /* StringList provides a scrolling list of text strings which can be selected. */
  19.  
  20. #include "Screen.h"
  21. #include "EventLoop.h"
  22.  
  23. struct StringListRec;
  24. typedef struct StringListRec StringListRec;
  25.  
  26. #define StringListDoAllowMultipleSelection (True)
  27. #define StringListDontAllowMultipleSelection (False)
  28.  
  29. /* forward declaration for Array */
  30. struct ArrayRec;
  31.  
  32. /* allocate a new, empty string list.  Title is null terminated */
  33. StringListRec*        NewStringList(WinType* Window, OrdType X, OrdType Y,
  34.                                         OrdType Width, OrdType Height, FontType Font, FontSizeType FontSize,
  35.                                         MyBoolean AllowMultipleSelection, char* Title);
  36.  
  37. /* dispose the string list and all of the items in it */
  38. void                            DisposeStringList(StringListRec* List);
  39.  
  40. /* find out where the string list is located */
  41. OrdType                        GetStringListXLoc(StringListRec* List);
  42. OrdType                        GetStringListYLoc(StringListRec* List);
  43. OrdType                        GetStringListWidth(StringListRec* List);
  44. OrdType                        GetStringListHeight(StringListRec* List);
  45.  
  46. /* what font is being used to display the string list */
  47. FontType                    GetStringListFont(StringListRec* List);
  48.  
  49. /* what point size is being used to display the string list */
  50. FontSizeType            GetStringListFontSize(StringListRec* List);
  51.  
  52. /* how many lines of text are visible in the string list */
  53. long                            GetStringListNumVisibleLines(StringListRec* List);
  54.  
  55. /* change the location of the string list */
  56. void                            SetStringListLoc(StringListRec* List, OrdType X, OrdType Y,
  57.                                         OrdType Width, OrdType Height);
  58.  
  59. /* change the font being used to display the string list */
  60. void                            SetStringListFontInfo(StringListRec* List, FontType Font,
  61.                                         FontSizeType FontSize);
  62.  
  63. /* do a complete redraw of the string list */
  64. void                            RedrawStringList(StringListRec* List);
  65.  
  66. /* return a count of the number of selected items in the string list */
  67. long                            GetStringListHowManySelectedItems(StringListRec* List);
  68.  
  69. /* return an Array containing a list of the References of all selected items */
  70. struct ArrayRec*    GetListOfSelectedItems(StringListRec* List);
  71.  
  72. /* add a new element to the string list.  String is the string to be added to the */
  73. /* list, and OurReference is the reference pointer that identifies the item.  */
  74. /* BeforeThisReference is the item to insert it before.  if it is NIL then the */
  75. /* item is appended to the list.  NIL can be passed for the name if the name isn't */
  76. /* known yet.  Returns True if insertion was successful. */
  77. MyBoolean                    InsertStringListElement(StringListRec* List, char* String,
  78.                                         void* BeforeThisReference, void* OurReference, MyBoolean Redraw);
  79.  
  80. /* change the name of a string list element associated with the specified reference */
  81. void                            ChangeStringListElementName(StringListRec* List, char* NewName,
  82.                                         void* Reference);
  83.  
  84. /* remove an element from the string list */
  85. void                            RemoveStringListElement(StringListRec* List, void* Reference,
  86.                                         MyBoolean Redraw);
  87.  
  88. /* see if the specified location is within the string list box */
  89. MyBoolean                    StringListHitTest(StringListRec* List, OrdType X, OrdType Y);
  90.  
  91. /* do a mouse down in the string list to select items.  returns True if it was */
  92. /* a double click. */
  93. MyBoolean                    StringListMouseDown(StringListRec* List, OrdType X, OrdType Y,
  94.                                         ModifierFlags Modifiers);
  95.  
  96. /* select (hilite) the specified element in the list */
  97. void                            SelectStringListElement(StringListRec* List, void* Reference);
  98.  
  99. /* deselect the specified element in the list */
  100. void                            DeselectStringListElement(StringListRec* List, void* Reference);
  101.  
  102. /* enable the scrollbar display in the list */
  103. void                            EnableStringList(StringListRec* List);
  104.  
  105. /* disable the scrollbar display in the list */
  106. void                            DisableStringList(StringListRec* List);
  107.  
  108. /* deselect all of the items in the string list that are selected */
  109. void                            DeselectAllStringListElements(StringListRec* List);
  110.  
  111. /* make sure selection is visible in the window */
  112. void                            MakeStringListSelectionVisible(StringListRec* List);
  113.  
  114. #endif
  115.