-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDlgProgress.h
99 lines (73 loc) · 2.43 KB
/
DlgProgress.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
#ifndef _DLGPROGRESS_H_
#define _DLGPROGRESS_H_
class Interface;
#include "IProgress.h"
#include "ParticleState.h"
// ----------------------------------------------------------------------------
// Structure used to pass recalculation info to background thread
//
struct RecalcThreadParams {
public:
ParticleSystemState* pPartState;
Interval animRange;
IProgress* pProgress;
INode* pParticleNode;
Tab<INode*>* pEventList;
};
// ---------------------------------------------------------------------------
//
// DlgProgress.h
//
// Class that handles progress update and cancellation messages in Max
// by displaying a modal dialog with a progress bar and cancel button
//
// ---------------------------------------------------------------------------
class DlgProgress : public IProgress {
public:
enum { STATE_UNSTARTED, STATE_RUNNING, STATE_FINISHED };
DlgProgress(ParticleSystemState*, Interval, INode*,
Tab<INode*>* pEventList = NULL);
int doRecalc();
void progressStart();
void progressNotify(int progress, int total);
void progressEnd();
bool isCancelled();
#ifdef MAX64
static INT_PTR CALLBACK ProgressDlgProc(HWND hDlg, UINT iMsg, WPARAM wParam,
LPARAM lParam);
#else
static BOOL CALLBACK ProgressDlgProc(HWND hDlg, UINT iMsg, UINT wParam,
LONG lParam);
#endif
private:
static DlgProgress* currentInstance;
int currentProgress;
int progressTotal;
int progressState;
bool cancelled;
RecalcThreadParams recalcParams;
};
// ----------------------------------------------------------------------------
class NullProgress : public IProgress {
public:
NullProgress(){};
virtual void progressStart(){};
virtual void progressNotify(int progress, int total){};
virtual void progressEnd(){};
virtual bool isCancelled() { return false; };
};
// ----------------------------------------------------------------------------
class ButtonProgress : public IProgress {
private:
HWND hButton;
int curPct;
void setButtonPctText();
void resetButtonText();
public:
ButtonProgress(HWND hWnd) : hButton(hWnd), curPct(0){};
virtual void progressStart();
virtual void progressNotify(int progress, int total);
virtual void progressEnd();
virtual bool isCancelled() { return false; };
};
#endif // _DLGPROGRESS_H_