]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: dnd.h | |
6dddc146 DW |
3 | // Purpose: declaration of the wxDropTarget class |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/21/99 | |
0e320a79 | 7 | // RCS-ID: $Id$ |
6dddc146 | 8 | // Copyright: (c) 1999 David Webster |
65571936 | 9 | // Licence: wxWindows licence |
0e320a79 DW |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
6dddc146 DW |
12 | |
13 | #ifndef __OS2DNDH__ | |
14 | #define __OS2DNDH__ | |
0e320a79 | 15 | |
6dddc146 DW |
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 | |
0e320a79 | 19 | |
20947e08 DW |
20 | #define INCL_WINSTDDRAG |
21 | #include <os2.h> | |
5b10a619 | 22 | #ifndef __EMX__ |
20947e08 | 23 | #include <pmstddlg.h> |
5b10a619 | 24 | #endif |
20947e08 | 25 | |
4fd899b6 DW |
26 | class CIDropTarget; |
27 | ||
0e320a79 | 28 | //------------------------------------------------------------------------- |
6dddc146 | 29 | // wxDropSource |
54da4255 DW |
30 | //------------------------------------------------------------------------- |
31 | ||
6dddc146 | 32 | class WXDLLEXPORT wxDropSource: public wxDropSourceBase |
54da4255 | 33 | { |
54da4255 | 34 | public: |
6dddc146 | 35 | /* constructor. set data later with SetData() */ |
5dcec1d9 | 36 | wxDropSource(wxWindow* pWin); |
6dddc146 DW |
37 | |
38 | /* constructor for setting one data object */ | |
39 | wxDropSource( wxDataObject& rData, | |
e6ebb514 | 40 | wxWindow* pWin |
6dddc146 DW |
41 | ); |
42 | virtual ~wxDropSource(); | |
43 | ||
44 | /* start drag action */ | |
2245b2b2 | 45 | virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); |
4fd899b6 | 46 | virtual bool GiveFeedback(wxDragResult eEffect); |
6dddc146 DW |
47 | |
48 | protected: | |
49 | void Init(void); | |
6dddc146 | 50 | |
4fd899b6 DW |
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 | |
54da4255 | 57 | |
0e320a79 | 58 | //------------------------------------------------------------------------- |
6dddc146 | 59 | // wxDropTarget |
0e320a79 DW |
60 | //------------------------------------------------------------------------- |
61 | ||
4fd899b6 | 62 | class WXDLLEXPORT wxDropTarget : public wxDropTargetBase |
0e320a79 DW |
63 | { |
64 | public: | |
4fd899b6 | 65 | wxDropTarget(wxDataObject* pDataObject = (wxDataObject*)NULL); |
6dddc146 | 66 | virtual ~wxDropTarget(); |
0e320a79 | 67 | |
4fd899b6 DW |
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; | |
0e320a79 | 88 | |
6dddc146 | 89 | protected: |
4fd899b6 DW |
90 | virtual bool GetData(void); |
91 | wxDataFormat GetSupportedFormat(PDRAGINFO pDataSource) const; | |
92 | void Release(void); | |
0e320a79 | 93 | |
4fd899b6 DW |
94 | private: |
95 | CIDropTarget* m_pDropTarget; | |
96 | }; // end of CLASS wxDropTarget | |
0e320a79 | 97 | |
6dddc146 | 98 | #endif //__OS2DNDH__ |
0e320a79 | 99 |