]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk/dnd.h
Added wxWindow::DoMoveWindow(..)
[wxWidgets.git] / include / wx / gtk / dnd.h
... / ...
CommitLineData
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
31class wxWindow;
32
33class wxDropTarget;
34class wxTextDropTarget;
35class wxFileDropTarget;
36
37class wxDropSource;
38
39//-------------------------------------------------------------------------
40// wxDropTarget
41//-------------------------------------------------------------------------
42
43class wxDropTarget: public wxDropTargetBase
44{
45public:
46 wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
47
48 virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
49 virtual bool OnDrop(wxCoord x, wxCoord y);
50 virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
51 virtual bool GetData();
52
53 // implementation
54
55 GdkAtom GetMatchingPair();
56
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; }
70};
71
72//-------------------------------------------------------------------------
73// wxDropSource
74//-------------------------------------------------------------------------
75
76class wxDropSource: public wxDropSourceBase
77{
78public:
79 /* constructor. set data later with SetData() */
80 wxDropSource( wxWindow *win,
81 const wxIcon &go = wxNullIcon );
82
83 /* constructor for setting one data object */
84 wxDropSource( wxDataObject& data,
85 wxWindow *win,
86 const wxIcon &go = wxNullIcon );
87
88 ~wxDropSource();
89
90 /* start drag action */
91 virtual wxDragResult DoDragDrop( bool bAllowMove = FALSE );
92
93 /* GTK implementation */
94 void RegisterWindow();
95 void UnregisterWindow();
96
97 void PrepareIcon( int hot_x, int hot_y, GdkDragContext *context );
98
99 GtkWidget *m_widget;
100 GtkWidget *m_iconWindow;
101 GdkDragContext *m_dragContext;
102 wxWindow *m_window;
103
104 wxDragResult m_retValue;
105 wxIcon m_icon;
106
107 bool m_waiting;
108};
109
110#endif
111
112 // wxUSE_DRAG_AND_DROP
113
114#endif
115 //__GTKDNDH__
116