]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dnd.h
Made wxGTK compile and link again. Broke wxMSW a little.
[wxWidgets.git] / include / wx / gtk / dnd.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: dnd.h
3 // Purpose: declaration of the wxDropTarget class
4 // Author: Robert Roebling
5 // RCS-ID: $Id$
6 // Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling
7 // Licence: wxWindows license
8 ///////////////////////////////////////////////////////////////////////////////
9
10
11 #ifndef __GTKDNDH__
12 #define __GTKDNDH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #if wxUSE_DRAG_AND_DROP
19
20 #include "wx/object.h"
21 #include "wx/string.h"
22 #include "wx/dataobj.h"
23 #include "wx/cursor.h"
24 #include "wx/icon.h"
25 #include "wx/gdicmn.h"
26
27 //-------------------------------------------------------------------------
28 // classes
29 //-------------------------------------------------------------------------
30
31 class wxWindow;
32
33 class wxDropTarget;
34 class wxTextDropTarget;
35 class wxFileDropTarget;
36 class wxPrivateDropTarget;
37
38 class wxDropSource;
39
40 //-------------------------------------------------------------------------
41 // wxDropTarget
42 //-------------------------------------------------------------------------
43
44 class wxDropTarget: public wxDropTargetBase
45 {
46 public:
47 wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
48
49 virtual bool OnEnter(wxCoord x, wxCoord y) ;
50 virtual bool OnMove(wxCoord x, wxCoord y);
51 virtual bool OnDrop(wxCoord x, wxCoord y);
52 virtual bool OnData(wxCoord x, wxCoord y);
53 virtual bool GetData();
54
55 // implementation
56
57 GdkAtom GetMatchingPair();
58 void RegisterWidget( GtkWidget *widget );
59 void UnregisterWidget( GtkWidget *widget );
60
61 GdkDragContext *m_dragContext;
62 GtkWidget *m_dragWidget;
63 GtkSelectionData *m_dragData;
64 guint m_dragTime;
65 bool m_firstMotion; /* gdk has no "gdk_drag_enter" event */
66
67 void SetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
68 void SetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
69 void SetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
70 void SetDragTime( guint time ) { m_dragTime = time; }
71 };
72
73 //-------------------------------------------------------------------------
74 // wxDropSource
75 //-------------------------------------------------------------------------
76
77 class wxDropSource: public wxDropSourceBase
78 {
79 public:
80 /* constructor. set data later with SetData() */
81 wxDropSource( wxWindow *win,
82 const wxIcon &go = wxNullIcon,
83 const wxIcon &stop = wxNullIcon );
84
85 /* constructor for setting one data object */
86 wxDropSource( wxDataObject& data,
87 wxWindow *win,
88 const wxIcon &go = wxNullIcon,
89 const wxIcon &stop = wxNullIcon );
90
91 ~wxDropSource();
92
93 /* start drag action */
94 virtual wxDragResult DoDragDrop( bool bAllowMove = FALSE );
95
96 /* GTK implementation */
97 void RegisterWindow();
98 void UnregisterWindow();
99
100 GtkWidget *m_widget;
101 wxWindow *m_window;
102 wxDragResult m_retValue;
103 wxDataObject *m_data;
104
105 wxCursor m_defaultCursor;
106 wxCursor m_goaheadCursor;
107
108 wxIcon m_goIcon;
109 wxIcon m_stopIcon;
110
111 bool m_waiting;
112 };
113
114 #endif
115
116 // wxUSE_DRAG_AND_DROP
117
118 #endif
119 //__GTKDNDH__
120