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:
@@ -126,6 +126,11 @@ public:
|
|||||||
wxDataViewModel *model,
|
wxDataViewModel *model,
|
||||||
const wxDataViewItem& item,
|
const wxDataViewItem& item,
|
||||||
unsigned int col);
|
unsigned int col);
|
||||||
|
|
||||||
|
virtual bool WXOnActivate(const wxRect& cell,
|
||||||
|
wxDataViewModel *model,
|
||||||
|
const wxDataViewItem& item,
|
||||||
|
unsigned int col);
|
||||||
private:
|
private:
|
||||||
bool m_toggle;
|
bool m_toggle;
|
||||||
|
|
||||||
|
@@ -939,7 +939,7 @@ bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxDataViewToggleRenderer::WXOnLeftClick(const wxPoint& cursor,
|
bool wxDataViewToggleRenderer::WXOnLeftClick(const wxPoint& cursor,
|
||||||
const wxRect& WXUNUSED(cell),
|
const wxRect& cell,
|
||||||
wxDataViewModel *model,
|
wxDataViewModel *model,
|
||||||
const wxDataViewItem& item,
|
const wxDataViewItem& item,
|
||||||
unsigned int col)
|
unsigned int col)
|
||||||
@@ -948,6 +948,14 @@ bool wxDataViewToggleRenderer::WXOnLeftClick(const wxPoint& cursor,
|
|||||||
if (!wxRect(GetSize()).Contains(cursor))
|
if (!wxRect(GetSize()).Contains(cursor))
|
||||||
return false;
|
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))
|
if (model->IsEnabled(item, col))
|
||||||
{
|
{
|
||||||
model->ChangeValue(!m_toggle, item, col);
|
model->ChangeValue(!m_toggle, item, col);
|
||||||
|
Reference in New Issue
Block a user