CategoryBarWnd.h
上传用户:lds876
上传日期:2013-05-25
资源大小:567k
文件大小:5k
源码类别:

P2P编程

开发平台:

Visual C++

  1. #if !defined(AFX_CATEGORYBARWND_H__E3D48BF4_C720_47E5_BF74_F883FD69DD58__INCLUDED_)
  2. #define AFX_CATEGORYBARWND_H__E3D48BF4_C720_47E5_BF74_F883FD69DD58__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // CategoryBarWnd.h : header file
  7. //
  8. #include "ctrlext.h"
  9. #include "val.h"
  10. #include "FileDB.h"
  11. #include "DownloadEngine.h"
  12. #include "CategoryFileDB.h"
  13. #include "CategoryDownload.h"
  14. class CFilesListCtrl;
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CCategoryBarWnd window
  17. class CCategoryBarWnd : public CCategoryDownload// CCategoryFileDB //CTreeCtrlEx
  18. {
  19. // Construction
  20. public:
  21. CCategoryBarWnd();
  22. // Attributes
  23. public:
  24. CImageList m_ctlImage;
  25. UINT m_nIDClipFormat;
  26. // Operations
  27. public:
  28. void OpenTorrentFile(string strTorrentFileName, 
  29. HTREEITEM hItemSel = 0, string strDirectorySave = string(), bool bOverwrite = false);
  30. bool CreateNewCategory(CTreeCursor curSel, CTreeCursor& curNew);
  31. // command handler from mainframe.
  32. void OnUpdateMenuitem(CCmdUI* pCmdUI);
  33. void OnCommandMenuitem(UINT iID);
  34. void OnFindFile();
  35. void OnFindNext();
  36. void OnPopupCommand(UINT nMenuID);
  37. void OnFileListViewInitialUpdate();
  38. // Overrides
  39. // ClassWizard generated virtual function overrides
  40. //{{AFX_VIRTUAL(CCategoryBarWnd)
  41. public:
  42. //}}AFX_VIRTUAL
  43. virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
  44. virtual BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
  45. virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
  46. // Implementation
  47. public:
  48. virtual ~CCategoryBarWnd();
  49. // Generated message map functions
  50. protected:
  51. //{{AFX_MSG(CCategoryBarWnd)
  52. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  53. afx_msg void OnDestroy();
  54. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  55. //}}AFX_MSG
  56. DECLARE_MESSAGE_MAP()
  57. void OnRightClick(NMHDR *pNotifyStruct,LRESULT *result);
  58. void DoPopupMenu(UINT nMenuID);
  59. void OnNodeSelect(NMHDR *pNotifyStruct,LRESULT *result);
  60. friend class CDownloadEngine;
  61. private:
  62. bool CopyFileTorrent(string strTorrentFileName, string& strTorrentFileNameNoPath);
  63. CTreeCursor findFileExist(CTreeCursor& curItem, string strInfohash, CFileDBItem*& pExistFileDBItem);
  64. void findFileByConditions(bool bRefind, string strFindContion = "");
  65. static bool findDownloading(CTreeCursor curItem);
  66. bool GetChildCount(CTreeCursor& curSrc, long& lCategoryCount, long& lFilesCount);
  67. static bool IsChild(CTreeCursor curSrc, CTreeCursor curTarget);
  68. static CTreeCursor MoveTree(CTreeCursor curSrc, CTreeCursor curTarget);
  69. static bool MoveTreeEx(CTreeCursor curSrc, CTreeCursor curTarget);
  70. CTreeCursor m_ItemSel;
  71. /**************************************************************
  72. CFindFileByConditions
  73. **************************************************************/
  74. class CFindFileByConditions
  75. {
  76. public:
  77. CFindFileByConditions();
  78. void Create(CCategoryBarWnd* pCategoryBarWnd);
  79. int findFileByConditions(bool bRefind, string strCondition);
  80. void SetNewStartLocation(CTreeCursor curLocate, CFileDBItem* pFileDBItem);
  81. bool CanFindNext();
  82. CTreeCursor m_curLast;
  83. CFileDBItem* m_pFileItem;
  84. private:
  85. CTreeCursor findFileByConditionsrec(CTreeCursor& curItem, string strCondition);
  86. CCategoryBarWnd* m_pCategoryBarWnd;
  87. bool m_bStart;
  88. string m_strCondition;
  89. }m_FindFileByConditions;
  90. friend class CFindFileByConditions;
  91. /**************************************************************
  92. CCategoryTarget 
  93. **************************************************************/
  94. class CCategoryTarget : public COleDropTarget
  95. {
  96. public:
  97. DROPEFFECT OnDragEnter( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
  98. {
  99. return ((CCategoryBarWnd*) pWnd)->OnDragEnter(pDataObject, dwKeyState, point);
  100. }
  101. virtual DROPEFFECT OnDragOver( CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
  102. {
  103. return ((CCategoryBarWnd*) pWnd)->OnDragOver( pDataObject, dwKeyState, point);
  104. }
  105. virtual BOOL OnDrop( CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
  106. {
  107. return ((CCategoryBarWnd*) pWnd)->OnDrop(pDataObject, dropEffect, point);
  108. }
  109. void OnDragLeave(CWnd* pWnd)
  110. {
  111. COleDropTarget::OnDragLeave(pWnd);
  112. }
  113. }m_dropTarget;
  114. };
  115. /////////////////////////////////////////////////////////////////////////////
  116. //{{AFX_INSERT_LOCATION}}
  117. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  118. #endif // !defined(AFX_CATEGORYBARWND_H__E3D48BF4_C720_47E5_BF74_F883FD69DD58__INCLUDED_)