mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 07:00:36 +08:00
Finished implementing ProgressStatusBar class
This commit is contained in:
parent
1ffd57d37a
commit
1e8655bf24
@ -52,6 +52,18 @@ void ProgressStatusBar::OnSize(wxSizeEvent &e) {
|
||||
e.Skip();
|
||||
}
|
||||
|
||||
void ProgressStatusBar::SetProgress(size_t val) {
|
||||
if (!this->prog->IsShown()) {
|
||||
this->ShowProgress(true);
|
||||
}
|
||||
if (val == this->prog->GetRange()) {
|
||||
this->prog->SetValue(0);
|
||||
this->ShowProgress(false);
|
||||
} else {
|
||||
this->prog->SetValue(val);
|
||||
}
|
||||
}
|
||||
|
||||
void ProgressStatusBar::OnTimer(wxTimerEvent& e) {
|
||||
if (this->prog->IsShown())
|
||||
this->timer->Stop();
|
||||
|
@ -32,21 +32,25 @@ public:
|
||||
cb == nullptr ? this->cancelbutton->Hide() : this->cancelbutton->Show();
|
||||
}
|
||||
|
||||
/// Accessor function for the current value of the progress bar
|
||||
size_t GetProgress() {return this->prog->GetValue();}
|
||||
|
||||
/// Accessor function for busy state
|
||||
bool IsBusy() {return this->busy;}
|
||||
|
||||
/// Show the progress bar.
|
||||
void ShowProgress(bool show = true) { this->prog->Show(show); this->prog->Pulse(); }
|
||||
|
||||
/// Accessor function for the current value of the progress bar
|
||||
inline size_t GetProgress() {return this->prog->GetValue();}
|
||||
|
||||
/// Accessor set function for the current value of the progress bar
|
||||
void SetProgress(size_t val);
|
||||
|
||||
void SetRange(int range) { if (range != this->prog->GetRange() ) this->prog->SetRange(range);}
|
||||
|
||||
/// Start the timer.
|
||||
void Run(int rate = 100) { if (this->timer->IsRunning()) this->timer->Start(rate);};
|
||||
|
||||
void StartBusy(int rate = 100) { this->busy = true; this->ShowProgress(true); if (!this->timer->IsRunning()) this->timer->Start(rate); }
|
||||
void StopBusy() { this->timer->Stop(); this->ShowProgress(false); this->prog->SetValue(0); this->busy = false;}
|
||||
|
||||
/// Accessor function for busy state
|
||||
bool IsBusy() {return this->busy;}
|
||||
|
||||
private:
|
||||
void OnSize(wxSizeEvent& e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user