forked from crypto2011/IDR
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgressBar.cpp
More file actions
55 lines (48 loc) · 2.09 KB
/
ProgressBar.cpp
File metadata and controls
55 lines (48 loc) · 2.09 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
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "ProgressBar.h"
#include "Threads.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFProgressBar *FProgressBar;
//---------------------------------------------------------------------------
__fastcall TFProgressBar::TFProgressBar(TComponent *Owner)
: TForm(Owner) {}
//---------------------------------------------------------------------------
void __fastcall TFProgressBar::FormShow(TObject *Sender) {
pb->Position = 0;
sb->Panels->Items[0]->Text = "";
sb->Panels->Items[1]->Text = "";
}
//---------------------------------------------------------------------------
void __fastcall TFProgressBar::StartProgress(String text0, String text1, int steps) {
pb->Min = 0;
pb->Max = steps;
pb->Step = 1;
pb->Position = 0;
pb->Update();
sb->Panels->Items[0]->Text = text0;
sb->Panels->Items[1]->Text = text1;
sb->Update();
}
//---------------------------------------------------------------------------
void __fastcall TFProgressBar::wm_updAnalysisStatus(TMessage &msg) {
if (taStartPrBar == msg.WParam) {
const ThreadAnalysisData *startOperation = (ThreadAnalysisData *) msg.LParam;
FProgressBar->StartProgress(startOperation ? startOperation->sbText : String(""), "",
startOperation ? startOperation->pbSteps : 0);
if (startOperation) delete startOperation;
} else if (taUpdatePrBar == msg.WParam) {
FProgressBar->pb->StepIt();
FProgressBar->pb->Invalidate();
} else if (taUpdateStBar == msg.WParam) {
const ThreadAnalysisData *updStatusBar = (ThreadAnalysisData *) msg.LParam;
FProgressBar->sb->Panels->Items[1]->Text = updStatusBar ? updStatusBar->sbText : String("?");
FProgressBar->sb->Invalidate();
if (updStatusBar) delete updStatusBar;
Application->ProcessMessages();
}
}
//---------------------------------------------------------------------------