]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dnd.h
Visualage C++ V4.0 has a native long long data type.
[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
KB
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
06cfab17 18#if wxUSE_DRAG_AND_DROP
ac57418f 19
c801d85f
KB
20#include "wx/object.h"
21#include "wx/string.h"
8b53e5a2 22#include "wx/dataobj.h"
c801d85f 23#include "wx/cursor.h"
e4677d31
RR
24#include "wx/icon.h"
25#include "wx/gdicmn.h"
c801d85f
KB
26
27//-------------------------------------------------------------------------
28// classes
29//-------------------------------------------------------------------------
30
31class wxWindow;
32
33class wxDropTarget;
34class wxTextDropTarget;
e3e65dac
RR
35class wxFileDropTarget;
36
37class wxDropSource;
38
d6086ea6
RR
39//-------------------------------------------------------------------------
40// wxDropTarget
41//-------------------------------------------------------------------------
42
b068c4e8 43class wxDropTarget: public wxDropTargetBase
d6086ea6
RR
44{
45public:
b068c4e8 46 wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
8ee9d618 47
c9057ae1 48 virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
b068c4e8 49 virtual bool OnDrop(wxCoord x, wxCoord y);
8ee9d618 50 virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
b068c4e8
RR
51 virtual bool GetData();
52
53 // implementation
54
55 GdkAtom GetMatchingPair();
12db77ca 56
b068c4e8
RR
57 void RegisterWidget( GtkWidget *widget );
58 void UnregisterWidget( GtkWidget *widget );
59
60 GdkDragContext *m_dragContext;
61 GtkWidget *m_dragWidget;
62 GtkSelectionData *m_dragData;
63 guint m_dragTime;
64 bool m_firstMotion; /* gdk has no "gdk_drag_enter" event */
65
66 void SetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
67 void SetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
68 void SetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
69 void SetDragTime( guint time ) { m_dragTime = time; }
9e2896e5 70};
8e193f38 71
9e2896e5
VZ
72//-------------------------------------------------------------------------
73// wxDropSource
74//-------------------------------------------------------------------------
75
b068c4e8 76class wxDropSource: public wxDropSourceBase
9e2896e5
VZ
77{
78public:
79 /* constructor. set data later with SetData() */
80 wxDropSource( wxWindow *win,
7b5d5699 81 const wxIcon &go = wxNullIcon );
8e193f38 82
9e2896e5
VZ
83 /* constructor for setting one data object */
84 wxDropSource( wxDataObject& data,
85 wxWindow *win,
7b5d5699 86 const wxIcon &go = wxNullIcon );
8e193f38 87
9e2896e5 88 ~wxDropSource();
8e193f38 89
9e2896e5
VZ
90 /* start drag action */
91 virtual wxDragResult DoDragDrop( bool bAllowMove = FALSE );
8e193f38 92
9e2896e5
VZ
93 /* GTK implementation */
94 void RegisterWindow();
95 void UnregisterWindow();
8e193f38 96
7b5d5699 97 void PrepareIcon( int hot_x, int hot_y, GdkDragContext *context );
8ee9d618 98
7b5d5699
RR
99 GtkWidget *m_widget;
100 GtkWidget *m_iconWindow;
101 GdkDragContext *m_dragContext;
102 wxWindow *m_window;
8ee9d618 103
7b5d5699
RR
104 wxDragResult m_retValue;
105 wxIcon m_icon;
8ee9d618 106
7b5d5699 107 bool m_waiting;
c801d85f
KB
108};
109
ac57418f
RR
110#endif
111
112 // wxUSE_DRAG_AND_DROP
113
8e193f38 114#endif
c801d85f
KB
115 //__GTKDNDH__
116