1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/classic/dnd.h
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 wxUSE_DRAG_AND_DROP
16 #include "wx/object.h"
17 #include "wx/string.h"
18 #include "wx/string.h"
19 #include "wx/dataobj.h"
20 #include "wx/cursor.h"
22 //-------------------------------------------------------------------------
24 //-------------------------------------------------------------------------
26 class WXDLLEXPORT wxWindow
;
28 class WXDLLEXPORT wxDropTarget
;
29 class WXDLLEXPORT wxTextDropTarget
;
30 class WXDLLEXPORT wxFileDropTarget
;
32 class WXDLLEXPORT wxDropSource
;
34 // ----------------------------------------------------------------------------
36 // ----------------------------------------------------------------------------
38 // this macro may be used instead for wxDropSource ctor arguments: it will use
39 // the icon 'name' from an XPM file under GTK, but will expand to something
40 // else under MSW. If you don't use it, you will have to use #ifdef in the
42 #define wxDROP_ICON(X) wxCursor( (const char**) X##_xpm )
44 //-------------------------------------------------------------------------
46 //-------------------------------------------------------------------------
48 class WXDLLEXPORT wxDropTarget
: public wxDropTargetBase
52 wxDropTarget(wxDataObject
*dataObject
= (wxDataObject
*) NULL
);
54 virtual wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
55 virtual bool OnDrop(wxCoord x
, wxCoord y
);
56 virtual wxDragResult
OnData(wxCoord x
, wxCoord y
, wxDragResult def
);
57 virtual bool GetData();
59 bool CurrentDragHasSupportedFormat() ;
60 void SetCurrentDrag( void* drag
) { m_currentDrag
= drag
; }
61 void* GetCurrentDrag() { return m_currentDrag
; }
66 //-------------------------------------------------------------------------
68 //-------------------------------------------------------------------------
70 class WXDLLEXPORT 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
= (wxWindow
*)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 SetCurrentDrag( void* drag
) { m_currentDrag
= drag
; }
97 void* GetCurrentDrag() { return m_currentDrag
; }
98 bool MacInstallDefaultCursor(wxDragResult effect
) ;
102 void* m_currentDrag
;
105 #endif // wxUSE_DRAG_AND_DROP