+// make the given menu item default
+void SetDefaultMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu),
+ UINT WXUNUSED_IN_WINCE(id))
+{
+#ifndef __WXWINCE__
+ WinStruct<MENUITEMINFO> mii;
+ mii.fMask = MIIM_STATE;
+ mii.fState = MFS_DEFAULT;
+
+ if ( !::SetMenuItemInfo(hmenu, id, FALSE, &mii) )
+ {
+ wxLogLastError(wxT("SetMenuItemInfo"));
+ }
+#endif // !__WXWINCE__
+}
+
+// make the given menu item owner-drawn
+void SetOwnerDrawnMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu),
+ UINT WXUNUSED_IN_WINCE(id),
+ ULONG_PTR WXUNUSED_IN_WINCE(data),
+ BOOL WXUNUSED_IN_WINCE(byPositon = FALSE))
+{
+#ifndef __WXWINCE__
+ WinStruct<MENUITEMINFO> mii;
+ mii.fMask = MIIM_FTYPE | MIIM_DATA;
+ mii.fType = MFT_OWNERDRAW;
+ mii.dwItemData = data;
+
+ if ( reinterpret_cast<wxMenuItem*>(data)->IsSeparator() )
+ mii.fType |= MFT_SEPARATOR;
+
+ if ( !::SetMenuItemInfo(hmenu, id, byPositon, &mii) )
+ {
+ wxLogLastError(wxT("SetMenuItemInfo"));
+ }
+#endif // !__WXWINCE__
+}
+
+#ifdef __WXWINCE__
+UINT GetMenuState(HMENU hMenu, UINT id, UINT flags)
+{
+ WinStruct<MENUITEMINFO> info;
+ info.fMask = MIIM_STATE;
+ // MF_BYCOMMAND is zero so test MF_BYPOSITION
+ if ( !::GetMenuItemInfo(hMenu, id, flags & MF_BYPOSITION ? TRUE : FALSE , & info) )
+ {
+ wxLogLastError(wxT("GetMenuItemInfo"));
+ }
+ return info.fState;
+}
+#endif // __WXWINCE__
+
+inline bool IsGreaterThanStdSize(const wxBitmap& bmp)
+{
+ return bmp.GetWidth() > ::GetSystemMetrics(SM_CXMENUCHECK) ||
+ bmp.GetHeight() > ::GetSystemMetrics(SM_CYMENUCHECK);
+}
+
+} // anonymous namespace