1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declaration of the wxDropTarget class
4 // Author: David Webster
7 // Copyright: (c) 1999 David Webster
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
15 #if !wxUSE_DRAG_AND_DROP
16 #error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!"
19 #define INCL_WINSTDDRAG
27 //-------------------------------------------------------------------------
29 //-------------------------------------------------------------------------
31 class WXDLLIMPEXP_CORE wxDropSource
: public wxDropSourceBase
34 /* constructor. set data later with SetData() */
35 wxDropSource(wxWindow
* pWin
);
37 /* constructor for setting one data object */
38 wxDropSource( wxDataObject
& rData
,
41 virtual ~wxDropSource();
43 /* start drag action */
44 virtual wxDragResult
DoDragDrop(int flags
= wxDrag_CopyOnly
);
45 virtual bool GiveFeedback(wxDragResult eEffect
);
51 PDRAGINFO m_pDragInfo
;
52 DRAGIMAGE m_vDragImage
;
53 PDRAGITEM m_pDragItem
;
55 }; // end of CLASS wxDropSource
57 //-------------------------------------------------------------------------
59 //-------------------------------------------------------------------------
61 class WXDLLIMPEXP_CORE wxDropTarget
: public wxDropTargetBase
64 wxDropTarget(wxDataObject
* pDataObject
= NULL
);
65 virtual ~wxDropTarget();
68 // These functions are called when data is moved over position (x, y) and
69 // may return either wxDragCopy, wxDragMove or wxDragNone depending on
70 // what would happen if the data were dropped here.
72 // The last parameter is what would happen by default and is determined by
73 // the platform-specific logic (for example, under Windows it's wxDragCopy
74 // if Ctrl key is pressed and wxDragMove otherwise) except that it will
75 // always be wxDragNone if the carried data is in an unsupported format.
77 // OnData must be implemented and other should be overridden by derived classes
79 virtual wxDragResult
OnData( wxCoord vX
83 virtual bool OnDrop( wxCoord vX
86 bool IsAcceptedData(PDRAGINFO pDataSource
) const;
89 virtual bool GetData(void);
90 wxDataFormat
GetSupportedFormat(PDRAGINFO pDataSource
) const;
94 CIDropTarget
* m_pDropTarget
;
95 }; // end of CLASS wxDropTarget