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.

234 lines
8.6 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Copyright (C) 1993-1996 Microsoft Corporation. All Rights Reserved.
  3. //
  4. // MODULE: GrpDlg.h
  5. //
  6. // PURPOSE: Defines the CGroupListDlg class.
  7. //
  8. #ifndef __GRPDLG_H__
  9. #define __GRPDLG_H__
  10. #define idtFindDelay 1
  11. #define dtFindDelay 600
  12. #define szDelimiters TEXT(" ,\t;")
  13. // Forward references
  14. class CNNTPServer;
  15. class CGroupList;
  16. class CSubList;
  17. class CEmptyList;
  18. /////////////////////////////////////////////////////////////////////////////
  19. // Types
  20. // SERVERINFO - One of these structs is kept for each news server currently
  21. // configured. We keep all the information about the server,
  22. // including the agent used to connect, the list of groups which
  23. // groups are subscribed or new, etc. here.
  24. typedef struct tagSERVERINFO
  25. {
  26. LPTSTR pszAcct;
  27. CNNTPServer *pNNTPServer;
  28. CGroupList *pGroupList;
  29. CSubList *pSubList;
  30. LPDWORD rgdwItems;
  31. LPDWORD rgdwOrigSub;
  32. DWORD cOrigSub;
  33. DWORD cItems;
  34. BOOL fNewViewed;
  35. BOOL fDirty;
  36. } SERVERINFO, *PSERVERINFO;
  37. // #define SetSubscribed(_b, _f) (_b) = (_f ? ((_b) | GROUP_SUBSCRIBED) : ((_b) & ~GROUP_SUBSCRIBED))
  38. // #define SetNew(_b, _f) (_b) = (_f ? ((_b) | GROUP_NEW) : ((_b) & ~GROUP_NEW))
  39. // SIZETABLE - This struct is used to make the dialog resizable. We keep one
  40. // of these for each control in the dialog. The rect's are updated
  41. // in WM_SIZE. A table of these is built in WM_INITDIALOG.
  42. typedef struct tagSIZETABLE
  43. {
  44. HWND hwndCtl;
  45. UINT id;
  46. RECT rc;
  47. } SIZETABLE, *PSIZETABLE;
  48. // COLUMNS - This struct is used to store the widths of the columns in the
  49. // dialog box so the widths can be persisted from session to session.
  50. // This guy is created in the WM_DESTROY handler and read in
  51. // CGroupListDlg::InitListView().
  52. #define COLUMNS_VERSION 0x1
  53. #define NUM_COLUMNS 2 // Group name, Description
  54. typedef struct tagCOLUMNS
  55. {
  56. DWORD dwVersion;
  57. DWORD rgWidths[NUM_COLUMNS];
  58. } COLUMNS, *PCOLUMNS;
  59. // CGroupListDlg - This class manages the Newsgroups... Dialog. It used to have
  60. // several subclasses so if it seems wierd to have all these
  61. // functions as virtual that's why.
  62. class CGroupListDlg
  63. {
  64. /////////////////////////////////////////////////////////////////////////
  65. // Initialization
  66. public:
  67. CGroupListDlg();
  68. ~CGroupListDlg();
  69. #ifdef DEAD
  70. virtual BOOL FCreate(HWND hwndOwner, CNNTPServer *pNNTPServer,
  71. CSubList *pSubList, LPTSTR* ppszNewGroup,
  72. LPTSTR* ppszNewServer, UINT m_iTabSelect = 0,
  73. BOOL fEnableGoto = TRUE, LPTSTR pszAcctSel = NULL);
  74. #endif // DEAD
  75. protected:
  76. virtual BOOL FCreate(HWND hwndOwner, UINT idd);
  77. /////////////////////////////////////////////////////////////////////////
  78. // Message Handlers
  79. protected:
  80. static BOOL CALLBACK GroupListDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam,
  81. LPARAM lParam);
  82. virtual BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam);
  83. virtual void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
  84. virtual LRESULT OnNotify(HWND hwnd, int idFrom, LPNMHDR pnmhdr);
  85. virtual void OnTimer(HWND hwnd, UINT id);
  86. virtual void OnPaint(HWND hwnd);
  87. virtual void OnClose(HWND hwnd);
  88. virtual void OnDestroy(HWND hwnd);
  89. virtual void OnSize(HWND hwnd, UINT state, int cx, int cy);
  90. virtual void OnGetMinMaxInfo(HWND hwnd, LPMINMAXINFO lpmmi);
  91. virtual void OnChangeServers(HWND hwnd);
  92. virtual BOOL IsGrpDialogMessage(HWND hwnd, LPMSG pMsg);
  93. /////////////////////////////////////////////////////////////////////////
  94. // Group List manipulation
  95. void QueryList(LPTSTR pszQuery);
  96. void ResetList(void);
  97. void FilterFavorites(void);
  98. void FilterNew(void);
  99. void SetSubscribed(PSERVERINFO psi, DWORD index, BOOL fSubscribe);
  100. BOOL IsSubscribed(PSERVERINFO psi, DWORD index);
  101. BOOL IsNew(PSERVERINFO psi, DWORD index);
  102. /////////////////////////////////////////////////////////////////////////
  103. // Utility functions
  104. LPTSTR GetFindText(void);
  105. virtual BOOL ChangeServers(LPTSTR pszAcct, BOOL fUseAgent,
  106. BOOL fForce = FALSE);
  107. BOOL FillServerList(HWND hwndList, LPTSTR pszSelectServer);
  108. BOOL OnSwitchTabs(HWND hwnd, UINT iTab);
  109. void UpdateStateInfo(PSERVERINFO psi);
  110. virtual BOOL InitListView(HWND hwndList);
  111. void SetLastServer(LPTSTR pszAcct);
  112. void SetLastGroup(LPTSTR pszGroup);
  113. PSERVERINFO FInitServer(LPTSTR pszAcct, CNNTPServer* pNNTPServer,
  114. CSubList* pSubList);
  115. void Sort(LPDWORD rgdw, DWORD c);
  116. void ShowHideDescriptions(BOOL fShow);
  117. HRESULT HandleResetButton(void);
  118. HRESULT SaveCurrentSubscribed(PSERVERINFO psi, LPTSTR** prgszSubscribed, LPUINT pcSub);
  119. HRESULT RestoreCurrentSubscribed(PSERVERINFO psi, LPTSTR* rgszSub, UINT cSub);
  120. // Whenever we do something that might update the state of a button on
  121. // the dialog, we call this to allow the subclasses to update their UI.
  122. virtual void UpdateStateUI(void);
  123. protected:
  124. /////////////////////////////////////////////////////////////////////////
  125. // Class Data
  126. // Array of server information objects. Each object contains all the
  127. // objects and state arrays for the server it needs.
  128. PSERVERINFO m_rgServerInfo;
  129. DWORD m_cServers;
  130. DWORD m_cMaxServers;
  131. PSERVERINFO m_psiCur;
  132. // Handy window handles to have available
  133. HWND m_hwnd;
  134. HWND m_hwndList;
  135. HWND m_hwndFindText;
  136. HWND m_hwndOwner;
  137. // State variables
  138. BOOL m_fAllowDesc; // TRUE if the user can search descriptions
  139. LPTSTR m_pszPrevQuery; // The string that we last searched on
  140. UINT m_cchPrevQuery; // The allocated length of m_pszPrevQuery
  141. // Values used in resizing
  142. UINT m_cxHorzSep;
  143. UINT m_cyVertSep;
  144. PSIZETABLE m_rgst; // st - SizeTable. I use this a lot so I wanted it short - SteveSer
  145. SIZE m_sizeDlg;
  146. POINT m_ptDragMin;
  147. // Everything else
  148. HIMAGELIST m_himlFolders; // The folder image list.
  149. HIMAGELIST m_himlState;
  150. CNNTPServer *m_pNNTPServer;
  151. CSubList *m_pSubList;
  152. BOOL m_fServerListInited;
  153. DWORD m_dwCurrentAccount;
  154. LPTSTR m_pszCurrentAccount;
  155. LPTSTR m_pszLastAccount;
  156. LPTSTR m_pszLastGroup;
  157. BOOL m_fSaveWindowPos;
  158. UINT m_iTabSelect;
  159. BOOL m_fEnableGoto;
  160. LPTSTR m_pszAcctSel;
  161. HICON m_hIcon;
  162. CEmptyList *m_pEmptyList;
  163. };
  164. /////////////////////////////////////////////////////////////////////////////
  165. // Dialog Control ID's
  166. //
  167. #define idcGroupList 2001 // Group list listview
  168. #define idcFindText 2002 // Find query edit box
  169. #define idcShowFavorites 2003 // Filter favorites toggle
  170. #define idcUseDesc 2004 // Use Desc checkbox
  171. #define idcServers 2005 // Server Listview
  172. #define idcHelp 2006 // Help button
  173. #define idcResetList 2007 // Rebuild the group list
  174. #define idcUpdateNow 1001
  175. #define idcFullWord 1004
  176. #define idcPreview 1006
  177. #define idcProgress 1007
  178. #define idcApply 1008
  179. #define idcFind 1010
  180. #define idcDispText 1011
  181. #define idcServerText 1012
  182. #define idcPreviewBtn 1013
  183. #define idcSubscribe 1014
  184. #define idcUnsubscribe 1015
  185. #define idcTabs 1016
  186. #define idcStaticNewsServers 1017
  187. #define idcStaticVertLine 1018
  188. #define idcStaticHorzLine 1019
  189. #define idcGoto 1020
  190. enum { iTabAll = 0, iTabSubscribed, iTabNew, iTabMax };
  191. enum { iCtlFindText = 0, iCtlUseDesc, iCtlGroupList, iCtlSubscribe, iCtlUnsubscribe,
  192. iCtlResetList, iCtlGoto, iCtlOK, iCtlCancel, iCtlServers, iCtlStaticNewsServers, iCtlStaticVertLine,
  193. iCtlStaticHorzLine, iCtlTabs, iCtlMax };
  194. #endif