Source code of Windows XP (NT5)
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.

293 lines
8.0 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. olb.hxx
  7. Header file for the outline listbox
  8. This outline listbox is not a general purpose outline listbox.
  9. Rather, it only supports the Enterprise/Domain/Server outline in the
  10. Winnet browsing subsystem.
  11. FILE HISTORY:
  12. rustanl 16-Nov-1991 Created
  13. rustanl 22-Mar-1991 Rolled in code review changes from CR
  14. on 21-Mar-1991 attended by ChuckC,
  15. TerryK, BenG, AnnMc, RustanL.
  16. gregj 01-May-1991 Added GUILTT support.
  17. Johnl 14-Jun-1991 Added +/- support to LM_OLLB
  18. KeithMo 23-Oct-1991 Added forward references.
  19. Chuckc 23-Feb-1992 Added SELECTION_TYPE
  20. KeithMo 23-Jul-1992 Added maskDomainSources and
  21. pszDefaultSelection to LM_OLLB.
  22. KeithMo 16-Nov-1992 Performance tuning.
  23. YiHsinS 10-Mar-1993 Add a second constructor for LM_OLLB
  24. that initially contains no data.
  25. Also added FillAllInfo.
  26. */
  27. #ifndef _OLB_HXX_
  28. #define _OLB_HXX_
  29. extern "C"
  30. {
  31. #include "domenum.h" // for BROWSE_*_DOMAIN[S] flags
  32. } // extern "C"
  33. #include "focus.hxx" // for SELECTION_TYPE
  34. #include "lmoesrv.hxx" // for SERVER1_ENUM
  35. #include "domenum.hxx" // for BROWSE_DOMAIN_ENUM
  36. enum OUTLINE_LB_LEVEL
  37. {
  38. // Note, these numbers also indicate the indent level. Hence,
  39. // the order nor the starting point must not be tampered with.
  40. #if ENTERPRISE
  41. OLLBL_ENTERPRISE,
  42. #endif
  43. OLLBL_DOMAIN,
  44. OLLBL_SERVER,
  45. };
  46. //
  47. // Forward references.
  48. //
  49. DLL_CLASS OLLB_ENTRY;
  50. DLL_CLASS OUTLINE_LISTBOX;
  51. DLL_CLASS LM_OLLB;
  52. /*************************************************************************
  53. NAME: OLLB_ENTRY
  54. SYNOPSIS: Entry in an outline listbox.
  55. PARENT: LBI
  56. USES: NLS_STR
  57. NOTES:
  58. OLLB_ENTRY:OUTLINE_LISTBOX :: LBI:BLT_LISTBOX
  59. HISTORY:
  60. beng 05-Oct-1991 Win32 conversion
  61. beng 21-Apr-1992 BLT_LISTBOX -> LISTBOX
  62. **************************************************************************/
  63. DLL_CLASS OLLB_ENTRY : public LBI
  64. {
  65. friend class OUTLINE_LISTBOX;
  66. private:
  67. OUTLINE_LB_LEVEL _ollbl;
  68. BOOL _fExpanded;
  69. NLS_STR _nlsDomain;
  70. NLS_STR _nlsServer;
  71. NLS_STR _nlsComment;
  72. VOID SetExpanded( BOOL f = TRUE ) // called only by OUTLINE_LISTBOX
  73. { _fExpanded = f; }
  74. public:
  75. OLLB_ENTRY( OUTLINE_LB_LEVEL ollbl,
  76. BOOL fExpanded,
  77. const TCHAR * pszDomain,
  78. const TCHAR * pszServer,
  79. const TCHAR * pszComment );
  80. virtual ~OLLB_ENTRY();
  81. INT QueryLevel() const
  82. { return (INT) _ollbl ; }
  83. /* Query the type of this LBI, currently returns an OUTLINE_LB_LEVEL
  84. */
  85. OUTLINE_LB_LEVEL QueryType() const
  86. { return _ollbl; }
  87. BOOL IsExpanded() const
  88. { return _fExpanded; }
  89. #if ENTERPRISE
  90. const TCHAR * QueryEnterprise() const
  91. { return _achServer; }
  92. #endif
  93. const TCHAR * QueryDomain( VOID ) const
  94. { return _nlsDomain.QueryPch(); }
  95. const TCHAR * QueryServer( VOID ) const
  96. { return _nlsServer.QueryPch(); }
  97. const TCHAR * QueryComment( VOID ) const
  98. { return _nlsComment.QueryPch(); }
  99. virtual VOID Paint( LISTBOX * plb, HDC hdc, const RECT * prect,
  100. GUILTT_INFO * pGUILTT ) const;
  101. virtual INT Compare( const LBI * plbi ) const;
  102. virtual WCHAR QueryLeadingChar() const;
  103. };
  104. /*************************************************************************
  105. NAME: OUTLINE_LISTBOX
  106. SYNOPSIS: Listbox with outline-manipulation support
  107. PARENT: BLT_LISTBOX
  108. USES: DMID_DTE, DM_DTE
  109. HISTORY:
  110. beng 05-Oct-1991 Win32 conversion
  111. beng 21-Feb-1992 Make ctor use CID type
  112. **************************************************************************/
  113. DLL_CLASS OUTLINE_LISTBOX : public BLT_LISTBOX
  114. {
  115. private:
  116. #if ENTERPRISE
  117. DMID_DTE * _pdmiddteEnterprise;
  118. #endif
  119. DMID_DTE * _pdmiddteDomain;
  120. DMID_DTE * _pdmiddteDomainExpanded;
  121. DMID_DTE * _pdmiddteServer;
  122. INT _nS;
  123. protected:
  124. INT AddItem( OUTLINE_LB_LEVEL ollbl,
  125. BOOL fExpanded,
  126. const TCHAR * pszDomain,
  127. const TCHAR * pszServerName,
  128. const TCHAR * pszComment );
  129. INT CD_Char( WCHAR wch, USHORT nLastPos );
  130. public:
  131. OUTLINE_LISTBOX( OWNER_WINDOW * powin,
  132. CID cid,
  133. BOOL fCanExpand = TRUE ) ;
  134. ~OUTLINE_LISTBOX();
  135. DECLARE_LB_QUERY_ITEM( OLLB_ENTRY );
  136. INT FindItem( const TCHAR * pszDomain,
  137. const TCHAR * pszServer = NULL ) const;
  138. #if ENTERPRISE
  139. INT AddEnterprise( const TCHAR * pszEnterprise,
  140. const TCHAR * pszComment );
  141. #endif
  142. INT AddDomain( const TCHAR * pszDomain,
  143. const TCHAR * pszComment,
  144. BOOL fExpanded = FALSE );
  145. INT AddServer( const TCHAR * pszDomain,
  146. const TCHAR * pszServer,
  147. const TCHAR * pszComment );
  148. VOID SetDomainExpanded( INT i, BOOL f = TRUE );
  149. BOOL IsS()
  150. { return ( _nS < 0 ); }
  151. // The following method provides the listbox items with access to the
  152. // different display maps.
  153. //
  154. DM_DTE * QueryDmDte( OUTLINE_LB_LEVEL ollbl, BOOL fExpanded ) const;
  155. };
  156. /*************************************************************************
  157. NAME: LM_OLLB
  158. SYNOPSIS: Listbox that hierarchically list servers, domains and
  159. eventually enterprises.
  160. INTERFACE: See class def.
  161. PARENT: OUTLINE_LISTBOX
  162. USES:
  163. NOTES:
  164. HISTORY:
  165. JohnL 14-Jun-1991 Added CD_Char to support +/- expansion
  166. of domains.
  167. beng 21-Aug-1991 Removed LC_CURRENT_ITEM magic number
  168. beng 05-Oct-1991 Win32 conversion
  169. KeithMo 23-Jul-1992 Added maskDomainSources and
  170. pszDefaultSelection.
  171. **************************************************************************/
  172. DLL_CLASS LM_OLLB : public OUTLINE_LISTBOX
  173. {
  174. private:
  175. #if ENTERPRISE
  176. APIERR FillEnterprise();
  177. #endif
  178. APIERR FillDomains( ULONG maskDomainSources,
  179. const TCHAR * pszDefaultSelection );
  180. APIERR FillServers( const TCHAR * pszDomain, UINT * pcServersAdded );
  181. INT AddIdempDomain( const TCHAR * pszDomain, const TCHAR * pszComment );
  182. SELECTION_TYPE _seltype ;
  183. ULONG _nServerTypes;
  184. protected:
  185. APIERR OnUserAction( const CONTROL_EVENT & e );
  186. INT CD_Char( WCHAR wch, USHORT nLastPos );
  187. public:
  188. LM_OLLB( OWNER_WINDOW * powin,
  189. CID cid,
  190. SELECTION_TYPE seltype,
  191. const TCHAR * pszDefaultSelection = NULL,
  192. ULONG maskDomainSources = BROWSE_LM2X_DOMAINS,
  193. ULONG nServerTypes = (ULONG)-1L );
  194. /*
  195. * This form of constructor does not get the data initially and
  196. * the listbox is disabled. FillAllInfo is used to fill this
  197. * kind of listbox.
  198. */
  199. LM_OLLB( OWNER_WINDOW * powin,
  200. CID cid,
  201. SELECTION_TYPE seltype,
  202. ULONG nServerTypes );
  203. VOID FillAllInfo( BROWSE_DOMAIN_ENUM *pEnumDomains,
  204. SERVER1_ENUM *pEnumServers,
  205. const TCHAR *pszSelection );
  206. APIERR ToggleDomain( INT iDomain );
  207. APIERR ToggleDomain()
  208. { return ToggleDomain(QueryCurrentItem()); }
  209. APIERR ExpandDomain( INT iDomain );
  210. APIERR ExpandDomain()
  211. { return ExpandDomain(QueryCurrentItem()); }
  212. APIERR CollapseDomain( INT iDomain );
  213. APIERR CollapseDomain()
  214. { return CollapseDomain(QueryCurrentItem()); }
  215. };
  216. #endif // _OLB_HXX_