X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a83f860948059b0273b5cc6d9e43fadad3ebfca..66f75561893ea7b4bf429d1882d9cc0407ba932d:/src/osx/carbon/window.cpp diff --git a/src/osx/carbon/window.cpp b/src/osx/carbon/window.cpp index 09f448a83c..b7ccb7cc43 100644 --- a/src/osx/carbon/window.cpp +++ b/src/osx/carbon/window.cpp @@ -65,7 +65,7 @@ #include "wx/osx/uma.h" #else #include "wx/osx/private.h" -// bring in themeing +// bring in theming #include #endif @@ -188,7 +188,13 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl OSStatus err = cEvent.GetParameter(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 ) ; @@ -604,14 +610,9 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even uniChars = new wchar_t[ numChars ] ; GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ; charBuf[ numChars - 1 ] = 0; -#if SIZEOF_WCHAR_T == 2 - uniChars = (wchar_t*) charBuf ; -/* memcpy( uniChars , charBuf , numChars * 2 ) ;*/ // is there any point in copying charBuf over itself? (in fact, memcpy isn't even guaranteed to work correctly if the source and destination ranges overlap...) -#else // the resulting string will never have more chars than the utf16 version, so this is safe wxMBConvUTF16 converter ; numChars = converter.MB2WC( uniChars , (const char*)charBuf , numChars ) ; -#endif } switch ( GetEventKind( event ) ) @@ -964,7 +965,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 +985,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 -= (int)parent.origin.x; + y -= (int)parent.origin.y; + } + } void wxMacControl::GetSize( int &width, int &height ) const @@ -1318,6 +1341,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 ); @@ -1515,6 +1554,8 @@ wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now ) } // the root control level handler - contentview->InstallEventHandler() ; + if ( !now->IsNativeWindowWrapper() ) + contentview->InstallEventHandler() ; + return contentview; }