]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/clipbrd.cpp
don't provide unnecessary (as default) arguments to wxPen ctor, this incidentally...
[wxWidgets.git] / src / msw / clipbrd.cpp
index 3c233998730f770128c80ca64fb5e12010627b51..2369d769fb015b47c5ced071a2ac781c701010dc 100644 (file)
@@ -537,9 +537,7 @@ wxClipboard::~wxClipboard()
 {
     if ( m_lastDataObject )
     {
-        // Retain any remaining clipboard data
-        // after application exits.
-        Flush();
+        Clear();
     }
 
 #if wxUSE_OLE_CLIPBOARD
@@ -549,6 +547,9 @@ wxClipboard::~wxClipboard()
 
 void wxClipboard::Clear()
 {
+    if ( IsUsingPrimarySelection() )
+        return;
+
 #if wxUSE_OLE_CLIPBOARD
     if (m_lastDataObject)
     {
@@ -557,10 +558,10 @@ void wxClipboard::Clear()
         if (S_OK == hr)
         {
             hr = OleSetClipboard(NULL);
-    if ( FAILED(hr) )
-    {
-        wxLogApiError(wxT("OleSetClipboard(NULL)"), hr);
-    }
+            if ( FAILED(hr) )
+            {
+                wxLogApiError(wxT("OleSetClipboard(NULL)"), hr);
+            }
         }
         m_lastDataObject = NULL;
     }
@@ -578,14 +579,14 @@ bool wxClipboard::Flush()
         if (S_OK == hr)
         {
             hr = OleFlushClipboard();
-    if ( FAILED(hr) )
-    {
-        wxLogApiError(wxT("OleFlushClipboard"), hr);
+            if ( FAILED(hr) )
+            {
+                wxLogApiError(wxT("OleFlushClipboard"), hr);
 
-        return false;
-    }
-        return true;
-    }
+                return false;
+            }
+            return true;
+        }
     }
     return false;
 #else // !wxUSE_OLE_CLIPBOARD
@@ -615,6 +616,9 @@ bool wxClipboard::IsOpened() const
 
 bool wxClipboard::SetData( wxDataObject *data )
 {
+    if ( IsUsingPrimarySelection() )
+        return false;
+
 #if !wxUSE_OLE_CLIPBOARD
     (void)wxEmptyClipboard();
 #endif // wxUSE_OLE_CLIPBOARD
@@ -627,6 +631,9 @@ bool wxClipboard::SetData( wxDataObject *data )
 
 bool wxClipboard::AddData( wxDataObject *data )
 {
+    if ( IsUsingPrimarySelection() )
+        return false;
+
     wxCHECK_MSG( data, false, wxT("data is invalid") );
 
 #if wxUSE_OLE_CLIPBOARD
@@ -720,11 +727,14 @@ void wxClipboard::Close()
 
 bool wxClipboard::IsSupported( const wxDataFormat& format )
 {
-    return wxIsClipboardFormatAvailable(format);
+    return !IsUsingPrimarySelection() && wxIsClipboardFormatAvailable(format);
 }
 
 bool wxClipboard::GetData( wxDataObject& data )
 {
+    if ( IsUsingPrimarySelection() )
+        return false;
+
 #if wxUSE_OLE_CLIPBOARD
     IDataObject *pDataObject = NULL;
     HRESULT hr = OleGetClipboard(&pDataObject);