first stab at supporting custom renderers
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67831 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -42,9 +42,22 @@
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "wx/osx/cocoa/dataview.h"
|
||||
#include "wx/renderer.h"
|
||||
#include "wx/stopwatch.h"
|
||||
#include "wx/dcgraph.h"
|
||||
|
||||
// ============================================================================
|
||||
// Constants used locally
|
||||
@@ -1164,9 +1165,23 @@ outlineView:(NSOutlineView*)outlineView
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user