bool wxWidgetCocoaImpl::performKeyEquivalent(WX_NSEvent event, WXWidget slf, void *_cmd)
{
- wxOSX_PerformKeyEventHandlerPtr superimpl = (wxOSX_PerformKeyEventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
- return superimpl(slf, (SEL)_cmd, event);
+ if ( GetFocusedViewInWindow([slf window]) != slf || m_hasEditor || !DoHandleKeyEvent(event) )
+ {
+ wxOSX_PerformKeyEventHandlerPtr superimpl = (wxOSX_PerformKeyEventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
+ return superimpl(slf, (SEL)_cmd, event);
+ }
+ return YES;
}
bool wxWidgetCocoaImpl::acceptsFirstResponder(WXWidget slf, void *_cmd)
CGContextRestoreGState( context );
CGContextSaveGState( context );
}
+ // as we called restore above, we have to flip again if necessary
+ if ( !m_isFlipped )
+ {
+ CGContextTranslateCTM( context, 0, [m_osxView bounds].size.height );
+ CGContextScaleCTM( context, 1, -1 );
+ }
wxpeer->MacPaintChildrenBorders();
wxpeer->MacSetCGContextRef( NULL );
CGContextRestoreGState( context );
wxRect r = wxFromNSRect( [m_osxView superview], [m_osxView frame] );
x = r.GetLeft();
y = r.GetTop();
+
+ // under Cocoa we might have a contentView in the wxParent to which we have to
+ // adjust the coordinates
+ wxWindowMac* parent = GetWXPeer()->GetParent();
+ if (parent && [m_osxView superview] != parent->GetHandle() )
+ {
+ int cx = 0,cy = 0,cw = 0,ch = 0;
+ if ( parent->GetPeer() )
+ {
+ parent->GetPeer()->GetContentArea(cx, cy, cw, ch);
+ x += cx;
+ y += cy;
+ }
+ }
}
void wxWidgetCocoaImpl::GetSize( int &width, int &height ) const
// eventually we could setup a doCommandBySelector catcher and retransform this into the wx key chars
wxKeyEvent wxevent2(wxevent) ;
wxevent2.SetEventType(wxEVT_CHAR);
- GetWXPeer()->OSXHandleKeyEvent(wxevent2);
+ result = GetWXPeer()->OSXHandleKeyEvent(wxevent2);
}
else
{
- if ( [m_osxView isKindOfClass:[NSScrollView class] ] )
- [[(NSScrollView*)m_osxView documentView] interpretKeyEvents:[NSArray arrayWithObject:event]];
- else
- [m_osxView interpretKeyEvents:[NSArray arrayWithObject:event]];
+ if ( !wxevent.CmdDown() )
+ {
+ if ( [m_osxView isKindOfClass:[NSScrollView class] ] )
+ [[(NSScrollView*)m_osxView documentView] interpretKeyEvents:[NSArray arrayWithObject:event]];
+ else
+ [m_osxView interpretKeyEvents:[NSArray arrayWithObject:event]];
+ result = true;
+ }
}
- result = true;
}
}
void wxWidgetCocoaImpl::SetCursor(const wxCursor& cursor)
{
- NSPoint location = [NSEvent mouseLocation];
- location = [[m_osxView window] convertScreenToBase:location];
- NSPoint locationInView = [m_osxView convertPoint:location fromView:nil];
-
- if( NSMouseInRect(locationInView, [m_osxView bounds], YES) )
+ if ( !wxIsBusy() )
{
- [(NSCursor*)cursor.GetHCURSOR() set];
+ NSPoint location = [NSEvent mouseLocation];
+ location = [[m_osxView window] convertScreenToBase:location];
+ NSPoint locationInView = [m_osxView convertPoint:location fromView:nil];
+
+ if( NSMouseInRect(locationInView, [m_osxView bounds], YES) )
+ {
+ [(NSCursor*)cursor.GetHCURSOR() set];
+ }
}
[[m_osxView window] invalidateCursorRectsForView:m_osxView];
}