1999-07-29 05:11:30 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dnd.h
|
1999-10-22 04:37:39 +00:00
|
|
|
// Purpose: declaration of the wxDropTarget class
|
|
|
|
// Author: David Webster
|
|
|
|
// Modified by:
|
|
|
|
// Created: 10/21/99
|
1999-07-29 05:11:30 +00:00
|
|
|
// RCS-ID: $Id$
|
1999-10-22 04:37:39 +00:00
|
|
|
// Copyright: (c) 1999 David Webster
|
2003-03-17 10:34:04 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-07-29 05:11:30 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-10-22 04:37:39 +00:00
|
|
|
|
|
|
|
#ifndef __OS2DNDH__
|
|
|
|
#define __OS2DNDH__
|
1999-07-29 05:11:30 +00:00
|
|
|
|
1999-10-22 04:37:39 +00:00
|
|
|
#if !wxUSE_DRAG_AND_DROP
|
|
|
|
#error "You should #define wxUSE_DRAG_AND_DROP to 1 to compile this file!"
|
|
|
|
#endif //WX_DRAG_DROP
|
1999-07-29 05:11:30 +00:00
|
|
|
|
1999-11-22 05:27:57 +00:00
|
|
|
#define INCL_WINSTDDRAG
|
|
|
|
#include <os2.h>
|
2000-01-14 23:04:16 +00:00
|
|
|
#ifndef __EMX__
|
1999-11-22 05:27:57 +00:00
|
|
|
#include <pmstddlg.h>
|
2000-01-14 23:04:16 +00:00
|
|
|
#endif
|
1999-11-22 05:27:57 +00:00
|
|
|
|
2003-01-24 22:31:41 +00:00
|
|
|
class CIDropTarget;
|
|
|
|
|
1999-07-29 05:11:30 +00:00
|
|
|
//-------------------------------------------------------------------------
|
1999-10-22 04:37:39 +00:00
|
|
|
// wxDropSource
|
1999-08-02 04:44:01 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
1999-10-22 04:37:39 +00:00
|
|
|
class WXDLLEXPORT wxDropSource: public wxDropSourceBase
|
1999-08-02 04:44:01 +00:00
|
|
|
{
|
|
|
|
public:
|
1999-10-22 04:37:39 +00:00
|
|
|
/* constructor. set data later with SetData() */
|
1999-10-22 04:40:12 +00:00
|
|
|
wxDropSource(wxWindow* pWin);
|
1999-10-22 04:37:39 +00:00
|
|
|
|
|
|
|
/* constructor for setting one data object */
|
|
|
|
wxDropSource( wxDataObject& rData,
|
1999-10-24 15:57:35 +00:00
|
|
|
wxWindow* pWin
|
1999-10-22 04:37:39 +00:00
|
|
|
);
|
|
|
|
virtual ~wxDropSource();
|
|
|
|
|
|
|
|
/* start drag action */
|
2002-04-28 14:30:54 +00:00
|
|
|
virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
|
2003-01-24 22:31:41 +00:00
|
|
|
virtual bool GiveFeedback(wxDragResult eEffect);
|
1999-10-22 04:37:39 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void Init(void);
|
|
|
|
|
2003-01-24 22:31:41 +00:00
|
|
|
ULONG m_ulItems;
|
|
|
|
PDRAGINFO m_pDragInfo;
|
|
|
|
DRAGIMAGE m_vDragImage;
|
|
|
|
PDRAGITEM m_pDragItem;
|
|
|
|
wxWindow* m_pWindow;
|
|
|
|
}; // end of CLASS wxDropSource
|
1999-08-02 04:44:01 +00:00
|
|
|
|
1999-07-29 05:11:30 +00:00
|
|
|
//-------------------------------------------------------------------------
|
1999-10-22 04:37:39 +00:00
|
|
|
// wxDropTarget
|
1999-07-29 05:11:30 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2003-01-24 22:31:41 +00:00
|
|
|
class WXDLLEXPORT wxDropTarget : public wxDropTargetBase
|
1999-07-29 05:11:30 +00:00
|
|
|
{
|
|
|
|
public:
|
2003-01-24 22:31:41 +00:00
|
|
|
wxDropTarget(wxDataObject* pDataObject = (wxDataObject*)NULL);
|
1999-10-22 04:37:39 +00:00
|
|
|
virtual ~wxDropTarget();
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2003-01-24 22:31:41 +00:00
|
|
|
//
|
|
|
|
// 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;
|
1999-07-29 05:11:30 +00:00
|
|
|
|
1999-10-22 04:37:39 +00:00
|
|
|
protected:
|
2003-01-24 22:31:41 +00:00
|
|
|
virtual bool GetData(void);
|
|
|
|
wxDataFormat GetSupportedFormat(PDRAGINFO pDataSource) const;
|
|
|
|
void Release(void);
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2003-01-24 22:31:41 +00:00
|
|
|
private:
|
|
|
|
CIDropTarget* m_pDropTarget;
|
|
|
|
}; // end of CLASS wxDropTarget
|
1999-07-29 05:11:30 +00:00
|
|
|
|
1999-10-22 04:37:39 +00:00
|
|
|
#endif //__OS2DNDH__
|
1999-07-29 05:11:30 +00:00
|
|
|
|