1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: declaration of the wxDropTarget class
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_GTK_DND_H_
11 #define _WX_GTK_DND_H_
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // this macro may be used instead for wxDropSource ctor arguments: it will use
20 // the icon 'name' from an XPM file under GTK, but will expand to something
21 // else under MSW. If you don't use it, you will have to use #ifdef in the
23 #define wxDROP_ICON(name) wxICON(name)
25 //-------------------------------------------------------------------------
27 //-------------------------------------------------------------------------
29 class WXDLLIMPEXP_CORE wxDropTarget
: public wxDropTargetBase
32 wxDropTarget(wxDataObject
*dataObject
= (wxDataObject
*) NULL
);
34 virtual wxDragResult
OnDragOver(wxCoord x
, wxCoord y
, wxDragResult def
);
35 virtual bool OnDrop(wxCoord x
, wxCoord y
);
36 virtual wxDragResult
OnData(wxCoord x
, wxCoord y
, wxDragResult def
);
37 virtual bool GetData();
41 GdkAtom
GetMatchingPair();
43 void RegisterWidget( GtkWidget
*widget
);
44 void UnregisterWidget( GtkWidget
*widget
);
46 GdkDragContext
*m_dragContext
;
47 GtkWidget
*m_dragWidget
;
48 GtkSelectionData
*m_dragData
;
50 bool m_firstMotion
; // gdk has no "gdk_drag_enter" event
52 void SetDragContext( GdkDragContext
*dc
) { m_dragContext
= dc
; }
53 void SetDragWidget( GtkWidget
*w
) { m_dragWidget
= w
; }
54 void SetDragData( GtkSelectionData
*sd
) { m_dragData
= sd
; }
55 void SetDragTime( guint time
) { m_dragTime
= time
; }
58 //-------------------------------------------------------------------------
60 //-------------------------------------------------------------------------
62 class WXDLLIMPEXP_CORE wxDropSource
: public wxDropSourceBase
65 // constructor. set data later with SetData()
66 wxDropSource( wxWindow
*win
= (wxWindow
*)NULL
,
67 const wxIcon
©
= wxNullIcon
,
68 const wxIcon
&move
= wxNullIcon
,
69 const wxIcon
&none
= wxNullIcon
);
71 // constructor for setting one data object
72 wxDropSource( wxDataObject
& data
,
74 const wxIcon
©
= wxNullIcon
,
75 const wxIcon
&move
= wxNullIcon
,
76 const wxIcon
&none
= wxNullIcon
);
78 virtual ~wxDropSource();
81 virtual wxDragResult
DoDragDrop(int flags
= wxDrag_CopyOnly
);
83 void PrepareIcon( int action
, GdkDragContext
*context
);
86 GtkWidget
*m_iconWindow
;
87 GdkDragContext
*m_dragContext
;
90 wxDragResult m_retValue
;
98 // common part of both ctors
99 void SetIcons(const wxIcon
& copy
,
103 // GTK implementation
104 void GTKConnectDragSignals();
105 void GTKDisconnectDragSignals();
109 #endif // _WX_GTK_DND_H_