]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/ole/droptgt.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / msw / ole / droptgt.h
CommitLineData
bbf1f0e5 1///////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/msw/ole/droptgt.h
bbf1f0e5
KB
3// Purpose: declaration of the wxDropTarget class
4// Author: Vadim Zeitlin
e1ee679c 5// Modified by:
bbf1f0e5 6// Created: 06.03.98
bbf1f0e5 7// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 8// Licence: wxWindows licence
bbf1f0e5
KB
9///////////////////////////////////////////////////////////////////////////////
10
bbcdf8bc
JS
11#ifndef _WX_OLEDROPTGT_H
12#define _WX_OLEDROPTGT_H
bbf1f0e5 13
0a0e6a5b 14#if wxUSE_DRAG_AND_DROP
bbf1f0e5
KB
15
16// ----------------------------------------------------------------------------
17// forward declarations
18// ----------------------------------------------------------------------------
9e2896e5 19
bbf1f0e5 20class wxIDropTarget;
4d604ad3 21struct wxIDropTargetHelper;
bbf1f0e5
KB
22struct IDataObject;
23
bbf1f0e5
KB
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.
e1ee679c 28//
bbf1f0e5
KB
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// ----------------------------------------------------------------------------
9e2896e5 33
53a2db12 34class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase
bbf1f0e5
KB
35{
36public:
e1ee679c 37 // ctor & dtor
9e2896e5 38 wxDropTarget(wxDataObject *dataObject = NULL);
e1ee679c 39 virtual ~wxDropTarget();
bbf1f0e5 40
e1ee679c
VZ
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);
bbf1f0e5 45
9e2896e5
VZ
46 // provide default implementation for base class pure virtuals
47 virtual bool OnDrop(wxCoord x, wxCoord y);
48 virtual bool GetData();
49
51c9c13c
RR
50 // Can only be called during OnXXX methods.
51 wxDataFormat GetMatchingPair();
52
9e2896e5
VZ
53 // implementation only from now on
54 // -------------------------------
55
e1ee679c 56 // do we accept this kind of data?
81a1c686 57 bool MSWIsAcceptedData(IDataObject *pIDataSource) const;
9e2896e5
VZ
58
59 // give us the data source from IDropTarget::Drop() - this is later used by
60 // GetData() when it's called from inside OnData()
81a1c686 61 void MSWSetDataSource(IDataObject *pIDataSource);
bbf1f0e5 62
40375032
VZ
63 // These functions take care of all things necessary to support native drag
64 // images.
65 //
66 // {Init,End}DragImageSupport() are called during Register/Revoke,
67 // UpdateDragImageOnXXX() functions are called on the corresponding drop
68 // target events.
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();
75
bbf1f0e5 76private:
9e2896e5 77 // helper used by IsAcceptedData() and GetData()
81a1c686 78 wxDataFormat MSWGetSupportedFormat(IDataObject *pIDataSource) const;
9e2896e5 79
40375032
VZ
80 wxIDropTarget *m_pIDropTarget; // the pointer to our COM interface
81 IDataObject *m_pIDataSource; // the pointer to the source data object
4d604ad3 82 wxIDropTargetHelper *m_dropTargetHelper; // the drop target helper
22f3361e 83
c0c133e1 84 wxDECLARE_NO_COPY_CLASS(wxDropTarget);
bbf1f0e5
KB
85};
86
0a0e6a5b
WS
87#endif //wxUSE_DRAG_AND_DROP
88
bbcdf8bc 89#endif //_WX_OLEDROPTGT_H