dropsrc.h 3.0 KB

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