More DnD.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -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
|
||||
//
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user