git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67840 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2011-06-02 08:18:11 +00:00
parent 7cc84a7322
commit 94156c296f
2 changed files with 12 additions and 19 deletions

View File

@@ -39,12 +39,9 @@
#endif // wxHAS_DRAW_TITLE_BAR_BITMAP
// check if we're currently in a paint event
inline bool wxInPaintEvent(wxWindow* win, wxDC& dc)
// check if we're having a CGContext we can draw into
inline bool wxHasCGContext(wxWindow* win, wxDC& dc)
{
if ( win->MacGetCGContextRef() != NULL )
return true;
wxGCDCImpl* gcdc = wxDynamicCast( dc.GetImpl() , wxGCDCImpl);
if ( gcdc )
@@ -52,11 +49,6 @@ inline bool wxInPaintEvent(wxWindow* win, wxDC& dc)
if ( gcdc->GetGraphicsContext()->GetNativeContext() )
return true;
}
/*
return win->MacGetCGContextRef() != NULL ||
// wxMemoryDC's also have a valid CGContext.
dc.IsKindOf( CLASSINFO(wxMemoryDC) );
*/
return false;
}
@@ -171,7 +163,7 @@ int wxRendererMac::DrawHeaderButton( wxWindow *win,
dc.SetBrush( *wxTRANSPARENT_BRUSH );
HIRect headerRect = CGRectMake( x, y, w, h );
if ( !wxInPaintEvent(win, dc) )
if ( !wxHasCGContext(win, dc) )
{
win->Refresh( &rect );
}
@@ -260,7 +252,7 @@ void wxRendererMac::DrawTreeItemButton( wxWindow *win,
dc.SetBrush( *wxTRANSPARENT_BRUSH );
HIRect headerRect = CGRectMake( x, y, w, h );
if ( !wxInPaintEvent(win, dc) )
if ( !wxHasCGContext(win, dc) )
{
win->Refresh( &rect );
}
@@ -306,7 +298,7 @@ void wxRendererMac::DrawSplitterSash( wxWindow *win,
// under compositing we should only draw when called by the OS, otherwise just issue a redraw command
// strange redraw errors occur if we don't do this
if ( !wxInPaintEvent(win, dc) )
if ( !wxHasCGContext(win, dc) )
{
wxRect rect( (int) splitterRect.origin.x, (int) splitterRect.origin.y, (int) splitterRect.size.width,
(int) splitterRect.size.height );
@@ -376,7 +368,7 @@ wxRendererMac::DrawMacThemeButton(wxWindow *win,
dc.SetBrush( *wxTRANSPARENT_BRUSH );
HIRect headerRect = CGRectMake( x, y, w, h );
if ( !wxInPaintEvent(win, dc) )
if ( !wxHasCGContext(win, dc) )
{
win->Refresh( &rect );
}
@@ -584,7 +576,7 @@ void wxRendererMac::DrawTextCtrl(wxWindow* win, wxDC& dc,
dc.SetBrush( *wxTRANSPARENT_BRUSH );
HIRect hiRect = CGRectMake( x, y, w, h );
if ( !wxInPaintEvent(win, dc) )
if ( !wxHasCGContext(win, dc) )
{
win->Refresh( &rect );
}

View File

@@ -1165,6 +1165,7 @@ outlineView:(NSOutlineView*)outlineView
wxDataViewCustomRenderer * const renderer = obj->customRenderer;
// if this method is called everything is already setup correctly,
CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
CGContextSaveGState( context );
@@ -1174,14 +1175,13 @@ outlineView:(NSOutlineView*)outlineView
CGContextScaleCTM( context, 1, -1 );
}
// wxDC * const dc = renderer->GetDC();
wxGraphicsContext* gc = wxGraphicsContext::CreateFromNative(context);
wxGCDC dc;
wxGraphicsContext* gc = wxGraphicsContext::CreateFromNative(context);
dc.SetGraphicsContext(gc);
renderer->WXCallRender(wxFromNSRect(controlView, cellFrame), &dc, 0);
CGContextRestoreGState( context );
// renderer->SetDC(NULL);
}
-(NSRect) imageRectForBounds:(NSRect)cellFrame
@@ -2329,11 +2329,12 @@ void wxCocoaDataViewControl::Resort()
[m_OutlineView reloadData];
}
/*
void wxCocoaDataViewControl::StartEditor( const wxDataViewItem & item, unsigned int column )
{
[m_OutlineView editColumn:column row:[m_OutlineView rowForItem:[m_DataSource getDataViewItemFromBuffer:item]] withEvent:nil select:YES];
}
*/
//
// other methods (inherited from wxDataViewWidgetImpl)
//