VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.h@ 49947

Last change on this file since 49947 was 49947, checked in by vboxsync, 11 years ago

Additions/WINNT: fix OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1/* $Id: VBoxDnD.h 49947 2013-12-17 08:40:37Z vboxsync $ */
2/** @file
3 * VBoxDnD.h - Windows-specific bits of the drag'n drop service.
4 */
5
6/*
7 * Copyright (C) 2013 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef __VBOXTRAYDND__H
19#define __VBOXTRAYDND__H
20
21#include <iprt/cpp/mtlist.h>
22#include <iprt/cpp/ministring.h>
23
24int VBoxDnDInit (const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread);
25unsigned __stdcall VBoxDnDThread (void *pInstance);
26void VBoxDnDStop (const VBOXSERVICEENV *pEnv, void *pInstance);
27void VBoxDnDDestroy (const VBOXSERVICEENV *pEnv, void *pInstance);
28
29class VBoxDnDWnd;
30
31class VBoxDnDDataObject : public IDataObject
32{
33public:
34
35 enum Status
36 {
37 Uninitialized = 0,
38 Initialized,
39 Dropping,
40 Dropped,
41 Aborted
42 };
43
44public:
45
46 VBoxDnDDataObject(FORMATETC *pFormatEtc = NULL, STGMEDIUM *pStgMed = NULL, ULONG cFormats = 0);
47 virtual ~VBoxDnDDataObject(void);
48
49public:
50
51 static int CreateDataObject(FORMATETC *pFormatEtc, STGMEDIUM *pStgMeds,
52 ULONG cFormats, IDataObject **ppDataObject);
53public: /* IUnknown methods. */
54
55 STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject);
56 STDMETHOD_(ULONG, AddRef)(void);
57 STDMETHOD_(ULONG, Release)(void);
58
59public: /* IDataObject methods. */
60
61 STDMETHOD(GetData)(FORMATETC *pFormatEtc, STGMEDIUM *pMedium);
62 STDMETHOD(GetDataHere)(FORMATETC *pFormatEtc, STGMEDIUM *pMedium);
63 STDMETHOD(QueryGetData)(FORMATETC *pFormatEtc);
64 STDMETHOD(GetCanonicalFormatEtc)(FORMATETC *pFormatEct, FORMATETC *pFormatEtcOut);
65 STDMETHOD(SetData)(FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease);
66 STDMETHOD(EnumFormatEtc)(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc);
67 STDMETHOD(DAdvise)(FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection);
68 STDMETHOD(DUnadvise)(DWORD dwConnection);
69 STDMETHOD(EnumDAdvise)(IEnumSTATDATA **ppEnumAdvise);
70
71public:
72
73 static const char* ClipboardFormatToString(CLIPFORMAT fmt);
74
75 int Abort(void);
76 void SetStatus(Status status);
77 int Signal(const RTCString &strFormat, const void *pvData, uint32_t cbData);
78
79protected:
80
81 bool LookupFormatEtc(FORMATETC *pFormatEtc, ULONG *puIndex);
82 static HGLOBAL MemDup(HGLOBAL hMemSource);
83 void RegisterFormat(FORMATETC *pFormatEtc, CLIPFORMAT clipFormat, TYMED tyMed = TYMED_HGLOBAL,
84 LONG lindex = -1, DWORD dwAspect = DVASPECT_CONTENT, DVTARGETDEVICE *pTargetDevice = NULL);
85
86 Status mStatus;
87 LONG mRefCount;
88 ULONG mcFormats;
89 FORMATETC *mpFormatEtc;
90 STGMEDIUM *mpStgMedium;
91 RTSEMEVENT mSemEvent;
92 RTCString mstrFormat;
93 void *mpvData;
94 uint32_t mcbData;
95};
96
97class VBoxDnDDropSource : public IDropSource
98{
99public:
100
101 VBoxDnDDropSource(VBoxDnDWnd *pThis);
102 virtual ~VBoxDnDDropSource(void);
103
104public:
105
106 static int CreateDropSource(VBoxDnDWnd *pParent, IDropSource **ppDropSource);
107
108public:
109
110 uint32_t GetCurrentAction(void) { return muCurAction; }
111
112public: /* IUnknown methods. */
113
114 STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject);
115 STDMETHOD_(ULONG, AddRef)(void);
116 STDMETHOD_(ULONG, Release)(void);
117
118public: /* IDropSource methods. */
119
120 STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD dwKeyState);
121 STDMETHOD(GiveFeedback)(DWORD dwEffect);
122
123protected:
124
125 LONG mRefCount;
126 VBoxDnDWnd *mpWndParent;
127 uint32_t mClientID;
128 DWORD mdwCurEffect;
129 uint32_t muCurAction;
130};
131
132class VBoxDnDEnumFormatEtc : public IEnumFORMATETC
133{
134public:
135
136 VBoxDnDEnumFormatEtc(FORMATETC *pFormatEtc, ULONG cFormats);
137 virtual ~VBoxDnDEnumFormatEtc(void);
138
139public:
140
141 STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject);
142 STDMETHOD_(ULONG, AddRef)(void);
143 STDMETHOD_(ULONG, Release)(void);
144
145 STDMETHOD(Next)(ULONG cFormats, FORMATETC *pFormatEtc, ULONG *pcFetched);
146 STDMETHOD(Skip)(ULONG cFormats);
147 STDMETHOD(Reset)(void);
148 STDMETHOD(Clone)(IEnumFORMATETC ** ppEnumFormatEtc);
149
150public:
151
152 static void CopyFormat(FORMATETC *pFormatDest, FORMATETC *pFormatSource);
153 static HRESULT CreateEnumFormatEtc(UINT cFormats, FORMATETC *pFormatEtc, IEnumFORMATETC **ppEnumFormatEtc);
154
155private:
156
157 LONG m_lRefCount;
158 ULONG m_nIndex;
159 ULONG m_nNumFormats;
160 FORMATETC * m_pFormatEtc;
161};
162#endif /* __VBOXTRAYDND__H */
163
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette