Fix build for gcc and wx < 3.1.6

This commit is contained in:
Jon Evans 2022-12-08 07:27:30 -05:00
parent 1fcdd94caf
commit 0a881e091c
2 changed files with 14 additions and 3 deletions

View File

@ -36,6 +36,16 @@
static std::unordered_map<unsigned long, int> doNotShowAgainDlgs; static std::unordered_map<unsigned long, int> doNotShowAgainDlgs;
bool IsGUI()
{
#if wxCHECK_VERSION( 3, 1, 6 )
return wxTheApp->IsGUI();
#else
return dynamic_cast<wxAppBase*>( wxTheApp );
#endif
}
KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption, KIDIALOG::KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption,
long aStyle ) long aStyle )
: wxRichMessageDialog( aParent, aMessage, aCaption, aStyle | wxCENTRE | wxSTAY_ON_TOP ), : wxRichMessageDialog( aParent, aMessage, aCaption, aStyle | wxCENTRE | wxSTAY_ON_TOP ),
@ -286,7 +296,7 @@ void DisplayError( wxWindow* aParent, const wxString& aText, int aDisplayTime )
return; return;
} }
if( !wxTheApp->IsGUI() ) if( !IsGUI() )
{ {
wxFprintf( stderr, aText ); wxFprintf( stderr, aText );
return; return;
@ -311,7 +321,7 @@ void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxStri
return; return;
} }
if( !wxTheApp->IsGUI() ) if( !IsGUI() )
{ {
wxFprintf( stderr, aText ); wxFprintf( stderr, aText );
return; return;
@ -338,7 +348,7 @@ void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxSt
return; return;
} }
if( !wxTheApp->IsGUI() ) if( !IsGUI() )
{ {
wxFprintf( stdout, "%s %s", aMessage, aExtraInfo ); wxFprintf( stdout, "%s %s", aMessage, aExtraInfo );
return; return;

View File

@ -28,6 +28,7 @@
#include <wx/string.h> #include <wx/string.h>
#include <functional>
#include <list> #include <list>
#include <map> #include <map>
#include <unordered_map> #include <unordered_map>