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