-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProgressDlg.cpp
More file actions
109 lines (93 loc) · 2.33 KB
/
ProgressDlg.cpp
File metadata and controls
109 lines (93 loc) · 2.33 KB
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
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: PROGRESSDLG.CPP
** COMPONENT: The Application.
** DESCRIPTION: CProgressDlg class definition.
**
*******************************************************************************
*/
#include "Common.hpp"
#include "ProgressDlg.hpp"
#include "UTCMGRApp.hpp"
/******************************************************************************
** Method: Default constructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CProgressDlg::CProgressDlg()
: CDialog(IDD_PROGRESS)
{
DEFINE_CTRL_TABLE
CTRL(IDC_OPERATION, &m_txtLabel)
CTRL(IDC_PROGRESS, &m_barMeter)
END_CTRL_TABLE
}
/******************************************************************************
** Method: OnInitDialog()
**
** Description: Initialise the dialog.
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CProgressDlg::OnInitDialog()
{
// Display it.
Centre();
Show();
}
/******************************************************************************
** Method: InitMeter()
**
** Description: Initialise the progress bar.
**
** Parameters: nSteps The maximum number of steps.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CProgressDlg::InitMeter(uint nSteps)
{
m_barMeter.Range(0, nSteps);
}
/******************************************************************************
** Method: Update*()
**
** Description: Updates the label and/or progress bar.
**
** Parameters: pszLabel The new label.
** nSteps The number of steps done.
**
** Returns: Nothing.
**
*******************************************************************************
*/
void CProgressDlg::UpdateLabel(const tchar* pszLabel)
{
ASSERT(pszLabel != nullptr);
m_txtLabel.Text(pszLabel);
App.m_MainThread.ProcessMsgQueue();
}
void CProgressDlg::UpdateMeter(uint nSteps)
{
m_barMeter.Pos(nSteps);
App.m_MainThread.ProcessMsgQueue();
}
void CProgressDlg::UpdateLabelAndMeter(const tchar* pszLabel, uint nSteps)
{
ASSERT(pszLabel != nullptr);
m_txtLabel.Text(pszLabel);
m_barMeter.Pos(nSteps);
App.m_MainThread.ProcessMsgQueue();
}