- public:
-
- wxTextDropTarget() {};
- virtual bool OnDrop( long x, long y, const void *data, size_t size );
- virtual bool OnDropText( long x, long y, const char *psz );
-
- protected:
-
- virtual size_t GetFormatCount() const;
- virtual wxDataFormat GetFormat(size_t n) const;
-};
-
-// ----------------------------------------------------------------------------
-// A drop target which accepts files (dragged from File Manager or Explorer)
-// ----------------------------------------------------------------------------
-
-class wxFileDropTarget: public wxDropTarget
-{
- public:
-
- wxFileDropTarget() {};
-
- virtual bool OnDrop( long x, long y, const void *data, size_t size );
- virtual bool OnDropFiles( long x, long y,
- size_t nFiles, const char * const aszFiles[] );
-
- protected:
-
- virtual size_t GetFormatCount() const;
- virtual wxDataFormat GetFormat(size_t n) const;
-};
+public:
+ // constructor. set data later with SetData()
+ wxDropSource( wxWindow *win = NULL,
+ const wxIcon © = wxNullIcon,
+ const wxIcon &move = wxNullIcon,
+ const wxIcon &none = wxNullIcon);
+
+ // constructor for setting one data object
+ wxDropSource( wxDataObject& data,
+ wxWindow *win,
+ const wxIcon © = wxNullIcon,
+ const wxIcon &move = wxNullIcon,
+ const wxIcon &none = wxNullIcon);
+
+ virtual ~wxDropSource();
+
+ // set the icon corresponding to given drag result
+ void SetIcon(wxDragResult res, const wxIcon& icon)
+ {
+ if ( res == wxDragCopy )
+ m_iconCopy = icon;
+ else if ( res == wxDragMove )
+ m_iconMove = icon;
+ else
+ m_iconNone = icon;
+ }
+
+ // start drag action
+ virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
+
+ void PrepareIcon( int action, GdkDragContext *context );
+
+ GtkWidget *m_widget;
+ GtkWidget *m_iconWindow;
+ GdkDragContext *m_dragContext;
+ wxWindow *m_window;
+
+ wxDragResult m_retValue;
+ wxIcon m_iconCopy,
+ m_iconMove,
+ m_iconNone;
+
+ bool m_waiting;