]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/ole/droptgt.h
Don't create multiple parent-less top level frames in layout sample.
[wxWidgets.git] / include / wx / msw / ole / droptgt.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/ole/droptgt.h
3 // Purpose: declaration of the wxDropTarget class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 06.03.98
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_OLEDROPTGT_H
13 #define _WX_OLEDROPTGT_H
14
15 #if wxUSE_DRAG_AND_DROP
16
17 // ----------------------------------------------------------------------------
18 // forward declarations
19 // ----------------------------------------------------------------------------
20
21 class wxIDropTarget;
22 struct wxIDropTargetHelper;
23 struct IDataObject;
24
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.
29 //
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 // ----------------------------------------------------------------------------
34
35 class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase
36 {
37 public:
38 // ctor & dtor
39 wxDropTarget(wxDataObject *dataObject = NULL);
40 virtual ~wxDropTarget();
41
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);
46
47 // provide default implementation for base class pure virtuals
48 virtual bool OnDrop(wxCoord x, wxCoord y);
49 virtual bool GetData();
50
51 // Can only be called during OnXXX methods.
52 wxDataFormat GetMatchingPair();
53
54 // implementation only from now on
55 // -------------------------------
56
57 // do we accept this kind of data?
58 bool MSWIsAcceptedData(IDataObject *pIDataSource) const;
59
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);
63
64 // These functions take care of all things necessary to support native drag
65 // images.
66 //
67 // {Init,End}DragImageSupport() are called during Register/Revoke,
68 // UpdateDragImageOnXXX() functions are called on the corresponding drop
69 // target events.
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();
76
77 private:
78 // helper used by IsAcceptedData() and GetData()
79 wxDataFormat MSWGetSupportedFormat(IDataObject *pIDataSource) const;
80
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
84
85 wxDECLARE_NO_COPY_CLASS(wxDropTarget);
86 };
87
88 #endif //wxUSE_DRAG_AND_DROP
89
90 #endif //_WX_OLEDROPTGT_H