1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declaration of the wxDropTarget class
4 // Author: David Webster
8 // Copyright: (c) 1999 David Webster
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
16 #if !wxUSE_DRAG_AND_DROP
17 #error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!"
20 #define INCL_WINSTDDRAG
28 //-------------------------------------------------------------------------
30 //-------------------------------------------------------------------------
32 class WXDLLIMPEXP_CORE wxDropSource
: public wxDropSourceBase
35 /* constructor. set data later with SetData() */
36 wxDropSource(wxWindow
* pWin
);
38 /* constructor for setting one data object */
39 wxDropSource( wxDataObject
& rData
,
42 virtual ~wxDropSource();
44 /* start drag action */
45 virtual wxDragResult
DoDragDrop(int flags
= wxDrag_CopyOnly
);
46 virtual bool GiveFeedback(wxDragResult eEffect
);
52 PDRAGINFO m_pDragInfo
;
53 DRAGIMAGE m_vDragImage
;
54 PDRAGITEM m_pDragItem
;
56 }; // end of CLASS wxDropSource
58 //-------------------------------------------------------------------------
60 //-------------------------------------------------------------------------
62 class WXDLLIMPEXP_CORE wxDropTarget
: public wxDropTargetBase
65 wxDropTarget(wxDataObject
* pDataObject
= (wxDataObject
*)NULL
);
66 virtual ~wxDropTarget();
69 // These functions are called when data is moved over position (x, y) and
70 // may return either wxDragCopy, wxDragMove or wxDragNone depending on
71 // what would happen if the data were dropped here.
73 // The last parameter is what would happen by default and is determined by
74 // the platform-specific logic (for example, under Windows it's wxDragCopy
75 // if Ctrl key is pressed and wxDragMove otherwise) except that it will
76 // always be wxDragNone if the carried data is in an unsupported format.
78 // OnData must be implemented and other should be overridden by derived classes
80 virtual wxDragResult
OnData( wxCoord vX
84 virtual bool OnDrop( wxCoord vX
87 bool IsAcceptedData(PDRAGINFO pDataSource
) const;
90 virtual bool GetData(void);
91 wxDataFormat
GetSupportedFormat(PDRAGINFO pDataSource
) const;
95 CIDropTarget
* m_pDropTarget
;
96 }; // end of CLASS wxDropTarget