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
This commit is contained in:
Václav Slavík 2011-03-23 13:57:52 +00:00
parent 09bdb1cb3e
commit fce2dc61c3

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