#include "wx/wx.h"
#endif
-#include "wx/uiaction.h"
+#if wxUSE_UIACTIONSIMULATOR
+ #include "wx/uiaction.h"
+#endif
// ----------------------------------------------------------------------------
// resources
#include "../sample.xpm"
#endif
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+enum
+{
+ // menu items
+ TheButton = 100,
+ RunSimulation
+};
+
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
virtual bool OnInit();
};
+#if wxUSE_UIACTIONSIMULATOR
+
// Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame
{
private:
bool m_buttonPressed;
bool m_menuSelected;
-};
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-// IDs for the controls and the menu commands
-enum
-{
- // menu items
- TheButton = wxID_ANY,
- RunSimulation = wxID_ANY
+ DECLARE_EVENT_TABLE()
};
-IMPLEMENT_APP(MyApp)
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_BUTTON(TheButton, MyFrame::OnButtonPressed)
+ EVT_MENU(RunSimulation, MyFrame::OnRunSimulation)
+END_EVENT_TABLE()
+
+#endif // wxUSE_UIACTIONSIMULATOR
// ============================================================================
// implementation
// the application class
// ----------------------------------------------------------------------------
+IMPLEMENT_APP(MyApp)
+
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)
wxButton* button = new wxButton(this, TheButton, "Button");
button->SetName("TheButton");
- Bind(wxEVT_COMMAND_BUTTON_CLICKED, &MyFrame::OnButtonPressed, this, button->GetId());
- Bind(wxEVT_COMMAND_MENU_SELECTED, &MyFrame::OnRunSimulation, this, RunSimulation);
}
{
m_buttonPressed = true;
}
+
+#endif // wxUSE_UIACTIONSIMULATOR