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

P2P编程

开发平台:

Visual C++

  1. #if !defined(AFX_FILESLISTCTRL_H__DDCB9AC9_603C_4945_9798_670F1A1DD128__INCLUDED_)
  2. #define AFX_FILESLISTCTRL_H__DDCB9AC9_603C_4945_9798_670F1A1DD128__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // FilesListCtrl.h : header file
  7. //
  8. #include "ListCtrlBase.h"
  9. #include "ctrlext.h"
  10. #include "ListCtrlBaseEx.h"
  11. #include "MenuSpawn.h"
  12. class CMonitorWnd;
  13. class CFileDBItem;
  14. class CCategoryBarWnd;
  15. class CSetupRegister;
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CFilesListCtrl window
  18. class CFilesListCtrl : public CListCtrlBaseEx // CListCtrl
  19. {
  20. // Construction
  21. public:
  22. CFilesListCtrl();
  23. // Attributes
  24. public:
  25. CTreeCursor m_curCursor;
  26. vector<CFileDBItem*> m_vDragFileDBItems;
  27. // Operations
  28. public:
  29. // Overrides
  30. // ClassWizard generated virtual function overrides
  31. //{{AFX_VIRTUAL(CFilesListCtrl)
  32. public:
  33. virtual BOOL PreTranslateMessage(MSG* pMsg);
  34. //}}AFX_VIRTUAL
  35. // Implementation
  36. public:
  37. virtual ~CFilesListCtrl();
  38. BOOL CreateEx(CWnd* pParent, CRect& rc, long lParam, CMonitorWnd* pMonitorWnd, CCategoryBarWnd* pCategoryBarWnd, CSetupRegister* pSetupRegister);
  39. void SetSetupParameter();
  40. void LoadCatetory(CTreeCursor curItem, CFileDBItem* pFileDBItemSel = 0);
  41. void OnDownloadTerminated(long lParam, bool bCompletedMove);
  42. void OnUpdateMenuitem(CCmdUI* pCmdUI);
  43. void OnCommandMenuitem(UINT iID);
  44. // Generated message map functions
  45. protected:
  46. //{{AFX_MSG(CFilesListCtrl)
  47. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  48. afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
  49. afx_msg void OnMenuitemDel();
  50. afx_msg void OnMenuitemDownload();
  51. afx_msg void OnItemchanged(NMHDR* pNMHDR, LRESULT* pResult);
  52. afx_msg void OnMenuitemStop();
  53. afx_msg void OnTimer(UINT nIDEvent);
  54. afx_msg void OnDestroy();
  55. afx_msg void OnMenuitemMoveto();
  56. afx_msg void OnMenuitemFileProperty();
  57. afx_msg void OnMenuitemCopyTorrentFilePath();
  58. afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  59. afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
  60. //}}AFX_MSG
  61. afx_msg void OnItemDblclk(NMHDR* pNMHDR, LRESULT* pResult);
  62. afx_msg void OnMenuitemMonitorSub(UINT uID);
  63. afx_msg void OnMenuitemPause();
  64. afx_msg void OnMenuitemOpenDownloadedFile();
  65. afx_msg void OnMenuitemRunParamter();
  66. afx_msg void OnMenuitemOpenDownloadedDirectory();
  67. afx_msg void OnMenuitemRestore();
  68. void OnItemclickSort(NMHDR* pNMHDR, LRESULT* pResult);
  69. void OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult);
  70. afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
  71. // afx_msg void OnMenuitemDelLink();
  72. // afx_msg void OnMenuitemLocateCategory();
  73. DECLARE_MESSAGE_MAP()
  74. private:
  75. void OnShowColumn(int iItem);
  76. void OnColumnSort(int iColumn);
  77. bool OnContextMenuRecycle(CWnd* pWnd, CPoint point);
  78. void DeleteSelectedItem(bool bForceDelete);
  79. void ShowFileDBItemText(int iItem);
  80. void ShowFileDBItemActive(int iItem);
  81. CMenuSpawn m_menuspawnPopup;
  82. bool m_bDeleteing;
  83. CImageList  m_ctlImage;
  84. CImageList m_ctlImageDelete;
  85. CMonitorWnd* m_pMonitorWnd;
  86. CCategoryBarWnd* m_pCategoryBarWnd;
  87. CSetupRegister* m_pSetupRegister;
  88. enum eColumns{eIcon, eFileName, eCompleted, eFilesize, eTimeleft, 
  89. eTimerunned, eDownloadrate, eUploadrate, eSeeds, eModifiedTime, eCreateTime,  eAllSize};
  90. int m_iSortedCol;
  91. static int CALLBACK Compare1(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  92. enum ImageState{IID_UNCOMPLETE = 0, IID_COMPLETE, IID_DOWNLOAD, IID_UPLOAD, 
  93. IID_DOWNLOAD_TRACKER, IID_UPLOAD_TRACKER, IID_DOWNLOAD_OTHERS, IID_UPLOAD_OTHERS, 
  94. IID_DOWNLOAD_SEED, IID_UPLOAD_SEED, IID_BAD, IID_PREPARE, IID_PAUSE, IID_DOWNLOAD_FIRE, IID_UPLOAD_FIRE};
  95. };
  96. /////////////////////////////////////////////////////////////////////////////
  97. //{{AFX_INSERT_LOCATION}}
  98. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  99. #endif // !defined(AFX_FILESLISTCTRL_H__DDCB9AC9_603C_4945_9798_670F1A1DD128__INCLUDED_)