// other standard headers
#include <string.h>
-#if wxUSE_OWNER_DRAWN && defined(MIIM_BITMAP)
+//VC6 needs these defining, though they are in winuser.h
+#ifndef MIIM_BITMAP
+#define MIIM_STRING 0x00000040
+#define MIIM_BITMAP 0x00000080
+#define MIIM_FTYPE 0x00000100
+#define HBMMENU_CALLBACK ((HBITMAP) -1)
+typedef struct tagMENUINFO
+{
+ DWORD cbSize;
+ DWORD fMask;
+ DWORD dwStyle;
+ UINT cyMax;
+ HBRUSH hbrBack;
+ DWORD dwContextHelpID;
+ DWORD dwMenuData;
+} MENUINFO, FAR *LPMENUINFO;
+#endif
+
+#if wxUSE_OWNER_DRAWN
#include "wx/dynlib.h"
#endif
{
// try to use InsertMenuItem() as it's guaranteed to look correct
// while our owner-drawn code is not
-
- // first compile-time check
-#if defined(MIIM_BITMAP) && (_WIN32_WINNT >= 0x0500)
+#ifndef __DMC__
+ // DMC at march 2007 doesn't have HBITMAP hbmpItem tagMENUITEMINFOA /W
+ // MIIM_BITMAP only works under WinME/2000+
WinStruct<MENUITEMINFO> mii;
-
- // now run-time one: MIIM_BITMAP only works under WinME/2000+
if ( wxGetWinVersion() >= wxWinVersion_98 )
{
mii.fMask = MIIM_STRING | MIIM_DATA | MIIM_BITMAP;
}
mii.cch = itemText.length();
- mii.dwTypeData = wx_const_cast(wxChar *, itemText.c_str());
+ mii.dwTypeData = wx_const_cast(wxChar *, itemText.wx_str());
if (flags & MF_POPUP)
{
pItem->ResetOwnerDrawn();
}
}
-#endif // MIIM_BITMAP
+#endif // __DMC__
}
if ( !ok )
itemText = wxMenuItem::GetLabelFromText(itemText);
#endif
- pData = (wxChar*)itemText.c_str();
+ pData = (wxChar*)itemText.wx_str();
}
// item might have already been inserted by InsertMenuItem() above
if ( item && item->IsCheckable() )
item->Toggle();
- // get the checked status of the menu item: note that menuState is the
- // old state of the menu, so the test for MF_CHECKED must be inverted
+ // get the status of the menu item: note that it has been just changed
+ // by Toggle() above so here we already get the new state of the item
UINT menuState = ::GetMenuState(GetHmenu(), id, MF_BYCOMMAND);
- SendEvent(id, !(menuState & MF_CHECKED));
+ SendEvent(id, menuState & MF_CHECKED);
}
return true;