]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/clipbrd.cpp
Handle cases where an index larger than GetItemCount() is passed into InsertItem.
[wxWidgets.git] / src / mac / carbon / clipbrd.cpp
index 14fdda89c21467dc3529a5d2781da51427ab6c62..d0ea791e8b9a7509530637a118b2b23e64473557 100644 (file)
@@ -2,7 +2,7 @@
 // Name:        src/mac/carbon/clipbrd.cpp
 // Purpose:     Clipboard functionality
 // Author:      Stefan Csomor;
-//                   Generalized clipboard implementation by Matthew Flatt
+//              Generalized clipboard implementation by Matthew Flatt
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 
 #if wxUSE_CLIPBOARD
 
-#include "wx/app.h"
-#include "wx/frame.h"
-#include "wx/bitmap.h"
-#include "wx/utils.h"
-#include "wx/metafile.h"
 #include "wx/clipbrd.h"
-#include "wx/intl.h"
-#include "wx/log.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/intl.h"
+    #include "wx/log.h"
+    #include "wx/app.h"
+    #include "wx/utils.h"
+    #include "wx/frame.h"
+    #include "wx/bitmap.h"
+#endif
+
+#include "wx/metafile.h"
 
 #ifndef __DARWIN__
 #include <Scrap.h>
@@ -236,9 +240,18 @@ bool wxClipboard::AddData( wxDataObject *data )
 
     for (size_t i = 0; i < m_data->GetFormatCount(); i++)
     {
-        wxLogTrace( TRACE_CLIPBOARD,
-                    wxT("wxClipboard now supports atom %s"),
-                    array[i].GetId().c_str() );
+        if (array[i].IsStandard())
+        {
+            wxLogTrace( TRACE_CLIPBOARD,
+                        wxT("wxClipboard now supports standard atom type %d"),
+                        array[i].GetType() );
+        }
+        else
+        {
+            wxLogTrace( TRACE_CLIPBOARD,
+                        wxT("wxClipboard now supports atom %s"),
+                        array[i].GetId().c_str() );
+        }
 
         size_t sz = data->GetDataSize( array[ i ] );
         void* buf = malloc( sz + 1 );
@@ -329,6 +342,16 @@ bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
             if (err == noErr)
                 hasData = true;
         }
+        else if ( dataFormat.GetType() == wxDF_UNICODETEXT )
+        {
+            err = GetScrapFlavorFlags( scrapRef, 'TEXT', &flavorFlags );
+            if (err == noErr)
+            {
+                err = GetScrapFlavorSize( scrapRef, 'TEXT', &byteCount );
+                if (err == noErr)
+                    hasData = true;
+            }
+        }
     }
 
 #else