From 0a881e091c4c76ca69242b3806fea8ee9124ea7d Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@craftyjon.com>
Date: Thu, 8 Dec 2022 07:27:30 -0500
Subject: [PATCH] Fix build for gcc and wx < 3.1.6

---
 common/confirm.cpp                | 16 +++++++++++++---
 include/properties/property_mgr.h |  1 +
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/common/confirm.cpp b/common/confirm.cpp
index fa9730fb5e..5b594dcb81 100644
--- a/common/confirm.cpp
+++ b/common/confirm.cpp
@@ -36,6 +36,16 @@
 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,
                     long aStyle )
     : wxRichMessageDialog( aParent, aMessage, aCaption, aStyle | wxCENTRE | wxSTAY_ON_TOP ),
@@ -286,7 +296,7 @@ void DisplayError( wxWindow* aParent, const wxString& aText, int aDisplayTime )
         return;
     }
 
-    if( !wxTheApp->IsGUI() )
+    if( !IsGUI() )
     {
         wxFprintf( stderr, aText );
         return;
@@ -311,7 +321,7 @@ void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxStri
         return;
     }
 
-    if( !wxTheApp->IsGUI() )
+    if( !IsGUI() )
     {
         wxFprintf( stderr, aText );
         return;
@@ -338,7 +348,7 @@ void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxSt
         return;
     }
 
-    if( !wxTheApp->IsGUI() )
+    if( !IsGUI() )
     {
         wxFprintf( stdout, "%s %s", aMessage, aExtraInfo );
         return;
diff --git a/include/properties/property_mgr.h b/include/properties/property_mgr.h
index 373e280470..a766028d85 100644
--- a/include/properties/property_mgr.h
+++ b/include/properties/property_mgr.h
@@ -28,6 +28,7 @@
 
 #include <wx/string.h>
 
+#include <functional>
 #include <list>
 #include <map>
 #include <unordered_map>