]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/settings.cpp
Compile corrections
[wxWidgets.git] / src / msw / settings.cpp
index 85d8b311f4377f2ba7d334eee345d868b8880d1c..5cf3b7970075c278c6e98cbc56baa52b6b6a78dd 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 #ifndef WX_PRECOMP
 #endif
 
 #ifndef WX_PRECOMP
+    #include "wx/utils.h"
     #include "wx/gdicmn.h"
 #endif
 
     #include "wx/gdicmn.h"
 #endif
 
 
 #include "wx/msw/private.h"
 
 
 #include "wx/msw/private.h"
 
+#ifndef SPI_GETFLATMENU
+#define SPI_GETFLATMENU                     0x1022
+#endif
+
 #include "wx/module.h"
 #include "wx/fontutil.h"
 
 #include "wx/module.h"
 #include "wx/fontutil.h"
 
@@ -155,7 +160,17 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
         {
             // 5.1 is Windows XP
             useDefault = FALSE;
         {
             // 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__
 #else
         useDefault = TRUE;
 #endif // __WIN32__
@@ -332,7 +347,8 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index)
     // TODO: probably use wxUniv themes functionality
     return 0;
 #else // !__WXMICROWIN__
     // 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 )
 
     int indexMSW = gs_metricsMap[index];
     if ( indexMSW == -1 )