Skip to content

WxProgressDialog

Example

아래와 같이 구현한 다음 EVENT방식으로 다른 THREAD에서 호출하면 된다.

void MainFrame::openProgress(wxString const & title, wxString const & message, int const & max)
{
    std::lock_guard<std::mutex> guard(_progress_locker);
    _progress = new (std::nothrow) wxProgressDialog(title, message, max, this);
    _progress->ShowModal();
}
void MainFrame::setProgressMaxValue(int const & value)
{
    std::lock_guard<std::mutex> guard(_progress_locker);
    if (_progress != nullptr && value <= _progress->GetRange()) {
        _progress->SetRange(value);
    }
}
void MainFrame::setProgressValue()
{
    std::lock_guard<std::mutex> guard(_progress_locker);
    if (_progress == nullptr) {
        return;
    }
    _progress->Pulse();
}
void MainFrame::setProgressValue(int const & value)
{
    std::lock_guard<std::mutex> guard(_progress_locker);
    if (_progress == nullptr) {
        return;
    }
    _progress->Update(value);
}
void MainFrame::closeProgress()
{
    std::lock_guard<std::mutex> guard(_progress_locker);
    if (_progress == nullptr) {
        return;
    }

    // _progress->Update(_progress->GetRange());
    _progress->Destroy();
    // delete _progress;
    // _progress = nullptr;
}

Favorite site