Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
4.6 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. bltlbsel.hxx
  7. Selections within listboxen - class definitions
  8. FILE HISTORY:
  9. beng 06-Aug-1991 Created
  10. */
  11. #ifndef _BLT_HXX_
  12. #error "Don't include this file directly; instead, include it through blt.hxx"
  13. #endif // _BLT_HXX_
  14. #ifndef _BLTLBSEL_HXX_
  15. #define _BLTLBSEL_HXX_
  16. #if 0 // DEAD
  17. /******************************************************************
  18. NAME: LB_SELECTION
  19. SYNOPSIS: Represents the set of lines selected in a listbox.
  20. INTERFACE:
  21. LB_SELECTION() - given a listbox, builds the current selection
  22. in that listbox.
  23. Select() - adds an existing element (identified by index)
  24. to the selection. I.e., selects the element.
  25. This would be "Add" to a collection.
  26. Unselect() - removes an existing selected element (id'd by
  27. index) from the selection. I.e., deselects
  28. the element. This would be "Remove" to a coll.
  29. UnselectAll() - removes every element from the selection.
  30. Listbox has no selection.
  31. AddItem() - adds a new element to the listbox, and leaves
  32. it selected. The difference between adding the
  33. item here and adding it at the listbox is
  34. that this selects the new item.
  35. DeleteAllItems()- completely empties the listbox of every item
  36. currently selected.
  37. QueryCount() - return the number of items selected.
  38. Redundant, given LISTBOX::QuerySelCount,
  39. yet convenient.
  40. PARENT: BASE
  41. USES: BLT_LISTBOX, ITER_LB
  42. CAVEATS:
  43. At any time a listbox may have no more than one SELECTION
  44. object in existence. More may lead to bad behavior, esp. if
  45. each calls DeleteAllItems or some such.
  46. NOTES:
  47. Placing the SELECTION attributes in a separate class lets the
  48. class allocate the (potentially large) set of selected records
  49. only when needed.
  50. The selection uses a "collection" metaphor, which is a bit
  51. confusing when juxtaposed against AddItem and such which work
  52. on the underlying collection of LBI*.
  53. HISTORY:
  54. beng 06-Aug-1991 Created
  55. **********************************************************************/
  56. DLL_CLASS LB_SELECTION: public BASE
  57. {
  58. friend LB_ITER;
  59. private:
  60. BLT_LISTBOX* _plb;
  61. UINT _cilbSelected;
  62. INT * _pilbSelected;
  63. public:
  64. LB_SELECTION( BLT_LISTBOX * );
  65. UINT QueryCount() const;
  66. VOID Select(INT)
  67. VOID Unselect(INT);
  68. VOID UnselectAll();
  69. INT AddItem(const LBI*);
  70. VOID DeleteAllItems();
  71. };
  72. /*************************************************************************
  73. NAME: ITER_LB
  74. SYNOPSIS: Step through the lines of a listbox
  75. INTERFACE:
  76. ITER_LB() - Construct the iterator. Can take either a listbox
  77. proper, in which case it steps through every line,
  78. or else a selection, in which case it steps through
  79. only those lines selected.
  80. Reset() - as usual for iterator
  81. operator()
  82. Next() - as usual for iterator, returning a LBI*.
  83. UnselectThis() - unselects the *current* line (the one just returned
  84. by Next). This will remove it from a selection.
  85. DeleteThis()- deletes the *current* line from the listbox.
  86. USES: LBI
  87. CAVEATS:
  88. The usual warnings apply about deleting items from a collection
  89. which has outstanding iterators. UnselectThis and DeleteThis
  90. are guaranteed safe on the current iterator, but no others.
  91. NOTES:
  92. HISTORY:
  93. beng 06-Aug-1991 Created
  94. **************************************************************************/
  95. DLL_CLASS ITER_LB
  96. {
  97. public:
  98. ITER_LB(const BLT_LISTBOX &);
  99. ITER_LB(const LB_SELECTION &);
  100. VOID Reset();
  101. LBI* Next();
  102. LBI* operator()() { return Next(); }
  103. VOID UnselectThis();
  104. VOID DeleteThis();
  105. };
  106. #endif // DEAD
  107. #endif // _BLTLBSEL_HXX_ - end of file