/*
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
 */
#ifndef GLASSDND_H
#define GLASSDND_H

#include <shlobj.h>

class ViewContainer;

//Ctrl + Shift -> ACTION_LINK
//Ctrl         -> ACTION_COPY
//Shift        -> ACTION_MOVE

_COM_SMARTPTR_TYPEDEF(IDropTargetHelper, IID_IDropTargetHelper);

class GlassDropTarget : public IUnknownImpl<IDropTarget>
{
public:
    GlassDropTarget(ViewContainer *viewContainer, HWND hwnd);
    virtual ~GlassDropTarget();

protected:
    STDMETHOD(DragEnter)(
        /* [unique][in] */ IDataObject *pDataObj,
        /* [in] */ DWORD grfKeyState,
        /* [in] */ POINTL pt,
        /* [out][in] */ DWORD *pdwEffect);

    STDMETHOD(DragOver)(
        /* [in] */ DWORD grfKeyState,
        /* [in] */ POINTL pt,
        /* [out][in] */ DWORD *pdwEffect);

    STDMETHOD(DragLeave)();

    STDMETHOD(Drop)(
        /* [unique][in] */ IDataObject *pDataObj,
        /* [in] */ DWORD grfKeyState,
        /* [in] */ POINTL pt,
        /* [out][in] */ DWORD *pdwEffect);

    HRESULT  UpdateDnDClipboardData(
        IDataObject *pDataObj);

    HRESULT  CallbackToJava(
        /* [in] */ jmethodID method,
        /* [in] */ DWORD grfKeyState,
        /* [in] */ POINTL pt,
        /* [out][in] */ DWORD *pdwEffect);

    ViewContainer *m_viewContainer;
    IDropTargetHelperPtr m_spDropTargetHelper;

private:
    static HRESULT SetSourceSupportedActions(jint actions);
    HWND m_hwnd;
};

class GlassDropSource : public IUnknownImpl<IDropSource>
{
public:
    GlassDropSource(jobject jDnDClipboard);
    virtual ~GlassDropSource();
    static HRESULT SetDragButton(jint button);

protected:
    STDMETHOD(QueryContinueDrag)(
        /* [in] */ BOOL fEscapePressed,
        /* [in] */ DWORD grfKeyState);

    STDMETHOD(GiveFeedback)(
        /* [in] */ DWORD dwEffect);

    DWORD m_button;
};

#endif //GLASSDND_H

