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.

145 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. Folder.h
  5. Abstract:
  6. Interface for the CFolder class.
  7. This abstract class is the base class for all 4 types of folders.
  8. It manages it's own view internally.
  9. Author:
  10. Eran Yariv (EranY) Dec, 1999
  11. Revision History:
  12. --*/
  13. #if !defined(AFX_FOLDER_H__80DEDFB5_FF48_41BC_95DC_04A4060CF5FD__INCLUDED_)
  14. #define AFX_FOLDER_H__80DEDFB5_FF48_41BC_95DC_04A4060CF5FD__INCLUDED_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif // _MSC_VER > 1000
  18. typedef map<DWORDLONG, CFaxMsg*> MSGS_MAP;
  19. class CFolder : public CTreeNode
  20. {
  21. public:
  22. CFolder(FolderType type) :
  23. CTreeNode (type),
  24. m_pAssignedView(NULL),
  25. m_bVisible(FALSE),
  26. m_pServer (NULL),
  27. m_bValidList (FALSE),
  28. m_hBuildThread (NULL),
  29. m_bCsDataInitialized (FALSE),
  30. m_bRefreshFailed (FALSE),
  31. m_bRefreshing(FALSE),
  32. m_bLocked (FALSE)
  33. {
  34. DBG_ENTER (TEXT("CFolder::CFolder"));
  35. }
  36. virtual ~CFolder();
  37. DECLARE_DYNAMIC(CFolder)
  38. virtual DWORD Init ();
  39. void AttachView();
  40. CFolderListView* GetView() const { return m_pAssignedView; }
  41. void SetVisible ();
  42. void SetInvalid() { m_bValidList = FALSE; }
  43. BOOL IsValid() { return m_bValidList; }
  44. void SetServer (CServerNode *pServer) ;
  45. const CServerNode* GetServer () const { return m_pServer; }
  46. virtual void AssertValid( ) const;
  47. DWORD InvalidateContents (BOOL bClearView);
  48. DWORD RebuildContents ();
  49. MSGS_MAP &GetData () { return m_Msgs; }
  50. DWORD GetDataCount ()
  51. {
  52. EnterData();
  53. int iSize = m_Msgs.size();
  54. LeaveData();
  55. return iSize;
  56. }
  57. CFaxMsg* FindMessage (DWORDLONG dwlMsgId);
  58. void EnterData()
  59. {
  60. if(!m_bCsDataInitialized)
  61. {
  62. ASSERT (FALSE);
  63. return;
  64. }
  65. EnterCriticalSection (&m_CsData);
  66. }
  67. void LeaveData()
  68. {
  69. if(!m_bCsDataInitialized)
  70. {
  71. ASSERT (FALSE);
  72. return;
  73. }
  74. LeaveCriticalSection (&m_CsData);
  75. }
  76. BOOL IsRefreshing () const { return m_bRefreshing; }
  77. DWORD OnJobRemoved (DWORDLONG dwlMsgId, CFaxMsg* pMsg = NULL);
  78. virtual DWORD OnJobAdded (DWORDLONG dwlMsgId) = 0;
  79. virtual DWORD OnJobUpdated (DWORDLONG dwlMsgId, PFAX_JOB_STATUS pNewStatus) = 0;
  80. int GetActivityStringResource() const;
  81. BOOL Locked() { return m_bLocked; }
  82. DWORD StopBuildThread (BOOL bWaitForDeath = TRUE);
  83. protected:
  84. MSGS_MAP m_Msgs; // Map of message id to CFaxMsg pointer.
  85. CFolderListView* m_pAssignedView; // Points to the view assigned to this node.
  86. BOOL m_bVisible; // Is this node currently visible?
  87. CServerNode *m_pServer; // Points to the server's node
  88. BOOL m_bStopRefresh; // Should we abort the refresh operation?
  89. BOOL m_bValidList; // Is the list of jobs / message valid?
  90. virtual DWORD Refresh () = 0;
  91. void PreDestruct (); // Call on sons dtor
  92. private:
  93. HANDLE m_hBuildThread; // Handle of background contents building thread
  94. BOOL m_bCsDataInitialized; // Did we init the m_CsData member?
  95. CRITICAL_SECTION m_CsData; // Critical section to protect the data
  96. static DWORD WINAPI BuildThreadProc (LPVOID lpParameter);
  97. BOOL m_bRefreshFailed; // Was the refresh a failure?
  98. BOOL m_bRefreshing;
  99. BOOL m_bLocked; // If TRUE, do not process server notifications
  100. };
  101. #endif // !defined(AFX_FOLDER_H__80DEDFB5_FF48_41BC_95DC_04A4060CF5FD__INCLUDED_)