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