fix for sf bug 1671804

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Chris Elliott
2007-03-07 09:31:30 +00:00
parent bc9e85a319
commit a0369cb367

View File

@@ -59,7 +59,25 @@
// other standard headers // other standard headers
#include <string.h> #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" #include "wx/dynlib.h"
#endif #endif
@@ -433,16 +451,14 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
!pItem->GetBackgroundColour().Ok() && !pItem->GetBackgroundColour().Ok() &&
!pItem->GetFont().Ok() ) !pItem->GetFont().Ok() )
{ {
// try to use InsertMenuItem() as it's guaranteed to look correct // try to use InsertMenuItem() as it's guaranteed to look correct
// while our owner-drawn code is not // while our owner-drawn code is not
#ifndef __DMC__
// first compile-time check // DMC at march 2007 doesn't have HBITMAP hbmpItem tagMENUITEMINFOA /W
#if defined(MIIM_BITMAP) && (_WIN32_WINNT >= 0x0500) // MIIM_BITMAP only works under WinME/2000+
WinStruct<MENUITEMINFO> mii; WinStruct<MENUITEMINFO> mii;
// now run-time one: MIIM_BITMAP only works under WinME/2000+
if ( wxGetWinVersion() >= wxWinVersion_98 ) if ( wxGetWinVersion() >= wxWinVersion_98 )
{ {
mii.fMask = MIIM_STRING | MIIM_DATA | MIIM_BITMAP; mii.fMask = MIIM_STRING | MIIM_DATA | MIIM_BITMAP;
if ( pItem->IsCheckable() ) if ( pItem->IsCheckable() )
{ {
@@ -512,7 +528,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
pItem->ResetOwnerDrawn(); pItem->ResetOwnerDrawn();
} }
} }
#endif // MIIM_BITMAP #endif // __DMC__
} }
if ( !ok ) if ( !ok )