// 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"
// ----------------------------------------------------------------------------
// 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;
{
wxLogLastError(wxT("SetMenuItemInfo"));
}
-#else
- wxUnusedVar(hmenu);
- wxUnusedVar(id);
#endif
}
#include <wx/listimpl.cpp>
-WX_DEFINE_LIST( wxMenuInfoList ) ;
+WX_DEFINE_LIST( wxMenuInfoList )
#if wxUSE_EXTENDED_RTTI
}
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 )
LPCTSTR pData = NULL;
if ( pos == (size_t)-1 )
{
- // append at the end
- pos = GetMenuItemCount();
+ // append at the end (note that the item is already appended to
+ // internal data structures)
+ pos = GetMenuItemCount() - 1;
}
+ // adjust position to account for the title, if any
+ if ( !m_title.empty() )
+ pos += 2; // for the title itself and its separator
+
BOOL ok = false;
// check if we have something more than a simple text item