]>
Commit | Line | Data |
---|---|---|
bbf1f0e5 KB |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: ole/droptgt.h | |
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> | |
77ffb593 | 9 | // Licence: wxWidgets licence |
bbf1f0e5 KB |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_OLEDROPTGT_H |
13 | #define _WX_OLEDROPTGT_H | |
bbf1f0e5 | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
bbf1f0e5 KB |
16 | #pragma interface "droptgt.h" |
17 | #endif | |
18 | ||
f97c9854 | 19 | #if !wxUSE_DRAG_AND_DROP |
9e2896e5 | 20 | #error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!" |
bbf1f0e5 KB |
21 | #endif //WX_DRAG_DROP |
22 | ||
23 | // ---------------------------------------------------------------------------- | |
24 | // forward declarations | |
25 | // ---------------------------------------------------------------------------- | |
9e2896e5 | 26 | |
bbf1f0e5 KB |
27 | class wxIDropTarget; |
28 | struct IDataObject; | |
29 | ||
bbf1f0e5 KB |
30 | // ---------------------------------------------------------------------------- |
31 | // An instance of the class wxDropTarget may be associated with any wxWindow | |
32 | // derived object via SetDropTarget() function. If this is done, the virtual | |
33 | // methods of wxDropTarget are called when something is dropped on the window. | |
e1ee679c | 34 | // |
bbf1f0e5 KB |
35 | // Note that wxDropTarget is an abstract base class (ABC) and you should derive |
36 | // your own class from it implementing pure virtual function in order to use it | |
37 | // (all of them, including protected ones which are called by the class itself) | |
38 | // ---------------------------------------------------------------------------- | |
9e2896e5 VZ |
39 | |
40 | class WXDLLEXPORT wxDropTarget : public wxDropTargetBase | |
bbf1f0e5 KB |
41 | { |
42 | public: | |
e1ee679c | 43 | // ctor & dtor |
9e2896e5 | 44 | wxDropTarget(wxDataObject *dataObject = NULL); |
e1ee679c | 45 | virtual ~wxDropTarget(); |
bbf1f0e5 | 46 | |
e1ee679c VZ |
47 | // normally called by wxWindow on window creation/destruction, but might be |
48 | // called `manually' as well. Register() returns true on success. | |
49 | bool Register(WXHWND hwnd); | |
50 | void Revoke(WXHWND hwnd); | |
bbf1f0e5 | 51 | |
9e2896e5 VZ |
52 | // provide default implementation for base class pure virtuals |
53 | virtual bool OnDrop(wxCoord x, wxCoord y); | |
54 | virtual bool GetData(); | |
55 | ||
56 | // implementation only from now on | |
57 | // ------------------------------- | |
58 | ||
e1ee679c | 59 | // do we accept this kind of data? |
9e2896e5 VZ |
60 | bool IsAcceptedData(IDataObject *pIDataSource) const; |
61 | ||
62 | // give us the data source from IDropTarget::Drop() - this is later used by | |
63 | // GetData() when it's called from inside OnData() | |
64 | void SetDataSource(IDataObject *pIDataSource); | |
bbf1f0e5 KB |
65 | |
66 | private: | |
9e2896e5 VZ |
67 | // helper used by IsAcceptedData() and GetData() |
68 | wxDataFormat GetSupportedFormat(IDataObject *pIDataSource) const; | |
69 | ||
70 | wxIDropTarget *m_pIDropTarget; // the pointer to our COM interface | |
71 | IDataObject *m_pIDataSource; // the pointer to the source data object | |
22f3361e VZ |
72 | |
73 | DECLARE_NO_COPY_CLASS(wxDropTarget) | |
bbf1f0e5 KB |
74 | }; |
75 | ||
bbcdf8bc | 76 | #endif //_WX_OLEDROPTGT_H |