]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dnd.h
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declaration of the wxDropTarget class
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling
7 // Licence: wxWindows license
8 ///////////////////////////////////////////////////////////////////////////////
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/dataobj.h"
22 #include "wx/cursor.h"
24 //-------------------------------------------------------------------------
25 // conditional compilation
26 //-------------------------------------------------------------------------
28 #if (GTK_MINOR_VERSION == 1)
29 #if (GTK_MICRO_VERSION >= 3)
30 #define NEW_GTK_DND_CODE
34 //-------------------------------------------------------------------------
36 //-------------------------------------------------------------------------
41 class wxTextDropTarget
;
42 class wxFileDropTarget
;
46 //-------------------------------------------------------------------------
48 //-------------------------------------------------------------------------
50 class wxDropTarget
: public wxObject
57 virtual void OnEnter() { }
58 virtual void OnLeave() { }
59 virtual bool OnDrop( long x
, long y
, const void *data
, size_t size
) = 0;
61 // Override these to indicate what kind of data you support:
63 virtual size_t GetFormatCount() const = 0;
64 virtual wxDataFormat
GetFormat(size_t n
) const = 0;
68 void RegisterWidget( GtkWidget
*widget
);
69 void UnregisterWidget( GtkWidget
*widget
);
72 //-------------------------------------------------------------------------
74 //-------------------------------------------------------------------------
76 class wxTextDropTarget
: public wxDropTarget
80 wxTextDropTarget() {};
81 virtual bool OnDrop( long x
, long y
, const void *data
, size_t size
);
82 virtual bool OnDropText( long x
, long y
, const char *psz
);
86 virtual size_t GetFormatCount() const;
87 virtual wxDataFormat
GetFormat(size_t n
) const;
90 // ----------------------------------------------------------------------------
91 // A drop target which accepts files (dragged from File Manager or Explorer)
92 // ----------------------------------------------------------------------------
94 class wxFileDropTarget
: public wxDropTarget
98 wxFileDropTarget() {};
100 virtual bool OnDrop( long x
, long y
, const void *data
, size_t size
);
101 virtual bool OnDropFiles( long x
, long y
,
102 size_t nFiles
, const char * const aszFiles
[] );
106 virtual size_t GetFormatCount() const;
107 virtual wxDataFormat
GetFormat(size_t n
) const;
110 //-------------------------------------------------------------------------
112 //-------------------------------------------------------------------------
116 wxDragError
, // error prevented the d&d operation from completing
117 wxDragNone
, // drag target didn't accept the data
118 wxDragCopy
, // the data was successfully copied
119 wxDragMove
, // the data was successfully moved
120 wxDragCancel
// the operation was cancelled by user (not an error)
123 class wxDropSource
: public wxObject
127 wxDropSource( wxWindow
*win
);
128 wxDropSource( wxDataObject
&data
, wxWindow
*win
);
132 void SetData( wxDataObject
&data
);
133 wxDragResult
DoDragDrop( bool bAllowMove
= FALSE
);
135 virtual bool GiveFeedback( wxDragResult
WXUNUSED(effect
), bool WXUNUSED(bScrolling
) ) { return TRUE
; };
139 void RegisterWindow(void);
140 void UnregisterWindow(void);
144 wxDragResult m_retValue
;
145 wxDataObject
*m_data
;
147 wxCursor m_defaultCursor
;
148 wxCursor m_goaheadCursor
;