X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f55d9f749b61b3a8435c58a285ac096726d15040..ec2df34e27ba41f202ecbf096cdfed082a9ddb8f:/src/osx/carbon/window.cpp diff --git a/src/osx/carbon/window.cpp b/src/osx/carbon/window.cpp index 21e9c4174a..b918d152d8 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 @@ -79,6 +79,20 @@ #define wxMAC_DEBUG_REDRAW 0 #endif +// Get the window with the focus +WXWidget wxWidgetImpl::FindFocus() +{ + ControlRef control = NULL ; + GetKeyboardFocus( GetUserFocusWindow() , &control ) ; + return control; +} + +// no compositing to take into account under carbon +wxWidgetImpl* wxWidgetImpl::FindBestFromWXWidget(WXWidget control) +{ + return FindFromWXWidget(control); +} + // --------------------------------------------------------------------------- // Carbon Events // --------------------------------------------------------------------------- @@ -131,24 +145,23 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl { case kEventControlDraw : { - RgnHandle updateRgn = NULL ; - RgnHandle allocatedRgn = NULL ; + HIShapeRef updateRgn = NULL ; + HIMutableShapeRef allocatedRgn = NULL ; wxRegion visRegion = thisWindow->MacGetVisibleRegion() ; - if ( cEvent.GetParameter(kEventParamRgnHandle, &updateRgn) != noErr ) + // according to the docs: redraw entire control if param not present + if ( cEvent.GetParameter(kEventParamShape, &updateRgn) != noErr ) { - HIShapeGetAsQDRgn( visRegion.GetWXHRGN(), updateRgn ); + updateRgn = visRegion.GetWXHRGN(); } else { if ( thisWindow->MacGetLeftBorderSize() != 0 || thisWindow->MacGetTopBorderSize() != 0 ) { // as this update region is in native window locals we must adapt it to wx window local - allocatedRgn = NewRgn() ; - CopyRgn( updateRgn , allocatedRgn ) ; - + allocatedRgn = HIShapeCreateMutableCopy(updateRgn); + HIShapeOffset(allocatedRgn, thisWindow->MacGetLeftBorderSize() , thisWindow->MacGetTopBorderSize()); // hide the given region by the new region that must be shifted - OffsetRgn( allocatedRgn , thisWindow->MacGetLeftBorderSize() , thisWindow->MacGetTopBorderSize() ) ; updateRgn = allocatedRgn ; } } @@ -177,12 +190,17 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl #endif { - bool created = false ; CGContextRef cgContext = NULL ; 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 ) ; @@ -201,7 +219,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl iter = iter->GetParent() ; } } - CGContextSetAlpha( cgContext , alpha ) ; + CGContextSetAlpha( cgContext, alpha ) ; if ( thisWindow->GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT ) { @@ -210,20 +228,36 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl CGContextClearRect( cgContext, bounds ); } - - - if ( thisWindow->MacDoRedraw( updateRgn , cEvent.GetTicks() ) ) - result = noErr ; - + if ( !HIShapeIsEmpty(updateRgn) ) + { + // refcount increase because wxRegion constructor takes ownership of the native region + CFRetain(updateRgn); + thisWindow->GetUpdateRegion() = wxRegion(updateRgn); + if ( !thisWindow->MacDoRedraw( cEvent.GetTicks() ) ) + { + // for native controls: call their native paint method + if ( !thisWindow->MacIsUserPane() || + ( thisWindow->IsTopLevel() && thisWindow->GetBackgroundStyle() == wxBG_STYLE_SYSTEM ) ) + { + if ( thisWindow->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT ) + { + CallNextEventHandler( handler,event ) ; + result = noErr ; + } + } + } + else + { + result = noErr ; + } + thisWindow->MacPaintChildrenBorders(); + } thisWindow->MacSetCGContextRef( NULL ) ; } - - if ( created ) - CGContextRelease( cgContext ) ; } if ( allocatedRgn ) - DisposeRgn( allocatedRgn ) ; + CFRelease( allocatedRgn ) ; } break ; @@ -287,7 +321,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl thisWindow->GetCaret()->OnKillFocus(); #endif - wxLogTrace(_T("Focus"), _T("focus lost(%p)"), wx_static_cast(void*, thisWindow)); + wxLogTrace(wxT("Focus"), wxT("focus lost(%p)"), static_cast(thisWindow)); // remove this as soon as posting the synthesized event works properly static bool inKillFocusEvent = false ; @@ -307,7 +341,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl { // set focus // panel wants to track the window which was the last to have focus in it - wxLogTrace(_T("Focus"), _T("focus set(%p)"), wx_static_cast(void*, thisWindow)); + wxLogTrace(wxT("Focus"), wxT("focus set(%p)"), static_cast(thisWindow)); wxChildFocusEvent eventFocus((wxWindow*)thisWindow); thisWindow->HandleWindowEvent(eventFocus); @@ -335,14 +369,14 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl if ( controlPart != kControlFocusNoPart ) { targetFocusWindow = thisWindow; - wxLogTrace(_T("Focus"), _T("focus to be set(%p)"), wx_static_cast(void*, thisWindow)); + wxLogTrace(wxT("Focus"), wxT("focus to be set(%p)"), static_cast(thisWindow)); } else { formerFocusWindow = thisWindow; - wxLogTrace(_T("Focus"), _T("focus to be lost(%p)"), wx_static_cast(void*, thisWindow)); + wxLogTrace(wxT("Focus"), wxT("focus to be lost(%p)"), static_cast(thisWindow)); } - + ControlPartCode previousControlPart = 0; verify_noerr( HIViewGetFocusPart(controlRef, &previousControlPart)); @@ -375,7 +409,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl iEvent.SetParameter( kEventParamPostTarget, typeEventTargetRef, GetControlEventTarget( controlRef ) ); iEvent.SetParameter( kEventParamControlPreviousPart, typeControlPartCode, previousControlPart ); iEvent.SetParameter( kEventParamControlCurrentPart, typeControlPartCode, currentControlPart ); - + #if 1 // TODO test this first, avoid double posts etc... PostEventToQueue( GetMainEventQueue(), evRef , kEventPriorityHigh ); @@ -393,7 +427,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl thisWindow->GetCaret()->OnKillFocus(); #endif - wxLogTrace(_T("Focus"), _T("focus lost(%p)"), wx_static_cast(void*, thisWindow)); + wxLogTrace(wxT("Focus"), wxT("focus lost(%p)"), static_cast(thisWindow)); static bool inKillFocusEvent = false ; @@ -409,7 +443,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl else { // panel wants to track the window which was the last to have focus in it - wxLogTrace(_T("Focus"), _T("focus set(%p)"), wx_static_cast(void*, thisWindow)); + wxLogTrace(wxT("Focus"), wxT("focus set(%p)"), static_cast(thisWindow)); wxChildFocusEvent eventFocus((wxWindow*)thisWindow); thisWindow->HandleWindowEvent(eventFocus); @@ -557,7 +591,7 @@ wxMacWindowServiceEventHandler(EventHandlerCallRef WXUNUSED(handler), return result ; } -pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) +WXDLLEXPORT pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) { OSStatus result = eventNotHandledErr ; wxWindowMac* focus = (wxWindowMac*) data ; @@ -582,14 +616,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 ) ) @@ -630,8 +659,7 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even I don't have time to look into that right now. -- CL */ - if ( wxTheApp->MacSendCharEvent( - focus , message , 0 , when , 0 , 0 , uniChars[pos] ) ) + if ( wxTheApp->MacSendCharEvent( focus , message , 0 , when , uniChars[pos] ) ) { result = noErr ; } @@ -643,15 +671,13 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even case kEventTextInputUnicodeForKeyEvent : { UInt32 keyCode, modifiers ; - Point point ; EventRef rawEvent ; unsigned char charCode ; GetEventParameter( event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent ) ; - GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &charCode ); + GetEventParameter( rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode ); GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode ); GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers ); - GetEventParameter( rawEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point ); UInt32 message = (keyCode << 8) + charCode; @@ -663,8 +689,7 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ; wxTheApp->MacSetCurrentEvent( event , handler ) ; - if ( wxTheApp->MacSendCharEvent( - focus , message , modifiers , when , point.h , point.v , uniChars[pos] ) ) + if ( wxTheApp->MacSendCharEvent( focus , message , modifiers , when , uniChars[pos] ) ) { result = noErr ; } @@ -770,17 +795,50 @@ pascal void wxMacLiveScrollbarActionProc( ControlRef control , ControlPartCode p { wxWindow* wx = wxFindWindowFromWXWidget( (WXWidget) control ) ; if ( wx ) - wx->MacHandleControlClick( (WXWidget) control , partCode , true /* stillDown */ ) ; + { + wxEventType scrollEvent = wxEVT_NULL; + switch ( partCode ) + { + case kControlUpButtonPart: + scrollEvent = wxEVT_SCROLL_LINEUP; + break; + + case kControlDownButtonPart: + scrollEvent = wxEVT_SCROLL_LINEDOWN; + break; + + case kControlPageUpPart: + scrollEvent = wxEVT_SCROLL_PAGEUP; + break; + + case kControlPageDownPart: + scrollEvent = wxEVT_SCROLL_PAGEDOWN; + break; + + case kControlIndicatorPart: + scrollEvent = wxEVT_SCROLL_THUMBTRACK; + // when this is called as a live proc, mouse is always still down + // so no need for thumbrelease + // scrollEvent = wxEVT_SCROLL_THUMBRELEASE; + break; + } + wx->TriggerScrollEvent(scrollEvent) ; + } } } wxMAC_DEFINE_PROC_GETTER( ControlActionUPP , wxMacLiveScrollbarActionProc ) ; -wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, long extraStyle) +wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, + wxWindowMac* WXUNUSED(parent), + wxWindowID WXUNUSED(id), + const wxPoint& pos, + const wxSize& size, + long WXUNUSED(style), + long WXUNUSED(extraStyle)) { OSStatus err = noErr; Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; - wxMacControl* c = new wxMacControl(wxpeer) ; + wxMacControl* c = new wxMacControl(wxpeer, false, true) ; UInt32 features = 0 | kControlSupportsEmbedding | kControlSupportsLiveFeedback @@ -812,8 +870,8 @@ wxMacControl::wxMacControl() Init(); } -wxMacControl::wxMacControl(wxWindowMac* peer , bool isRootControl ) : - wxWidgetImpl( peer, isRootControl ) +wxMacControl::wxMacControl(wxWindowMac* peer , bool isRootControl, bool isUserPane ) : + wxWidgetImpl( peer, isRootControl, isUserPane ) { Init(); } @@ -841,22 +899,15 @@ void wxMacControl::Init() m_macControlEventHandler = NULL; } -void wxMacControl::SetReference( URefCon data ) -{ - SetControlReference( m_controlRef , data ); -} - void wxMacControl::RemoveFromParent() { // nothing to do here for carbon + HIViewRemoveFromSuperview(m_controlRef); } void wxMacControl::Embed( wxWidgetImpl *parent ) { - // copied from MacPostControlCreate - ControlRef container = (ControlRef) parent->GetWXWidget() ; - wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ; - ::EmbedControl( m_controlRef , container ) ; + HIViewAddSubview((ControlRef)parent->GetWXWidget(), m_controlRef); } void wxMacControl::SetNeedsDisplay( const wxRect* rect ) @@ -877,7 +928,7 @@ void wxMacControl::Raise() { verify_noerr( HIViewSetZOrder( m_controlRef, kHIViewZOrderAbove, NULL ) ); } - + void wxMacControl::Lower() { verify_noerr( HIViewSetZOrder( m_controlRef, kHIViewZOrderBelow, NULL ) ); @@ -885,19 +936,27 @@ void wxMacControl::Lower() void wxMacControl::GetContentArea(int &left , int &top , int &width , int &height) const { - RgnHandle rgn = NewRgn() ; + HIShapeRef rgn = NULL; Rect content ; - if ( GetControlRegion( m_controlRef, kControlContentMetaPart , rgn ) == noErr ) - GetRegionBounds( rgn , &content ) ; + + if ( HIViewCopyShape(m_controlRef, kHIViewContentMetaPart, &rgn) == noErr) + { + CGRect cgrect; + HIShapeGetBounds(rgn, &cgrect); + content = (Rect){ (short)cgrect.origin.y, + (short)cgrect.origin.x, + (short)(cgrect.origin.y+cgrect.size.height), + (short)(cgrect.origin.x+cgrect.size.width) }; + CFRelease(rgn); + } else { - GetControlBounds( m_controlRef , &content ); + GetControlBounds(m_controlRef, &content); content.right -= content.left; content.left = 0; content.bottom -= content.top; content.top = 0; } - DisposeRgn( rgn ) ; left = content.left; top = content.top; @@ -908,7 +967,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 ); } @@ -918,6 +987,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 @@ -928,7 +1009,7 @@ void wxMacControl::GetSize( int &width, int &height ) const height = r.bottom - r.top; } -void wxMacControl::SetControlSize( wxWindowVariant variant ) +void wxMacControl::SetControlSize( wxWindowVariant variant ) { ControlSize size ; switch ( variant ) @@ -951,7 +1032,7 @@ void wxMacControl::SetControlSize( wxWindowVariant variant ) break ; default: - wxFAIL_MSG(_T("unexpected window variant")); + wxFAIL_MSG(wxT("unexpected window variant")); break ; } @@ -1034,7 +1115,7 @@ bool wxMacControl::SetFocus() if ( err == errCouldntSetFocus ) return false ; SetUserFocusWindow(GetControlOwner( m_controlRef ) ); - + return true; } @@ -1045,6 +1126,47 @@ bool wxMacControl::HasFocus() const return control == m_controlRef; } +void wxMacControl::SetCursor(const wxCursor& cursor) +{ + wxWindowMac *mouseWin = 0 ; + WindowRef window = GetControlOwner( m_controlRef ) ; + + wxNonOwnedWindow* tlwwx = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) window ) ; + if ( tlwwx != NULL ) + { + ControlPartCode part ; + ControlRef control ; + Point pt ; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + HIPoint hiPoint ; + HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint); + pt.h = hiPoint.x; + pt.v = hiPoint.y; +#else + GetGlobalMouse( &pt ); + int x = pt.h; + int y = pt.v; + tlwwx->ScreenToClient(&x, &y); + pt.h = x; + pt.v = y; +#endif + control = FindControlUnderMouse( pt , window , &part ) ; + if ( control ) + mouseWin = wxFindWindowFromWXWidget( (WXWidget) control ) ; + } + + if ( mouseWin == tlwwx && !wxIsBusy() ) + cursor.MacInstall() ; +} + +void wxMacControl::CaptureMouse() +{ +} + +void wxMacControl::ReleaseMouse() +{ +} + // // subclass specifics // @@ -1098,17 +1220,15 @@ wxInt32 wxMacControl::GetValue() const return ::GetControl32BitValue( m_controlRef ); } -SInt32 wxMacControl::GetMaximum() const +wxInt32 wxMacControl::GetMaximum() const { return ::GetControl32BitMaximum( m_controlRef ); } -/* wxInt32 wxMacControl::GetMinimum() const { return ::GetControl32BitMinimum( m_controlRef ); } -*/ void wxMacControl::SetValue( wxInt32 v ) { @@ -1152,7 +1272,7 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l flush = kHIThemeTextHorizontalFlushCenter; else if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_RIGHT ) flush = kHIThemeTextHorizontalFlushRight; - HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.MacGetCTFont() ); + HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.OSXGetCTFont() ); HIViewSetTextHorizontalFlush( m_controlRef, part, flush ); if ( foreground != *wxBLACK || ignoreBlack == false ) @@ -1193,7 +1313,7 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l { fontStyle.font = font.MacGetFontNum(); fontStyle.style = font.MacGetFontStyle(); - fontStyle.size = font.MacGetFontSize(); + fontStyle.size = font.GetPointSize(); fontStyle.flags = kControlUseFontMask | kControlUseFaceMask | kControlUseSizeMask; } @@ -1223,6 +1343,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 ); @@ -1274,7 +1410,15 @@ void wxMacControl::Enable( bool enable ) void wxMacControl::SetDrawingEnabled( bool enable ) { - HIViewSetDrawingEnabled( m_controlRef , enable ); + if ( enable ) + { + HIViewSetDrawingEnabled( m_controlRef , true ); + HIViewSetNeedsDisplay( m_controlRef, true); + } + else + { + HIViewSetDrawingEnabled( m_controlRef , false ); + } } void wxMacControl::GetRectInWindowCoords( Rect *r ) @@ -1318,12 +1462,6 @@ void wxMacControl::GetFeatures( UInt32 * features ) GetControlFeatures( m_controlRef , features ); } -OSStatus wxMacControl::GetRegion( ControlPartCode partCode , RgnHandle region ) -{ - OSStatus err = GetControlRegion( m_controlRef , partCode , region ); - return err; -} - void wxMacControl::PulseGauge() { } @@ -1378,11 +1516,21 @@ wxMacControl* wxMacControl::GetReferenceFromNativeControl(ControlRef control) return NULL; } +wxBitmap wxMacControl::GetBitmap() const +{ + return wxNullBitmap; +} + void wxMacControl::SetBitmap( const wxBitmap& WXUNUSED(bmp) ) { // implemented in the respective subclasses } +void wxMacControl::SetBitmapPosition( wxDirection WXUNUSED(dir) ) +{ + // implemented in the same subclasses that implement SetBitmap() +} + void wxMacControl::SetScrollThumb( wxInt32 WXUNUSED(pos), wxInt32 WXUNUSED(viewsize) ) { // implemented in respective subclass @@ -1401,11 +1549,11 @@ OSStatus wxMacControl::SetTabEnabled( SInt16 tabNo , bool enable ) // Control Factory -wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now ) +wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now ) { // 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 explicitly - + wxMacControl* contentview = new wxMacControl(now , true /*isRootControl*/); HIViewFindByID( HIViewGetRoot( (WindowRef) now->GetWXWindow() ) , kHIViewWindowContentID , contentview->GetControlRefAddr() ) ; @@ -1416,6 +1564,8 @@ wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now ) } // the root control level handler - contentview->InstallEventHandler() ; + if ( !now->IsNativeWindowWrapper() ) + contentview->InstallEventHandler() ; + return contentview; }