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
This commit is contained in:
@@ -163,9 +163,7 @@ public:
|
|||||||
virtual bool IsCustomRenderer() const { return false; }
|
virtual bool IsCustomRenderer() const { return false; }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
// Implementation only from now on.
|
||||||
// Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl
|
|
||||||
void DestroyEditControl();
|
|
||||||
|
|
||||||
// Return the alignment of this renderer if it's specified (i.e. has value
|
// 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
|
// different from the default wxDVR_DEFAULT_ALIGNMENT) or the alignment of
|
||||||
@@ -176,6 +174,10 @@ protected:
|
|||||||
// wxDVR_DEFAULT_ALIGNMENT.
|
// wxDVR_DEFAULT_ALIGNMENT.
|
||||||
int GetEffectiveAlignment() const;
|
int GetEffectiveAlignment() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Called from {Cancel,Finish}Editing() to cleanup m_editorCtrl
|
||||||
|
void DestroyEditControl();
|
||||||
|
|
||||||
wxString m_variantType;
|
wxString m_variantType;
|
||||||
wxDataViewColumn *m_owner;
|
wxDataViewColumn *m_owner;
|
||||||
wxWeakRef<wxWindow> m_editorCtrl;
|
wxWeakRef<wxWindow> m_editorCtrl;
|
||||||
|
@@ -4412,9 +4412,7 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
|
|||||||
// see #12270.
|
// see #12270.
|
||||||
|
|
||||||
// adjust the rectangle ourselves to account for the alignment
|
// adjust the rectangle ourselves to account for the alignment
|
||||||
int align = cell->GetAlignment();
|
const int align = cell->GetEffectiveAlignment();
|
||||||
if ( align == wxDVR_DEFAULT_ALIGNMENT )
|
|
||||||
align = wxALIGN_CENTRE;
|
|
||||||
|
|
||||||
wxRect rectItem = cell_rect;
|
wxRect rectItem = cell_rect;
|
||||||
const wxSize size = cell->GetSize();
|
const wxSize size = cell->GetSize();
|
||||||
|
Reference in New Issue
Block a user