]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/window.cpp
Fix file paths in the header comments.
[wxWidgets.git] / src / osx / carbon / window.cpp
index 1e54d5a279a86d0d32bd462fed7c6a88dcbf2484..7545767b41643b0a47ae48c0b8aa632ffd8b25e0 100644 (file)
@@ -188,7 +188,13 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
                     OSStatus err = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef, &cgContext) ;
                     if ( err != noErr )
                     {
-                        wxFAIL_MSG("Unable to retrieve CGContextRef");
+                        // for non-composite drawing, since we don't support it ourselves, send it through the
+                        // the default handler
+                        // CallNextEventHandler( handler,event ) ;
+                        // result = noErr ;
+                        if ( allocatedRgn )
+                            CFRelease( allocatedRgn ) ;
+                        break;
                     }
 
                     thisWindow->MacSetCGContextRef( cgContext ) ;
@@ -964,7 +970,17 @@ void wxMacControl::GetContentArea(int &left , int &top , int &width , int &heigh
 
 void wxMacControl::Move(int x, int y, int width, int height)
 {
+    UInt32 attr = 0 ;
+    GetWindowAttributes( GetControlOwner(m_controlRef) , &attr ) ;
+
     HIRect hir = CGRectMake(x,y,width,height);
+    if ( !(attr & kWindowCompositingAttribute) )
+    {
+        HIRect parent;
+        HIViewGetFrame( HIViewGetSuperview(m_controlRef), &parent );
+        hir.origin.x += parent.origin.x;
+        hir.origin.y += parent.origin.y;
+    }
     HIViewSetFrame ( m_controlRef , &hir );
 }
 
@@ -974,6 +990,18 @@ void wxMacControl::GetPosition( int &x, int &y ) const
     GetControlBounds( m_controlRef , &r );
     x = r.left;
     y = r.top;
+
+    UInt32 attr = 0 ;
+    GetWindowAttributes( GetControlOwner(m_controlRef) , &attr ) ;
+
+    if ( !(attr & kWindowCompositingAttribute) )
+    {
+        HIRect parent;
+        HIViewGetFrame( HIViewGetSuperview(m_controlRef), &parent );
+        x -= parent.origin.x;
+        y -= parent.origin.y;
+    }
+    
 }
 
 void wxMacControl::GetSize( int &width, int &height ) const
@@ -1318,6 +1346,22 @@ void wxMacControl::SetBackgroundColour( const wxColour &WXUNUSED(col) )
 //    HITextViewSetBackgroundColor( m_textView , color );
 }
 
+bool wxMacControl::SetBackgroundStyle(wxBackgroundStyle style)
+{
+    if ( style != wxBG_STYLE_PAINT )
+    {
+        OSStatus err = HIViewChangeFeatures(m_controlRef , 0 , kHIViewIsOpaque);
+        verify_noerr( err );
+    }
+    else
+    {
+        OSStatus err = HIViewChangeFeatures(m_controlRef , kHIViewIsOpaque , 0);
+        verify_noerr( err );
+    }
+    
+    return true ;
+}
+
 void wxMacControl::SetRange( SInt32 minimum , SInt32 maximum )
 {
     ::SetControl32BitMinimum( m_controlRef , minimum );
@@ -1387,7 +1431,7 @@ void wxMacControl::GetRectInWindowCoords( Rect *r )
         OffsetRect( r , (short) hiPoint.x , (short) hiPoint.y ) ;
     }
 }
-
+        
 void wxMacControl::GetBestRect( wxRect *rect ) const
 {
     short   baselineoffset;
@@ -1515,6 +1559,8 @@ wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
     }
 
     // the root control level handler
-    contentview->InstallEventHandler() ;
+    if ( !now->IsNativeWindowWrapper() )
+        contentview->InstallEventHandler() ;
+    
     return contentview;
 }