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