From a923d77fc57722f430d21fd3bd6b5ec86d6e1bc3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 10 Nov 2009 17:41:42 +0000 Subject: [PATCH] Pass full cell rectangle to WXCallRender(). There is no need to ask the item for its size in gtk_wx_cell_renderer_render() as WXCallRender() will already do it (correctly, accounting for badly implemented GetSize() unlike this version) internally on its own. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/dataview.cpp | 60 +++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index 128c23c782..eca967e963 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -1232,47 +1232,33 @@ gtk_wx_cell_renderer_render (GtkCellRenderer *renderer, cell->expose_area = expose_area; cell->flags = flags; - GdkRectangle rect; - gtk_wx_cell_renderer_get_size (renderer, widget, cell_area, - &rect.x, - &rect.y, - &rect.width, - &rect.height); + wxRect rect(wxRectFromGDKRect(cell_area)); + rect = rect.Deflate(renderer->xpad, renderer->ypad); - rect.x += cell_area->x; - rect.y += cell_area->y; - rect.width -= renderer->xpad * 2; - rect.height -= renderer->ypad * 2; + wxWindowDC* dc = (wxWindowDC*) cell->GetDC(); + wxWindowDCImpl *impl = (wxWindowDCImpl *) dc->GetImpl(); - GdkRectangle dummy; - if (gdk_rectangle_intersect (expose_area, &rect, &dummy)) + // Reinitialize wxWindowDC's GDK window if drawing occurs into a different + // window such as a DnD drop window. + if (window != impl->m_gdkwindow) { - wxRect renderrect(wxRectFromGDKRect(&rect)); - wxWindowDC* dc = (wxWindowDC*) cell->GetDC(); - wxWindowDCImpl *impl = (wxWindowDCImpl *) dc->GetImpl(); - - // Reinitialize wxWindowDC's GDK window if drawing occurs into a different - // window such as a DnD drop window. - if (window != impl->m_gdkwindow) - { - impl->Destroy(); - impl->m_gdkwindow = window; - impl->SetUpDC(); - } - - int state = 0; - if (flags & GTK_CELL_RENDERER_SELECTED) - state |= wxDATAVIEW_CELL_SELECTED; - if (flags & GTK_CELL_RENDERER_PRELIT) - state |= wxDATAVIEW_CELL_PRELIT; - if (flags & GTK_CELL_RENDERER_INSENSITIVE) - state |= wxDATAVIEW_CELL_INSENSITIVE; - if (flags & GTK_CELL_RENDERER_INSENSITIVE) - state |= wxDATAVIEW_CELL_INSENSITIVE; - if (flags & GTK_CELL_RENDERER_FOCUSED) - state |= wxDATAVIEW_CELL_FOCUSED; - cell->WXCallRender( renderrect, dc, state ); + impl->Destroy(); + impl->m_gdkwindow = window; + impl->SetUpDC(); } + + int state = 0; + if (flags & GTK_CELL_RENDERER_SELECTED) + state |= wxDATAVIEW_CELL_SELECTED; + if (flags & GTK_CELL_RENDERER_PRELIT) + state |= wxDATAVIEW_CELL_PRELIT; + if (flags & GTK_CELL_RENDERER_INSENSITIVE) + state |= wxDATAVIEW_CELL_INSENSITIVE; + if (flags & GTK_CELL_RENDERER_INSENSITIVE) + state |= wxDATAVIEW_CELL_INSENSITIVE; + if (flags & GTK_CELL_RENDERER_FOCUSED) + state |= wxDATAVIEW_CELL_FOCUSED; + cell->WXCallRender( rect, dc, state ); } static gboolean