]>
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 DW |
8 | // Copyright: (c) 1999 David Webster |
9 | // Licence: wxWindows license | |
0e320a79 DW |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
6dddc146 DW |
12 | |
13 | #ifndef __OS2DNDH__ | |
14 | #define __OS2DNDH__ | |
0e320a79 DW |
15 | |
16 | #ifdef __GNUG__ | |
6dddc146 | 17 | #pragma interface |
0e320a79 DW |
18 | #endif |
19 | ||
6dddc146 DW |
20 | #if !wxUSE_DRAG_AND_DROP |
21 | #error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!" | |
22 | #endif //WX_DRAG_DROP | |
0e320a79 DW |
23 | |
24 | //------------------------------------------------------------------------- | |
6dddc146 | 25 | // wxDropSource |
54da4255 DW |
26 | //------------------------------------------------------------------------- |
27 | ||
6dddc146 | 28 | class WXDLLEXPORT wxDropSource: public wxDropSourceBase |
54da4255 | 29 | { |
54da4255 | 30 | public: |
6dddc146 | 31 | /* constructor. set data later with SetData() */ |
5dcec1d9 | 32 | wxDropSource(wxWindow* pWin); |
6dddc146 DW |
33 | |
34 | /* constructor for setting one data object */ | |
35 | wxDropSource( wxDataObject& rData, | |
e6ebb514 | 36 | wxWindow* pWin |
6dddc146 DW |
37 | ); |
38 | virtual ~wxDropSource(); | |
39 | ||
40 | /* start drag action */ | |
41 | virtual wxDragResult DoDragDrop(bool bAllowMove = FALSE); | |
42 | ||
43 | protected: | |
44 | void Init(void); | |
45 | bool m_bLazyDrag; | |
46 | ||
47 | DRAGIMAGE* m_pDragImage; | |
48 | DRAGINFO* m_pDragInfo; | |
49 | DRAGTRANSFER* m_pDragTransfer; | |
54da4255 DW |
50 | }; |
51 | ||
0e320a79 | 52 | //------------------------------------------------------------------------- |
6dddc146 | 53 | // wxDropTarget |
0e320a79 DW |
54 | //------------------------------------------------------------------------- |
55 | ||
6dddc146 | 56 | class WXDLLEXPORT wxDropTarget: public wxDropTargetBase |
0e320a79 DW |
57 | { |
58 | public: | |
6dddc146 DW |
59 | wxDropTarget(wxDataObject *dataObject = (wxDataObject*)NULL); |
60 | virtual ~wxDropTarget(); | |
0e320a79 | 61 | |
6dddc146 DW |
62 | void Register(WXHWND hwnd); |
63 | void Revoke(WXHWND hwnd); | |
0e320a79 | 64 | |
6dddc146 DW |
65 | virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def); |
66 | virtual bool OnDrop(wxCoord x, wxCoord y); | |
67 | virtual bool OnData(wxCoord x, wxCoord y); | |
004fd0c8 | 68 | virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult vResult); |
6dddc146 | 69 | virtual bool GetData(); |
0e320a79 | 70 | |
6dddc146 DW |
71 | // implementation |
72 | protected: | |
73 | virtual bool IsAcceptable(DRAGINFO* pInfo); | |
0e320a79 | 74 | |
6dddc146 DW |
75 | DRAGINFO* m_pDragInfo; |
76 | DRAGTRANSFER* m_pDragTransfer; | |
0e320a79 DW |
77 | }; |
78 | ||
79 | // ---------------------------------------------------------------------------- | |
6dddc146 DW |
80 | // A simple wxDropTarget derived class for text data: you only need to |
81 | // override OnDropText() to get something working | |
0e320a79 DW |
82 | // ---------------------------------------------------------------------------- |
83 | ||
6dddc146 | 84 | class WXDLLEXPORT wxTextDropTarget : public wxDropTarget |
0e320a79 DW |
85 | { |
86 | public: | |
6dddc146 DW |
87 | wxTextDropTarget(); |
88 | virtual ~wxTextDropTarget(); | |
0e320a79 | 89 | |
6dddc146 DW |
90 | virtual bool OnDropText( wxCoord x |
91 | ,wxCoord y | |
92 | ,const wxString& rText | |
93 | ) = 0; | |
0e320a79 | 94 | |
6dddc146 DW |
95 | virtual bool OnData( wxCoord x |
96 | ,wxCoord y | |
97 | ); | |
004fd0c8 | 98 | virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult vResult); |
0e320a79 DW |
99 | }; |
100 | ||
101 | // ---------------------------------------------------------------------------- | |
102 | // A drop target which accepts files (dragged from File Manager or Explorer) | |
103 | // ---------------------------------------------------------------------------- | |
104 | ||
6dddc146 | 105 | class WXDLLEXPORT wxFileDropTarget : public wxDropTarget |
0e320a79 | 106 | { |
6dddc146 DW |
107 | public: |
108 | wxFileDropTarget(); | |
109 | virtual ~wxFileDropTarget(); | |
110 | ||
111 | // parameters are the number of files and the array of file names | |
112 | virtual bool OnDropFiles( wxCoord x | |
113 | ,wxCoord y | |
114 | ,const wxArrayString& rFilenames | |
115 | ) = 0; | |
116 | ||
117 | virtual bool OnData( wxCoord x | |
118 | ,wxCoord y | |
119 | ); | |
004fd0c8 | 120 | virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult vResult); |
0e320a79 DW |
121 | }; |
122 | ||
6dddc146 | 123 | #endif //__OS2DNDH__ |
0e320a79 | 124 |