]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: dnd.h | |
3 | // Purpose: Declaration of the wxDropTarget, wxDropSource class etc. | |
a31a5f85 | 4 | // Author: Stefan Csomor |
0dbd6262 | 5 | // RCS-ID: $Id$ |
a31a5f85 | 6 | // Copyright: (c) 1998 Stefan Csomor |
0dbd6262 SC |
7 | // Licence: wxWindows licence |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_DND_H_ | |
11 | #define _WX_DND_H_ | |
12 | ||
af49c4b8 | 13 | #if defined(__GNUG__) && !defined(__APPLE__) |
0dbd6262 SC |
14 | #pragma interface "dnd.h" |
15 | #endif | |
16 | ||
8400ad1e SC |
17 | #if wxUSE_DRAG_AND_DROP |
18 | ||
0dbd6262 SC |
19 | #include "wx/defs.h" |
20 | #include "wx/object.h" | |
21 | #include "wx/string.h" | |
8400ad1e SC |
22 | #include "wx/string.h" |
23 | #include "wx/dataobj.h" | |
0dbd6262 SC |
24 | #include "wx/cursor.h" |
25 | ||
26 | //------------------------------------------------------------------------- | |
27 | // classes | |
28 | //------------------------------------------------------------------------- | |
29 | ||
30 | class WXDLLEXPORT wxWindow; | |
31 | ||
0dbd6262 SC |
32 | class WXDLLEXPORT wxDropTarget; |
33 | class WXDLLEXPORT wxTextDropTarget; | |
34 | class WXDLLEXPORT wxFileDropTarget; | |
35 | ||
36 | class WXDLLEXPORT wxDropSource; | |
37 | ||
0dbd6262 | 38 | // ---------------------------------------------------------------------------- |
8400ad1e | 39 | // macros |
0dbd6262 SC |
40 | // ---------------------------------------------------------------------------- |
41 | ||
8400ad1e SC |
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. | |
30727fae | 46 | #define wxDROP_ICON(X) wxCursor( (const char**) X##_xpm ) |
03e11df5 | 47 | |
0dbd6262 SC |
48 | //------------------------------------------------------------------------- |
49 | // wxDropTarget | |
50 | //------------------------------------------------------------------------- | |
51 | ||
8400ad1e | 52 | class WXDLLEXPORT wxDropTarget: public wxDropTargetBase |
0dbd6262 SC |
53 | { |
54 | public: | |
55 | ||
8400ad1e | 56 | wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL ); |
0dbd6262 | 57 | |
8400ad1e SC |
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(); | |
0dbd6262 | 62 | |
8400ad1e | 63 | bool CurrentDragHasSupportedFormat() ; |
5273bf2f SC |
64 | void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; } |
65 | void* GetCurrentDrag() { return m_currentDrag ; } | |
8400ad1e | 66 | protected : |
5273bf2f | 67 | void* m_currentDrag ; |
0dbd6262 SC |
68 | }; |
69 | ||
70 | //------------------------------------------------------------------------- | |
8400ad1e | 71 | // wxDropSource |
0dbd6262 SC |
72 | //------------------------------------------------------------------------- |
73 | ||
8400ad1e | 74 | class WXDLLEXPORT wxDropSource: public wxDropSourceBase |
0dbd6262 | 75 | { |
8400ad1e | 76 | public: |
30727fae SC |
77 | // ctors: if you use default ctor you must call SetData() later! |
78 | // | |
79 | // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK | |
80 | // compatibility, as well as both icon parameters | |
8400ad1e | 81 | wxDropSource( wxWindow *win = (wxWindow *)NULL, |
30727fae SC |
82 | const wxCursor &cursorCopy = wxNullCursor, |
83 | const wxCursor &cursorMove = wxNullCursor, | |
84 | const wxCursor &cursorStop = wxNullCursor); | |
0dbd6262 | 85 | |
8400ad1e SC |
86 | /* constructor for setting one data object */ |
87 | wxDropSource( wxDataObject& data, | |
88 | wxWindow *win, | |
30727fae SC |
89 | const wxCursor &cursorCopy = wxNullCursor, |
90 | const wxCursor &cursorMove = wxNullCursor, | |
91 | const wxCursor &cursorStop = wxNullCursor); | |
0dbd6262 | 92 | |
8400ad1e | 93 | ~wxDropSource(); |
0dbd6262 | 94 | |
30727fae SC |
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 | |
2245b2b2 | 97 | virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); |
30727fae | 98 | |
8400ad1e | 99 | wxWindow* GetWindow() { return m_window ; } |
5273bf2f SC |
100 | void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; } |
101 | void* GetCurrentDrag() { return m_currentDrag ; } | |
30727fae | 102 | bool MacInstallDefaultCursor(wxDragResult effect) ; |
8400ad1e | 103 | protected : |
30727fae | 104 | |
8400ad1e | 105 | wxWindow *m_window; |
5273bf2f | 106 | void* m_currentDrag ; |
0dbd6262 SC |
107 | }; |
108 | ||
8400ad1e SC |
109 | #endif |
110 | // D&D | |
111 | ||
0dbd6262 SC |
112 | #endif |
113 | //_WX_DND_H_ | |
114 |