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