]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/ole/droptgt.h
Unselect all wxDataViewCtrl items when clicking outside of the item area.
[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
KB
6// Created: 06.03.98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
65571936 9// Licence: wxWindows licence
bbf1f0e5
KB
10///////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_OLEDROPTGT_H
13#define _WX_OLEDROPTGT_H
bbf1f0e5 14
0a0e6a5b 15#if wxUSE_DRAG_AND_DROP
bbf1f0e5
KB
16
17// ----------------------------------------------------------------------------
18// forward declarations
19// ----------------------------------------------------------------------------
9e2896e5 20
bbf1f0e5 21class wxIDropTarget;
4d604ad3 22struct wxIDropTargetHelper;
bbf1f0e5
KB
23struct IDataObject;
24
bbf1f0e5
KB
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.
e1ee679c 29//
bbf1f0e5
KB
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// ----------------------------------------------------------------------------
9e2896e5 34
53a2db12 35class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase
bbf1f0e5
KB
36{
37public:
e1ee679c 38 // ctor & dtor
9e2896e5 39 wxDropTarget(wxDataObject *dataObject = NULL);
e1ee679c 40 virtual ~wxDropTarget();
bbf1f0e5 41
e1ee679c
VZ
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);
bbf1f0e5 46
9e2896e5
VZ
47 // provide default implementation for base class pure virtuals
48 virtual bool OnDrop(wxCoord x, wxCoord y);
49 virtual bool GetData();
50
51c9c13c
RR
51 // Can only be called during OnXXX methods.
52 wxDataFormat GetMatchingPair();
53
9e2896e5
VZ
54 // implementation only from now on
55 // -------------------------------
56
e1ee679c 57 // do we accept this kind of data?
81a1c686 58 bool MSWIsAcceptedData(IDataObject *pIDataSource) const;
9e2896e5
VZ
59
60 // give us the data source from IDropTarget::Drop() - this is later used by
61 // GetData() when it's called from inside OnData()
81a1c686 62 void MSWSetDataSource(IDataObject *pIDataSource);
bbf1f0e5 63
40375032
VZ
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
bbf1f0e5 77private:
9e2896e5 78 // helper used by IsAcceptedData() and GetData()
81a1c686 79 wxDataFormat MSWGetSupportedFormat(IDataObject *pIDataSource) const;
9e2896e5 80
40375032
VZ
81 wxIDropTarget *m_pIDropTarget; // the pointer to our COM interface
82 IDataObject *m_pIDataSource; // the pointer to the source data object
4d604ad3 83 wxIDropTargetHelper *m_dropTargetHelper; // the drop target helper
22f3361e 84
c0c133e1 85 wxDECLARE_NO_COPY_CLASS(wxDropTarget);
bbf1f0e5
KB
86};
87
0a0e6a5b
WS
88#endif //wxUSE_DRAG_AND_DROP
89
bbcdf8bc 90#endif //_WX_OLEDROPTGT_H