]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/ole/dropsrc.h
bdc972b7327a5f17df495c75d871e08aad851bb9
[wxWidgets.git] / include / wx / msw / ole / dropsrc.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: ole/dropsrc.h
3 // Purpose: declaration of the wxDropSource class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 06.03.98
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_OLEDROPSRC_H
13 #define _WX_OLEDROPSRC_H
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface
17 #endif
18
19 #if !wxUSE_DRAG_AND_DROP
20 #error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!"
21 #endif //WX_DRAG_DROP
22
23 // ----------------------------------------------------------------------------
24 // forward declarations
25 // ----------------------------------------------------------------------------
26
27 class wxIDropSource;
28 class WXDLLEXPORT wxDataObject;
29 class WXDLLEXPORT wxWindow;
30
31 // ----------------------------------------------------------------------------
32 // macros
33 // ----------------------------------------------------------------------------
34
35 // this macro may be used instead for wxDropSource ctor arguments: it will use
36 // the cursor 'name' from the resources under MSW, but will expand to
37 // something else under GTK. If you don't use it, you will have to use #ifdef
38 // in the application code.
39 #define wxDROP_ICON(name) wxCursor(_T(#name))
40
41 // ----------------------------------------------------------------------------
42 // wxDropSource is used to start the drag-&-drop operation on associated
43 // wxDataObject object. It's responsible for giving UI feedback while dragging.
44 // ----------------------------------------------------------------------------
45
46 class WXDLLEXPORT wxDropSource : public wxDropSourceBase
47 {
48 public:
49 // ctors: if you use default ctor you must call SetData() later!
50 //
51 // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK
52 // compatibility, as well as both icon parameters
53 wxDropSource(wxWindow *win = NULL,
54 const wxCursor &cursorCopy = wxNullCursor,
55 const wxCursor &cursorMove = wxNullCursor,
56 const wxCursor &cursorStop = wxNullCursor);
57 wxDropSource(wxDataObject& data,
58 wxWindow *win = NULL,
59 const wxCursor &cursorCopy = wxNullCursor,
60 const wxCursor &cursorMove = wxNullCursor,
61 const wxCursor &cursorStop = wxNullCursor);
62
63 virtual ~wxDropSource();
64
65 // do it (call this in response to a mouse button press, for example)
66 // params: if bAllowMove is false, data can be only copied
67 virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
68
69 // overridable: you may give some custom UI feedback during d&d operation
70 // in this function (it's called on each mouse move, so it shouldn't be
71 // too slow). Just return false if you want default feedback.
72 virtual bool GiveFeedback(wxDragResult effect);
73
74 protected:
75 void Init();
76
77 private:
78 wxIDropSource *m_pIDropSource; // the pointer to COM interface
79
80 DECLARE_NO_COPY_CLASS(wxDropSource)
81 };
82
83 #endif //_WX_OLEDROPSRC_H