From: Vadim Zeitlin Date: Sun, 5 Aug 2012 22:44:21 +0000 (+0000) Subject: Fix the checkbox cell size in generic wxDataViewToggleRenderer. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/45a04dd31ac86ce6d317fef080f127e8c96f2626 Fix the checkbox cell size in generic wxDataViewToggleRenderer. r62940 fixed an appearance problem with the checkboxes in wxDataViewCtrl but introduced another one: as the checkbox was now always drawn in the entire cell rectangle, the cell alignment was not taken into account any more. Fix this by only increasing the checkbox rectangle up to the required minimal size but not any more. Closes #14504. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72294 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index f500ec27ee..b1ce9f1162 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -1007,11 +1007,13 @@ bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state GetEnabled() == false) flags |= wxCONTROL_DISABLED; - // check boxes we draw must always have the same, standard size (if it's - // bigger than the cell size the checkbox will be truncated because the - // caller had set the clipping rectangle to prevent us from drawing outside - // the cell) - cell.SetSize(GetSize()); + // Ensure that the check boxes always have at least the minimal required + // size, otherwise DrawCheckBox() doesn't really work well. If this size is + // greater than the cell size, the checkbox will be truncated but this is a + // lesser evil. + wxSize size = cell.GetSize(); + size.IncTo(GetSize()); + cell.SetSize(size); wxRendererNative::Get().DrawCheckBox( GetOwner()->GetOwner(),