More DnD.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-10-21 13:09:06 +00:00
parent 79ec2ce20e
commit 97c79de27c
9 changed files with 206 additions and 54 deletions

View File

@@ -73,15 +73,6 @@ public:
// X11 has two clipboards which get selected by this call. Empty on MSW.
virtual void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
#ifdef WXWIN_COMPATIBILITY_2
// deprecated version
bool GetData(wxDataObject *data)
{
wxCHECK_MSG(data, FALSE, wxT("NULL pointer in wxClipboard"));
return GetData(*data);
}
#endif // WXWIN_COMPATIBILITY_2
};
// ----------------------------------------------------------------------------

View File

@@ -45,8 +45,10 @@ public:
// set the data which is transfered by drag and drop
void SetData(wxDataObject& data)
{ if (m_data) delete m_data;
m_data = &data; }
{ m_data = &data; }
wxDataObject *GetDataObject()
{ return m_data; }
// start drag action, see enum wxDragResult for return value description
//

View File

@@ -33,7 +33,6 @@ class wxWindow;
class wxDropTarget;
class wxTextDropTarget;
class wxFileDropTarget;
class wxPrivateDropTarget;
class wxDropSource;
@@ -70,6 +69,37 @@ public:
void SetDragTime( guint time ) { m_dragTime = time; }
};
// ----------------------------------------------------------------------------
// A simple wxDropTarget derived class for text data: you only need to
// override OnDropText() to get something working
// ----------------------------------------------------------------------------
class wxTextDropTarget : public wxDropTarget
{
public:
wxTextDropTarget();
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0;
virtual bool OnData(wxCoord x, wxCoord y);
};
// ----------------------------------------------------------------------------
// A drop target which accepts files (dragged from File Manager or Explorer)
// ----------------------------------------------------------------------------
class wxFileDropTarget : public wxDropTarget
{
public:
wxFileDropTarget();
// parameters are the number of files and the array of file names
virtual bool OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) = 0;
virtual bool OnData(wxCoord x, wxCoord y);
};
//-------------------------------------------------------------------------
// wxDropSource
//-------------------------------------------------------------------------
@@ -100,7 +130,6 @@ public:
GtkWidget *m_widget;
wxWindow *m_window;
wxDragResult m_retValue;
wxDataObject *m_data;
wxCursor m_defaultCursor;
wxCursor m_goaheadCursor;

View File

@@ -33,7 +33,6 @@ class wxWindow;
class wxDropTarget;
class wxTextDropTarget;
class wxFileDropTarget;
class wxPrivateDropTarget;
class wxDropSource;
@@ -70,6 +69,37 @@ public:
void SetDragTime( guint time ) { m_dragTime = time; }
};
// ----------------------------------------------------------------------------
// A simple wxDropTarget derived class for text data: you only need to
// override OnDropText() to get something working
// ----------------------------------------------------------------------------
class wxTextDropTarget : public wxDropTarget
{
public:
wxTextDropTarget();
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& text) = 0;
virtual bool OnData(wxCoord x, wxCoord y);
};
// ----------------------------------------------------------------------------
// A drop target which accepts files (dragged from File Manager or Explorer)
// ----------------------------------------------------------------------------
class wxFileDropTarget : public wxDropTarget
{
public:
wxFileDropTarget();
// parameters are the number of files and the array of file names
virtual bool OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames) = 0;
virtual bool OnData(wxCoord x, wxCoord y);
};
//-------------------------------------------------------------------------
// wxDropSource
//-------------------------------------------------------------------------
@@ -100,7 +130,6 @@ public:
GtkWidget *m_widget;
wxWindow *m_window;
wxDragResult m_retValue;
wxDataObject *m_data;
wxCursor m_defaultCursor;
wxCursor m_goaheadCursor;