]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed border calculation
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 9 Jan 2005 05:50:36 +0000 (05:50 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 9 Jan 2005 05:50:36 +0000 (05:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31297 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/uma.cpp

index 3e603385382e4f60dd819a7f2858109d17ffa9b7..7f1fa17db934f2d5554035522a3eb0459e256fd1 100644 (file)
@@ -796,15 +796,27 @@ Rect* UMAGetControlBoundsInWindowCoords(ControlRef theControl, Rect *bounds)
 #if TARGET_API_MAC_OSX
     if ( win != NULL && win->MacGetTopLevelWindow() != NULL )   
     {
-        int x , y ;
-        x = 0 ;
-        y = 0 ;
-        
-        win->GetParent()->MacWindowToRootWindow( &x , & y ) ;
-        bounds->left += x ;
-        bounds->right += x ;
-        bounds->top += y ;
-        bounds->bottom += y ;
+        wxWindow* parent = win->GetParent() ;
+        if ( parent )
+        {
+            // the parent controls 'origin' expressed in its own
+            // window coordinates (explanation in window.cpp)
+            int x , y ;
+            x = 0 ;
+            y = 0 ;
+            
+            if ( !parent->IsTopLevel() )
+            {
+                x += parent->MacGetLeftBorderSize() ;
+                y += parent->MacGetTopBorderSize() ;
+            }
+            
+            parent->MacWindowToRootWindow( &x , & y ) ;
+            bounds->left += x ;
+            bounds->right += x ;
+            bounds->top += y ;
+            bounds->bottom += y ;
+        }
     }
 #endif
     return bounds ;