]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: dnd.h | |
3 | // Purpose: declaration of the wxDropTarget class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/21/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1999 David Webster | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | ||
13 | #ifndef __OS2DNDH__ | |
14 | #define __OS2DNDH__ | |
15 | ||
16 | #if !wxUSE_DRAG_AND_DROP | |
17 | #error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!" | |
18 | #endif //WX_DRAG_DROP | |
19 | ||
20 | #define INCL_WINSTDDRAG | |
21 | #include <os2.h> | |
22 | #ifndef __EMX__ | |
23 | #include <pmstddlg.h> | |
24 | #endif | |
25 | ||
26 | class CIDropTarget; | |
27 | ||
28 | //------------------------------------------------------------------------- | |
29 | // wxDropSource | |
30 | //------------------------------------------------------------------------- | |
31 | ||
32 | class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase | |
33 | { | |
34 | public: | |
35 | /* constructor. set data later with SetData() */ | |
36 | wxDropSource(wxWindow* pWin); | |
37 | ||
38 | /* constructor for setting one data object */ | |
39 | wxDropSource( wxDataObject& rData, | |
40 | wxWindow* pWin | |
41 | ); | |
42 | virtual ~wxDropSource(); | |
43 | ||
44 | /* start drag action */ | |
45 | virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); | |
46 | virtual bool GiveFeedback(wxDragResult eEffect); | |
47 | ||
48 | protected: | |
49 | void Init(void); | |
50 | ||
51 | ULONG m_ulItems; | |
52 | PDRAGINFO m_pDragInfo; | |
53 | DRAGIMAGE m_vDragImage; | |
54 | PDRAGITEM m_pDragItem; | |
55 | wxWindow* m_pWindow; | |
56 | }; // end of CLASS wxDropSource | |
57 | ||
58 | //------------------------------------------------------------------------- | |
59 | // wxDropTarget | |
60 | //------------------------------------------------------------------------- | |
61 | ||
62 | class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase | |
63 | { | |
64 | public: | |
65 | wxDropTarget(wxDataObject* pDataObject = (wxDataObject*)NULL); | |
66 | virtual ~wxDropTarget(); | |
67 | ||
68 | // | |
69 | // These functions are called when data is moved over position (x, y) and | |
70 | // may return either wxDragCopy, wxDragMove or wxDragNone depending on | |
71 | // what would happen if the data were dropped here. | |
72 | // | |
73 | // The last parameter is what would happen by default and is determined by | |
74 | // the platform-specific logic (for example, under Windows it's wxDragCopy | |
75 | // if Ctrl key is pressed and wxDragMove otherwise) except that it will | |
76 | // always be wxDragNone if the carried data is in an unsupported format. | |
77 | // | |
78 | // OnData must be implemented and other should be overridden by derived classes | |
79 | // | |
80 | virtual wxDragResult OnData( wxCoord vX | |
81 | ,wxCoord vY | |
82 | ,wxDragResult eResult | |
83 | ); | |
84 | virtual bool OnDrop( wxCoord vX | |
85 | ,wxCoord vY | |
86 | ); | |
87 | bool IsAcceptedData(PDRAGINFO pDataSource) const; | |
88 | ||
89 | protected: | |
90 | virtual bool GetData(void); | |
91 | wxDataFormat GetSupportedFormat(PDRAGINFO pDataSource) const; | |
92 | void Release(void); | |
93 | ||
94 | private: | |
95 | CIDropTarget* m_pDropTarget; | |
96 | }; // end of CLASS wxDropTarget | |
97 | ||
98 | #endif //__OS2DNDH__ | |
99 |