]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dnd.h
Ensure that the progress dialog parent is activated at the end under MSW.
[wxWidgets.git] / include / wx / gtk / dnd.h
CommitLineData
c801d85f 1///////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/gtk/dnd.h
c801d85f
KB
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:
d3b9f782 32 wxDropTarget(wxDataObject *dataObject = 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
51c9c13c
RR
39 // Can only be called during OnXXX methods.
40 wxDataFormat GetMatchingPair();
b068c4e8 41
1fe91d70 42 // implementation
711f12ef 43
1aeae3f7
RR
44 GdkAtom GTKGetMatchingPair(bool quiet = false);
45 wxDragResult GTKFigureOutSuggestedAction();
12db77ca 46
1fe91d70
RR
47 void GtkRegisterWidget( GtkWidget *widget );
48 void GtkUnregisterWidget( GtkWidget *widget );
b068c4e8
RR
49
50 GdkDragContext *m_dragContext;
51 GtkWidget *m_dragWidget;
52 GtkSelectionData *m_dragData;
29e461a2 53 unsigned m_dragTime;
2245b2b2 54 bool m_firstMotion; // gdk has no "gdk_drag_enter" event
b068c4e8 55
1aeae3f7
RR
56 void GTKSetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
57 void GTKSetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
58 void GTKSetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
29e461a2 59 void GTKSetDragTime(unsigned time) { m_dragTime = time; }
9e2896e5 60};
8e193f38 61
9e2896e5
VZ
62//-------------------------------------------------------------------------
63// wxDropSource
64//-------------------------------------------------------------------------
65
20123d49 66class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
9e2896e5
VZ
67{
68public:
2245b2b2 69 // constructor. set data later with SetData()
d3b9f782 70 wxDropSource( wxWindow *win = NULL,
f6bcfd97
BP
71 const wxIcon &copy = wxNullIcon,
72 const wxIcon &move = wxNullIcon,
73 const wxIcon &none = wxNullIcon);
8e193f38 74
2245b2b2 75 // constructor for setting one data object
9e2896e5
VZ
76 wxDropSource( wxDataObject& data,
77 wxWindow *win,
f6bcfd97
BP
78 const wxIcon &copy = wxNullIcon,
79 const wxIcon &move = wxNullIcon,
80 const wxIcon &none = wxNullIcon);
8e193f38 81
2245b2b2 82 virtual ~wxDropSource();
8e193f38 83
2245b2b2
VZ
84 // start drag action
85 virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
8e193f38 86
f6bcfd97 87 void PrepareIcon( int action, GdkDragContext *context );
8ee9d618 88
7b5d5699
RR
89 GtkWidget *m_widget;
90 GtkWidget *m_iconWindow;
91 GdkDragContext *m_dragContext;
92 wxWindow *m_window;
8ee9d618 93
7b5d5699 94 wxDragResult m_retValue;
f6bcfd97
BP
95 wxIcon m_iconCopy,
96 m_iconMove,
97 m_iconNone;
8ee9d618 98
7b5d5699 99 bool m_waiting;
f6bcfd97
BP
100
101private:
102 // common part of both ctors
103 void SetIcons(const wxIcon& copy,
104 const wxIcon& move,
105 const wxIcon& none);
86f19f7c
VZ
106
107 // GTK implementation
108 void GTKConnectDragSignals();
109 void GTKDisconnectDragSignals();
110
c801d85f
KB
111};
112
0416c418 113#endif // _WX_GTK_DND_H_
c801d85f 114