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