-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathFlashGetToolBar.cpp
98 lines (76 loc) · 1.99 KB
/
FlashGetToolBar.cpp
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
// FlashGetToolBar.cpp : implementation file
//
#include "stdafx.h"
#include "myget.h"
#include "FlashGetToolBar.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFlashGetToolBar
CFlashGetToolBar::CFlashGetToolBar()
{
}
CFlashGetToolBar::~CFlashGetToolBar()
{
}
BEGIN_MESSAGE_MAP(CFlashGetToolBar, CToolBar)
//{{AFX_MSG_MAP(CFlashGetToolBar)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONDBLCLK()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFlashGetToolBar message handlers
void CFlashGetToolBar::ResizeBar(int cx)
{
if (m_ctlDownloadSpeed.GetSafeHwnd())
{
CRect rectBar;
GetWindowRect(&rectBar);
ScreenToClient(&rectBar);
rectBar.left = 0;
rectBar.right = rectBar.left + cx - 2;
MoveWindow(&rectBar);
CRect rectSpeed;
rectSpeed = rectBar;
rectSpeed.right = cx - 2;
rectSpeed.left = rectSpeed.right - 125;
m_ctlDownloadSpeed.MoveWindow(&rectSpeed);
}
}
void CFlashGetToolBar::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (GetToolBarCtrl().HitTest(&point) >= 0)
{
CToolBar::OnLButtonDown(nFlags, point);
}
}
void CFlashGetToolBar::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// CToolBar::OnLButtonDblClk(nFlags, point);
}
void CFlashGetToolBar::SetSpeed(float fSpeedByKB)
{
m_ctlDownloadSpeed.SetPos((UINT)(fSpeedByKB * 100 / 8));
}
int CFlashGetToolBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CToolBar::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
CRect rect;
rect.left = 0;
rect.right = 125;
rect.top = 0;
rect.bottom = 40;
m_ctlDownloadSpeed.Create(WS_VISIBLE | WS_CHILD, rect, this, IDC_SPEEDBAR);
m_ctlDownloadSpeed.SetRange(0, 100);
return 0;
}