]> git.saurik.com Git - wxWidgets.git/commitdiff
Only react to clicks on the checkbox in wxDataViewToggleRenderer.
authorVáclav Slavík <vslavik@fastmail.fm>
Wed, 23 Mar 2011 13:57:52 +0000 (13:57 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Wed, 23 Mar 2011 13:57:52 +0000 (13:57 +0000)
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

index 84520f5cce8e9fb7d6e3d66e96ac04d0ebf2d09c..cf63855f78d56b55ca2c68923c2a608620ce4362 100644 (file)
@@ -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);