X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72e7ec5b6ac8d98afc60afeba10bcad8341e72ec..ce7208d49d5ce2ca1dc0b3b83f14f1d04f29c4bf:/src/msw/menu.cpp diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index cd13e77512..65affb6e59 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -26,9 +26,11 @@ #if wxUSE_MENUS +#include "wx/menu.h" + #ifndef WX_PRECOMP + #include "wx/msw/wrapcctl.h" // include "properly" #include "wx/frame.h" - #include "wx/menu.h" #include "wx/utils.h" #include "wx/intl.h" #include "wx/log.h" @@ -46,7 +48,6 @@ #include #include #include -#include #if (_WIN32_WCE < 400) && !defined(__HANDHELDPC__) #include #endif @@ -312,7 +313,7 @@ void wxMenu::UpdateAccel(wxMenuItem *item) } // find the (new) accel for this item - wxAcceleratorEntry *accel = wxGetAccelFromString(item->GetText()); + wxAcceleratorEntry *accel = wxAcceleratorEntry::Create(item->GetText()); if ( accel ) accel->m_command = item->GetId(); @@ -411,11 +412,11 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) !pItem->GetFont().Ok() && !pItem->GetBitmap(true).Ok() ) { - // try to use InsertMenuItem() as it's guaranteed to look correctly - // while our owner-drawning code is not + // try to use InsertMenuItem() as it's guaranteed to look correct + // while our owner-drawn code is not // first compile-time check -#ifdef MIIM_BITMAP +#if defined(MIIM_BITMAP) && (_WIN32_WINNT >= 0x0500) WinStruct mii; // now run-time one: MIIM_BITMAP only works under WinME/2000+ @@ -439,7 +440,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) // we can't pass HBITMAP directly as hbmpItem for 2 reasons: // 1. we can't draw it with transparency then (this is not // very important now but would be with themed menu bg) - // 2. worse, Windows inverses the bitmap for the selected + // 2. worse, Windows inverts the bitmap for the selected // item and this looks downright ugly // // so instead draw it ourselves in MSWOnDrawItem() @@ -491,7 +492,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) else #endif // wxUSE_OWNER_DRAWN { - // menu is just a normal string (passed in data parameter) + // item is just a normal string (passed in data parameter) flags |= MF_STRING; #ifdef __WXWINCE__ @@ -501,7 +502,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) pData = (wxChar*)itemText.c_str(); } - // item might have been already inserted by InsertMenuItem() above + // item might have already been inserted by InsertMenuItem() above if ( !ok ) { if ( !::InsertMenu(GetHmenu(), pos, flags | MF_BYPOSITION, id, pData) ) @@ -602,7 +603,7 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) { - // we need to find the items position in the child list + // we need to find the item's position in the child list size_t pos; wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); for ( pos = 0; node; pos++ ) @@ -613,7 +614,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) node = node->GetNext(); } - // DoRemove() (unlike Remove) can only be called for existing item! + // DoRemove() (unlike Remove) can only be called for an existing item! wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") ); #if wxUSE_ACCEL @@ -636,7 +637,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) if ( IsAttached() && GetMenuBar()->IsAttached() ) { - // otherwise, the chane won't be visible + // otherwise, the change won't be visible GetMenuBar()->Refresh(); } @@ -650,7 +651,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) #if wxUSE_ACCEL -// create the wxAcceleratorEntries for our accels and put them into provided +// create the wxAcceleratorEntries for our accels and put them into the provided // array - return the number of accels we have size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const { @@ -844,6 +845,9 @@ wxMenuBar::~wxMenuBar() void wxMenuBar::Refresh() { + if ( IsFrozen() ) + return; + wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") ); #if defined(WINCE_WITHOUT_COMMANDBAR) @@ -861,7 +865,7 @@ void wxMenuBar::Refresh() WXHMENU wxMenuBar::Create() { - // Note: this totally doesn't work on Smartphone, + // Note: this doesn't work at all on Smartphone, // since you have to use resources. // We'll have to find another way to add a menu // by changing/adding menu items to an existing menu. @@ -875,7 +879,7 @@ WXHMENU wxMenuBar::Create() HWND hCommandBar = (HWND) GetToolBar()->GetHWND(); HMENU hMenu = (HMENU)::SendMessage(hCommandBar, SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0); - // hMenu may be zero on Windows Mobile 5. So add the menus anyway. + // hMenu may be zero on Windows Mobile 5. So add the menus anyway. if (1) // (hMenu) { TBBUTTON tbButton;