X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ef1717a963dfb76bac26b9f4277ae590b3c0a2e6..abd474ea63667f727940a009cc3e0b23ba9f418f:/src/cocoa/display.mm diff --git a/src/cocoa/display.mm b/src/cocoa/display.mm index d5bd1dbeba..af4c6266c4 100644 --- a/src/cocoa/display.mm +++ b/src/cocoa/display.mm @@ -18,14 +18,15 @@ #if wxUSE_DISPLAY +#include "wx/display.h" + #ifndef WX_PRECOMP - #include "wx/dynarray.h" + #include "wx/dynarray.h" + #include "wx/string.h" + #include "wx/gdicmn.h" #endif -#include "wx/display.h" #include "wx/display_impl.h" -#include "wx/gdicmn.h" -#include "wx/string.h" #import @@ -36,7 +37,11 @@ class wxDisplayImplMacOSX : public wxDisplayImpl { public: - wxDisplayImplMacOSX(CGDirectDisplayID id_) : m_id(id_) { } + wxDisplayImplMacOSX(unsigned n, CGDirectDisplayID id_) + : wxDisplayImpl(n), + m_id(id_) + { + } virtual wxRect GetGeometry() const; virtual wxString GetName() const { return wxString(); } @@ -48,35 +53,31 @@ public: private: CGDirectDisplayID m_id; - DECLARE_NO_COPY_CLASS(wxDisplayImplMacOSX) + wxDECLARE_NO_COPY_CLASS(wxDisplayImplMacOSX); }; class wxDisplayFactoryMacOSX : public wxDisplayFactory { public: - wxDisplayFactoryMacOSX(); + wxDisplayFactoryMacOSX() { } - virtual wxDisplayImpl *CreateDisplay(size_t n); - virtual size_t GetCount(); + virtual wxDisplayImpl *CreateDisplay(unsigned n); + virtual unsigned GetCount(); virtual int GetFromPoint(const wxPoint& pt); protected: - DECLARE_NO_COPY_CLASS(wxDisplayFactoryMacOSX) + wxDECLARE_NO_COPY_CLASS(wxDisplayFactoryMacOSX); }; // ============================================================================ // wxDisplayFactoryMacOSX implementation // ============================================================================ -size_t wxDisplayFactoryMacOSX::GetCount() +unsigned wxDisplayFactoryMacOSX::GetCount() { CGDisplayCount count; -#ifdef __WXDEBUG__ - CGDisplayErr err = -#endif - CGGetActiveDisplayList(0, NULL, &count); - - wxASSERT(err == CGDisplayNoErr); + CGDisplayErr err = CGGetActiveDisplayList(0, NULL, &count); + wxCHECK_MSG( err != CGDisplayNoErr, 0, "CGGetActiveDisplayList() failed" ); return count; } @@ -116,20 +117,17 @@ int wxDisplayFactoryMacOSX::GetFromPoint(const wxPoint& p) return nWhich; } -wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(size_t n) +wxDisplayImpl *wxDisplayFactoryMacOSX::CreateDisplay(unsigned n) { CGDisplayCount theCount = GetCount(); CGDirectDisplayID* theIDs = new CGDirectDisplayID[theCount]; -#ifdef __WXDEBUG__ - CGDisplayErr err = -#endif - CGGetActiveDisplayList(theCount, theIDs, &theCount); + CGDisplayErr err = CGGetActiveDisplayList(theCount, theIDs, &theCount); + wxCHECK_MSG( err != CGDisplayNoErr, NULL, "CGGetActiveDisplayList() failed" ); - wxASSERT( err == CGDisplayNoErr ); wxASSERT( n < theCount ); - wxDisplayImplMacOSX *display = new wxDisplayImplMacOSX(theIDs[n]); + wxDisplayImplMacOSX *display = new wxDisplayImplMacOSX(n, theIDs[n]); delete [] theIDs; @@ -218,8 +216,7 @@ bool wxDisplayImplMacOSX::ChangeMode(const wxVideoMode& mode) /* static */ wxDisplayFactory *wxDisplay::CreateFactory() { - return new wxDisplayFactoryMac; + return new wxDisplayFactoryMacOSX; } #endif // wxUSE_DISPLAY -