// check if we're currently in a paint event
inline bool wxInPaintEvent(wxWindow* win, wxDC& dc)
{
+ if ( win->MacGetCGContextRef() != NULL )
+ return true;
+
+ wxGCDCImpl* gcdc = wxDynamicCast( dc.GetImpl() , wxGCDCImpl);
+
+ if ( gcdc )
+ {
+ if ( gcdc->GetGraphicsContext()->GetNativeContext() )
+ return true;
+ }
+ /*
return win->MacGetCGContextRef() != NULL ||
// wxMemoryDC's also have a valid CGContext.
dc.IsKindOf( CLASSINFO(wxMemoryDC) );
+ */
+ return false;
}
#include "wx/osx/cocoa/dataview.h"
#include "wx/renderer.h"
#include "wx/stopwatch.h"
+#include "wx/dcgraph.h"
// ============================================================================
// Constants used locally
wxDataViewCustomRenderer * const renderer = obj->customRenderer;
- wxDC * const dc = renderer->GetDC();
- renderer->WXCallRender(wxFromNSRect(controlView, cellFrame), dc, 0);
- renderer->SetDC(NULL);
+ CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
+ CGContextSaveGState( context );
+
+ if ( ![controlView isFlipped] )
+ {
+ CGContextTranslateCTM( context, 0, [controlView bounds].size.height );
+ CGContextScaleCTM( context, 1, -1 );
+ }
+
+ // wxDC * const dc = renderer->GetDC();
+ wxGraphicsContext* gc = wxGraphicsContext::CreateFromNative(context);
+ wxGCDC dc;
+ dc.SetGraphicsContext(gc);
+ renderer->WXCallRender(wxFromNSRect(controlView, cellFrame), &dc, 0);
+
+ CGContextRestoreGState( context );
+ // renderer->SetDC(NULL);
}
-(NSRect) imageRectForBounds:(NSRect)cellFrame