]>
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 ///////////////////////////////////////////////////////////////////////////////
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
;
39 //-------------------------------------------------------------------------
41 //-------------------------------------------------------------------------
43 class wxDropTarget
: public wxDropTargetBase
46 wxDropTarget(wxDataObject
*dataObject
= (wxDataObject
*) NULL
);
48 virtual wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
49 virtual bool OnDrop(wxCoord x
, wxCoord y
);
50 virtual wxDragResult
OnData(wxCoord x
, wxCoord y
, wxDragResult def
);
51 virtual bool GetData();
55 GdkAtom
GetMatchingPair();
57 void RegisterWidget( GtkWidget
*widget
);
58 void UnregisterWidget( GtkWidget
*widget
);
60 GdkDragContext
*m_dragContext
;
61 GtkWidget
*m_dragWidget
;
62 GtkSelectionData
*m_dragData
;
64 bool m_firstMotion
; /* gdk has no "gdk_drag_enter" event */
66 void SetDragContext( GdkDragContext
*dc
) { m_dragContext
= dc
; }
67 void SetDragWidget( GtkWidget
*w
) { m_dragWidget
= w
; }
68 void SetDragData( GtkSelectionData
*sd
) { m_dragData
= sd
; }
69 void SetDragTime( guint time
) { m_dragTime
= time
; }
72 //-------------------------------------------------------------------------
74 //-------------------------------------------------------------------------
76 class wxDropSource
: public wxDropSourceBase
79 /* constructor. set data later with SetData() */
80 wxDropSource( wxWindow
*win
= (wxWindow
*)NULL
,
81 const wxIcon
&go
= wxNullIcon
);
83 /* constructor for setting one data object */
84 wxDropSource( wxDataObject
& data
,
86 const wxIcon
&go
= wxNullIcon
);
90 /* start drag action */
91 virtual wxDragResult
DoDragDrop( bool bAllowMove
= FALSE
);
93 /* GTK implementation */
94 void RegisterWindow();
95 void UnregisterWindow();
97 void PrepareIcon( int hot_x
, int hot_y
, GdkDragContext
*context
);
100 GtkWidget
*m_iconWindow
;
101 GdkDragContext
*m_dragContext
;
104 wxDragResult m_retValue
;
112 // wxUSE_DRAG_AND_DROP