From 144805406121940c36c609069334cf2794cc7b14 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 22 Mar 2010 22:56:22 +0000 Subject: [PATCH] Let uiaction sample compile even if wxUSE_UIACTIONSIMULATOR==0. There is no way to exclude the sample from the build under Windows so make it compile and link even if wxUSE_UIACTIONSIMULATOR==0 but just give an error message on startup in this case instead of working as expected. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/uiaction/uiaction.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/samples/uiaction/uiaction.cpp b/samples/uiaction/uiaction.cpp index b08767fdd3..63a5bb6271 100644 --- a/samples/uiaction/uiaction.cpp +++ b/samples/uiaction/uiaction.cpp @@ -24,15 +24,15 @@ #pragma hdrstop #endif -#if wxUSE_UIACTIONSIMULATOR - // for all others, include the necessary headers (this file is usually all you // need because it includes almost all "standard" wxWidgets headers) #ifndef WX_PRECOMP #include "wx/wx.h" #endif -#include "wx/uiaction.h" +#if wxUSE_UIACTIONSIMULATOR + #include "wx/uiaction.h" +#endif // ---------------------------------------------------------------------------- // resources @@ -67,6 +67,8 @@ public: virtual bool OnInit(); }; +#if wxUSE_UIACTIONSIMULATOR + // Define a new frame type: this is going to be our main frame class MyFrame : public wxFrame { @@ -92,6 +94,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(RunSimulation, MyFrame::OnRunSimulation) END_EVENT_TABLE() +#endif // wxUSE_UIACTIONSIMULATOR + // ============================================================================ // implementation // ============================================================================ @@ -107,16 +111,23 @@ bool MyApp::OnInit() if ( !wxApp::OnInit() ) return false; +#if wxUSE_UIACTIONSIMULATOR MyFrame *frame = new MyFrame("wxUIActionSimulator sample application"); frame->Show(true); return true; +#else // !wxUSE_UIACTIONSIMULATOR + wxLogError("wxUSE_UIACTIONSIMULATOR must be 1 for this sample"); + return false; +#endif // wxUSE_UIACTIONSIMULATOR/!wxUSE_UIACTIONSIMULATOR } // ---------------------------------------------------------------------------- // main frame // ---------------------------------------------------------------------------- +#if wxUSE_UIACTIONSIMULATOR + // frame constructor MyFrame::MyFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title) -- 2.47.2