]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/classic/dnd.h
added a couple of base classes
[wxWidgets.git] / include / wx / mac / classic / dnd.h
CommitLineData
52479aef
SC
1///////////////////////////////////////////////////////////////////////////////
2// Name: dnd.h
3// Purpose: Declaration of the wxDropTarget, wxDropSource class etc.
4// Author: Stefan Csomor
5// RCS-ID: $Id$
6// Copyright: (c) 1998 Stefan Csomor
65571936 7// Licence: wxWindows licence
52479aef
SC
8///////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_DND_H_
11#define _WX_DND_H_
12
52479aef
SC
13#if wxUSE_DRAG_AND_DROP
14
15#include "wx/defs.h"
16#include "wx/object.h"
17#include "wx/string.h"
18#include "wx/string.h"
19#include "wx/dataobj.h"
20#include "wx/cursor.h"
21
22//-------------------------------------------------------------------------
23// classes
24//-------------------------------------------------------------------------
25
26class WXDLLEXPORT wxWindow;
27
28class WXDLLEXPORT wxDropTarget;
29class WXDLLEXPORT wxTextDropTarget;
30class WXDLLEXPORT wxFileDropTarget;
31
32class WXDLLEXPORT wxDropSource;
33
34// ----------------------------------------------------------------------------
35// macros
36// ----------------------------------------------------------------------------
37
38// this macro may be used instead for wxDropSource ctor arguments: it will use
39// the icon 'name' from an XPM file under GTK, but will expand to something
40// else under MSW. If you don't use it, you will have to use #ifdef in the
41// application code.
42#define wxDROP_ICON(X) wxCursor( (const char**) X##_xpm )
43
44//-------------------------------------------------------------------------
45// wxDropTarget
46//-------------------------------------------------------------------------
47
48class WXDLLEXPORT wxDropTarget: public wxDropTargetBase
49{
50 public:
51
52 wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
53
54 virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
55 virtual bool OnDrop(wxCoord x, wxCoord y);
56 virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
57 virtual bool GetData();
58
59 bool CurrentDragHasSupportedFormat() ;
60 void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; }
61 void* GetCurrentDrag() { return m_currentDrag ; }
62 protected :
63 void* m_currentDrag ;
64};
65
66//-------------------------------------------------------------------------
67// wxDropSource
68//-------------------------------------------------------------------------
69
70class WXDLLEXPORT wxDropSource: public wxDropSourceBase
71{
72public:
73 // ctors: if you use default ctor you must call SetData() later!
74 //
75 // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK
76 // compatibility, as well as both icon parameters
77 wxDropSource( wxWindow *win = (wxWindow *)NULL,
78 const wxCursor &cursorCopy = wxNullCursor,
79 const wxCursor &cursorMove = wxNullCursor,
80 const wxCursor &cursorStop = wxNullCursor);
81
82 /* constructor for setting one data object */
83 wxDropSource( wxDataObject& data,
84 wxWindow *win,
85 const wxCursor &cursorCopy = wxNullCursor,
86 const wxCursor &cursorMove = wxNullCursor,
87 const wxCursor &cursorStop = wxNullCursor);
88
89 ~wxDropSource();
90
91 // do it (call this in response to a mouse button press, for example)
92 // params: if bAllowMove is false, data can be only copied
93 virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
94
95 wxWindow* GetWindow() { return m_window ; }
96 void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; }
97 void* GetCurrentDrag() { return m_currentDrag ; }
98 bool MacInstallDefaultCursor(wxDragResult effect) ;
99 protected :
100
101 wxWindow *m_window;
102 void* m_currentDrag ;
103};
104
105#endif
106 // D&D
107
108#endif
109 //_WX_DND_H_
110