1999-01-01 11:05:26 -05: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_
|
|
|
|
|
2002-08-31 07:29:13 -04:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
1999-01-01 11:05:26 -05:00
|
|
|
#pragma interface "dnd.h"
|
|
|
|
#endif
|
|
|
|
|
2001-12-31 11:31:23 -05:00
|
|
|
#if wxUSE_DRAG_AND_DROP
|
|
|
|
|
1999-01-01 11:05:26 -05:00
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
2001-12-31 11:31:23 -05:00
|
|
|
#include "wx/string.h"
|
|
|
|
#include "wx/dataobj.h"
|
1999-01-01 11:05:26 -05:00
|
|
|
#include "wx/cursor.h"
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxWindow;
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxDropTarget;
|
|
|
|
class WXDLLEXPORT wxTextDropTarget;
|
|
|
|
class WXDLLEXPORT wxFileDropTarget;
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxDropSource;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2001-12-31 11:31:23 -05:00
|
|
|
// macros
|
1999-01-01 11:05:26 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2001-12-31 11:31:23 -05: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 16:51:14 -05:00
|
|
|
|
1999-01-01 11:05:26 -05:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
// wxDropTarget
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2001-12-31 11:31:23 -05:00
|
|
|
class WXDLLEXPORT wxDropTarget: public wxDropTargetBase
|
1999-01-01 11:05:26 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2001-12-31 11:31:23 -05:00
|
|
|
wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
|
1999-01-01 11:05:26 -05:00
|
|
|
|
2001-12-31 11:31:23 -05: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 11:05:26 -05:00
|
|
|
|
2001-12-31 11:31:23 -05:00
|
|
|
bool CurrentDragHasSupportedFormat() ;
|
2002-01-04 12:13:39 -05:00
|
|
|
void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; }
|
|
|
|
void* GetCurrentDrag() { return m_currentDrag ; }
|
2001-12-31 11:31:23 -05:00
|
|
|
protected :
|
2002-01-04 12:13:39 -05:00
|
|
|
void* m_currentDrag ;
|
1999-01-01 11:05:26 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
2001-12-31 11:31:23 -05:00
|
|
|
// wxDropSource
|
1999-01-01 11:05:26 -05:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2001-12-31 11:31:23 -05:00
|
|
|
class WXDLLEXPORT wxDropSource: public wxDropSourceBase
|
1999-01-01 11:05:26 -05:00
|
|
|
{
|
2001-12-31 11:31:23 -05: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 11:05:26 -05:00
|
|
|
|
2001-12-31 11:31:23 -05: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 11:05:26 -05:00
|
|
|
|
|
|
|
|
2001-12-31 11:31:23 -05:00
|
|
|
~wxDropSource();
|
1999-01-01 11:05:26 -05:00
|
|
|
|
2001-12-31 11:31:23 -05:00
|
|
|
/* start drag action */
|
2002-04-28 10:30:54 -04:00
|
|
|
virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
|
1999-01-01 11:05:26 -05:00
|
|
|
|
2001-12-31 11:31:23 -05:00
|
|
|
wxWindow* GetWindow() { return m_window ; }
|
2002-01-04 12:13:39 -05:00
|
|
|
void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; }
|
|
|
|
void* GetCurrentDrag() { return m_currentDrag ; }
|
2001-12-31 11:31:23 -05:00
|
|
|
protected :
|
|
|
|
wxWindow *m_window;
|
2002-01-04 12:13:39 -05:00
|
|
|
void* m_currentDrag ;
|
1999-01-01 11:05:26 -05:00
|
|
|
};
|
|
|
|
|
2001-12-31 11:31:23 -05:00
|
|
|
#endif
|
|
|
|
// D&D
|
|
|
|
|
1999-01-01 11:05:26 -05:00
|
|
|
#endif
|
|
|
|
//_WX_DND_H_
|
|
|
|
|