]> git.saurik.com Git - wxWidgets.git/commitdiff
wxDataObjectComposite/Custom seem to work
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 8 Nov 1999 17:05:51 +0000 (17:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 8 Nov 1999 17:05:51 +0000 (17:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/richedit/wxllist.cpp
samples/richedit/wxlwindow.cpp
src/gtk/clipbrd.cpp
src/gtk1/clipbrd.cpp

index 9ea3e73f2b1d9b5e90558b368e5d3c0a099086b4..94e81f7d7bc6b54dbdb6d8edaf01a3ea56930bb1 100644 (file)
@@ -2352,10 +2352,15 @@ wxLayoutList::Draw(wxDC &dc,
    }
    InvalidateUpdateRect();
 
-   WXLO_DEBUG(("Selection is %s : l%d,%ld/%ld,%ld",
-               m_Selection.m_valid ? "valid" : "invalid",
-               m_Selection.m_CursorA.x, m_Selection.m_CursorA.y,
-               m_Selection.m_CursorB.x, m_Selection.m_CursorB.y));
+#ifdef DEBUG
+   if ( m_Selection.m_valid )
+   {
+       WXLO_DEBUG(("Selection is %s : %ld,%ld/%ld,%ld",
+                   m_Selection.m_valid ? "valid" : "invalid",
+                   m_Selection.m_CursorA.x, m_Selection.m_CursorA.y,
+                   m_Selection.m_CursorB.x, m_Selection.m_CursorB.y));
+   }
+#endif
 }
 
 wxLayoutObject *
index 441d5a28ccd87ffc2d79fcbce901a7d13a57aab5..7ca4640d1ad41a2d12b989d8c6e4f15e1114df1d 100644 (file)
@@ -88,7 +88,7 @@ static const int Y_SCROLL_PAGE = 20;
 
 
 
-#define wxUSE_PRIVATE_CLIPBOARD_FORMAT 0
+#define wxUSE_PRIVATE_CLIPBOARD_FORMAT 1
 
 // ----------------------------------------------------------------------------
 // event tables
@@ -1079,12 +1079,11 @@ wxLayoutWindow::Paste(bool primary)
    {
 #if wxUSE_PRIVATE_CLIPBOARD_FORMAT
       wxLayoutDataObject wxldo;
-      if (wxTheClipboard->IsSupported( wxldo.GetFormat() ))
+      if ( wxTheClipboard->GetData(wxldo) )
       {
-         wxTheClipboard->GetData(wxldo);
-         {
-         }
          //FIXME: missing functionality  m_llist->Insert(wxldo.GetList());
+         wxLayoutImportText(m_llist, wxldo.GetLayoutData());
+         SetDirty();
       }
       else
 #endif
@@ -1113,8 +1112,14 @@ wxLayoutWindow::Copy(bool invalidate)
       m_llist->EndSelection();
    }
 
-   wxLayoutDataObject wldo;
-   wxLayoutList *llist = m_llist->GetSelection(&wldo, invalidate);
+#if wxUSE_PRIVATE_CLIPBOARD_FORMAT
+   // the data object which holds all different data objects, one for each
+   // format we support
+   wxDataObjectComposite *data = new wxDataObjectComposite;
+#endif
+
+   wxLayoutDataObject *wldo = new wxLayoutDataObject;
+   wxLayoutList *llist = m_llist->GetSelection(wldo, invalidate);
    if(! llist)
       return FALSE;
    // Export selection as text:
@@ -1139,18 +1144,20 @@ wxLayoutWindow::Copy(bool invalidate)
          text = text.Mid(0,len-1);
    }
 
-   if (wxTheClipboard->Open())
-   {
-      wxTextDataObject *data = new wxTextDataObject( text );
-      bool  rc = wxTheClipboard->SetData( data );
+   if (!wxTheClipboard->Open())
+       return FALSE;
+
 #if wxUSE_PRIVATE_CLIPBOARD_FORMAT
-      rc |= wxTheClipboard->AddData( &wldo );
+   data->Add(wldo, TRUE /* preferred */);
+   data->Add(new wxTextDataObject(text));
+#else
+   wxTextDataObject *data = new wxTextDataObject( text );
 #endif
-      wxTheClipboard->Close();
-      return rc;
-   }
-   
-   return FALSE;
+
+   bool rc = wxTheClipboard->SetData( data );
+
+   wxTheClipboard->Close();
+   return rc;
 }
 
 bool
index eb5efb10a07de58ec46f10fd17948299bd38c065..dc4bbe9c9043661ffa6cedb84e192fb95177b002 100644 (file)
@@ -229,7 +229,11 @@ selection_clear_clip( GtkWidget *WXUNUSED(widget), GdkEventSelection *event )
 //-----------------------------------------------------------------------------
 
 static void
-selection_handler( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data, gpointer WXUNUSED(data) )
+selection_handler( GtkWidget *WXUNUSED(widget),
+                   GtkSelectionData *selection_data,
+                   guint WXUNUSED(info),
+                   guint WXUNUSED(time),
+                   gpointer WXUNUSED(data) )
 {
     if (!wxTheClipboard) return;
 
index eb5efb10a07de58ec46f10fd17948299bd38c065..dc4bbe9c9043661ffa6cedb84e192fb95177b002 100644 (file)
@@ -229,7 +229,11 @@ selection_clear_clip( GtkWidget *WXUNUSED(widget), GdkEventSelection *event )
 //-----------------------------------------------------------------------------
 
 static void
-selection_handler( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data, gpointer WXUNUSED(data) )
+selection_handler( GtkWidget *WXUNUSED(widget),
+                   GtkSelectionData *selection_data,
+                   guint WXUNUSED(info),
+                   guint WXUNUSED(time),
+                   gpointer WXUNUSED(data) )
 {
     if (!wxTheClipboard) return;