-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCtrlDownloadTabBar.h
125 lines (111 loc) · 3.94 KB
/
CtrlDownloadTabBar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//
// CtrlDownloadTabBar.h
//
// This file is part of PeerProject (peerproject.org) © 2008-2010
// Portions copyright Shareaza Development Team, 2002-2007.
//
// PeerProject is free software. You may redistribute and/or modify it
// under the terms of the GNU Affero General Public License
// as published by the Free Software Foundation (fsf.org);
// version 3 or later at your option. (AGPLv3)
//
// PeerProject is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Affero General Public License 3.0 for details:
// (http://www.gnu.org/licenses/agpl.html)
//
#pragma once
class CDownload;
class CDownloadGroup;
class CDownloadTabBar : public CControlBar
{
// Construction
public:
CDownloadTabBar();
virtual ~CDownloadTabBar();
// Item Class
public:
class TabItem
{
// Construction
public:
TabItem(CDownloadGroup* pGroup, int nCookie);
virtual ~TabItem();
// Attributes
public:
CDownloadGroup* m_pGroup;
CString m_sCaption;
CString m_sName;
int m_nImage;
int m_nCount;
BOOL m_bSelected;
// Operations
public:
BOOL Update(int nCookie);
BOOL Select(BOOL bSelect);
void Paint(CDownloadTabBar* pBar, CDC* pDC, CRect* pRect, BOOL bHot, BOOL bTransparent);
};
// Attributes
protected:
CList< TabItem* > m_pItems;
TabItem* m_pHot;
BOOL m_bTimer;
BOOL m_bMenuGray;
int m_nCookie;
int m_nMaximumWidth;
UINT m_nMessage;
CString m_sMessage;
CBitmap m_bmImage;
// Operations
public:
void OnSkinChange();
void Update(int nCookie);
BOOL Select(TabItem* pHit = NULL);
TabItem* HitTest(const CPoint& point, CRect* pItemRect = NULL) const;
BOOL DropShowTarget(CList< CDownload* >* pList, const CPoint& ptScreen);
BOOL DropObjects(CList< CDownload* >* pList, const CPoint& ptScreen);
protected:
void UpdateGroups(int nCookie);
void UpdateStates(int nCookie);
int GetSelectedCount(BOOL bDownloads = FALSE);
TabItem* GetSelectedItem();
CDownloadGroup* GetSelectedGroup();
void GetSelectedDownloads(CList< CDownload* >* pDownloads);
void NotifySelection();
// Overrides
public:
virtual BOOL Create(CWnd* pParentWnd, DWORD dwStyle = WS_CHILD|WS_VISIBLE|CBRS_BOTTOM, UINT nID = AFX_IDW_STATUS_BAR);
virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL /*bDisableIfNoHndler*/) {};
virtual void DoPaint(CDC* pDC);
// Implementation
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
afx_msg void OnDownloadGroupNew();
afx_msg void OnUpdateDownloadGroupRemove(CCmdUI* pCmdUI);
afx_msg void OnDownloadGroupRemove();
afx_msg void OnUpdateDownloadGroupMoveRight(CCmdUI* pCmdUI);
afx_msg void OnDownloadGroupMoveRight();
afx_msg void OnUpdateDownloadGroupMoveLeft(CCmdUI* pCmdUI);
afx_msg void OnDownloadGroupMoveLeft();
afx_msg void OnUpdateDownloadGroupProperties(CCmdUI* pCmdUI);
afx_msg void OnDownloadGroupProperties();
afx_msg void OnUpdateDownloadGroupResume(CCmdUI* pCmdUI);
afx_msg void OnDownloadGroupResume();
afx_msg void OnUpdateDownloadGroupPause(CCmdUI* pCmdUI);
afx_msg void OnDownloadGroupPause();
afx_msg void OnUpdateDownloadGroupClear(CCmdUI* pCmdUI);
afx_msg void OnDownloadGroupClear();
afx_msg void OnDownloadGroupOpen();
DECLARE_MESSAGE_MAP()
friend class TabItem;
};