]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk/dnd.h
Add new wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED event. Implement for all backends, exten...
[wxWidgets.git] / include / wx / gtk / dnd.h
... / ...
CommitLineData
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/gtk/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
29class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase
30{
31public:
32 wxDropTarget(wxDataObject *dataObject = 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 // Can only be called during OnXXX methods.
40 wxDataFormat GetMatchingPair();
41
42 // implementation
43
44 GdkAtom GTKGetMatchingPair(bool quiet = false);
45 wxDragResult GTKFigureOutSuggestedAction();
46
47 void GtkRegisterWidget( GtkWidget *widget );
48 void GtkUnregisterWidget( GtkWidget *widget );
49
50 GdkDragContext *m_dragContext;
51 GtkWidget *m_dragWidget;
52 GtkSelectionData *m_dragData;
53 guint m_dragTime;
54 bool m_firstMotion; // gdk has no "gdk_drag_enter" event
55
56 void GTKSetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
57 void GTKSetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
58 void GTKSetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
59 void GTKSetDragTime( guint time ) { m_dragTime = time; }
60};
61
62//-------------------------------------------------------------------------
63// wxDropSource
64//-------------------------------------------------------------------------
65
66class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
67{
68public:
69 // constructor. set data later with SetData()
70 wxDropSource( wxWindow *win = NULL,
71 const wxIcon &copy = wxNullIcon,
72 const wxIcon &move = wxNullIcon,
73 const wxIcon &none = wxNullIcon);
74
75 // constructor for setting one data object
76 wxDropSource( wxDataObject& data,
77 wxWindow *win,
78 const wxIcon &copy = wxNullIcon,
79 const wxIcon &move = wxNullIcon,
80 const wxIcon &none = wxNullIcon);
81
82 virtual ~wxDropSource();
83
84 // start drag action
85 virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
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
101private:
102 // common part of both ctors
103 void SetIcons(const wxIcon& copy,
104 const wxIcon& move,
105 const wxIcon& none);
106
107 // GTK implementation
108 void GTKConnectDragSignals();
109 void GTKDisconnectDragSignals();
110
111};
112
113#endif // _WX_GTK_DND_H_
114