]>
Commit | Line | Data |
---|---|---|
6762286d | 1 | /////////////////////////////////////////////////////////////////////////////// |
233f5738 | 2 | // Name: wx/osx/dnd.h |
6762286d SC |
3 | // Purpose: Declaration of the wxDropTarget, wxDropSource class etc. |
4 | // Author: Stefan Csomor | |
5 | // RCS-ID: $Id$ | |
6 | // Copyright: (c) 1998 Stefan Csomor | |
7 | // Licence: wxWindows licence | |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_DND_H_ | |
11 | #define _WX_DND_H_ | |
12 | ||
13 | #if wxUSE_DRAG_AND_DROP | |
14 | ||
15 | #include "wx/defs.h" | |
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" | |
21 | ||
22 | //------------------------------------------------------------------------- | |
23 | // classes | |
24 | //------------------------------------------------------------------------- | |
25 | ||
26 | class WXDLLIMPEXP_FWD_CORE wxWindow; | |
27 | ||
28 | class WXDLLIMPEXP_FWD_CORE wxDropTarget; | |
29 | class WXDLLIMPEXP_FWD_CORE wxTextDropTarget; | |
30 | class WXDLLIMPEXP_FWD_CORE wxFileDropTarget; | |
31 | ||
32 | class WXDLLIMPEXP_FWD_CORE wxDropSource; | |
33 | ||
34 | // ---------------------------------------------------------------------------- | |
35 | // macros | |
36 | // ---------------------------------------------------------------------------- | |
37 | ||
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 | |
41 | // application code. | |
42 | #define wxDROP_ICON(X) wxCursor(X##_xpm) | |
43 | ||
44 | //------------------------------------------------------------------------- | |
45 | // wxDropTarget | |
46 | //------------------------------------------------------------------------- | |
47 | ||
48 | class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase | |
49 | { | |
50 | public: | |
51 | ||
d3b9f782 | 52 | wxDropTarget(wxDataObject *dataObject = NULL ); |
6762286d SC |
53 | |
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(); | |
03647350 | 58 | // NOTE: This is needed by the generic wxDataViewCtrl, not sure how to implement. |
ada08326 | 59 | virtual wxDataFormat GetMatchingPair(); |
6762286d SC |
60 | |
61 | bool CurrentDragHasSupportedFormat() ; | |
4dd9fdf8 | 62 | void SetCurrentDragPasteboard( void* dragpasteboard ) { m_currentDragPasteboard = dragpasteboard ; } |
6762286d | 63 | protected : |
4dd9fdf8 | 64 | void* m_currentDragPasteboard ; |
6762286d SC |
65 | }; |
66 | ||
67 | //------------------------------------------------------------------------- | |
68 | // wxDropSource | |
69 | //------------------------------------------------------------------------- | |
70 | ||
71 | class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase | |
72 | { | |
73 | public: | |
74 | // ctors: if you use default ctor you must call SetData() later! | |
75 | // | |
76 | // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK | |
77 | // compatibility, as well as both icon parameters | |
d3b9f782 | 78 | wxDropSource( wxWindow *win = NULL, |
6762286d SC |
79 | const wxCursor &cursorCopy = wxNullCursor, |
80 | const wxCursor &cursorMove = wxNullCursor, | |
81 | const wxCursor &cursorStop = wxNullCursor); | |
82 | ||
83 | /* constructor for setting one data object */ | |
84 | wxDropSource( wxDataObject& data, | |
85 | wxWindow *win, | |
86 | const wxCursor &cursorCopy = wxNullCursor, | |
87 | const wxCursor &cursorMove = wxNullCursor, | |
88 | const wxCursor &cursorStop = wxNullCursor); | |
89 | ||
90 | virtual ~wxDropSource(); | |
91 | ||
92 | // do it (call this in response to a mouse button press, for example) | |
93 | // params: if bAllowMove is false, data can be only copied | |
94 | virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); | |
95 | ||
96 | wxWindow* GetWindow() { return m_window ; } | |
4dd9fdf8 | 97 | void SetCurrentDragPasteboard( void* dragpasteboard ) { m_currentDragPasteboard = dragpasteboard ; } |
6762286d | 98 | bool MacInstallDefaultCursor(wxDragResult effect) ; |
808cbd17 | 99 | static wxDropSource* GetCurrentDropSource(); |
6762286d SC |
100 | protected : |
101 | ||
102 | wxWindow *m_window; | |
4dd9fdf8 | 103 | void* m_currentDragPasteboard ; |
6762286d SC |
104 | }; |
105 | ||
106 | #endif // wxUSE_DRAG_AND_DROP | |
107 | ||
5c6eb3a8 | 108 | #endif |
6762286d | 109 | //_WX_DND_H_ |