VBoxDnDDropSource.cpp revision a29027bb2378172c7c88610ad5311548b66f96f6
/* $Id$ */
/** @file
* VBoxDnDSource.cpp - IDropSource implementation.
*/
/*
* Copyright (C) 2013-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. */
#ifdef LOG_GROUP
#endif
#define LOG_GROUP LOG_GROUP_GUEST_DND
#include "VBoxTray.h"
#include "VBoxHelpers.h"
#include "VBoxDnD.h"
#include "VBox/HostServices/DragAndDropSvc.h"
: mRefCount(1),
mdwCurEffect(0),
{
}
VBoxDnDDropSource::~VBoxDnDDropSource(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;
}
/*
* IDropSource methods.
*/
/**
* The system informs us about whether we should continue the drag'n drop
* operation or not, depending on the sent key states.
*
* @return HRESULT
*/
{
#ifndef DEBUG_andy
LogFlowFunc(("fEscapePressed=%RTbool, dwKeyState=0x%x, mdwCurEffect=%RI32, muCurAction=%RU32\n",
#endif
/* ESC pressed? Bail out. */
if (fEscapePressed)
{
mdwCurEffect = 0;
return DRAGDROP_S_CANCEL;
}
/* Left mouse button released? Start "drop" action. */
if ((dwKeyState & MK_LBUTTON) == 0)
return DRAGDROP_S_DROP;
/* No change, just continue. */
return S_OK;
}
/**
* The drop target gives our source feedback about whether
* it can handle our data or not.
*
* @return HRESULT
*/
{
#ifndef DEBUG_andy
#endif
if (dwEffect)
{
if (dwEffect & DROPEFFECT_COPY)
if (dwEffect & DROPEFFECT_MOVE)
if (dwEffect & DROPEFFECT_LINK)
}
return DRAGDROP_S_USEDEFAULTCURSORS;
}