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
This commit is contained in:
Vadim Zeitlin
2010-03-22 22:56:22 +00:00
parent 7633bfcd68
commit 1448054061

View File

@@ -24,15 +24,15 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#if wxUSE_UIACTIONSIMULATOR
// for all others, include the necessary headers (this file is usually all you // for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWidgets headers) // need because it includes almost all "standard" wxWidgets headers)
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
#include "wx/uiaction.h" #if wxUSE_UIACTIONSIMULATOR
#include "wx/uiaction.h"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// resources // resources
@@ -67,6 +67,8 @@ public:
virtual bool OnInit(); virtual bool OnInit();
}; };
#if wxUSE_UIACTIONSIMULATOR
// Define a new frame type: this is going to be our main frame // Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame class MyFrame : public wxFrame
{ {
@@ -92,6 +94,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(RunSimulation, MyFrame::OnRunSimulation) EVT_MENU(RunSimulation, MyFrame::OnRunSimulation)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif // wxUSE_UIACTIONSIMULATOR
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================
@@ -107,16 +111,23 @@ bool MyApp::OnInit()
if ( !wxApp::OnInit() ) if ( !wxApp::OnInit() )
return false; return false;
#if wxUSE_UIACTIONSIMULATOR
MyFrame *frame = new MyFrame("wxUIActionSimulator sample application"); MyFrame *frame = new MyFrame("wxUIActionSimulator sample application");
frame->Show(true); frame->Show(true);
return true; return true;
#else // !wxUSE_UIACTIONSIMULATOR
wxLogError("wxUSE_UIACTIONSIMULATOR must be 1 for this sample");
return false;
#endif // wxUSE_UIACTIONSIMULATOR/!wxUSE_UIACTIONSIMULATOR
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// main frame // main frame
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxUSE_UIACTIONSIMULATOR
// frame constructor // frame constructor
MyFrame::MyFrame(const wxString& title) MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title) : wxFrame(NULL, wxID_ANY, title)