]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/ole/droptgt.h
cocoa doesn't need system framework - string conversion for cocoa - focus for cocoa...
[wxWidgets.git] / include / wx / msw / ole / droptgt.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: 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 defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "droptgt.h"
17 #endif
18
19 #if wxUSE_DRAG_AND_DROP
20
21 // ----------------------------------------------------------------------------
22 // forward declarations
23 // ----------------------------------------------------------------------------
24
25 class wxIDropTarget;
26 struct IDataObject;
27
28 // ----------------------------------------------------------------------------
29 // An instance of the class wxDropTarget may be associated with any wxWindow
30 // derived object via SetDropTarget() function. If this is done, the virtual
31 // methods of wxDropTarget are called when something is dropped on the window.
32 //
33 // Note that wxDropTarget is an abstract base class (ABC) and you should derive
34 // your own class from it implementing pure virtual function in order to use it
35 // (all of them, including protected ones which are called by the class itself)
36 // ----------------------------------------------------------------------------
37
38 class WXDLLEXPORT wxDropTarget : public wxDropTargetBase
39 {
40 public:
41 // ctor & dtor
42 wxDropTarget(wxDataObject *dataObject = NULL);
43 virtual ~wxDropTarget();
44
45 // normally called by wxWindow on window creation/destruction, but might be
46 // called `manually' as well. Register() returns true on success.
47 bool Register(WXHWND hwnd);
48 void Revoke(WXHWND hwnd);
49
50 // provide default implementation for base class pure virtuals
51 virtual bool OnDrop(wxCoord x, wxCoord y);
52 virtual bool GetData();
53
54 // implementation only from now on
55 // -------------------------------
56
57 // do we accept this kind of data?
58 bool IsAcceptedData(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 SetDataSource(IDataObject *pIDataSource);
63
64 private:
65 // helper used by IsAcceptedData() and GetData()
66 wxDataFormat GetSupportedFormat(IDataObject *pIDataSource) const;
67
68 wxIDropTarget *m_pIDropTarget; // the pointer to our COM interface
69 IDataObject *m_pIDataSource; // the pointer to the source data object
70
71 DECLARE_NO_COPY_CLASS(wxDropTarget)
72 };
73
74 #endif //wxUSE_DRAG_AND_DROP
75
76 #endif //_WX_OLEDROPTGT_H