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