]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/dataobj.cpp
Added back compile-time check for about/prefs menu separator; OS 9 should not have...
[wxWidgets.git] / src / gtk1 / dataobj.cpp
index 84b89dbef67dc7f02fe9bd85d98c6fb2b379df99..0602e780372db27ec04a1ec7366240485ade5606 100644 (file)
@@ -28,6 +28,7 @@
 //-------------------------------------------------------------------------
 
 GdkAtom  g_textAtom        = 0;
+GdkAtom  g_altTextAtom     = 0;
 GdkAtom  g_pngAtom         = 0;
 GdkAtom  g_fileAtom        = 0;
 
@@ -77,13 +78,17 @@ void wxDataFormat::SetType( wxDataFormatId type )
 {
     PrepareFormats();
     
-    if (type == wxDF_UNICODETEXT)
-       type = wxDF_TEXT;
-
     m_type = type;
     
-    if (m_type == wxDF_TEXT)
+#if wxUSE_UNICODE
+    if (m_type == wxDF_UNICODETEXT)
         m_format = g_textAtom;
+    else if (m_type == wxDF_TEXT)
+        m_format = g_altTextAtom;
+#else
+    if (m_type == wxDF_TEXT || m_type == wxDF_UNICODETEXT)
+        m_format = g_textAtom;
+#endif
     else
     if (m_type == wxDF_BITMAP)
         m_format = g_pngAtom;
@@ -113,6 +118,13 @@ void wxDataFormat::SetId( NativeFormat format )
     m_format = format;
 
     if (m_format == g_textAtom)
+#if wxUSE_UNICODE
+        m_type = wxDF_UNICODETEXT;
+#else
+        m_type = wxDF_TEXT;
+#endif
+    else
+    if (m_format == g_altTextAtom)
         m_type = wxDF_TEXT;
     else
     if (m_format == g_pngAtom)
@@ -144,6 +156,7 @@ void wxDataFormat::PrepareFormats()
     if (!g_textAtom)
 #if wxUSE_UNICODE
         g_textAtom = gdk_atom_intern( "UTF8_STRING", FALSE );
+        g_altTextAtom = gdk_atom_intern( "STRING", FALSE );
 #else
         g_textAtom = gdk_atom_intern( "STRING" /* "text/plain" */, FALSE );
 #endif
@@ -192,6 +205,18 @@ bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir)
     }
 }
 
+// ----------------------------------------------------------------------------
+// wxTextDataObject
+// ----------------------------------------------------------------------------
+
+#if defined(__WXGTK20__) && wxUSE_UNICODE
+void wxTextDataObject::GetAllFormats(wxDataFormat *formats, wxDataObjectBase::Direction dir) const
+{
+    *formats++ = GetPreferredFormat();
+    *formats = g_altTextAtom;
+}
+#endif
+
 // ----------------------------------------------------------------------------
 // wxFileDataObject
 // ----------------------------------------------------------------------------