X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7d6d3bf31edc02abde8b32a8725f69f396f3dfff..277f2e527e33de039146ab94358ffec9c98f6112:/src/msw/settings.cpp diff --git a/src/msw/settings.cpp b/src/msw/settings.cpp index 85d8b311f4..a621cc73e2 100644 --- a/src/msw/settings.cpp +++ b/src/msw/settings.cpp @@ -25,6 +25,7 @@ #endif #ifndef WX_PRECOMP + #include "wx/utils.h" #include "wx/gdicmn.h" #endif @@ -32,6 +33,10 @@ #include "wx/msw/private.h" +#ifndef SPI_GETFLATMENU +#define SPI_GETFLATMENU 0x1022 +#endif + #include "wx/module.h" #include "wx/fontutil.h" @@ -155,7 +160,17 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) { // 5.1 is Windows XP useDefault = FALSE; - } + // Determine if we are using flat menus, only then allow wxSYS_COLOUR_MENUBAR + if ( index == wxSYS_COLOUR_MENUBAR ) + { + BOOL isFlat ; + if ( SystemParametersInfo( SPI_GETFLATMENU , 0 ,&isFlat, 0 ) ) + { + if ( !isFlat ) + index = wxSYS_COLOUR_MENU ; + } + } + } #else useDefault = TRUE; #endif // __WIN32__ @@ -172,7 +187,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) } else // replace with default colour { - int n = index - wxSYS_COLOUR_BTNHIGHLIGHT; + unsigned int n = index - wxSYS_COLOUR_BTNHIGHLIGHT; wxASSERT_MSG( n < WXSIZEOF(s_defaultSysColors), _T("forgot tp update the default colours array") ); @@ -332,7 +347,8 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index) // TODO: probably use wxUniv themes functionality return 0; #else // !__WXMICROWIN__ - wxCHECK_MSG( index < WXSIZEOF(gs_metricsMap), 0, _T("invalid metric") ); + wxCHECK_MSG( index > 0 && (size_t)index < WXSIZEOF(gs_metricsMap), 0, + _T("invalid metric") ); int indexMSW = gs_metricsMap[index]; if ( indexMSW == -1 )