From c072c75701861cb508a1a46c50c3223359169242 Mon Sep 17 00:00:00 2001
From: Robin Dunn <robin@alldunn.com>
Date: Sat, 15 Apr 2006 05:35:08 +0000
Subject: [PATCH] Give wxDataObjectComposite a way to report what kind of data
 was given to it from the clipboard or DnD source.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/dobjcomp.tex | 9 +++++++++
 include/wx/dataobj.h       | 8 ++++++++
 src/common/dobjcmn.cpp     | 7 +++++++
 wxPython/src/_dataobj.i    | 8 ++++++++
 4 files changed, 32 insertions(+)

diff --git a/docs/latex/wx/dobjcomp.tex b/docs/latex/wx/dobjcomp.tex
index adeb6714ea..d295dc5eb1 100644
--- a/docs/latex/wx/dobjcomp.tex
+++ b/docs/latex/wx/dobjcomp.tex
@@ -63,3 +63,12 @@ Adds the {\it dataObject} to the list of supported objects and it becomes the
 preferred object if {\it preferred} is true.
 
 
+\membersection{wxDataObjectComposite::GetReceivedFormat}\label{wxdataobjectcompositegetreceivedformat}
+
+\constfunc{wxDataFormat}{GetReceivedFormat}{}
+
+Report the format passed to the SetData method.  This should be the
+format of the data object within the composite that recieved data from
+the clipboard or the DnD operation.  You can use this method to find
+out what kind of data object was recieved.
+
diff --git a/include/wx/dataobj.h b/include/wx/dataobj.h
index 6c7c1d0d01..174c649316 100644
--- a/include/wx/dataobj.h
+++ b/include/wx/dataobj.h
@@ -273,6 +273,12 @@ public:
     // one if preferred == true
     void Add(wxDataObjectSimple *dataObject, bool preferred = false);
 
+    // Report the format passed to the SetData method.  This should be the
+    // format of the data object within the composite that recieved data from
+    // the clipboard or the DnD operation.  You can use this method to find
+    // out what kind of data object was recieved.
+    wxDataFormat GetReceivedFormat() const;
+
     // implement base class pure virtuals
     // ----------------------------------
     virtual wxDataFormat GetPreferredFormat(wxDataObjectBase::Direction dir = Get) const;
@@ -301,6 +307,8 @@ private:
     // one is the preferred)
     size_t m_preferred;
 
+    wxDataFormat m_receivedFormat;
+
     DECLARE_NO_COPY_CLASS(wxDataObjectComposite)
 };
 
diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp
index 675ebdf2c0..e9aa506b79 100644
--- a/src/common/dobjcmn.cpp
+++ b/src/common/dobjcmn.cpp
@@ -86,6 +86,7 @@ bool wxDataObjectBase::IsSupported(const wxDataFormat& format,
 wxDataObjectComposite::wxDataObjectComposite()
 {
     m_preferred = 0;
+    m_receivedFormat = wxFormatInvalid;
 }
 
 wxDataObjectComposite::~wxDataObjectComposite()
@@ -120,6 +121,11 @@ void wxDataObjectComposite::Add(wxDataObjectSimple *dataObject, bool preferred)
     m_dataObjects.Append( dataObject );
 }
 
+wxDataFormat wxDataObjectComposite::GetReceivedFormat() const
+{
+    return m_receivedFormat;
+}
+
 wxDataFormat
 wxDataObjectComposite::GetPreferredFormat(Direction WXUNUSED(dir)) const
 {
@@ -219,6 +225,7 @@ bool wxDataObjectComposite::SetData(const wxDataFormat& format,
     wxCHECK_MSG( dataObj, false,
                  wxT("unsupported format in wxDataObjectComposite"));
 
+    m_receivedFormat = format;
     return dataObj->SetData( len, buf );
 }
 
diff --git a/wxPython/src/_dataobj.i b/wxPython/src/_dataobj.i
index fd6cd5c5b0..8f5f8f0e27 100644
--- a/wxPython/src/_dataobj.i
+++ b/wxPython/src/_dataobj.i
@@ -524,6 +524,14 @@ public:
 the preferred object if preferred is True.", "");
     
     %cleardisown( wxDataObjectSimple *dataObject );
+
+    DocDeclStr(
+        wxDataFormat , GetReceivedFormat() const,
+        "Report the format passed to the `SetData` method.  This should be the
+format of the data object within the composite that recieved data from
+the clipboard or the DnD operation.  You can use this method to find
+out what kind of data object was recieved.", "");
+    
 };
 
 //---------------------------------------------------------------------------
-- 
2.50.0

