-
Notifications
You must be signed in to change notification settings - Fork 517
Expand file tree
/
Copy pathScenarioDragDropOverride.h
More file actions
61 lines (53 loc) · 1.78 KB
/
ScenarioDragDropOverride.h
File metadata and controls
61 lines (53 loc) · 1.78 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
51
52
53
54
55
56
57
58
59
60
61
// 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.
#pragma once
#include "stdafx.h"
#include "AppWindow.h"
#include "ComponentBase.h"
class ScenarioDragDropOverride : public ComponentBase
{
public:
ScenarioDragDropOverride(AppWindow* appWindow);
~ScenarioDragDropOverride() override;
private:
// Barebones IDropSource implementation to serve the example drag drop override.
class ScenarioDragDropOverrideDropSource
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, IDropSource>
{
public:
// IDropSource implementation:
STDMETHODIMP QueryContinueDrag(BOOL escapePressed, DWORD keyState) override
{
if (escapePressed)
{
return DRAGDROP_S_CANCEL;
}
if (!(keyState & (MK_LBUTTON | MK_RBUTTON)))
{
return DRAGDROP_S_DROP;
}
return S_OK;
}
STDMETHODIMP GiveFeedback(DWORD dwEffect) override
{
return DRAGDROP_S_USEDEFAULTCURSORS;
}
};
enum class DragOverrideMode
{
DEFAULT = 0,
OVERRIDE = 1,
NOOP = 2,
};
EventRegistrationToken m_dragStartingToken = {};
EventRegistrationToken m_webMessageReceivedToken = {};
EventRegistrationToken m_contentLoadingToken = {};
AppWindow* m_appWindow = nullptr;
std::wstring m_sampleUri;
wil::com_ptr<ICoreWebView2> m_webView = nullptr;
wil::com_ptr<ICoreWebView2CompositionController5> m_compController5;
wil::com_ptr<IDropSource> m_dropSource;
DragOverrideMode m_dragOverrideMode = DragOverrideMode::DEFAULT;
};