1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declaration of the wxDropTarget class
4 // Author: David Webster
8 // Copyright: (c) 1999 David Webster
9 // Licence: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
20 #if !wxUSE_DRAG_AND_DROP
21 #error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!"
24 //-------------------------------------------------------------------------
26 //-------------------------------------------------------------------------
28 class WXDLLEXPORT wxDropSource
: public wxDropSourceBase
31 /* constructor. set data later with SetData() */
32 wxDropSource(wxWindow
* pWin
);
34 /* constructor for setting one data object */
35 wxDropSource( wxDataObject
& rData
,
38 virtual ~wxDropSource();
40 /* start drag action */
41 virtual wxDragResult
DoDragDrop(bool bAllowMove
= FALSE
);
47 DRAGIMAGE
* m_pDragImage
;
48 DRAGINFO
* m_pDragInfo
;
49 DRAGTRANSFER
* m_pDragTransfer
;
52 //-------------------------------------------------------------------------
54 //-------------------------------------------------------------------------
56 class WXDLLEXPORT wxDropTarget
: public wxDropTargetBase
59 wxDropTarget(wxDataObject
*dataObject
= (wxDataObject
*)NULL
);
60 virtual ~wxDropTarget();
62 void Register(WXHWND hwnd
);
63 void Revoke(WXHWND hwnd
);
65 virtual wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
66 virtual bool OnDrop(wxCoord x
, wxCoord y
);
67 virtual bool OnData(wxCoord x
, wxCoord y
);
68 virtual wxDragResult
OnData(wxCoord x
, wxCoord y
, wxDragResult vResult
);
69 virtual bool GetData();
73 virtual bool IsAcceptable(DRAGINFO
* pInfo
);
75 DRAGINFO
* m_pDragInfo
;
76 DRAGTRANSFER
* m_pDragTransfer
;
79 // ----------------------------------------------------------------------------
80 // A simple wxDropTarget derived class for text data: you only need to
81 // override OnDropText() to get something working
82 // ----------------------------------------------------------------------------
84 class WXDLLEXPORT wxTextDropTarget
: public wxDropTarget
88 virtual ~wxTextDropTarget();
90 virtual bool OnDropText( wxCoord x
92 ,const wxString
& rText
95 virtual bool OnData( wxCoord x
98 virtual wxDragResult
OnData(wxCoord x
, wxCoord y
, wxDragResult vResult
);
101 // ----------------------------------------------------------------------------
102 // A drop target which accepts files (dragged from File Manager or Explorer)
103 // ----------------------------------------------------------------------------
105 class WXDLLEXPORT wxFileDropTarget
: public wxDropTarget
109 virtual ~wxFileDropTarget();
111 // parameters are the number of files and the array of file names
112 virtual bool OnDropFiles( wxCoord x
114 ,const wxArrayString
& rFilenames
117 virtual bool OnData( wxCoord x
120 virtual wxDragResult
OnData(wxCoord x
, wxCoord y
, wxDragResult vResult
);