}
[super removeTrackingRect:tag];
}
+
+#if wxOSX_USE_NATIVE_FLIPPED
+- (BOOL)isFlipped
+{
+ return YES;
+}
+#endif
+
@end // wxNSView
//
return impl->resignFirstResponder(self, _cmd);
}
+#if !wxOSX_USE_NATIVE_FLIPPED
+
BOOL wxOSX_isFlipped(NSView* self, SEL _cmd)
{
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
return impl->isFlipped(self, _cmd) ? YES:NO;
}
+#endif
+
typedef void (*wxOSX_DrawRectHandlerPtr)(NSView* self, SEL _cmd, NSRect rect);
void wxOSX_drawRect(NSView* self, SEL _cmd, NSRect rect)
superimpl(slf, (SEL)_cmd, event);
// super of built-ins keeps the mouse up, as wx expects this event, we have to synthesize it
-
- if ( [ event type] == NSLeftMouseDown )
+ // only trigger if at this moment the mouse is already up
+ if ( [ event type] == NSLeftMouseDown && !wxGetMouseState().LeftIsDown() )
{
wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
SetupMouseEvent(wxevent , event) ;
return r;
}
-bool wxWidgetCocoaImpl::isFlipped(WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd))
+#if !wxOSX_USE_NATIVE_FLIPPED
+
+bool wxWidgetCocoaImpl::isFlipped(WXWidget slf, void *WXUNUSED(_cmd))
{
return m_isFlipped;
}
+#endif
#define OSX_DEBUG_DRAWING 0
// preparing the update region
wxRegion updateRgn;
+
+ // since adding many rects to a region is a costly process, by default use the bounding rect
+#if 0
const NSRect *rects;
NSInteger count;
-
[slf getRectsBeingDrawn:&rects count:&count];
for ( int i = 0 ; i < count ; ++i )
{
updateRgn.Union(wxFromNSRect(slf, rects[i]));
}
-
+#else
+ updateRgn.Union(wxFromNSRect(slf,*(NSRect*)rect));
+#endif
+
wxWindow* wxpeer = GetWXPeer();
if ( wxpeer->MacGetLeftBorderSize() != 0 || wxpeer->MacGetTopBorderSize() != 0 )
CGContextStrokePath(context);
#endif
- if ( !m_isFlipped )
+ if ( ![slf isFlipped] )
{
CGContextTranslateCTM( context, 0, [m_osxView bounds].size.height );
CGContextScaleCTM( context, 1, -1 );
CGContextSaveGState( context );
}
// as we called restore above, we have to flip again if necessary
- if ( !m_isFlipped )
+ if ( ![slf isFlipped] )
{
CGContextTranslateCTM( context, 0, [m_osxView bounds].size.height );
CGContextScaleCTM( context, 1, -1 );
{
wxWindow* wxpeer = (wxWindow*) GetWXPeer();
if ( wxpeer )
+ {
+ wxpeer->OSXSimulateFocusEvents();
wxpeer->OSXHandleClicked(0);
+ }
}
void wxWidgetCocoaImpl::controlDoubleAction( WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd), void *WXUNUSED(sender))
wxOSX_CLASS_ADD_METHOD(c, @selector(becomeFirstResponder), (IMP) wxOSX_becomeFirstResponder, "c@:" )
wxOSX_CLASS_ADD_METHOD(c, @selector(resignFirstResponder), (IMP) wxOSX_resignFirstResponder, "c@:" )
+#if !wxOSX_USE_NATIVE_FLIPPED
wxOSX_CLASS_ADD_METHOD(c, @selector(isFlipped), (IMP) wxOSX_isFlipped, "c@:" )
+#endif
wxOSX_CLASS_ADD_METHOD(c, @selector(drawRect:), (IMP) wxOSX_drawRect, "v@:{_NSRect={_NSPoint=ff}{_NSSize=ff}}" )
wxOSX_CLASS_ADD_METHOD(c, @selector(controlAction:), (IMP) wxOSX_controlAction, "v@:@" )
void wxWidgetCocoaImpl::Init()
{
m_osxView = NULL;
+#if !wxOSX_USE_NATIVE_FLIPPED
m_isFlipped = true;
+#endif
m_lastKeyDownEvent = NULL;
m_hasEditor = false;
}
event.SetWindow(otherWindow->GetWXPeer());
thisWindow->HandleWindowEvent(event) ;
}
- else // !receivedFocuss
+ else // !receivedFocus
{
#if wxUSE_CARET
if ( thisWindow->GetCaret() )
// [[m_osxView window] enableCursorRects];
}
+#if !wxOSX_USE_NATIVE_FLIPPED
+
void wxWidgetCocoaImpl::SetFlipped(bool flipped)
{
m_isFlipped = flipped;
}
+#endif
+
void wxWidgetCocoaImpl::SetDrawingEnabled(bool enabled)
{
if ( enabled )