Cleanup of wxDataViewCtrl cell activation code.

Fix confusion of what cell activation is and inconsistence with native
handling in GTK+. Document the distinction between activating (~
editing) a cell and activating (double-clicking) the whole item.

Deprecate wxDataViewCustomRenderer::LeftClick() and Activate() methods,
replace them with single ActivateCell() that is called for both kinds of
activation.

Fix implementations so that ActivateCell() is not called on
double-click, when it shouldn't, and vice versa: don't send
wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED for cell activation.

Partially reverts r67099 -- restores old 2.9 signatures of compatibility
LeftClick() and Activate() methods.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2011-10-19 16:20:17 +00:00
parent 4a99d59750
commit dc73d7f5d4
9 changed files with 229 additions and 167 deletions

View File

@@ -189,22 +189,18 @@ public:
return true;
}
virtual bool Activate( const wxRect& WXUNUSED(cell),
wxDataViewModel *WXUNUSED(model),
const wxDataViewItem &WXUNUSED(item),
unsigned int WXUNUSED(col) )
virtual bool ActivateCell(const wxRect& WXUNUSED(cell),
wxDataViewModel *WXUNUSED(model),
const wxDataViewItem &WXUNUSED(item),
unsigned int WXUNUSED(col),
const wxMouseEvent *mouseEvent)
{
wxLogMessage( "MyCustomRenderer Activate()" );
return false;
}
virtual bool LeftClick(const wxPoint& cursor,
const wxRect& WXUNUSED(cell),
wxDataViewModel *WXUNUSED(model),
const wxDataViewItem &WXUNUSED(item),
unsigned int WXUNUSED(col) )
{
wxLogMessage( "MyCustomRenderer LeftClick( %d, %d )", cursor.x, cursor.y );
wxString position;
if ( mouseEvent )
position = wxString::Format("via mouse at %d, %d", mouseEvent->m_x, mouseEvent->m_y);
else
position = "from keyboard";
wxLogMessage("MyCustomRenderer ActivateCell() %s", position);
return false;
}