Files
wxWidgets/src/osx/dnd_osx.cpp

88 lines
2.2 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: src/osx/dnd_osx.cpp
// Purpose: Mac common wxDropTarget, wxDropSource implementations
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id: dnd.cpp 61724 2009-08-21 10:41:26Z VZ $
// Copyright: (c) 1998 Stefan Csomor
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#if wxUSE_DRAG_AND_DROP
#include "wx/dnd.h"
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/toplevel.h"
#include "wx/gdicmn.h"
#endif // WX_PRECOMP
#include "wx/osx/private.h"
//----------------------------------------------------------------------------
// wxDropTarget
//----------------------------------------------------------------------------
wxDragResult wxDropTarget::OnDragOver(
wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
wxDragResult def )
{
return CurrentDragHasSupportedFormat() ? def : wxDragNone;
}
wxDataFormat wxDropTarget::GetMatchingPair()
{
wxFAIL_MSG("wxDropTarget::GetMatchingPair() not implemented in src/osx/carbon/dnd.cpp");
return wxDF_INVALID;
}
bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
{
if (m_dataObject == NULL)
return false;
return CurrentDragHasSupportedFormat();
}
wxDragResult wxDropTarget::OnData(
wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
wxDragResult def )
{
if (m_dataObject == NULL)
return wxDragNone;
if (!CurrentDragHasSupportedFormat())
return wxDragNone;
return GetData() ? def : wxDragNone;
}
//-------------------------------------------------------------------------
// wxDropSource
//-------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// drag request
wxDropSource::~wxDropSource()
{
}
bool wxDropSource::MacInstallDefaultCursor(wxDragResult effect)
{
const wxCursor& cursor = GetCursor(effect);
bool result = cursor.Ok();
if ( result )
cursor.MacInstall();
return result;
}
#endif // wxUSE_DRAG_AND_DROP