]>
Commit | Line | Data |
---|---|---|
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 wxUSE_DRAG_AND_DROP | |
16 | ||
17 | // ---------------------------------------------------------------------------- | |
18 | // forward declarations | |
19 | // ---------------------------------------------------------------------------- | |
20 | ||
21 | class wxIDropSource; | |
22 | class WXDLLIMPEXP_FWD_CORE wxDataObject; | |
23 | class WXDLLIMPEXP_FWD_CORE wxWindow; | |
24 | ||
25 | // ---------------------------------------------------------------------------- | |
26 | // macros | |
27 | // ---------------------------------------------------------------------------- | |
28 | ||
29 | // this macro may be used instead for wxDropSource ctor arguments: it will use | |
30 | // the cursor 'name' from the resources under MSW, but will expand to | |
31 | // something else under GTK. If you don't use it, you will have to use #ifdef | |
32 | // in the application code. | |
33 | #define wxDROP_ICON(name) wxCursor(_T(#name)) | |
34 | ||
35 | // ---------------------------------------------------------------------------- | |
36 | // wxDropSource is used to start the drag-&-drop operation on associated | |
37 | // wxDataObject object. It's responsible for giving UI feedback while dragging. | |
38 | // ---------------------------------------------------------------------------- | |
39 | ||
40 | class WXDLLIMPEXP_CORE wxDropSource : public wxDropSourceBase | |
41 | { | |
42 | public: | |
43 | // ctors: if you use default ctor you must call SetData() later! | |
44 | // | |
45 | // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK | |
46 | // compatibility, as well as both icon parameters | |
47 | wxDropSource(wxWindow *win = NULL, | |
48 | const wxCursor &cursorCopy = wxNullCursor, | |
49 | const wxCursor &cursorMove = wxNullCursor, | |
50 | const wxCursor &cursorStop = wxNullCursor); | |
51 | wxDropSource(wxDataObject& data, | |
52 | wxWindow *win = NULL, | |
53 | const wxCursor &cursorCopy = wxNullCursor, | |
54 | const wxCursor &cursorMove = wxNullCursor, | |
55 | const wxCursor &cursorStop = wxNullCursor); | |
56 | ||
57 | virtual ~wxDropSource(); | |
58 | ||
59 | // do it (call this in response to a mouse button press, for example) | |
60 | // params: if bAllowMove is false, data can be only copied | |
61 | virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); | |
62 | ||
63 | // overridable: you may give some custom UI feedback during d&d operation | |
64 | // in this function (it's called on each mouse move, so it shouldn't be | |
65 | // too slow). Just return false if you want default feedback. | |
66 | virtual bool GiveFeedback(wxDragResult effect); | |
67 | ||
68 | protected: | |
69 | void Init(); | |
70 | ||
71 | private: | |
72 | wxIDropSource *m_pIDropSource; // the pointer to COM interface | |
73 | ||
74 | wxDECLARE_NO_COPY_CLASS(wxDropSource); | |
75 | }; | |
76 | ||
77 | #endif //wxUSE_DRAG_AND_DROP | |
78 | ||
79 | #endif //_WX_OLEDROPSRC_H |