]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dnd.h
make independent from carbon
[wxWidgets.git] / include / wx / gtk / dnd.h
CommitLineData
c801d85f
KB
1///////////////////////////////////////////////////////////////////////////////
2// Name: dnd.h
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
0416c418
PC
10#ifndef _WX_GTK_DND_H_
11#define _WX_GTK_DND_H_
c801d85f 12
e4677d31 13#include "wx/icon.h"
e3e65dac 14
f6bcfd97
BP
15// ----------------------------------------------------------------------------
16// macros
17// ----------------------------------------------------------------------------
18
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
22// application code.
23#define wxDROP_ICON(name) wxICON(name)
24
d6086ea6
RR
25//-------------------------------------------------------------------------
26// wxDropTarget
27//-------------------------------------------------------------------------
28
20123d49 29class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase
d6086ea6
RR
30{
31public:
b068c4e8 32 wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
8ee9d618 33
c9057ae1 34 virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
b068c4e8 35 virtual bool OnDrop(wxCoord x, wxCoord y);
8ee9d618 36 virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
b068c4e8
RR
37 virtual bool GetData();
38
39 // implementation
40
41 GdkAtom GetMatchingPair();
12db77ca 42
b068c4e8
RR
43 void RegisterWidget( GtkWidget *widget );
44 void UnregisterWidget( GtkWidget *widget );
45
46 GdkDragContext *m_dragContext;
47 GtkWidget *m_dragWidget;
48 GtkSelectionData *m_dragData;
49 guint m_dragTime;
2245b2b2 50 bool m_firstMotion; // gdk has no "gdk_drag_enter" event
b068c4e8
RR
51
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; }
9e2896e5 56};
8e193f38 57
9e2896e5
VZ
58//-------------------------------------------------------------------------
59// wxDropSource
60//-------------------------------------------------------------------------
61
20123d49 62class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
9e2896e5
VZ
63{
64public:
2245b2b2 65 // constructor. set data later with SetData()
0f8df1b9 66 wxDropSource( wxWindow *win = (wxWindow *)NULL,
f6bcfd97
BP
67 const wxIcon &copy = wxNullIcon,
68 const wxIcon &move = wxNullIcon,
69 const wxIcon &none = wxNullIcon);
8e193f38 70
2245b2b2 71 // constructor for setting one data object
9e2896e5
VZ
72 wxDropSource( wxDataObject& data,
73 wxWindow *win,
f6bcfd97
BP
74 const wxIcon &copy = wxNullIcon,
75 const wxIcon &move = wxNullIcon,
76 const wxIcon &none = wxNullIcon);
8e193f38 77
2245b2b2 78 virtual ~wxDropSource();
8e193f38 79
2245b2b2
VZ
80 // start drag action
81 virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
8e193f38 82
f6bcfd97 83 void PrepareIcon( int action, GdkDragContext *context );
8ee9d618 84
7b5d5699
RR
85 GtkWidget *m_widget;
86 GtkWidget *m_iconWindow;
87 GdkDragContext *m_dragContext;
88 wxWindow *m_window;
8ee9d618 89
7b5d5699 90 wxDragResult m_retValue;
f6bcfd97
BP
91 wxIcon m_iconCopy,
92 m_iconMove,
93 m_iconNone;
8ee9d618 94
7b5d5699 95 bool m_waiting;
f6bcfd97
BP
96
97private:
98 // common part of both ctors
99 void SetIcons(const wxIcon& copy,
100 const wxIcon& move,
101 const wxIcon& none);
86f19f7c
VZ
102
103 // GTK implementation
104 void GTKConnectDragSignals();
105 void GTKDisconnectDragSignals();
106
c801d85f
KB
107};
108
0416c418 109#endif // _WX_GTK_DND_H_
c801d85f 110