Fix sending of wxEVT_UPDATE_UI events when wxUSE_STATUSBAR==0

wxFrameBase code unintentionally excluded the function generating
wxUpdateUIEvents for the menus from compilation when wxUSE_STATUSBAR was
turned off.

Move OnMenuOpen() out of #if wxUSE_STATUSBAR section to ensure that it's
compiled whenever wxUSE_MENUS==1.

Closes #17553.
This commit is contained in:
Vadim Zeitlin 2016-06-04 21:59:36 +02:00
parent d68eb10e3d
commit 152b9fc0eb
2 changed files with 16 additions and 14 deletions

View File

@ -152,8 +152,8 @@ public:
// event handlers
#if wxUSE_MENUS
#if wxUSE_STATUSBAR
void OnMenuOpen(wxMenuEvent& event);
#if wxUSE_STATUSBAR
void OnMenuClose(wxMenuEvent& event);
void OnMenuHighlight(wxMenuEvent& event);
#endif // wxUSE_STATUSBAR

View File

@ -42,14 +42,14 @@ extern WXDLLEXPORT_DATA(const char) wxStatusLineNameStr[] = "status_line";
#if wxUSE_MENUS
#if wxUSE_STATUSBAR
wxBEGIN_EVENT_TABLE(wxFrameBase, wxTopLevelWindow)
EVT_MENU_OPEN(wxFrameBase::OnMenuOpen)
#if wxUSE_STATUSBAR
EVT_MENU_CLOSE(wxFrameBase::OnMenuClose)
EVT_MENU_HIGHLIGHT_ALL(wxFrameBase::OnMenuHighlight)
wxEND_EVENT_TABLE()
#endif // wxUSE_STATUSBAR
wxEND_EVENT_TABLE()
/* static */
bool wxFrameBase::ShouldUpdateMenuFromIdle()
@ -324,16 +324,7 @@ void wxFrameBase::UpdateWindowUI(long flags)
// event handlers for status bar updates from menus
// ----------------------------------------------------------------------------
#if wxUSE_MENUS && wxUSE_STATUSBAR
void wxFrameBase::OnMenuHighlight(wxMenuEvent& event)
{
event.Skip();
#if wxUSE_STATUSBAR
(void)ShowMenuHelp(event.GetMenuId());
#endif // wxUSE_STATUSBAR
}
#if wxUSE_MENUS
void wxFrameBase::OnMenuOpen(wxMenuEvent& event)
{
@ -346,6 +337,15 @@ void wxFrameBase::OnMenuOpen(wxMenuEvent& event)
}
}
#if wxUSE_STATUSBAR
void wxFrameBase::OnMenuHighlight(wxMenuEvent& event)
{
event.Skip();
(void)ShowMenuHelp(event.GetMenuId());
}
void wxFrameBase::OnMenuClose(wxMenuEvent& event)
{
event.Skip();
@ -353,7 +353,9 @@ void wxFrameBase::OnMenuClose(wxMenuEvent& event)
DoGiveHelp(wxEmptyString, false);
}
#endif // wxUSE_MENUS && wxUSE_STATUSBAR
#endif // wxUSE_STATUSBAR
#endif // wxUSE_MENUS
// Implement internal behaviour (menu updating on some platforms)
void wxFrameBase::OnInternalIdle()