#include "wx/menu.h"
#ifndef WX_PRECOMP
+ #include "wx/msw/wrapcctl.h" // include <commctrl.h> "properly"
#include "wx/frame.h"
#include "wx/utils.h"
#include "wx/intl.h"
#include <tchar.h>
#include <ole2.h>
#include <shellapi.h>
-#include <commctrl.h>
#if (_WIN32_WCE < 400) && !defined(__HANDHELDPC__)
#include <aygshell.h>
#endif
}
// 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();
!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<MENUITEMINFO> mii;
// now run-time one: MIIM_BITMAP only works under WinME/2000+
// 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()
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__
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) )
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++ )
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
if ( IsAttached() && GetMenuBar()->IsAttached() )
{
- // otherwise, the chane won't be visible
+ // otherwise, the change won't be visible
GetMenuBar()->Refresh();
}
#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
{
void wxMenuBar::Refresh()
{
+ if ( IsFrozen() )
+ return;
+
wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") );
#if defined(WINCE_WITHOUT_COMMANDBAR)
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.