forked from MicrosoftEdge/WebView2Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDropTarget.h
More file actions
50 lines (40 loc) · 1.54 KB
/
DropTarget.h
File metadata and controls
50 lines (40 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (C) Microsoft Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.s
#pragma once
struct IDropTargetHelper;
class ViewComponent;
class DropTarget : public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
IDropTarget>
{
public:
DropTarget();
virtual ~DropTarget();
// Initialize the drop target by associating it with the given HWND.
void Init(
HWND window, ViewComponent* viewComponent,
ICoreWebView2ExperimentalCompositionController3* webViewExperimentalCompositionController3);
// IDropTarget implementation:
HRESULT __stdcall DragEnter(IDataObject* dataObject,
DWORD keyState,
POINTL cursorPosition,
DWORD* effect) override;
HRESULT __stdcall DragOver(DWORD keyState,
POINTL cursor_position,
DWORD* effect) override;
HRESULT __stdcall DragLeave() override;
HRESULT __stdcall Drop(IDataObject* dataObject,
DWORD keyState,
POINTL cursorPosition,
DWORD* effect) override;
private:
ViewComponent* m_viewComponent = nullptr;
// Returns the hosting HWND.
HWND GetHWND() { return m_window; }
// The HWND of the source. This HWND is used to determine coordinates for
// mouse events that are sent to the renderer notifying various drag states.
HWND m_window;
wil::com_ptr<ICoreWebView2ExperimentalCompositionController3>
m_webViewExperimentalCompositionController3;
};