]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dnd.h
Fixed bug: wxPGProperty::SetName() crashed if it was called before property was added...
[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 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
VZ
43
44 GdkAtom GtkGetMatchingPair(bool quiet = false);
12db77ca 45
1fe91d70
RR
46 void GtkRegisterWidget( GtkWidget *widget );
47 void GtkUnregisterWidget( GtkWidget *widget );
b068c4e8
RR
48
49 GdkDragContext *m_dragContext;
50 GtkWidget *m_dragWidget;
51 GtkSelectionData *m_dragData;
52 guint m_dragTime;
2245b2b2 53 bool m_firstMotion; // gdk has no "gdk_drag_enter" event
b068c4e8 54
1fe91d70
RR
55 void GtkSetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
56 void GtkSetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
57 void GtkSetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
58 void GtkSetDragTime( guint time ) { m_dragTime = time; }
9e2896e5 59};
8e193f38 60
9e2896e5
VZ
61//-------------------------------------------------------------------------
62// wxDropSource
63//-------------------------------------------------------------------------
64
20123d49 65class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
9e2896e5
VZ
66{
67public:
2245b2b2 68 // constructor. set data later with SetData()
d3b9f782 69 wxDropSource( wxWindow *win = NULL,
f6bcfd97
BP
70 const wxIcon &copy = wxNullIcon,
71 const wxIcon &move = wxNullIcon,
72 const wxIcon &none = wxNullIcon);
8e193f38 73
2245b2b2 74 // constructor for setting one data object
9e2896e5
VZ
75 wxDropSource( wxDataObject& data,
76 wxWindow *win,
f6bcfd97
BP
77 const wxIcon &copy = wxNullIcon,
78 const wxIcon &move = wxNullIcon,
79 const wxIcon &none = wxNullIcon);
8e193f38 80
2245b2b2 81 virtual ~wxDropSource();
8e193f38 82
2245b2b2
VZ
83 // start drag action
84 virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
8e193f38 85
f6bcfd97 86 void PrepareIcon( int action, GdkDragContext *context );
8ee9d618 87
7b5d5699
RR
88 GtkWidget *m_widget;
89 GtkWidget *m_iconWindow;
90 GdkDragContext *m_dragContext;
91 wxWindow *m_window;
8ee9d618 92
7b5d5699 93 wxDragResult m_retValue;
f6bcfd97
BP
94 wxIcon m_iconCopy,
95 m_iconMove,
96 m_iconNone;
8ee9d618 97
7b5d5699 98 bool m_waiting;
f6bcfd97
BP
99
100private:
101 // common part of both ctors
102 void SetIcons(const wxIcon& copy,
103 const wxIcon& move,
104 const wxIcon& none);
86f19f7c
VZ
105
106 // GTK implementation
107 void GTKConnectDragSignals();
108 void GTKDisconnectDragSignals();
109
c801d85f
KB
110};
111
0416c418 112#endif // _WX_GTK_DND_H_
c801d85f 113