X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5c5871a4fc3a83c494f9fc0c8ae7b6ca210d37f4..f94a81c084696210418b8709e8ab649a18465fa6:/src/msw/menu.cpp diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index d18f97c893..f0069e6407 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -17,10 +17,6 @@ // headers // --------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "menu.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -89,7 +85,8 @@ static const int idMenuTitle = -3; // ---------------------------------------------------------------------------- // make the given menu item default -static void SetDefaultMenuItem(HMENU hmenu, UINT id) +static void SetDefaultMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu), + UINT WXUNUSED_IN_WINCE(id)) { #ifndef __WXWINCE__ MENUITEMINFO mii; @@ -102,9 +99,6 @@ static void SetDefaultMenuItem(HMENU hmenu, UINT id) { wxLogLastError(wxT("SetMenuItemInfo")); } -#else - wxUnusedVar(hmenu); - wxUnusedVar(id); #endif } @@ -128,7 +122,7 @@ UINT GetMenuState(HMENU hMenu, UINT id, UINT flags) #include -WX_DEFINE_LIST( wxMenuInfoList ) ; +WX_DEFINE_LIST( wxMenuInfoList ) #if wxUSE_EXTENDED_RTTI @@ -307,6 +301,16 @@ void wxMenu::UpdateAccel(wxMenuItem *item) } else if ( !item->IsSeparator() ) { + // recurse upwards: we should only modify m_accels of the top level + // menus, not of the submenus as wxMenuBar doesn't look at them + // (alternative and arguable cleaner solution would be to recurse + // downwards in GetAccelCount() and CopyAccels()) + if ( GetParent() ) + { + GetParent()->UpdateAccel(item); + return; + } + // find the (new) accel for this item wxAcceleratorEntry *accel = wxGetAccelFromString(item->GetText()); if ( accel )