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