]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/display.mm
linking fix for wxUSE_VALIDATORS==0
[wxWidgets.git] / src / cocoa / display.mm
index f1d7739174e7e886db635b9b6b037478fd250fcc..af4c6266c441f030d4be1dfda87188fbb9c70289 100644 (file)
 
 #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 <Foundation/Foundation.h>
 
@@ -36,7 +37,7 @@
 class wxDisplayImplMacOSX : public wxDisplayImpl
 {
 public:
-    wxDisplayImplMacOSX(size_t n, CGDirectDisplayID id_)
+    wxDisplayImplMacOSX(unsigned n, CGDirectDisplayID id_)
         : wxDisplayImpl(n),
           m_id(id_)
     {
@@ -52,7 +53,7 @@ public:
 private:
     CGDirectDisplayID m_id;
 
-    DECLARE_NO_COPY_CLASS(wxDisplayImplMacOSX)
+    wxDECLARE_NO_COPY_CLASS(wxDisplayImplMacOSX);
 };
 
 class wxDisplayFactoryMacOSX : public wxDisplayFactory
@@ -60,27 +61,23 @@ class wxDisplayFactoryMacOSX : public wxDisplayFactory
 public:
     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;
 }
@@ -120,17 +117,14 @@ 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(n, theIDs[n]);
@@ -226,4 +220,3 @@ bool wxDisplayImplMacOSX::ChangeMode(const wxVideoMode& mode)
 }
 
 #endif // wxUSE_DISPLAY
-