From: Václav Slavík Date: Mon, 29 Aug 2011 17:25:33 +0000 (+0000) Subject: Make generic wxDataViewToggleRenderer react to activation. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/297e2532b1f705be36d0116e97e88846e0310bf7 Make generic wxDataViewToggleRenderer react to activation. 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 --- diff --git a/include/wx/generic/dvrenderers.h b/include/wx/generic/dvrenderers.h index fe71dc45f6..5131894960 100644 --- a/include/wx/generic/dvrenderers.h +++ b/include/wx/generic/dvrenderers.h @@ -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; diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index e5cb0ce44d..07415d15f6 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -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);