]> git.saurik.com Git - wxWidgets.git/commitdiff
carbon cfm fixes
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 23 Feb 2005 15:48:52 +0000 (15:48 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 23 Feb 2005 15:48:52 +0000 (15:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32316 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/toplevel.cpp
src/mac/carbon/utils.cpp

index fac851267e03578afc61cb285e52b68c93bc09b2..4af012f7d652cfbc088feb4883038ac334d014c6 100644 (file)
@@ -545,9 +545,13 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev
             // if built-in find control is finding the wrong control (ie static box instead of overlaid
             // button, we cannot let the standard handler do its job, but must handle manually
 
-            if ( ( cEvent.GetKind() == kEventMouseDown ) && 
+            if ( ( cEvent.GetKind() == kEventMouseDown ) 
+#ifdef __WXMAC_OSX__
+                && 
                 (FindControlUnderMouse(windowMouseLocation , window , &dummyPart) != 
-                wxMacFindControlUnderMouse( windowMouseLocation , window , &dummyPart ) ) )
+                wxMacFindControlUnderMouse( windowMouseLocation , window , &dummyPart ) ) 
+#endif
+                )
             {
                 if ( currentMouseWindow->MacIsReallyEnabled() ) 
                 {
@@ -1125,7 +1129,7 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
 
     wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ;
     UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ;
-    m_peer = new wxMacControl() ;
+    m_peer = new wxMacControl(this) ;
 #if TARGET_API_MAC_OSX
     // There is a bug in 10.2.X for ::GetRootControl returning the window view instead of 
     // the content view, so we have to retrieve it explicitely
index c20126d12cb84fac07938b4f8c7713c7f472e58e..6139d8a3e14c62c527420f1c4548ab026a7f793a 100644 (file)
@@ -1024,6 +1024,7 @@ void wxMacControl::SetDrawingEnabled( bool enable )
 #endif
 }
 
+#if TARGET_API_MAC_OSX
 bool wxMacControl::GetNeedsDisplay() const
 {
 #if TARGET_API_MAC_OSX
@@ -1042,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 )
 {
@@ -1052,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
 }