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
= 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();
39 // Can only be called during OnXXX methods.
40 wxDataFormat
GetMatchingPair();
44 GdkAtom
GtkGetMatchingPair();
46 void GtkRegisterWidget( GtkWidget
*widget
);
47 void GtkUnregisterWidget( GtkWidget
*widget
);
49 GdkDragContext
*m_dragContext
;
50 GtkWidget
*m_dragWidget
;
51 GtkSelectionData
*m_dragData
;
53 bool m_firstMotion
; // gdk has no "gdk_drag_enter" event
55 void GtkSetDragContext( GdkDragContext
*dc
) { m_dragContext
= dc
; }
56 void GtkSetDragWidget( GtkWidget
*w
) { m_dragWidget
= w
; }
57 void GtkSetDragData( GtkSelectionData
*sd
) { m_dragData
= sd
; }
58 void GtkSetDragTime( guint time
) { m_dragTime
= time
; }
61 //-------------------------------------------------------------------------
63 //-------------------------------------------------------------------------
65 class WXDLLIMPEXP_CORE wxDropSource
: public wxDropSourceBase
68 // constructor. set data later with SetData()
69 wxDropSource( wxWindow
*win
= NULL
,
70 const wxIcon
©
= wxNullIcon
,
71 const wxIcon
&move
= wxNullIcon
,
72 const wxIcon
&none
= wxNullIcon
);
74 // constructor for setting one data object
75 wxDropSource( wxDataObject
& data
,
77 const wxIcon
©
= wxNullIcon
,
78 const wxIcon
&move
= wxNullIcon
,
79 const wxIcon
&none
= wxNullIcon
);
81 virtual ~wxDropSource();
84 virtual wxDragResult
DoDragDrop(int flags
= wxDrag_CopyOnly
);
86 void PrepareIcon( int action
, GdkDragContext
*context
);
89 GtkWidget
*m_iconWindow
;
90 GdkDragContext
*m_dragContext
;
93 wxDragResult m_retValue
;
101 // common part of both ctors
102 void SetIcons(const wxIcon
& copy
,
106 // GTK implementation
107 void GTKConnectDragSignals();
108 void GTKDisconnectDragSignals();
112 #endif // _WX_GTK_DND_H_