diff --git a/docs/changes.txt b/docs/changes.txt index 8cd7755901..dcba1e43d7 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -142,6 +142,7 @@ wxMSW: wxOSX/Cocoa: +- Implement wxWindow::Disable() for non-native controls too (Steve Browne). - Add support for wxEVT_COMBOBOX_DROPDOWN and wxEVT_COMBOBOX_CLOSEUP events (Igor Korot). - Implement strike-through support in wxFont (Igor Korot). diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index c1b26371a9..1953dc3b3d 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -877,6 +877,15 @@ void wxWidgetCocoaImpl::SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEve return NO; } +- (NSView *)hitTest:(NSPoint)aPoint; +{ + wxWidgetCocoaImpl* viewimpl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); + if ( viewimpl && viewimpl->GetWXPeer() && !viewimpl->GetWXPeer()->IsEnabled() ) + return nil; + + return [super hitTest:aPoint]; +} + @end // wxNSView // We need to adopt NSTextInputClient protocol in order to interpretKeyEvents: to work. @@ -1381,6 +1390,9 @@ bool wxWidgetCocoaImpl::SetupCursor(WX_NSEvent event) void wxWidgetCocoaImpl::keyEvent(WX_NSEvent event, WXWidget slf, void *_cmd) { + if ( !m_wxPeer->IsEnabled() ) + return; + if ( [event type] == NSKeyDown ) { // there are key equivalents that are not command-combos and therefore not handled by cocoa automatically, @@ -2593,6 +2605,9 @@ void wxWidgetCocoaImpl::Enable( bool enable ) if ( [targetView respondsToSelector:@selector(setEnabled:) ] ) [targetView setEnabled:enable]; + + if ( !enable && HasFocus() ) + m_wxPeer->Navigate(); } void wxWidgetCocoaImpl::PulseGauge()