00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 #include "CtrlDownloadTip.h"
00025
00026 class CDownload;
00027 class CDownloadSource;
00028
00029
00030 class CDownloadsCtrl : public CWnd
00031 {
00032
00033 public:
00034 CDownloadsCtrl();
00035 virtual ~CDownloadsCtrl();
00036
00037 DECLARE_DYNAMIC(CDownloadsCtrl)
00038
00039
00040 public:
00041 BOOL Create(CWnd* pParentWnd, UINT nID);
00042 BOOL Update();
00043 BOOL Update(int nGroupCookie);
00044 BOOL DropShowTarget(CPtrList* pSel, const CPoint& ptScreen);
00045 BOOL DropObjects(CPtrList* pSel, const CPoint& ptScreen);
00046 int GetExpandableColumnX() const;
00047 protected:
00048 void InsertColumn(int nColumn, LPCTSTR pszCaption, int nFormat, int nWidth);
00049 void SaveColumnState();
00050 BOOL LoadColumnState();
00051 void SelectTo(int nIndex);
00052 void BubbleSortDownloads(int nColumn);
00053 void DeselectAll(CDownload* pExcept1 = NULL, CDownloadSource* pExcept2 = NULL);
00054 void SelectAll(CDownload* pExcept1 = NULL, CDownloadSource* pExcept2 = NULL);
00055 int GetSelectedCount();
00056 BOOL HitTest(const CPoint& point, CDownload** ppDownload, CDownloadSource** ppSource, int* pnIndex, RECT* prcItem);
00057 BOOL GetAt(int nSelect, CDownload** ppDownload, CDownloadSource** ppSource);
00058 BOOL GetRect(CDownload* pSelect, RECT* prcItem);
00059 void MoveSelected(int nDelta);
00060 CString GetDownloadStatus(CDownload *pDownload);
00061 int GetClientStatus(CDownload *pDownload);
00062 void PaintDownload(CDC& dc, const CRect& rcRow, CDownload* pDownload, BOOL bFocus, BOOL bDrop);
00063 void PaintSource(CDC& dc, const CRect& rcRow, CDownload* pDownload, CDownloadSource* pSource, BOOL bFocus);
00064 void OnBeginDrag(CPoint ptAction);
00065 CImageList* CreateDragImage(CPtrList* pSel, const CPoint& ptMouse);
00066 public:
00067 static BOOL IsFiltered(CDownload* pDownload);
00068 static BOOL IsExpandable(CDownload* pDownload);
00069
00070 friend class CDownloadsWnd;
00071
00072
00073 protected:
00074 CHeaderCtrl m_wndHeader;
00075 CDownloadTipCtrl m_wndTip;
00076 CImageList m_pProtocols;
00077 int m_nGroupCookie;
00078 int m_nFocus;
00079 BOOL m_bCreateDragImage;
00080 CDownload* m_pDragDrop;
00081 BOOL m_bDrag;
00082 CPoint m_ptDrag;
00083 CDownload* m_pDeselect1;
00084 CDownloadSource* m_pDeselect2;
00085 BOOL* m_pbSortAscending;
00086 int m_nScrollWheelLines;
00087
00088
00089 protected:
00090 DECLARE_MESSAGE_MAP()
00091 public:
00092 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00093 afx_msg void OnDestroy();
00094 afx_msg void OnSize(UINT nType, int cx, int cy);
00095 afx_msg void OnPaint();
00096 afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00097 afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00098 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
00099 afx_msg void OnChangeHeader(NMHDR* pNotifyStruct, LRESULT* pResult);
00100 afx_msg void OnSortPanelItems(NMHDR* pNotifyStruct, LRESULT* pResult);
00101 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00102 afx_msg void OnEnterKey();
00103 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00104 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00105 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00106 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00107 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00108 afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
00109 afx_msg void OnSetFocus(CWnd* pOldWnd);
00110 afx_msg void OnKillFocus(CWnd* pNewWnd);
00111 };
00112
00113 #define DLF_ACTIVE 0x01
00114 #define DLF_QUEUED 0x02
00115 #define DLF_SOURCES 0x04
00116 #define DLF_PAUSED 0x08
00117
00118 #define DLF_ALL (DLF_ACTIVE|DLF_QUEUED|DLF_SOURCES|DLF_PAUSED)