// name may be empty
virtual wxString GetName() const = 0;
- // display 0 is always the primary display
- bool IsPrimary() const { return m_index == 0; }
+ // display 0 is usually the primary display
+ virtual bool IsPrimary() const { return m_index == 0; }
// enumerate all video modes supported by this display matching the given
virtual wxVideoMode GetCurrentMode() const;
virtual bool ChangeMode(const wxVideoMode& mode = wxVideoMode());
+ virtual bool IsPrimary() const;
+
private:
// get the display name to use with EnumDisplaySettings()
wxString GetNameForEnumSettings() const;
/////////////////////////////////////////////////////////////////////////////
// Name: display.cpp
// Purpose: MSW Implementation of wxDisplay class
-// Author: Royce Mitchell III
+// Author: Royce Mitchell III, Ryan Norton
// Modified by: VZ (resolutions enumeration/change support, DirectDraw, ...)
// Created: 06/21/02
// RCS-ID: $Id$
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
// ----------------------------------------------------------------------------