]>
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 ///////////////////////////////////////////////////////////////////////////////
20 #if wxUSE_DRAG_AND_DROP
22 #include "wx/object.h"
23 #include "wx/string.h"
24 #include "wx/dataobj.h"
25 #include "wx/cursor.h"
27 //-------------------------------------------------------------------------
28 // conditional compilation
29 //-------------------------------------------------------------------------
31 #if (GTK_MINOR_VERSION == 1)
32 #if (GTK_MICRO_VERSION >= 3)
33 #define NEW_GTK_DND_CODE
37 //-------------------------------------------------------------------------
39 //-------------------------------------------------------------------------
44 class wxTextDropTarget
;
45 class wxFileDropTarget
;
49 //-------------------------------------------------------------------------
51 //-------------------------------------------------------------------------
53 class wxDropTarget
: public wxObject
60 virtual void OnEnter() { }
61 virtual void OnLeave() { }
62 virtual bool OnDrop( long x
, long y
, const void *data
, size_t size
) = 0;
64 // Override these to indicate what kind of data you support:
66 virtual size_t GetFormatCount() const = 0;
67 virtual wxDataFormat
GetFormat(size_t n
) const = 0;
71 void RegisterWidget( GtkWidget
*widget
);
72 void UnregisterWidget( GtkWidget
*widget
);
75 //-------------------------------------------------------------------------
77 //-------------------------------------------------------------------------
79 class wxTextDropTarget
: public wxDropTarget
83 wxTextDropTarget() {};
84 virtual bool OnDrop( long x
, long y
, const void *data
, size_t size
);
85 virtual bool OnDropText( long x
, long y
, const char *psz
);
89 virtual size_t GetFormatCount() const;
90 virtual wxDataFormat
GetFormat(size_t n
) const;
93 // ----------------------------------------------------------------------------
94 // A drop target which accepts files (dragged from File Manager or Explorer)
95 // ----------------------------------------------------------------------------
97 class wxFileDropTarget
: public wxDropTarget
101 wxFileDropTarget() {};
103 virtual bool OnDrop( long x
, long y
, const void *data
, size_t size
);
104 virtual bool OnDropFiles( long x
, long y
,
105 size_t nFiles
, const char * const aszFiles
[] );
109 virtual size_t GetFormatCount() const;
110 virtual wxDataFormat
GetFormat(size_t n
) const;
113 //-------------------------------------------------------------------------
115 //-------------------------------------------------------------------------
119 wxDragError
, // error prevented the d&d operation from completing
120 wxDragNone
, // drag target didn't accept the data
121 wxDragCopy
, // the data was successfully copied
122 wxDragMove
, // the data was successfully moved
123 wxDragCancel
// the operation was cancelled by user (not an error)
126 class wxDropSource
: public wxObject
130 wxDropSource( wxWindow
*win
);
131 wxDropSource( wxDataObject
&data
, wxWindow
*win
);
135 void SetData( wxDataObject
&data
);
136 wxDragResult
DoDragDrop( bool bAllowMove
= FALSE
);
138 virtual bool GiveFeedback( wxDragResult
WXUNUSED(effect
), bool WXUNUSED(bScrolling
) ) { return TRUE
; };
142 void RegisterWindow(void);
143 void UnregisterWindow(void);
147 wxDragResult m_retValue
;
148 wxDataObject
*m_data
;
150 wxCursor m_defaultCursor
;
151 wxCursor m_goaheadCursor
;
156 // wxUSE_DRAG_AND_DROP