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
33 ,const wxIcon
& rGo
= wxNullIcon
34 ,const wxIcon
& rStop
= wxNullIcon
37 /* constructor for setting one data object */
38 wxDropSource( wxDataObject
& rData
,
40 const wxIcon
& rGo
= wxNullIcon
,
41 const wxIcon
& rStop
= wxNullIcon
43 virtual ~wxDropSource();
45 /* start drag action */
46 virtual wxDragResult
DoDragDrop(bool bAllowMove
= FALSE
);
52 DRAGIMAGE
* m_pDragImage
;
53 DRAGINFO
* m_pDragInfo
;
54 DRAGTRANSFER
* m_pDragTransfer
;
57 //-------------------------------------------------------------------------
59 //-------------------------------------------------------------------------
61 class WXDLLEXPORT wxDropTarget
: public wxDropTargetBase
64 wxDropTarget(wxDataObject
*dataObject
= (wxDataObject
*)NULL
);
65 virtual ~wxDropTarget();
67 void Register(WXHWND hwnd
);
68 void Revoke(WXHWND hwnd
);
70 virtual wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
71 virtual bool OnDrop(wxCoord x
, wxCoord y
);
72 virtual bool OnData(wxCoord x
, wxCoord y
);
73 virtual bool GetData();
77 virtual bool IsAcceptable(DRAGINFO
* pInfo
);
79 DRAGINFO
* m_pDragInfo
;
80 DRAGTRANSFER
* m_pDragTransfer
;
83 // ----------------------------------------------------------------------------
84 // A simple wxDropTarget derived class for text data: you only need to
85 // override OnDropText() to get something working
86 // ----------------------------------------------------------------------------
88 class WXDLLEXPORT wxTextDropTarget
: public wxDropTarget
92 virtual ~wxTextDropTarget();
94 virtual bool OnDropText( wxCoord x
96 ,const wxString
& rText
99 virtual bool OnData( wxCoord x
104 // ----------------------------------------------------------------------------
105 // A drop target which accepts files (dragged from File Manager or Explorer)
106 // ----------------------------------------------------------------------------
108 class WXDLLEXPORT wxFileDropTarget
: public wxDropTarget
112 virtual ~wxFileDropTarget();
114 // parameters are the number of files and the array of file names
115 virtual bool OnDropFiles( wxCoord x
117 ,const wxArrayString
& rFilenames
120 virtual bool OnData( wxCoord x