KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 The 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#include <wx/appprogress.h>
33
35
36#define PR_NO_ABORT 0
37#define PR_CAN_ABORT wxPD_CAN_ABORT
38
39
40#if defined( _WIN32 ) && wxCHECK_VERSION( 3, 3, 0 )
41// In order to get a dark mode compatible progress dialog on Windows with wx 3.3
42#define WX_PROGRESS_REPORTER_BASE wxGenericProgressDialog
43#else
44#define WX_PROGRESS_REPORTER_BASE wxProgressDialog
45#endif
46
54{
55public:
71 WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& aTitle, int aNumPhases, int aCanAbort,
72 bool aReserveSpaceForMessage = true );
74
78 void SetTitle( const wxString& aTitle ) override
79 {
80 WX_PROGRESS_REPORTER_BASE::SetTitle( aTitle );
81 }
82
83private:
84 bool updateUI() override;
85
86private:
87 wxAppProgressIndicator m_appProgressIndicator;
89};
90
91
92class GAUGE_PROGRESS_REPORTER : public PROGRESS_REPORTER_BASE, public wxGauge
93{
94public:
102 GAUGE_PROGRESS_REPORTER( wxWindow* aParent, int aNumPhases );
103
104private:
105 bool updateUI() override;
106};
107
108#endif
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.
wxAppProgressIndicator m_appProgressIndicator
#define WX_PROGRESS_REPORTER_BASE