From 1a438e786c27da4b617e5c10bc12564700d28c5d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 5 Jun 2016 00:10:13 +0200 Subject: [PATCH] Add a trivial "About" dialog to the uiaction sample This will be used later for testing opening (and closing) this dialog programmatically. --- samples/uiaction/uiaction.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/samples/uiaction/uiaction.cpp b/samples/uiaction/uiaction.cpp index 1211102661..d3de14ce4d 100644 --- a/samples/uiaction/uiaction.cpp +++ b/samples/uiaction/uiaction.cpp @@ -82,6 +82,7 @@ public: void OnRunSimulation(wxCommandEvent& event); void OnSimulateText(wxCommandEvent& event); void OnExit(wxCommandEvent& WXUNUSED(event)) { Close(); } + void OnAbout(wxCommandEvent& event); private: wxButton* m_button; @@ -96,6 +97,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(RunSimulation, MyFrame::OnRunSimulation) EVT_MENU(SimulateText, MyFrame::OnSimulateText) EVT_MENU(wxID_EXIT, MyFrame::OnExit) + EVT_MENU(wxID_ABOUT, MyFrame::OnAbout) wxEND_EVENT_TABLE() #endif // wxUSE_UIACTIONSIMULATOR @@ -151,8 +153,12 @@ MyFrame::MyFrame(const wxString& title) fileMenu->Append(wxID_EXIT, "E&xit\tAlt-X", "Quit this program"); + wxMenu* const helpMenu = new wxMenu; + helpMenu->Append(wxID_ABOUT); + wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(fileMenu, "&File"); + menuBar->Append(helpMenu, "&Help"); SetMenuBar(menuBar); #endif // wxUSE_MENUS @@ -250,4 +256,15 @@ void MyFrame::OnButtonPressed(wxCommandEvent& WXUNUSED(event)) m_text->AppendText("Button pressed.\n"); } +void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) +{ + wxMessageBox + ( + "Shows how to use wxUIActionSimulator to simulate user actions", + "About wxWidgets uiaction sample", + wxOK | wxICON_INFORMATION, + this + ); +} + #endif // wxUSE_UIACTIONSIMULATOR