]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/utils.cpp
removed checks for compilers supporting wxUSE_ON_FATAL_EXCEPTION, it's in wx/chkconf...
[wxWidgets.git] / src / mac / carbon / utils.cpp
index 44e917e2a7206f621ef1a1f0dbbbd4d707e43424..6139d8a3e14c62c527420f1c4548ab026a7f793a 100644 (file)
@@ -9,12 +9,13 @@
 // Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 // Note: this is done in utilscmn.cpp now.
 // #pragma implementation "utils.h"
 #endif
 
-#include "wx/setup.h"
+#include "wx/wxprec.h"
+
 #include "wx/utils.h"
 #include "wx/app.h"
 #include "wx/apptrait.h"
@@ -336,6 +337,18 @@ bool wxShutdown(wxShutdownFlags wFlags)
     return false;
 }
 
+wxPowerType wxGetPowerType()
+{
+    // TODO
+    return wxPOWER_UNKNOWN;
+}
+
+wxBatteryState wxGetBatteryState()
+{
+    // TODO
+    return wxBATTERY_UNKNOWN_STATE;
+}
+
 // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
 wxMemorySize wxGetFreeMemory()
 {
@@ -1011,6 +1024,7 @@ void wxMacControl::SetDrawingEnabled( bool enable )
 #endif
 }
 
+#if TARGET_API_MAC_OSX
 bool wxMacControl::GetNeedsDisplay() const
 {
 #if TARGET_API_MAC_OSX
@@ -1029,6 +1043,7 @@ void wxMacControl::SetNeedsDisplay( bool needsDisplay , RgnHandle where )
         HIViewSetNeedsDisplay( m_controlRef , needsDisplay ) ;
 #endif
 }
+#endif
 
 void  wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to )
 {
@@ -1039,6 +1054,21 @@ void  wxMacControl::Convert( wxPoint *pt , wxMacControl *from , wxMacControl *to
     HIViewConvertPoint( &hiPoint , from->m_controlRef , to->m_controlRef  ) ;
     pt->x = (int)hiPoint.x ;
     pt->y = (int)hiPoint.y ;
+#else
+    Rect fromRect ;
+    Rect toRect ;
+    from->GetRect( &fromRect ) ;
+    to->GetRect( &toRect ) ;
+    
+    // correct the case of the root control 
+    if ( fromRect.left == -32768 && fromRect.top == -32768 && fromRect.bottom == 32767 && fromRect.right == 32767)
+        fromRect.left = fromRect.top = 0 ;
+
+    if ( toRect.left == -32768 && toRect.top == -32768 && toRect.bottom == 32767 && toRect.right == 32767  )
+        toRect.left = toRect.top = 0 ;
+        
+    pt->x = pt->x + fromRect.left - toRect.left ;
+    pt->y = pt->y + fromRect.top - toRect.top ;
 #endif
 }