From 4064f7deac3752bb5b20505daedc4ed750d19dd9 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 23 Mar 2006 19:00:53 +0000 Subject: [PATCH] Take into account cell's own size, not only the space allocated to it (mostly much more). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38316 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 4317d495d6..ddb1a5bc4e 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -706,7 +706,19 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &event ) wxVariant value; model->GetValue( value, col->GetModelColumn(), item ); cell->SetValue( value ); - cell->Render( cell_rect, &dc, 0 ); + wxSize size = cell->GetSize(); + // cannot be bigger than allocated space + size.x = wxMin( size.x, cell_rect.width ); + size.y = wxMin( size.y, cell_rect.height ); + // TODO: check for left/right/centre alignment here + wxRect item_rect; + // for now: centre + item_rect.x = cell_rect.x + (cell_rect.width / 2) - (size.x / 2); + item_rect.y = cell_rect.y + (cell_rect.height / 2) - (size.y / 2); + + item_rect.width = size.x; + item_rect.height= size.y; + cell->Render( item_rect, &dc, 0 ); } cell_rect.x += cell_rect.width;