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

P2P编程

开发平台:

Visual C++

  1. #if !defined(AFX_PEERSLISTCTRL_H__E019D10C_4F57_45F5_8360_A5D212031356__INCLUDED_)
  2. #define AFX_PEERSLISTCTRL_H__E019D10C_4F57_45F5_8360_A5D212031356__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // PeersListCtrl.h : header file
  7. //
  8. #include "ListCtrlBaseEx.h"
  9. #include "PeerInfo.h"
  10. class CFileDBItem;
  11. class CConncetionData;
  12. class CSetupRegister;
  13. class CMonitorWnd;
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CPeersListCtrl window
  16. class CPeersListCtrl : public CListCtrlBaseEx  // CListCtrl
  17. {
  18. // Construction
  19. public:
  20. CPeersListCtrl();
  21. // Attributes
  22. public:
  23. CPeerInfo m_PeerInfoWnd;
  24. // Operations
  25. public:
  26. BOOL CreateEx(CWnd *pParent, CRect rc, long lID, long lParam, CSetupRegister* pSetupRegister, CMonitorWnd* pMonitorWnd);
  27. void Monitor(CFileDBItem* pFileDBItem = 0);
  28. void ShowAllPeers(bool bRefreshInfo);
  29. void OnMenuItemPeerInfo(UINT uID, const CConncetionData& conData);
  30. // Overrides
  31. // ClassWizard generated virtual function overrides
  32. //{{AFX_VIRTUAL(CPeersListCtrl)
  33. //}}AFX_VIRTUAL
  34. // Implementation
  35. public:
  36. virtual ~CPeersListCtrl();
  37. // Generated message map functions
  38. protected:
  39. //{{AFX_MSG(CPeersListCtrl)
  40. afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
  41. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  42. afx_msg void OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
  43. afx_msg void OnSize(UINT nType, int cx, int cy);
  44. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  45. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  46. //}}AFX_MSG
  47. // afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
  48. afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
  49. afx_msg void OnMenuItemPeers(UINT uID);
  50. afx_msg void OnMenuitemCopy();
  51. afx_msg void OnMenuitemSelectAll();
  52. afx_msg void OnMenuitemMonitorSub(UINT uID);
  53. DECLARE_MESSAGE_MAP()
  54. private:
  55. static int CALLBACK Compare1(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
  56. void OnShowColumn(int iItem);
  57. void OnColumnSort(int iColumn);
  58. void RefreshPeerText(int iItem, CConncetionData& Conn);
  59. void _ShowAllPeers(bool bRefreshInfo);
  60. void ShowPeerText(int iItem);
  61. enum eColumns {eIcon, eIP, eLocale,  eDownRate, eUpRate, eDownCount, eUpCount, eHave, 
  62. eInterested, eChoking, eInteresting, eChocked, ePeersColumnCount};
  63. CImageList m_ctlImage;
  64. CFileDBItem* m_pFileDBItem;
  65. CSetupRegister* m_pSetupRegister;
  66. CMonitorWnd* m_pMonitorWnd;
  67. int m_iSortedCol;
  68. // bool m_bSortAscending;
  69. // int m_iSortedCol;
  70. int m_arrColType[ePeersColumnCount];
  71. /*
  72. enum ImageState{IID_UNCOMPLETE = 0, IID_COMPLETE, IID_DOWNLOAD, IID_UPLOAD, 
  73. IID_DOWNLOAD_TRACKER, IID_UPLOAD_TRACKER, IID_DOWNLOAD_OTHERS, IID_UPLOAD_OTHERS, 
  74. IID_DOWNLOAD_SEED, IID_UPLOAD_SEED, IID_BAD, IID_PREPARE, IID_PAUSE};
  75. //*/
  76. enum {IID_UPLOAD, IID_DOWNLOAD, IID_CONNECTING, IID_DELETE, IID_PAUSE};
  77. };
  78. /////////////////////////////////////////////////////////////////////////////
  79. //{{AFX_INSERT_LOCATION}}
  80. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  81. #endif // !defined(AFX_PEERSLISTCTRL_H__E019D10C_4F57_45F5_8360_A5D212031356__INCLUDED_)