]> git.saurik.com Git - wxWidgets.git/commitdiff
Make generic wxDataViewToggleRenderer react to activation.
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 29 Aug 2011 17:25:33 +0000 (17:25 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 29 Aug 2011 17:25:33 +0000 (17:25 +0000)
Previously it only responded to single-clicks, which was to avoid the
need to double-click checkboxes. Fixed to react to activation via
double-click or keyboard too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68953 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/dvrenderers.h
src/generic/datavgen.cpp

index fe71dc45f6b71843504cf2cf29d226b3542fecf4..513189496050cbb58100173e4da6854a141007c8 100644 (file)
@@ -126,6 +126,11 @@ public:
                                wxDataViewModel *model,
                                const wxDataViewItem& item,
                                unsigned int col);
+
+    virtual bool WXOnActivate(const wxRect& cell,
+                              wxDataViewModel *model,
+                              const wxDataViewItem& item,
+                              unsigned int col);
 private:
     bool    m_toggle;
 
index e5cb0ce44d94fc27b6a73ea557eb5d299d0fa57d..07415d15f60ef9825d03d236928f3f8e908f7d71 100644 (file)
@@ -939,7 +939,7 @@ bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state
 }
 
 bool wxDataViewToggleRenderer::WXOnLeftClick(const wxPoint& cursor,
-                                             const wxRect& WXUNUSED(cell),
+                                             const wxRect& cell,
                                              wxDataViewModel *model,
                                              const wxDataViewItem& item,
                                              unsigned int col)
@@ -948,6 +948,14 @@ bool wxDataViewToggleRenderer::WXOnLeftClick(const wxPoint& cursor,
     if (!wxRect(GetSize()).Contains(cursor))
         return false;
 
+    return WXOnActivate(cell, model, item, col);
+}
+
+bool wxDataViewToggleRenderer::WXOnActivate(const wxRect& WXUNUSED(cell),
+                                            wxDataViewModel *model,
+                                            const wxDataViewItem& item,
+                                            unsigned int col)
+{
     if (model->IsEnabled(item, col))
     {
         model->ChangeValue(!m_toggle, item, col);