1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/ole/droptgt.h
3 // Purpose: declaration of the wxDropTarget class
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_OLEDROPTGT_H
12 #define _WX_OLEDROPTGT_H
14 #if wxUSE_DRAG_AND_DROP
16 // ----------------------------------------------------------------------------
17 // forward declarations
18 // ----------------------------------------------------------------------------
21 struct wxIDropTargetHelper
;
24 // ----------------------------------------------------------------------------
25 // An instance of the class wxDropTarget may be associated with any wxWindow
26 // derived object via SetDropTarget() function. If this is done, the virtual
27 // methods of wxDropTarget are called when something is dropped on the window.
29 // Note that wxDropTarget is an abstract base class (ABC) and you should derive
30 // your own class from it implementing pure virtual function in order to use it
31 // (all of them, including protected ones which are called by the class itself)
32 // ----------------------------------------------------------------------------
34 class WXDLLIMPEXP_CORE wxDropTarget
: public wxDropTargetBase
38 wxDropTarget(wxDataObject
*dataObject
= NULL
);
39 virtual ~wxDropTarget();
41 // normally called by wxWindow on window creation/destruction, but might be
42 // called `manually' as well. Register() returns true on success.
43 bool Register(WXHWND hwnd
);
44 void Revoke(WXHWND hwnd
);
46 // provide default implementation for base class pure virtuals
47 virtual bool OnDrop(wxCoord x
, wxCoord y
);
48 virtual bool GetData();
50 // Can only be called during OnXXX methods.
51 wxDataFormat
GetMatchingPair();
53 // implementation only from now on
54 // -------------------------------
56 // do we accept this kind of data?
57 bool MSWIsAcceptedData(IDataObject
*pIDataSource
) const;
59 // give us the data source from IDropTarget::Drop() - this is later used by
60 // GetData() when it's called from inside OnData()
61 void MSWSetDataSource(IDataObject
*pIDataSource
);
63 // These functions take care of all things necessary to support native drag
66 // {Init,End}DragImageSupport() are called during Register/Revoke,
67 // UpdateDragImageOnXXX() functions are called on the corresponding drop
69 void MSWInitDragImageSupport();
70 void MSWEndDragImageSupport();
71 void MSWUpdateDragImageOnData(wxCoord x
, wxCoord y
, wxDragResult res
);
72 void MSWUpdateDragImageOnDragOver(wxCoord x
, wxCoord y
, wxDragResult res
);
73 void MSWUpdateDragImageOnEnter(wxCoord x
, wxCoord y
, wxDragResult res
);
74 void MSWUpdateDragImageOnLeave();
77 // helper used by IsAcceptedData() and GetData()
78 wxDataFormat
MSWGetSupportedFormat(IDataObject
*pIDataSource
) const;
80 wxIDropTarget
*m_pIDropTarget
; // the pointer to our COM interface
81 IDataObject
*m_pIDataSource
; // the pointer to the source data object
82 wxIDropTargetHelper
*m_dropTargetHelper
; // the drop target helper
84 wxDECLARE_NO_COPY_CLASS(wxDropTarget
);
87 #endif //wxUSE_DRAG_AND_DROP
89 #endif //_WX_OLEDROPTGT_H