]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/dnd.h
Define __MINGW64_TOOLCHAIN__ and __MINGW32_TOOLCHAIN__ symbols.
[wxWidgets.git] / include / wx / x11 / dnd.h
CommitLineData
83df96d6 1///////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/x11/dnd.h
83df96d6
JS
3// Purpose: declaration of wxDropTarget, wxDropSource classes
4// Author: Julian Smart
83df96d6 5// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling, Julian Smart
65571936 6// Licence: wxWindows licence
83df96d6
JS
7///////////////////////////////////////////////////////////////////////////////
8
83df96d6
JS
9#ifndef _WX_DND_H_
10#define _WX_DND_H_
11
83df96d6
JS
12#include "wx/defs.h"
13
14#if wxUSE_DRAG_AND_DROP
15
16#include "wx/object.h"
17#include "wx/string.h"
18#include "wx/dataobj.h"
19#include "wx/cursor.h"
20
21//-------------------------------------------------------------------------
22// classes
23//-------------------------------------------------------------------------
24
b5dbe15d 25class WXDLLIMPEXP_FWD_CORE wxWindow;
83df96d6 26
b5dbe15d
VS
27class WXDLLIMPEXP_FWD_CORE wxDropTarget;
28class WXDLLIMPEXP_FWD_CORE wxTextDropTarget;
29class WXDLLIMPEXP_FWD_CORE wxFileDropTarget;
30class WXDLLIMPEXP_FWD_CORE wxPrivateDropTarget;
83df96d6 31
b5dbe15d 32class WXDLLIMPEXP_FWD_CORE wxDropSource;
83df96d6
JS
33
34//-------------------------------------------------------------------------
35// wxDropTarget
36//-------------------------------------------------------------------------
37
53a2db12 38class WXDLLIMPEXP_CORE wxDropTarget: public wxObject
83df96d6
JS
39{
40public:
03647350 41
83df96d6 42 wxDropTarget();
d3c7fc99 43 virtual ~wxDropTarget();
03647350 44
83df96d6
JS
45 virtual void OnEnter() { }
46 virtual void OnLeave() { }
47 virtual bool OnDrop( long x, long y, const void *data, size_t size ) = 0;
03647350
VZ
48
49 // Override these to indicate what kind of data you support:
50
83df96d6
JS
51 virtual size_t GetFormatCount() const = 0;
52 virtual wxDataFormat GetFormat(size_t n) const = 0;
03647350 53
83df96d6
JS
54 // implementation
55};
56
57//-------------------------------------------------------------------------
58// wxTextDropTarget
59//-------------------------------------------------------------------------
60
53a2db12 61class WXDLLIMPEXP_CORE wxTextDropTarget: public wxDropTarget
83df96d6
JS
62{
63public:
03647350 64
6dd0883d 65 wxTextDropTarget() {}
83df96d6
JS
66 virtual bool OnDrop( long x, long y, const void *data, size_t size );
67 virtual bool OnDropText( long x, long y, const char *psz );
03647350 68
83df96d6 69protected:
03647350 70
83df96d6
JS
71 virtual size_t GetFormatCount() const;
72 virtual wxDataFormat GetFormat(size_t n) const;
73};
74
75//-------------------------------------------------------------------------
76// wxPrivateDropTarget
77//-------------------------------------------------------------------------
78
53a2db12 79class WXDLLIMPEXP_CORE wxPrivateDropTarget: public wxDropTarget
83df96d6
JS
80{
81public:
03647350 82
83df96d6 83 wxPrivateDropTarget();
03647350 84
83df96d6 85 // you have to override OnDrop to get at the data
03647350 86
83df96d6
JS
87 // the string ID identifies the format of clipboard or DnD data. a word
88 // processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
89 // to the clipboard - the latter with the Id "WXWORD_FORMAT".
03647350 90
83df96d6
JS
91 void SetId( const wxString& id )
92 { m_id = id; }
03647350 93
83df96d6
JS
94 wxString GetId()
95 { return m_id; }
03647350 96
83df96d6 97private:
03647350 98
83df96d6
JS
99 virtual size_t GetFormatCount() const;
100 virtual wxDataFormat GetFormat(size_t n) const;
03647350 101
83df96d6
JS
102 wxString m_id;
103};
104
105// ----------------------------------------------------------------------------
106// A drop target which accepts files (dragged from File Manager or Explorer)
107// ----------------------------------------------------------------------------
108
53a2db12 109class WXDLLIMPEXP_CORE wxFileDropTarget: public wxDropTarget
83df96d6
JS
110{
111public:
03647350 112
6dd0883d 113 wxFileDropTarget() {}
03647350 114
83df96d6 115 virtual bool OnDrop( long x, long y, const void *data, size_t size );
03647350 116 virtual bool OnDropFiles( long x, long y,
83df96d6 117 size_t nFiles, const char * const aszFiles[] );
03647350 118
83df96d6 119protected:
03647350 120
83df96d6
JS
121 virtual size_t GetFormatCount() const;
122 virtual wxDataFormat GetFormat(size_t n) const;
123};
124
125//-------------------------------------------------------------------------
126// wxDropSource
127//-------------------------------------------------------------------------
128
129enum wxDragResult
130{
131 wxDragError, // error prevented the d&d operation from completing
132 wxDragNone, // drag target didn't accept the data
133 wxDragCopy, // the data was successfully copied
134 wxDragMove, // the data was successfully moved
135 wxDragCancel // the operation was cancelled by user (not an error)
136};
137
53a2db12 138class WXDLLIMPEXP_CORE wxDropSource: public wxObject
83df96d6
JS
139{
140public:
03647350 141
83df96d6
JS
142 wxDropSource( wxWindow *win );
143 wxDropSource( wxDataObject &data, wxWindow *win );
03647350 144
d3c7fc99 145 virtual ~wxDropSource(void);
03647350 146
83df96d6 147 void SetData( wxDataObject &data );
2245b2b2 148 wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
03647350 149
6dd0883d 150 virtual bool GiveFeedback( wxDragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; }
03647350 151
83df96d6
JS
152 // implementation
153#if 0
154 void RegisterWindow(void);
155 void UnregisterWindow(void);
03647350 156
83df96d6
JS
157 wxWindow *m_window;
158 wxDragResult m_retValue;
159 wxDataObject *m_data;
03647350 160
83df96d6
JS
161 wxCursor m_defaultCursor;
162 wxCursor m_goaheadCursor;
163#endif
164};
165
166#endif
167
168// wxUSE_DRAG_AND_DROP
169
03647350 170#endif
83df96d6
JS
171//_WX_DND_H_
172