]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dnd.h
edc321382d78315802601c0259b95b3b435e7fad
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 ///////////////////////////////////////////////////////////////////////////////
18 #if wxUSE_DRAG_AND_DROP
20 #include "wx/object.h"
21 #include "wx/string.h"
22 #include "wx/dataobj.h"
23 #include "wx/cursor.h"
25 #include "wx/gdicmn.h"
27 //-------------------------------------------------------------------------
29 //-------------------------------------------------------------------------
34 class wxTextDropTarget
;
35 class wxFileDropTarget
;
36 class wxPrivateDropTarget
;
40 //-------------------------------------------------------------------------
42 //-------------------------------------------------------------------------
44 class wxDropTarget
: public wxDropTargetBase
47 wxDropTarget(wxDataObject
*dataObject
= (wxDataObject
*) NULL
);
49 virtual bool OnEnter(wxCoord x
, wxCoord y
) ;
50 virtual bool OnMove(wxCoord x
, wxCoord y
);
51 virtual bool OnDrop(wxCoord x
, wxCoord y
);
52 virtual bool OnData(wxCoord x
, wxCoord y
);
53 virtual bool GetData();
57 GdkAtom
GetMatchingPair();
58 void RegisterWidget( GtkWidget
*widget
);
59 void UnregisterWidget( GtkWidget
*widget
);
61 GdkDragContext
*m_dragContext
;
62 GtkWidget
*m_dragWidget
;
63 GtkSelectionData
*m_dragData
;
65 bool m_firstMotion
; /* gdk has no "gdk_drag_enter" event */
67 void SetDragContext( GdkDragContext
*dc
) { m_dragContext
= dc
; }
68 void SetDragWidget( GtkWidget
*w
) { m_dragWidget
= w
; }
69 void SetDragData( GtkSelectionData
*sd
) { m_dragData
= sd
; }
70 void SetDragTime( guint time
) { m_dragTime
= time
; }
73 //-------------------------------------------------------------------------
75 //-------------------------------------------------------------------------
77 class wxDropSource
: public wxDropSourceBase
80 /* constructor. set data later with SetData() */
81 wxDropSource( wxWindow
*win
,
82 const wxIcon
&go
= wxNullIcon
,
83 const wxIcon
&stop
= wxNullIcon
);
85 /* constructor for setting one data object */
86 wxDropSource( wxDataObject
& data
,
88 const wxIcon
&go
= wxNullIcon
,
89 const wxIcon
&stop
= wxNullIcon
);
93 /* start drag action */
94 virtual wxDragResult
DoDragDrop( bool bAllowMove
= FALSE
);
96 /* GTK implementation */
97 void RegisterWindow();
98 void UnregisterWindow();
102 wxDragResult m_retValue
;
103 wxDataObject
*m_data
;
105 wxCursor m_defaultCursor
;
106 wxCursor m_goaheadCursor
;
116 // wxUSE_DRAG_AND_DROP