]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/dnd.h
No real changes, just make wxWindow::CanScroll() virtual.
[wxWidgets.git] / include / wx / gtk1 / dnd.h
CommitLineData
c801d85f 1///////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/dnd.h
c801d85f
KB
3// Purpose: declaration of the wxDropTarget class
4// Author: Robert Roebling
c801d85f 5// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling
65571936 6// Licence: wxWindows licence
c801d85f
KB
7///////////////////////////////////////////////////////////////////////////////
8
c801d85f
KB
9#ifndef __GTKDNDH__
10#define __GTKDNDH__
11
06cfab17 12#if wxUSE_DRAG_AND_DROP
ac57418f 13
c801d85f
KB
14#include "wx/object.h"
15#include "wx/string.h"
8b53e5a2 16#include "wx/dataobj.h"
c801d85f 17#include "wx/cursor.h"
e4677d31
RR
18#include "wx/icon.h"
19#include "wx/gdicmn.h"
c801d85f
KB
20
21//-------------------------------------------------------------------------
22// classes
23//-------------------------------------------------------------------------
24
b5dbe15d 25class WXDLLIMPEXP_FWD_CORE wxWindow;
c801d85f 26
b5dbe15d
VS
27class WXDLLIMPEXP_FWD_CORE wxDropTarget;
28class WXDLLIMPEXP_FWD_CORE wxTextDropTarget;
29class WXDLLIMPEXP_FWD_CORE wxFileDropTarget;
e3e65dac 30
b5dbe15d 31class WXDLLIMPEXP_FWD_CORE wxDropSource;
e3e65dac 32
f6bcfd97
BP
33// ----------------------------------------------------------------------------
34// macros
35// ----------------------------------------------------------------------------
36
37// this macro may be used instead for wxDropSource ctor arguments: it will use
38// the icon 'name' from an XPM file under GTK, but will expand to something
39// else under MSW. If you don't use it, you will have to use #ifdef in the
40// application code.
41#define wxDROP_ICON(name) wxICON(name)
42
d6086ea6
RR
43//-------------------------------------------------------------------------
44// wxDropTarget
45//-------------------------------------------------------------------------
46
20123d49 47class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase
d6086ea6
RR
48{
49public:
d3b9f782 50 wxDropTarget(wxDataObject *dataObject = NULL );
8ee9d618 51
c9057ae1 52 virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
b068c4e8 53 virtual bool OnDrop(wxCoord x, wxCoord y);
8ee9d618 54 virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
b068c4e8
RR
55 virtual bool GetData();
56
57 // implementation
58
711f12ef 59 GdkAtom GetMatchingPair(bool quiet = false);
12db77ca 60
b068c4e8
RR
61 void RegisterWidget( GtkWidget *widget );
62 void UnregisterWidget( GtkWidget *widget );
63
64 GdkDragContext *m_dragContext;
65 GtkWidget *m_dragWidget;
66 GtkSelectionData *m_dragData;
29e461a2 67 unsigned m_dragTime;
2245b2b2 68 bool m_firstMotion; // gdk has no "gdk_drag_enter" event
b068c4e8
RR
69
70 void SetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
71 void SetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
72 void SetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
29e461a2 73 void SetDragTime(unsigned time) { m_dragTime = time; }
9e2896e5 74};
8e193f38 75
9e2896e5
VZ
76//-------------------------------------------------------------------------
77// wxDropSource
78//-------------------------------------------------------------------------
79
20123d49 80class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
9e2896e5
VZ
81{
82public:
2245b2b2 83 // constructor. set data later with SetData()
d3b9f782 84 wxDropSource( wxWindow *win = NULL,
f6bcfd97
BP
85 const wxIcon &copy = wxNullIcon,
86 const wxIcon &move = wxNullIcon,
87 const wxIcon &none = wxNullIcon);
8e193f38 88
2245b2b2 89 // constructor for setting one data object
9e2896e5
VZ
90 wxDropSource( wxDataObject& data,
91 wxWindow *win,
f6bcfd97
BP
92 const wxIcon &copy = wxNullIcon,
93 const wxIcon &move = wxNullIcon,
94 const wxIcon &none = wxNullIcon);
8e193f38 95
2245b2b2 96 virtual ~wxDropSource();
8e193f38 97
2245b2b2
VZ
98 // start drag action
99 virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
8e193f38 100
2245b2b2 101 // GTK implementation
9e2896e5
VZ
102 void RegisterWindow();
103 void UnregisterWindow();
8e193f38 104
f6bcfd97 105 void PrepareIcon( int action, GdkDragContext *context );
8ee9d618 106
7b5d5699
RR
107 GtkWidget *m_widget;
108 GtkWidget *m_iconWindow;
109 GdkDragContext *m_dragContext;
110 wxWindow *m_window;
8ee9d618 111
7b5d5699 112 wxDragResult m_retValue;
f6bcfd97
BP
113 wxIcon m_iconCopy,
114 m_iconMove,
115 m_iconNone;
8ee9d618 116
7b5d5699 117 bool m_waiting;
f6bcfd97
BP
118
119private:
120 // common part of both ctors
121 void SetIcons(const wxIcon& copy,
122 const wxIcon& move,
123 const wxIcon& none);
c801d85f
KB
124};
125
2245b2b2 126#endif // wxUSE_DRAG_AND_DROP
ac57418f 127
2245b2b2 128#endif //__GTKDNDH__
c801d85f 129