]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/display.cpp
Add support for wxSL_INVERSE flag. Also uses new inverse logic to make Mac vertical...
[wxWidgets.git] / src / msw / display.cpp
index ba43859eda2b1d62689e6a38f2c4163d3e9ca7d7..6066895d21acba7595063ec1b6686b261db783fb 100644 (file)
@@ -3,6 +3,7 @@
 // Purpose:     MSW Implementation of wxDisplay class
 // Author:      Royce Mitchell III
 // Modified by: VZ (resolutions enumeration/change support, DirectDraw, ...)
+//                 Ryan Norton (IsPrimary override)
 // Created:     06/21/02
 // RCS-ID:      $Id$
 // Copyright:   (c) wxWidgets team
     #pragma warning(disable:4706)
 #endif
 
+// with mingw32, we must include windows.h first and it doesn't hurt with other
+// compilers
+#include <windows.h>
+
 #include <multimon.h>
 
 #ifdef _MSC_VER
@@ -544,6 +549,30 @@ wxString wxDisplay::GetNameForEnumSettings() const
     return name;
 }
 
+// ----------------------------------------------------------------------------
+// determine if this is the primary display
+// ----------------------------------------------------------------------------
+
+bool wxDisplay::IsPrimary() const
+{
+    wxDisplayInfo& dpyInfo = (*gs_displays)[m_index];
+
+    MONITORINFOEX monInfo;
+    wxZeroMemory(monInfo);
+    monInfo.cbSize = sizeof(monInfo);
+
+    // NB: Cast from MONITORINFOEX* to MONITORINFO* is done because
+    //     Mingw headers - unlike the ones from Microsoft's Platform SDK -
+    //     don't derive the former from the latter in C++ mode and so
+    //     the pointer's type is not converted implicitly.
+    if ( !::GetMonitorInfo(dpyInfo.m_hmon, (LPMONITORINFO)&monInfo) )
+    {
+        wxLogLastError(_T("GetMonitorInfo"));
+    }
+
+    return (monInfo.dwFlags & MONITORINFOF_PRIMARY) == MONITORINFOF_PRIMARY;
+}
+
 // ----------------------------------------------------------------------------
 // video modes enumeration
 // ----------------------------------------------------------------------------