1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: Declaration of the wxDropTarget, wxDropSource class etc.
4 // Author: Stefan Csomor
5 // Copyright: (c) 1998 Stefan Csomor
6 // Licence: wxWindows licence
7 ///////////////////////////////////////////////////////////////////////////////
12 #if wxUSE_DRAG_AND_DROP
15 #include "wx/object.h"
16 #include "wx/string.h"
17 #include "wx/string.h"
18 #include "wx/dataobj.h"
19 #include "wx/cursor.h"
21 //-------------------------------------------------------------------------
23 //-------------------------------------------------------------------------
25 class WXDLLIMPEXP_FWD_CORE wxWindow
;
27 class WXDLLIMPEXP_FWD_CORE wxDropTarget
;
28 class WXDLLIMPEXP_FWD_CORE wxTextDropTarget
;
29 class WXDLLIMPEXP_FWD_CORE wxFileDropTarget
;
31 class WXDLLIMPEXP_FWD_CORE wxDropSource
;
33 // ----------------------------------------------------------------------------
35 // ----------------------------------------------------------------------------
37 // this macro may be used instead for wxDropSource ctor arguments: it will use
38 // the icon 'name' from an XPM file under GTK, but will expand to something
39 // else under MSW. If you don't use it, you will have to use #ifdef in the
41 #define wxDROP_ICON(X) wxCursor(X##_xpm)
43 //-------------------------------------------------------------------------
45 //-------------------------------------------------------------------------
47 class WXDLLIMPEXP_CORE wxDropTarget
: public wxDropTargetBase
51 wxDropTarget(wxDataObject
*dataObject
= NULL
);
53 virtual wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
54 virtual bool OnDrop(wxCoord x
, wxCoord y
);
55 virtual wxDragResult
OnData(wxCoord x
, wxCoord y
, wxDragResult def
);
56 virtual bool GetData();
57 // NOTE: This is needed by the generic wxDataViewCtrl, not sure how to implement.
58 virtual wxDataFormat
GetMatchingPair();
60 bool CurrentDragHasSupportedFormat() ;
61 void SetCurrentDragPasteboard( void* dragpasteboard
) { m_currentDragPasteboard
= dragpasteboard
; }
63 void* m_currentDragPasteboard
;
66 //-------------------------------------------------------------------------
68 //-------------------------------------------------------------------------
70 class WXDLLIMPEXP_CORE wxDropSource
: public wxDropSourceBase
73 // ctors: if you use default ctor you must call SetData() later!
75 // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK
76 // compatibility, as well as both icon parameters
77 wxDropSource( wxWindow
*win
= NULL
,
78 const wxCursor
&cursorCopy
= wxNullCursor
,
79 const wxCursor
&cursorMove
= wxNullCursor
,
80 const wxCursor
&cursorStop
= wxNullCursor
);
82 /* constructor for setting one data object */
83 wxDropSource( wxDataObject
& data
,
85 const wxCursor
&cursorCopy
= wxNullCursor
,
86 const wxCursor
&cursorMove
= wxNullCursor
,
87 const wxCursor
&cursorStop
= wxNullCursor
);
89 virtual ~wxDropSource();
91 // do it (call this in response to a mouse button press, for example)
92 // params: if bAllowMove is false, data can be only copied
93 virtual wxDragResult
DoDragDrop(int flags
= wxDrag_CopyOnly
);
95 wxWindow
* GetWindow() { return m_window
; }
96 void SetCurrentDragPasteboard( void* dragpasteboard
) { m_currentDragPasteboard
= dragpasteboard
; }
97 bool MacInstallDefaultCursor(wxDragResult effect
) ;
98 static wxDropSource
* GetCurrentDropSource();
102 void* m_currentDragPasteboard
;
105 #endif // wxUSE_DRAG_AND_DROP