+#ifndef SPI_GETKEYBOARDCUES
+#define SPI_GETKEYBOARDCUES 0x100A
+#endif
+
+class wxMSWSystemMenuFontModule : public wxModule
+{
+public:
+
+ virtual bool OnInit()
+ {
+ ms_systemMenuFont = new wxFont;
+
+#if defined(__WXMSW__) && defined(__WIN32__) && defined(SM_CXMENUCHECK)
+ NONCLIENTMETRICS nm;
+ nm.cbSize = sizeof(NONCLIENTMETRICS);
+ SystemParametersInfo(SPI_GETNONCLIENTMETRICS,0,&nm,0);
+
+ ms_systemMenuButtonWidth = nm.iMenuHeight;
+ ms_systemMenuHeight = nm.iMenuHeight;
+
+ // create menu font
+ wxNativeFontInfo info;
+ memcpy(&info.lf, &nm.lfMenuFont, sizeof(LOGFONT));
+ ms_systemMenuFont->Create(info);
+
+ if (SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &ms_showCues, 0) == 0)
+ ms_showCues = true;
+#endif
+
+ return true;
+ }
+
+ virtual void OnExit()
+ {
+ delete ms_systemMenuFont;
+ ms_systemMenuFont = NULL;
+ }
+
+ static wxFont* ms_systemMenuFont;
+ static int ms_systemMenuButtonWidth; // windows clean install default
+ static int ms_systemMenuHeight; // windows clean install default
+ static bool ms_showCues;
+private:
+ DECLARE_DYNAMIC_CLASS(wxMSWSystemMenuFontModule)
+};
+
+// these static variables are from the wxMSWSystemMenuFontModule object
+// and reflect the system settings returned by the Win32 API's
+// SystemParametersInfo() call.
+
+wxFont* wxMSWSystemMenuFontModule::ms_systemMenuFont = NULL;
+int wxMSWSystemMenuFontModule::ms_systemMenuButtonWidth = 18; // windows clean install default
+int wxMSWSystemMenuFontModule::ms_systemMenuHeight = 18; // windows clean install default
+bool wxMSWSystemMenuFontModule::ms_showCues = true;
+
+IMPLEMENT_DYNAMIC_CLASS(wxMSWSystemMenuFontModule, wxModule)
+
+
+// temporary hack to implement wxOwnerDrawn::IsMenuItem() without breaking
+// backwards compatibility
+#if wxCHECK_VERSION(2, 7, 0)
+ #pragma warning "TODO: remove gs_menuItems hack"
+#endif
+
+// VC++ 6 gives a warning here:
+//
+// return type for 'OwnerDrawnSet_wxImplementation_HashTable::iterator::
+// operator ->' is 'class wxOwnerDrawn ** ' (ie; not a UDT or reference to
+// a UDT. Will produce errors if applied using infix notation.
+//
+// shut it down
+#ifdef __VISUALC__
+ #if __VISUALC__ <= 1300
+ #pragma warning(push)
+ #pragma warning(disable: 4284)
+ #define POP_WARNINGS
+ #endif
+#endif
+
+#include "wx/hashset.h"
+WX_DECLARE_HASH_SET(wxOwnerDrawn*, wxPointerHash, wxPointerEqual, OwnerDrawnSet);
+
+#ifdef POP_WARNINGS
+ #pragma warning(pop)
+#endif
+
+static OwnerDrawnSet gs_menuItems;