MCPcopy Create free account
hub / github.com/MicrosoftEdge/WebView2Samples / DropTarget

Class DropTarget

SampleApps/WebView2APISample/DropTarget.h:10–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8class ViewComponent;
9
10class DropTarget : public Microsoft::WRL::RuntimeClass<
11 Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
12 IDropTarget>
13{
14
15public:
16 DropTarget();
17 virtual ~DropTarget();
18
19 // Initialize the drop target by associating it with the given HWND.
20 void Init(
21 HWND window, ViewComponent* viewComponent,
22 ICoreWebView2CompositionController3* webViewCompositionController3);
23
24 // IDropTarget implementation:
25 HRESULT __stdcall DragEnter(IDataObject* dataObject,
26 DWORD keyState,
27 POINTL cursorPosition,
28 DWORD* effect) override;
29 HRESULT __stdcall DragOver(DWORD keyState,
30 POINTL cursor_position,
31 DWORD* effect) override;
32 HRESULT __stdcall DragLeave() override;
33 HRESULT __stdcall Drop(IDataObject* dataObject,
34 DWORD keyState,
35 POINTL cursorPosition,
36 DWORD* effect) override;
37
38private:
39 ViewComponent* m_viewComponent = nullptr;
40
41 // Returns the hosting HWND.
42 HWND GetHWND() { return m_window; }
43
44 // The HWND of the source. This HWND is used to determine coordinates for
45 // mouse events that are sent to the renderer notifying various drag states.
46 HWND m_window;
47
48 wil::com_ptr<ICoreWebView2CompositionController3> m_webViewCompositionController3;
49};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected