Browse Source

Use generic progress dialog on windows built with wx3.3 to get dark mode compatible dialogs

pull/18/head
Mark Roszko 4 months ago
parent
commit
95000ce62f
  1. 4
      common/widgets/app_progress_dialog.cpp
  2. 4
      common/widgets/wx_progress_reporters.cpp
  3. 9
      include/widgets/app_progress_dialog.h
  4. 12
      include/widgets/wx_progress_reporters.h

4
common/widgets/app_progress_dialog.cpp

@ -28,7 +28,7 @@
APP_PROGRESS_DIALOG::APP_PROGRESS_DIALOG( const wxString& aTitle, const wxString& aMessage,
int aMaximum, wxWindow* aParent,
bool aIndeterminateTaskBarStatus, int aStyle )
: wxProgressDialog( aTitle,
: APP_PROGRESS_DIALOG_BASE( aTitle,
aMessage == wxEmptyString ? wxString( wxT( " " ) ) : aMessage,
aMaximum, aParent, aStyle ),
m_appProgressIndicator( aParent, aMaximum ),
@ -49,5 +49,5 @@ bool APP_PROGRESS_DIALOG::Update( int aValue, const wxString& aNewMsg, bool* aSk
m_appProgressIndicator.SetValue( aValue );
}
return wxProgressDialog::Update( aValue, aNewMsg, aSkip );
return APP_PROGRESS_DIALOG_BASE::Update( aValue, aNewMsg, aSkip );
}

4
common/widgets/wx_progress_reporters.cpp

@ -33,7 +33,7 @@ WX_PROGRESS_REPORTER::WX_PROGRESS_REPORTER( wxWindow* aParent, const wxString& a
int aNumPhases, int aCanAbort,
bool aReserveSpaceForMessage ) :
PROGRESS_REPORTER_BASE( aNumPhases ),
wxProgressDialog( aTitle,
WX_PROGRESS_REPORTER_BASE( aTitle,
( aReserveSpaceForMessage ? wxT( " " ) : wxT( "" ) ),
1, aParent,
// wxPD_APP_MODAL | // Don't use; messes up OSX when called from
@ -93,7 +93,7 @@ bool WX_PROGRESS_REPORTER::updateUI()
}
// Returns false when cancelled (if it's a cancellable dialog)
bool diag = wxProgressDialog::Update( cur, message );
bool diag = WX_PROGRESS_REPORTER_BASE::Update( cur, message );
return diag;
}

9
include/widgets/app_progress_dialog.h

@ -27,10 +27,17 @@
#include <wx/progdlg.h>
#include <wx/appprogress.h>
#if defined( _WIN32 ) && wxCHECK_VERSION(3,3,0)
// In order to get a dark mode compatible progress dialog on Windows with wx 3.3
#define APP_PROGRESS_DIALOG_BASE wxGenericProgressDialog
#else
#define APP_PROGRESS_DIALOG_BASE wxProgressDialog
#endif
/**
* wxProgressDialog with the option to also update the application progress on the taskbar
*/
class APP_PROGRESS_DIALOG : public wxProgressDialog
class APP_PROGRESS_DIALOG : public APP_PROGRESS_DIALOG_BASE
{
public:
APP_PROGRESS_DIALOG( const wxString& aTitle, const wxString& aMessage, int aMaximum = 100,

12
include/widgets/wx_progress_reporters.h

@ -36,13 +36,21 @@
#define PR_NO_ABORT 0
#define PR_CAN_ABORT wxPD_CAN_ABORT
#if defined( _WIN32 ) && wxCHECK_VERSION( 3, 3, 0 )
// In order to get a dark mode compatible progress dialog on Windows with wx 3.3
#define WX_PROGRESS_REPORTER_BASE wxGenericProgressDialog
#else
#define WX_PROGRESS_REPORTER_BASE wxProgressDialog
#endif
/**
* Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting
* back of work status.
*
* @see PROGRESS_REPORTER.
*/
class WX_PROGRESS_REPORTER : public PROGRESS_REPORTER_BASE, public wxProgressDialog
class WX_PROGRESS_REPORTER : public PROGRESS_REPORTER_BASE, public WX_PROGRESS_REPORTER_BASE
{
public:
/**
@ -69,7 +77,7 @@ public:
*/
void SetTitle( const wxString& aTitle ) override
{
wxProgressDialog::SetTitle( aTitle );
WX_PROGRESS_REPORTER_BASE::SetTitle( aTitle );
}
private:

Loading…
Cancel
Save