wxDataObjectComposite/Custom seem to work
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fe26d444bb
commit
19d89516dd
@ -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 *
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user