KiCad PCB EDA Suite
wx_progress_reporters.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2017 CERN
5 * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * Author: Tomasz Wlostowski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef WX_PROGRESS_REPORTERS_H
28#define WX_PROGRESS_REPORTERS_H
29
30#include <wx/progdlg.h>
31#include <wx/gauge.h>
32#if wxCHECK_VERSION( 3, 1, 0 )
33#include <wx/appprogress.h>
34#endif
35
37
44class WX_PROGRESS_REPORTER : public PROGRESS_REPORTER_BASE, public wxProgressDialog
45{
46public:
62 WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& aTitle, int aNumPhases,
63 bool aCanAbort = true, bool aReserveSpaceForMessage = true );
65
69 void SetTitle( const wxString& aTitle ) override
70 {
71 wxProgressDialog::SetTitle( aTitle );
72 }
73
74private:
75 bool updateUI() override;
76
77private:
78#if wxCHECK_VERSION( 3, 1, 0 )
79 wxAppProgressIndicator m_appProgressIndicator;
80#endif
81
83};
84
85
86class GAUGE_PROGRESS_REPORTER : public PROGRESS_REPORTER_BASE, public wxGauge
87{
88public:
96 GAUGE_PROGRESS_REPORTER( wxWindow* aParent, int aNumPhases );
97
98private:
99 bool updateUI() override;
100};
101
102#endif
GAUGE_PROGRESS_REPORTER(wxWindow *aParent, int aNumPhases)
This implements all the tricky bits for thread safety, but the GUI is left to derived classes.
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
void SetTitle(const wxString &aTitle) override
Change the title displayed on the window caption.
WX_PROGRESS_REPORTER(wxWindow *aParent, const wxString &aTitle, int aNumPhases, bool aCanAbort=true, bool aReserveSpaceForMessage=true)
The PROGRESS_REPORTER will stay on top of aParent.