Fix double clicking over checkboxes in generic wxDataViewCtrl

Double clicks over checkboxes (i.e. items using wxDataViewToggleRenderer) were
ignored because they were translated to wxEVT_DATAVIEW_ITEM_ACTIVATED events
and nothing else happened, even if the event was not processed at all.

Fix this by continuing to process double clicks as normal clicks if there is
no special handling for the activation event.

In practice this means that half of the clicks doesn't seem to be "lost" any
more when clicking a checkbox in a quick succession.
This commit is contained in:
Vadim Zeitlin 2016-02-06 01:39:51 +01:00
parent bbf9927e94
commit 9ca5c2dce3

View File

@ -4233,12 +4233,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
if (event.LeftDClick())
{
if(hoverOverExpander)
{
// a double click on the expander will be converted into a "simulated" normal click
simulateClick = true;
}
else if ( current == m_lineLastClicked )
if ( !hoverOverExpander && (current == m_lineLastClicked) )
{
wxWindow *parent = GetParent();
wxDataViewEvent le(wxEVT_DATAVIEW_ITEM_ACTIVATED, parent->GetId());
@ -4248,15 +4243,19 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
le.SetEventObject(parent);
le.SetModel(GetModel());
parent->ProcessWindowEvent(le);
return;
}
else
{
// The first click was on another item, so don't interpret this as
// a double click, but as a simple click instead
simulateClick = true;
if ( parent->ProcessWindowEvent(le) )
{
// Item activation was handled from the user code.
return;
}
}
// Either it was a double click over the expander, or the second click
// happened on another item than the first one or it was a bona fide
// double click which was unhandled. In all these cases we continue
// processing this event as a simple click, e.g. to select the item or
// activate the renderer.
simulateClick = true;
}
if (event.LeftUp() && !hoverOverExpander)