]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/dnd.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / osx / dnd.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/dnd.h
3 // Purpose: Declaration of the wxDropTarget, wxDropSource class etc.
4 // Author: Stefan Csomor
5 // Copyright: (c) 1998 Stefan Csomor
6 // Licence: wxWindows licence
7 ///////////////////////////////////////////////////////////////////////////////
8
9 #ifndef _WX_DND_H_
10 #define _WX_DND_H_
11
12 #if wxUSE_DRAG_AND_DROP
13
14 #include "wx/defs.h"
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"
20
21 //-------------------------------------------------------------------------
22 // classes
23 //-------------------------------------------------------------------------
24
25 class WXDLLIMPEXP_FWD_CORE wxWindow;
26
27 class WXDLLIMPEXP_FWD_CORE wxDropTarget;
28 class WXDLLIMPEXP_FWD_CORE wxTextDropTarget;
29 class WXDLLIMPEXP_FWD_CORE wxFileDropTarget;
30
31 class WXDLLIMPEXP_FWD_CORE wxDropSource;
32
33 // ----------------------------------------------------------------------------
34 // macros
35 // ----------------------------------------------------------------------------
36
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
40 // application code.
41 #define wxDROP_ICON(X) wxCursor(X##_xpm)
42
43 //-------------------------------------------------------------------------
44 // wxDropTarget
45 //-------------------------------------------------------------------------
46
47 class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase
48 {
49 public:
50
51 wxDropTarget(wxDataObject *dataObject = NULL );
52
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();
59
60 bool CurrentDragHasSupportedFormat() ;
61 void SetCurrentDragPasteboard( void* dragpasteboard ) { m_currentDragPasteboard = dragpasteboard ; }
62 protected :
63 void* m_currentDragPasteboard ;
64 };
65
66 //-------------------------------------------------------------------------
67 // wxDropSource
68 //-------------------------------------------------------------------------
69
70 class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
71 {
72 public:
73 // ctors: if you use default ctor you must call SetData() later!
74 //
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);
81
82 /* constructor for setting one data object */
83 wxDropSource( wxDataObject& data,
84 wxWindow *win,
85 const wxCursor &cursorCopy = wxNullCursor,
86 const wxCursor &cursorMove = wxNullCursor,
87 const wxCursor &cursorStop = wxNullCursor);
88
89 virtual ~wxDropSource();
90
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);
94
95 wxWindow* GetWindow() { return m_window ; }
96 void SetCurrentDragPasteboard( void* dragpasteboard ) { m_currentDragPasteboard = dragpasteboard ; }
97 bool MacInstallDefaultCursor(wxDragResult effect) ;
98 static wxDropSource* GetCurrentDropSource();
99 protected :
100
101 wxWindow *m_window;
102 void* m_currentDragPasteboard ;
103 };
104
105 #endif // wxUSE_DRAG_AND_DROP
106
107 #endif
108 //_WX_DND_H_