Add logging of wxEVT_MENU_HIGHLIGHT events to the MDI sample too.

This allows to easily compare which events are generated and sent to which
objects under different platforms.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78225 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-12-05 22:17:34 +00:00
parent 5103243078
commit 5ef2ab09c6
2 changed files with 14 additions and 0 deletions

View File

@ -71,6 +71,8 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxMDIParentFrame)
EVT_MENU(wxID_CLOSE_ALL, MyFrame::OnCloseAll)
EVT_MENU_OPEN(MyFrame::OnMenuOpen)
EVT_MENU_HIGHLIGHT(wxID_ABOUT, MyFrame::OnMenuHighlight)
EVT_MENU_HIGHLIGHT(MDI_REFRESH, MyFrame::OnMenuHighlight)
EVT_MENU_CLOSE(MyFrame::OnMenuClose)
EVT_CLOSE(MyFrame::OnClose)
@ -95,6 +97,8 @@ wxBEGIN_EVENT_TABLE(MyChild, wxMDIChildFrame)
EVT_MOVE(MyChild::OnMove)
EVT_MENU_OPEN(MyChild::OnMenuOpen)
EVT_MENU_HIGHLIGHT(wxID_ABOUT, MyChild::OnMenuHighlight)
EVT_MENU_HIGHLIGHT(MDI_REFRESH, MyChild::OnMenuHighlight)
EVT_MENU_CLOSE(MyChild::OnMenuClose)
EVT_CLOSE(MyChild::OnCloseWindow)

View File

@ -63,6 +63,14 @@ protected:
wxLogMessage(m_frame, "%s %s in %s", what, action, m_label);
}
void LogMenuHighlight(wxMenuEvent& event)
{
event.Skip();
wxLogMessage(m_frame, "Item %d selected in %s",
event.GetMenuId(), m_label);
}
const wxString m_label;
wxFrame* const m_frame;
@ -90,6 +98,7 @@ private:
void OnCloseAll(wxCommandEvent& event);
void OnMenuOpen(wxMenuEvent& event) { LogMenuOpenClose(event, "opened"); }
void OnMenuHighlight(wxMenuEvent& event) { LogMenuHighlight(event); }
void OnMenuClose(wxMenuEvent& event) { LogMenuOpenClose(event, "closed"); }
void OnClose(wxCloseEvent& event);
@ -120,6 +129,7 @@ private:
void OnSize(wxSizeEvent& event);
void OnMove(wxMoveEvent& event);
void OnMenuOpen(wxMenuEvent& event) { LogMenuOpenClose(event, "opened"); }
void OnMenuHighlight(wxMenuEvent& event) { LogMenuHighlight(event); }
void OnMenuClose(wxMenuEvent& event) { LogMenuOpenClose(event, "closed"); }
void OnCloseWindow(wxCloseEvent& event);