From fe731cbdee2ca0991ac702987d0acc11d47bf493 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 2 Dec 2013 16:30:25 +0000 Subject: [PATCH] Use correct cell alignment in generic wxDataViewCtrl mouse handling code. Don't fall back to wxALIGN_CENTRE, even if the renderer doesn't specify its own alignment we still have to take the column alignment in consideration, so use GetEffectiveAlignment() (which had to be made public for this). This notably fixes (again) hit testing for wxDataViewToggleRenderer in the generic version. Closes #15731. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75329 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dvrenderers.h | 8 +++++--- src/generic/datavgen.cpp | 4 +--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/wx/dvrenderers.h b/include/wx/dvrenderers.h index 3f623cf6a6..775bc1a2d8 100644 --- a/include/wx/dvrenderers.h +++ b/include/wx/dvrenderers.h @@ -163,9 +163,7 @@ public: virtual bool IsCustomRenderer() const { return false; } -protected: - // Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl - void DestroyEditControl(); + // Implementation only from now on. // Return the alignment of this renderer if it's specified (i.e. has value // different from the default wxDVR_DEFAULT_ALIGNMENT) or the alignment of @@ -176,6 +174,10 @@ protected: // wxDVR_DEFAULT_ALIGNMENT. int GetEffectiveAlignment() const; +protected: + // Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl + void DestroyEditControl(); + wxString m_variantType; wxDataViewColumn *m_owner; wxWeakRef m_editorCtrl; diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 05f1b3992e..afba6111df 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -4412,9 +4412,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event ) // see #12270. // adjust the rectangle ourselves to account for the alignment - int align = cell->GetAlignment(); - if ( align == wxDVR_DEFAULT_ALIGNMENT ) - align = wxALIGN_CENTRE; + const int align = cell->GetEffectiveAlignment(); wxRect rectItem = cell_rect; const wxSize size = cell->GetSize();