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.

178 lines
5.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: statdlg.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _INC_CSCUI_STATDLG_H
  11. #define _INC_CSCUI_STATDLG_H
  12. #ifndef _CSCST_H_
  13. # include "cscst.h"
  14. #endif
  15. class CStatusDlg
  16. {
  17. public:
  18. enum Modes { MODE_NORMAL = 0,
  19. MODE_AUTOSYNC
  20. };
  21. static int Create(HWND hwndParent, LPCTSTR pszText, eSysTrayState eState, Modes mode = MODE_NORMAL);
  22. private:
  23. CStatusDlg(HINSTANCE hInstance, LPCTSTR pszText, eSysTrayState eState, Modes mode = MODE_NORMAL);
  24. ~CStatusDlg(void);
  25. int Run(HWND hwndParent);
  26. void Destroy(void);
  27. enum { iIMAGELIST_ICON_SERVER = 0,
  28. iIMAGELIST_ICON_SERVER_OFFLINE,
  29. iIMAGELIST_ICON_SERVER_BACK,
  30. iIMAGELIST_ICON_SERVER_DIRTY
  31. };
  32. //
  33. // An entry in the listview.
  34. //
  35. class LVEntry
  36. {
  37. public:
  38. LVEntry(HINSTANCE hInstance, LPCTSTR pszServer, bool bConnectable);
  39. ~LVEntry(void);
  40. LPCTSTR Server(void) const
  41. { return m_pszServer; }
  42. void GetStatusText(LPTSTR pszStatus, int cchStatus) const;
  43. void GetInfoText(LPTSTR pszInfo, int cchInfo) const;
  44. int GetImageIndex(void) const;
  45. bool AddShare(LPCTSTR pszShare, const CSCSHARESTATS& s, DWORD dwCscStatus);
  46. void GetStats(CSCSHARESTATS *ps, DWORD *pdwCscStatus) const;
  47. int GetShareCount(void) const;
  48. LPCTSTR GetShareName(int iShare) const;
  49. bool IsModified(void) const
  50. {
  51. return (0 < m_stats.cModified);
  52. }
  53. bool IsConnected(void) const
  54. {
  55. return (0 != (FLAG_CSC_SHARE_STATUS_CONNECTED & m_dwCscStatus));
  56. }
  57. bool IsOffline(void) const
  58. {
  59. return (0 != (FLAG_CSC_SHARE_STATUS_DISCONNECTED_OP & m_dwCscStatus));
  60. }
  61. bool IsConnectable(void) const
  62. {
  63. return m_bConnectable;
  64. }
  65. //
  66. // Structure describing the display info for one listview entry.
  67. //
  68. struct DispInfo
  69. {
  70. UINT idsStatusText;
  71. UINT idsInfoText;
  72. int iImage;
  73. };
  74. private:
  75. //
  76. // Disp Info flags used to control what's displayed for the
  77. // entry in the listview.
  78. //
  79. enum { DIF_MODIFIED = 0x00000001,
  80. DIF_AVAILABLE = 0x00000002,
  81. DIF_ONLINE = 0x00000004 };
  82. HINSTANCE m_hInstance;
  83. CSCSHARESTATS m_stats;
  84. DWORD m_dwCscStatus;
  85. LPTSTR m_pszServer;
  86. HDPA m_hdpaShares;
  87. mutable int m_iDispInfo; // Index into s_rgDispInfo[]
  88. bool m_bConnectable;
  89. static const TCHAR s_szBlank[];
  90. static const DispInfo s_rgDispInfo[];
  91. int GetDispInfoIndex(void) const;
  92. //
  93. // Prevent copy.
  94. //
  95. LVEntry(const LVEntry& rhs);
  96. LVEntry& operator = (const LVEntry& rhs);
  97. };
  98. enum { iLVSUBITEM_SERVER = 0,
  99. iLVSUBITEM_STATUS,
  100. iLVSUBITEM_INFO
  101. };
  102. HINSTANCE m_hInstance;
  103. HWND m_hwndDlg;
  104. HWND m_hwndLV;
  105. HIMAGELIST m_himl;
  106. LPTSTR m_pszText;
  107. Modes m_mode; // MODE_NORMAL etc.
  108. eSysTrayState m_eSysTrayState;
  109. int m_cyExpanded;
  110. int m_iLastColSorted;
  111. bool m_bExpanded;
  112. bool m_bSortAscending;
  113. BOOL OnInitDialog(WPARAM wParam, LPARAM lParam);
  114. BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  115. BOOL OnNotify(WPARAM wParam, LPARAM lParam);
  116. BOOL OnDestroy(void);
  117. void OnLVN_GetDispInfo(LV_DISPINFO *plvdi);
  118. void OnLVN_ColumnClick(NM_LISTVIEW *pnmlv);
  119. void CreateListColumns(void);
  120. HIMAGELIST CreateImageList(void);
  121. void FillListView(void);
  122. void DestroyLVEntries(void);
  123. LVEntry *CreateLVEntry(LPCTSTR pszServer, bool bConnectable);
  124. LVEntry *FindLVEntry(LPCTSTR pszServer);
  125. bool ShouldIncludeLVEntry(const CStatusDlg::LVEntry& entry);
  126. bool ShouldCheckLVEntry(const CStatusDlg::LVEntry& entry);
  127. void PrepListForDisplay(void);
  128. void EnableListviewCheckboxes(bool bEnable);
  129. static int CALLBACK CompareLVItems(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  130. static INT_PTR CALLBACK DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  131. void ExpandDialog(bool bExpand);
  132. void UpdateDetailsBtnTitle(void);
  133. void RememberUsersDialogSizePref(bool bExpanded);
  134. bool UserLikesDialogExpanded(void);
  135. HRESULT SynchronizeServers(void);
  136. HRESULT BuildFilenameList(CscFilenameList *pfnl);
  137. };
  138. BOOL TransitionShareOnline(LPCTSTR pszShare, BOOL bShareIsAlive, BOOL bCheckSpeed, DWORD dwPathSpeed);
  139. HRESULT ReconnectServers(CscFilenameList *pfnl, BOOL bCheckForOpenFiles, BOOL bCheckSpeed);
  140. #endif // _INC_CSCUI_STATDLG_H