VBoxDnDDropTarget.cpp revision 440c59bb6f5f678ce4e2569847262f6350c80fab
/* $Id$ */
/** @file
* VBoxDnDTarget.cpp - IDropTarget implementation.
*/
/*
* Copyright (C) 2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include <windows.h>
#include <new> /* For bad_alloc. */
#include "VBoxTray.h"
#include "VBoxHelpers.h"
#include "VBoxDnD.h"
#include "VBox/HostServices/DragAndDropSvc.h"
: mRefCount(1),
mdwCurEffect(0),
mfHasDropData(false)
{
LogFlowFunc(("clientID=%RU32, rc=%Rrc\n",
}
VBoxDnDDropTarget::~VBoxDnDDropTarget(void)
{
}
/*
* IUnknown methods.
*/
{
return InterlockedIncrement(&mRefCount);
}
{
if (lCount == 0)
{
delete this;
return 0;
}
return lCount;
}
{
if ( iid == IID_IDropSource
|| iid == IID_IUnknown)
{
AddRef();
*ppvObject = this;
return S_OK;
}
*ppvObject = 0;
return E_NOINTERFACE;
}
/*
* IDropTarget methods.
*/
{
LogFlowFunc(("mfHasDropData=%RTbool, pDataObject=0x%p, grfKeyState=0x%x, x=%ld, y=%ld, dwEffect=%RU32\n",
/* We only handle CF_HDROP in an HGLOBAL medium at the moment. */
if (mfHasDropData)
{
/* Which drop effect we're going to use? */
/* Note: pt is not used since we don't need to differentiate within our
* proxy window. */
}
else
{
/* No or incompatible data -- so no drop effect required. */
}
LogFlowFunc(("Returning mfHasDropData=%RTbool, pdwEffect=%ld, hr=%Rhrc\n",
return hr;
}
{
#ifdef DEBUG_andy
LogFlowFunc(("mfHasDropData=%RTbool, grfKeyState=0x%x, x=%ld, y=%ld\n",
#endif
if (mfHasDropData)
{
/* Note: pt is not used since we don't need to differentiate within our
* proxy window. */
}
else
{
}
#ifdef DEBUG_andy
#endif
return S_OK;
}
{
#ifdef DEBUG_andy
#endif
mpWndParent->hide();
return S_OK;
}
{
#ifdef DEBUG
LogFlowFunc(("mfHasDropData=%RTbool, pDataObject=0x%p, grfKeyState=0x%x, x=%ld, y=%ld\n",
#endif
bool fCanDrop = false;
if (mfHasDropData)
{
{
#ifdef DEBUG
#endif
/* Release storage medium again. */
fCanDrop = true;
}
}
if (fCanDrop)
{
/* Note: pt is not used since we don't need to differentiate within our
* proxy window. */
}
else
LogFlowFunc(("Returning with mfHasDropData=%RTbool, fCanDrop=%RTbool, *pdwEffect=%RI32\n",
return S_OK;
}
/* static */
{
if(grfKeyState & MK_CONTROL)
else if(grfKeyState & MK_SHIFT)
/* If there still was no drop effect assigned, check for the handed-in
* allowed effects and assign one of them.
*
* Note: A move action has precendence over a copy action! */
if (dwEffect == DROPEFFECT_NONE)
{
if (dwAllowedEffects & DROPEFFECT_COPY)
if (dwAllowedEffects & DROPEFFECT_MOVE)
}
#ifdef DEBUG_andy
LogFlowFunc(("grfKeyState=0x%x, dwAllowedEffects=0x%x, dwEffect=0x%x\n",
#endif
return dwEffect;
}