From fce2dc61c3fca054138702cad59077d8f7221360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 23 Mar 2011 13:57:52 +0000 Subject: [PATCH] Only react to clicks on the checkbox in wxDataViewToggleRenderer. Previously, left click anywhere in the cell toggled the checkbox. This was unexpected when the cursor was far from the checkbox in a wide column. With this change, one has to be over the checkbox to toggle it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 84520f5cce..cf63855f78 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -863,12 +863,16 @@ bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state return true; } -bool wxDataViewToggleRenderer::WXOnLeftClick(const wxPoint& WXUNUSED(cursor), +bool wxDataViewToggleRenderer::WXOnLeftClick(const wxPoint& cursor, const wxRect& WXUNUSED(cell), wxDataViewModel *model, const wxDataViewItem& item, unsigned int col) { + // only react to clicks directly on the checkbox, not elsewhere in the same cell: + if (!wxRect(GetSize()).Contains(cursor)) + return false; + if (model->IsEnabled(item, col)) { model->ChangeValue(!m_toggle, item, col);