1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: Declaration of the wxDropTarget, wxDropSource class etc.
4 // Author: Stefan Csomor
6 // Copyright: (c) 1998 Stefan Csomor
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
13 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
14 #pragma interface "dnd.h"
17 #if wxUSE_DRAG_AND_DROP
20 #include "wx/object.h"
21 #include "wx/string.h"
22 #include "wx/string.h"
23 #include "wx/dataobj.h"
24 #include "wx/cursor.h"
26 //-------------------------------------------------------------------------
28 //-------------------------------------------------------------------------
30 class WXDLLEXPORT wxWindow
;
32 class WXDLLEXPORT wxDropTarget
;
33 class WXDLLEXPORT wxTextDropTarget
;
34 class WXDLLEXPORT wxFileDropTarget
;
36 class WXDLLEXPORT wxDropSource
;
38 // ----------------------------------------------------------------------------
40 // ----------------------------------------------------------------------------
42 // this macro may be used instead for wxDropSource ctor arguments: it will use
43 // the icon 'name' from an XPM file under GTK, but will expand to something
44 // else under MSW. If you don't use it, you will have to use #ifdef in the
46 #define wxDROP_ICON(X) wxCursor( (const char**) X##_xpm )
48 //-------------------------------------------------------------------------
50 //-------------------------------------------------------------------------
52 class WXDLLEXPORT wxDropTarget
: public wxDropTargetBase
56 wxDropTarget(wxDataObject
*dataObject
= (wxDataObject
*) NULL
);
58 virtual wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
59 virtual bool OnDrop(wxCoord x
, wxCoord y
);
60 virtual wxDragResult
OnData(wxCoord x
, wxCoord y
, wxDragResult def
);
61 virtual bool GetData();
63 bool CurrentDragHasSupportedFormat() ;
64 void SetCurrentDrag( void* drag
) { m_currentDrag
= drag
; }
65 void* GetCurrentDrag() { return m_currentDrag
; }
70 //-------------------------------------------------------------------------
72 //-------------------------------------------------------------------------
74 class WXDLLEXPORT wxDropSource
: public wxDropSourceBase
77 // ctors: if you use default ctor you must call SetData() later!
79 // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK
80 // compatibility, as well as both icon parameters
81 wxDropSource( wxWindow
*win
= (wxWindow
*)NULL
,
82 const wxCursor
&cursorCopy
= wxNullCursor
,
83 const wxCursor
&cursorMove
= wxNullCursor
,
84 const wxCursor
&cursorStop
= wxNullCursor
);
86 /* constructor for setting one data object */
87 wxDropSource( wxDataObject
& data
,
89 const wxCursor
&cursorCopy
= wxNullCursor
,
90 const wxCursor
&cursorMove
= wxNullCursor
,
91 const wxCursor
&cursorStop
= wxNullCursor
);
95 // do it (call this in response to a mouse button press, for example)
96 // params: if bAllowMove is false, data can be only copied
97 virtual wxDragResult
DoDragDrop(int flags
= wxDrag_CopyOnly
);
99 wxWindow
* GetWindow() { return m_window
; }
100 void SetCurrentDrag( void* drag
) { m_currentDrag
= drag
; }
101 void* GetCurrentDrag() { return m_currentDrag
; }
102 bool MacInstallDefaultCursor(wxDragResult effect
) ;
106 void* m_currentDrag
;