]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dnd.h
compilation fix for insert()
[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 licence
8 ///////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_GTK_DND_H_
11 #define _WX_GTK_DND_H_
12
13 #include "wx/icon.h"
14
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
25 //-------------------------------------------------------------------------
26 // wxDropTarget
27 //-------------------------------------------------------------------------
28
29 class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase
30 {
31 public:
32 wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
33
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();
38
39 // implementation
40
41 GdkAtom GetMatchingPair();
42
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;
50 bool m_firstMotion; // gdk has no "gdk_drag_enter" event
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; }
56 };
57
58 //-------------------------------------------------------------------------
59 // wxDropSource
60 //-------------------------------------------------------------------------
61
62 class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
63 {
64 public:
65 // constructor. set data later with SetData()
66 wxDropSource( wxWindow *win = (wxWindow *)NULL,
67 const wxIcon &copy = wxNullIcon,
68 const wxIcon &move = wxNullIcon,
69 const wxIcon &none = wxNullIcon);
70
71 // constructor for setting one data object
72 wxDropSource( wxDataObject& data,
73 wxWindow *win,
74 const wxIcon &copy = wxNullIcon,
75 const wxIcon &move = wxNullIcon,
76 const wxIcon &none = wxNullIcon);
77
78 virtual ~wxDropSource();
79
80 // start drag action
81 virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
82
83 // GTK implementation
84 void RegisterWindow();
85 void UnregisterWindow();
86
87 void PrepareIcon( int action, GdkDragContext *context );
88
89 GtkWidget *m_widget;
90 GtkWidget *m_iconWindow;
91 GdkDragContext *m_dragContext;
92 wxWindow *m_window;
93
94 wxDragResult m_retValue;
95 wxIcon m_iconCopy,
96 m_iconMove,
97 m_iconNone;
98
99 bool m_waiting;
100
101 private:
102 // common part of both ctors
103 void SetIcons(const wxIcon& copy,
104 const wxIcon& move,
105 const wxIcon& none);
106 };
107
108 #endif // _WX_GTK_DND_H_
109