dnd.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/dnd.h
  3. // Purpose: declaration of the wxDropTarget class
  4. // Author: David Webster
  5. // Modified by:
  6. // Created: 10/21/99
  7. // Copyright: (c) 1999 David Webster
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef __OS2DNDH__
  11. #define __OS2DNDH__
  12. #if !wxUSE_DRAG_AND_DROP
  13. #error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!"
  14. #endif //WX_DRAG_DROP
  15. #define INCL_WINSTDDRAG
  16. #include <os2.h>
  17. #ifndef __EMX__
  18. #include <pmstddlg.h>
  19. #endif
  20. class CIDropTarget;
  21. //-------------------------------------------------------------------------
  22. // wxDropSource
  23. //-------------------------------------------------------------------------
  24. class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
  25. {
  26. public:
  27. /* constructor. set data later with SetData() */
  28. wxDropSource(wxWindow* pWin);
  29. /* constructor for setting one data object */
  30. wxDropSource( wxDataObject& rData,
  31. wxWindow* pWin
  32. );
  33. virtual ~wxDropSource();
  34. /* start drag action */
  35. virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
  36. virtual bool GiveFeedback(wxDragResult eEffect);
  37. protected:
  38. void Init(void);
  39. ULONG m_ulItems;
  40. PDRAGINFO m_pDragInfo;
  41. DRAGIMAGE m_vDragImage;
  42. PDRAGITEM m_pDragItem;
  43. wxWindow* m_pWindow;
  44. }; // end of CLASS wxDropSource
  45. //-------------------------------------------------------------------------
  46. // wxDropTarget
  47. //-------------------------------------------------------------------------
  48. class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase
  49. {
  50. public:
  51. wxDropTarget(wxDataObject* pDataObject = NULL);
  52. virtual ~wxDropTarget();
  53. //
  54. // These functions are called when data is moved over position (x, y) and
  55. // may return either wxDragCopy, wxDragMove or wxDragNone depending on
  56. // what would happen if the data were dropped here.
  57. //
  58. // The last parameter is what would happen by default and is determined by
  59. // the platform-specific logic (for example, under Windows it's wxDragCopy
  60. // if Ctrl key is pressed and wxDragMove otherwise) except that it will
  61. // always be wxDragNone if the carried data is in an unsupported format.
  62. //
  63. // OnData must be implemented and other should be overridden by derived classes
  64. //
  65. virtual wxDragResult OnData( wxCoord vX
  66. ,wxCoord vY
  67. ,wxDragResult eResult
  68. );
  69. virtual bool OnDrop( wxCoord vX
  70. ,wxCoord vY
  71. );
  72. bool IsAcceptedData(PDRAGINFO pDataSource) const;
  73. protected:
  74. virtual bool GetData(void);
  75. wxDataFormat GetSupportedFormat(PDRAGINFO pDataSource) const;
  76. void Release(void);
  77. private:
  78. CIDropTarget* m_pDropTarget;
  79. }; // end of CLASS wxDropTarget
  80. #endif //__OS2DNDH__