1999-01-01 16:05:26 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dnd.h
|
|
|
|
// Purpose: Declaration of the wxDropTarget, wxDropSource class etc.
|
|
|
|
// Author: AUTHOR
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1998 AUTHOR
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_DND_H_
|
|
|
|
#define _WX_DND_H_
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "dnd.h"
|
|
|
|
#endif
|
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
#if wxUSE_DRAG_AND_DROP
|
|
|
|
|
1999-01-01 16:05:26 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
2001-12-31 16:31:23 +00:00
|
|
|
#include "wx/string.h"
|
|
|
|
#include "wx/dataobj.h"
|
1999-01-01 16:05:26 +00:00
|
|
|
#include "wx/cursor.h"
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxWindow;
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxDropTarget;
|
|
|
|
class WXDLLEXPORT wxTextDropTarget;
|
|
|
|
class WXDLLEXPORT wxFileDropTarget;
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxDropSource;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2001-12-31 16:31:23 +00:00
|
|
|
// macros
|
1999-01-01 16:05:26 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
// this macro may be used instead for wxDropSource ctor arguments: it will use
|
|
|
|
// the icon 'name' from an XPM file under GTK, but will expand to something
|
|
|
|
// else under MSW. If you don't use it, you will have to use #ifdef in the
|
|
|
|
// application code.
|
|
|
|
#define wxDROP_ICON(name) wxICON(name)
|
2001-02-15 21:51:14 +00:00
|
|
|
|
1999-01-01 16:05:26 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// wxDropTarget
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
class WXDLLEXPORT wxDropTarget: public wxDropTargetBase
|
1999-01-01 16:05:26 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
|
1999-01-01 16:05:26 +00:00
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
|
|
|
|
virtual bool OnDrop(wxCoord x, wxCoord y);
|
|
|
|
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
|
|
|
|
virtual bool GetData();
|
1999-01-01 16:05:26 +00:00
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
bool CurrentDragHasSupportedFormat() ;
|
2002-01-04 17:13:39 +00:00
|
|
|
void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; }
|
|
|
|
void* GetCurrentDrag() { return m_currentDrag ; }
|
2001-12-31 16:31:23 +00:00
|
|
|
protected :
|
2002-01-04 17:13:39 +00:00
|
|
|
void* m_currentDrag ;
|
1999-01-01 16:05:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
2001-12-31 16:31:23 +00:00
|
|
|
// wxDropSource
|
1999-01-01 16:05:26 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
class WXDLLEXPORT wxDropSource: public wxDropSourceBase
|
1999-01-01 16:05:26 +00:00
|
|
|
{
|
2001-12-31 16:31:23 +00:00
|
|
|
public:
|
|
|
|
/* constructor. set data later with SetData() */
|
|
|
|
wxDropSource( wxWindow *win = (wxWindow *)NULL,
|
|
|
|
const wxIcon © = wxNullIcon,
|
|
|
|
const wxIcon &move = wxNullIcon,
|
|
|
|
const wxIcon &none = wxNullIcon);
|
1999-01-01 16:05:26 +00:00
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
/* constructor for setting one data object */
|
|
|
|
wxDropSource( wxDataObject& data,
|
|
|
|
wxWindow *win,
|
|
|
|
const wxIcon © = wxNullIcon,
|
|
|
|
const wxIcon &move = wxNullIcon,
|
|
|
|
const wxIcon &none = wxNullIcon);
|
1999-01-01 16:05:26 +00:00
|
|
|
|
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
~wxDropSource();
|
1999-01-01 16:05:26 +00:00
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
/* start drag action */
|
|
|
|
virtual wxDragResult DoDragDrop( bool bAllowMove = FALSE );
|
1999-01-01 16:05:26 +00:00
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
wxWindow* GetWindow() { return m_window ; }
|
2002-01-04 17:13:39 +00:00
|
|
|
void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; }
|
|
|
|
void* GetCurrentDrag() { return m_currentDrag ; }
|
2001-12-31 16:31:23 +00:00
|
|
|
protected :
|
|
|
|
wxWindow *m_window;
|
2002-01-04 17:13:39 +00:00
|
|
|
void* m_currentDrag ;
|
1999-01-01 16:05:26 +00:00
|
|
|
};
|
|
|
|
|
2001-12-31 16:31:23 +00:00
|
|
|
#endif
|
|
|
|
// D&D
|
|
|
|
|
1999-01-01 16:05:26 +00:00
|
|
|
#endif
|
|
|
|
//_WX_DND_H_
|
|
|
|
|