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
This commit is contained in:
Václav Slavík
2011-08-29 17:25:33 +00:00
parent 276227fcbb
commit 297e2532b1
2 changed files with 14 additions and 1 deletions

View 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);