From 352923dc8d0d01a0f00aa6ca9d01534b3592448b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 10 Dec 2021 19:31:24 +0100 Subject: [PATCH] Make wxDataViewCtrlBase::CreateDataObject() static This function doesn't need to be virtual as it's not meant to be overridden in, but just called from the derived classes. In fact, it doesn't even have to be a member function at all, but leave it in the class for now to avoid having to create a new header just for it, but make it static. Also add a comment explaining what is it for and what it does. --- include/wx/dataview.h | 6 ++++-- src/common/datavcmn.cpp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 9023e66e33..1b22d2eca1 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -806,11 +806,13 @@ protected: virtual void DoSetIndent() = 0; #if wxUSE_DRAG_AND_DROP - virtual wxDataObject* CreateDataObject(const wxVector& formats); + // Helper function which can be used by DoEnableDropTarget() implementations + // in the derived classes: return a composite data object supporting the + // given formats or null if the vector is empty. + static wxDataObject* CreateDataObject(const wxVector& formats); virtual bool DoEnableDropTarget(const wxVector& WXUNUSED(formats)) { return false; } - #endif // wxUSE_DRAG_AND_DROP // Just expand this item assuming it is already shown, i.e. its parent has diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index f1691311ff..952eb2e176 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -1690,6 +1690,7 @@ void wxDataViewCtrlBase::StartEditor(const wxDataViewItem& item, unsigned int co #if wxUSE_DRAG_AND_DROP +/* static */ wxDataObject* wxDataViewCtrlBase::CreateDataObject(const wxVector& formats) { if (formats.empty())