X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6dddc146fbea484558c02c18ea8250549329c70e..f2049b683752950d1fe91aec07318e7f2122ff16:/include/wx/os2/dnd.h diff --git a/include/wx/os2/dnd.h b/include/wx/os2/dnd.h index d774039221..9ead739ac4 100644 --- a/include/wx/os2/dnd.h +++ b/include/wx/os2/dnd.h @@ -1,126 +1,99 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: dnd.h +// Name: wx/os2/dnd.h // Purpose: declaration of the wxDropTarget class // Author: David Webster // Modified by: // Created: 10/21/99 // RCS-ID: $Id$ // Copyright: (c) 1999 David Webster -// Licence: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef __OS2DNDH__ #define __OS2DNDH__ -#ifdef __GNUG__ -#pragma interface -#endif - #if !wxUSE_DRAG_AND_DROP #error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!" #endif //WX_DRAG_DROP +#define INCL_WINSTDDRAG +#include +#ifndef __EMX__ +#include +#endif + +class CIDropTarget; + //------------------------------------------------------------------------- // wxDropSource //------------------------------------------------------------------------- -class WXDLLEXPORT wxDropSource: public wxDropSourceBase +class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase { public: /* constructor. set data later with SetData() */ - wxDropSource( wxWindow* pWin - ,const wxIcon& rGo = wxNullIcon - ,const wxIcon& rStop = wxNullIcon - ); + wxDropSource(wxWindow* pWin); /* constructor for setting one data object */ wxDropSource( wxDataObject& rData, - wxWindow* pWin, - const wxIcon& rGo = wxNullIcon, - const wxIcon& rStop = wxNullIcon + wxWindow* pWin ); virtual ~wxDropSource(); /* start drag action */ - virtual wxDragResult DoDragDrop(bool bAllowMove = FALSE); + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); + virtual bool GiveFeedback(wxDragResult eEffect); protected: void Init(void); - bool m_bLazyDrag; - DRAGIMAGE* m_pDragImage; - DRAGINFO* m_pDragInfo; - DRAGTRANSFER* m_pDragTransfer; -}; + ULONG m_ulItems; + PDRAGINFO m_pDragInfo; + DRAGIMAGE m_vDragImage; + PDRAGITEM m_pDragItem; + wxWindow* m_pWindow; +}; // end of CLASS wxDropSource //------------------------------------------------------------------------- // wxDropTarget //------------------------------------------------------------------------- -class WXDLLEXPORT wxDropTarget: public wxDropTargetBase +class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase { public: - wxDropTarget(wxDataObject *dataObject = (wxDataObject*)NULL); + wxDropTarget(wxDataObject* pDataObject = NULL); virtual ~wxDropTarget(); - void Register(WXHWND hwnd); - void Revoke(WXHWND hwnd); - - virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def); - virtual bool OnDrop(wxCoord x, wxCoord y); - virtual bool OnData(wxCoord x, wxCoord y); - virtual bool GetData(); + // + // These functions are called when data is moved over position (x, y) and + // may return either wxDragCopy, wxDragMove or wxDragNone depending on + // what would happen if the data were dropped here. + // + // The last parameter is what would happen by default and is determined by + // the platform-specific logic (for example, under Windows it's wxDragCopy + // if Ctrl key is pressed and wxDragMove otherwise) except that it will + // always be wxDragNone if the carried data is in an unsupported format. + // + // OnData must be implemented and other should be overridden by derived classes + // + virtual wxDragResult OnData( wxCoord vX + ,wxCoord vY + ,wxDragResult eResult + ); + virtual bool OnDrop( wxCoord vX + ,wxCoord vY + ); + bool IsAcceptedData(PDRAGINFO pDataSource) const; - // implementation protected: - virtual bool IsAcceptable(DRAGINFO* pInfo); - - DRAGINFO* m_pDragInfo; - DRAGTRANSFER* m_pDragTransfer; -}; - -// ---------------------------------------------------------------------------- -// A simple wxDropTarget derived class for text data: you only need to -// override OnDropText() to get something working -// ---------------------------------------------------------------------------- + virtual bool GetData(void); + wxDataFormat GetSupportedFormat(PDRAGINFO pDataSource) const; + void Release(void); -class WXDLLEXPORT wxTextDropTarget : public wxDropTarget -{ -public: - wxTextDropTarget(); - virtual ~wxTextDropTarget(); - - virtual bool OnDropText( wxCoord x - ,wxCoord y - ,const wxString& rText - ) = 0; - - virtual bool OnData( wxCoord x - ,wxCoord y - ); -}; - -// ---------------------------------------------------------------------------- -// A drop target which accepts files (dragged from File Manager or Explorer) -// ---------------------------------------------------------------------------- - -class WXDLLEXPORT wxFileDropTarget : public wxDropTarget -{ -public: - wxFileDropTarget(); - virtual ~wxFileDropTarget(); - - // parameters are the number of files and the array of file names - virtual bool OnDropFiles( wxCoord x - ,wxCoord y - ,const wxArrayString& rFilenames - ) = 0; - - virtual bool OnData( wxCoord x - ,wxCoord y - ); -}; +private: + CIDropTarget* m_pDropTarget; +}; // end of CLASS wxDropTarget #endif //__OS2DNDH__