From 94156c296fc6a70fb40d93ced91499450b8d8520 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 2 Jun 2011 08:18:11 +0000 Subject: [PATCH] cleanup git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67840 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/renderer.cpp | 22 +++++++--------------- src/osx/cocoa/dataview.mm | 9 +++++---- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/osx/carbon/renderer.cpp b/src/osx/carbon/renderer.cpp index 0f04a383a9..26aa6d6baf 100644 --- a/src/osx/carbon/renderer.cpp +++ b/src/osx/carbon/renderer.cpp @@ -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 ); } diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index 57e4927750..43d20630df 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -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) // -- 2.45.2