]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/dnd.h
Use wxClientDataDictionary for client data.
[wxWidgets.git] / include / wx / mac / dnd.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: dnd.h
3 // Purpose: Declaration of the wxDropTarget, wxDropSource class etc.
4 // Author: AUTHOR
5 // RCS-ID: $Id$
6 // Copyright: (c) 1998 AUTHOR
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_DND_H_
11 #define _WX_DND_H_
12
13 #if defined(__GNUG__) && !defined(__APPLE__)
14 #pragma interface "dnd.h"
15 #endif
16
17 #if wxUSE_DRAG_AND_DROP
18
19 #include "wx/defs.h"
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"
25
26 //-------------------------------------------------------------------------
27 // classes
28 //-------------------------------------------------------------------------
29
30 class WXDLLEXPORT wxWindow;
31
32 class WXDLLEXPORT wxDropTarget;
33 class WXDLLEXPORT wxTextDropTarget;
34 class WXDLLEXPORT wxFileDropTarget;
35
36 class WXDLLEXPORT wxDropSource;
37
38 // ----------------------------------------------------------------------------
39 // macros
40 // ----------------------------------------------------------------------------
41
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
45 // application code.
46 #define wxDROP_ICON(name) wxICON(name)
47
48 //-------------------------------------------------------------------------
49 // wxDropTarget
50 //-------------------------------------------------------------------------
51
52 class WXDLLEXPORT wxDropTarget: public wxDropTargetBase
53 {
54 public:
55
56 wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
57
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();
62
63 bool CurrentDragHasSupportedFormat() ;
64 void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; }
65 void* GetCurrentDrag() { return m_currentDrag ; }
66 protected :
67 void* m_currentDrag ;
68 };
69
70 //-------------------------------------------------------------------------
71 // wxDropSource
72 //-------------------------------------------------------------------------
73
74 class WXDLLEXPORT wxDropSource: public wxDropSourceBase
75 {
76 public:
77 /* constructor. set data later with SetData() */
78 wxDropSource( wxWindow *win = (wxWindow *)NULL,
79 const wxIcon &copy = wxNullIcon,
80 const wxIcon &move = wxNullIcon,
81 const wxIcon &none = wxNullIcon);
82
83 /* constructor for setting one data object */
84 wxDropSource( wxDataObject& data,
85 wxWindow *win,
86 const wxIcon &copy = wxNullIcon,
87 const wxIcon &move = wxNullIcon,
88 const wxIcon &none = wxNullIcon);
89
90
91 ~wxDropSource();
92
93 /* start drag action */
94 virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
95
96 wxWindow* GetWindow() { return m_window ; }
97 void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; }
98 void* GetCurrentDrag() { return m_currentDrag ; }
99 protected :
100 wxWindow *m_window;
101 void* m_currentDrag ;
102 };
103
104 #endif
105 // D&D
106
107 #endif
108 //_WX_DND_H_
109