Add a trivial "About" dialog to the uiaction sample
This will be used later for testing opening (and closing) this dialog programmatically.
This commit is contained in:
@@ -82,6 +82,7 @@ public:
|
|||||||
void OnRunSimulation(wxCommandEvent& event);
|
void OnRunSimulation(wxCommandEvent& event);
|
||||||
void OnSimulateText(wxCommandEvent& event);
|
void OnSimulateText(wxCommandEvent& event);
|
||||||
void OnExit(wxCommandEvent& WXUNUSED(event)) { Close(); }
|
void OnExit(wxCommandEvent& WXUNUSED(event)) { Close(); }
|
||||||
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxButton* m_button;
|
wxButton* m_button;
|
||||||
@@ -96,6 +97,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(RunSimulation, MyFrame::OnRunSimulation)
|
EVT_MENU(RunSimulation, MyFrame::OnRunSimulation)
|
||||||
EVT_MENU(SimulateText, MyFrame::OnSimulateText)
|
EVT_MENU(SimulateText, MyFrame::OnSimulateText)
|
||||||
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
|
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
|
||||||
|
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
#endif // wxUSE_UIACTIONSIMULATOR
|
#endif // wxUSE_UIACTIONSIMULATOR
|
||||||
@@ -151,8 +153,12 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
|
|
||||||
fileMenu->Append(wxID_EXIT, "E&xit\tAlt-X", "Quit this program");
|
fileMenu->Append(wxID_EXIT, "E&xit\tAlt-X", "Quit this program");
|
||||||
|
|
||||||
|
wxMenu* const helpMenu = new wxMenu;
|
||||||
|
helpMenu->Append(wxID_ABOUT);
|
||||||
|
|
||||||
wxMenuBar *menuBar = new wxMenuBar();
|
wxMenuBar *menuBar = new wxMenuBar();
|
||||||
menuBar->Append(fileMenu, "&File");
|
menuBar->Append(fileMenu, "&File");
|
||||||
|
menuBar->Append(helpMenu, "&Help");
|
||||||
|
|
||||||
SetMenuBar(menuBar);
|
SetMenuBar(menuBar);
|
||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
@@ -250,4 +256,15 @@ void MyFrame::OnButtonPressed(wxCommandEvent& WXUNUSED(event))
|
|||||||
m_text->AppendText("Button pressed.\n");
|
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
|
#endif // wxUSE_UIACTIONSIMULATOR
|
||||||
|
Reference in New Issue
Block a user