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