Skip to content

Commit d7bfa12

Browse files
committed
Adding interop interface, removing C#/midl 3 declaration. Adding note why .NET and WinRT will not be done
1 parent ec4af35 commit d7bfa12

File tree

1 file changed

+49
-36
lines changed

1 file changed

+49
-36
lines changed

specs/DragStarting.md

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ drop behavior when running in visual hosting mode. This event allows you to know
77
when a drag is initiated in WebView2 and provides the state necessary to override
88
the default WebView2 drag operation with your own logic.
99

10+
## Note about .NET/WinRT projection
11+
The work to project this API to .NET and WinRT are yet to be completed. Overall
12+
usage of this API is expected to be uncommon. There are no known public asks for
13+
this. Further, this API is exposed on the CompositionController which is very
14+
rarely used in .NET apps.
15+
1016
# Examples
1117
## DragStarting
1218
Users can use `add_DragStarting` on the CompositionController to add an event
@@ -124,6 +130,49 @@ interface ICoreWebView2DragStartingEventArgs : IUnknown {
124130
125131
126132
133+
/// Returns an `ICoreWebView2Deferral` object. Use this operation to complete
134+
/// the CoreWebView2DragStartingEventArgs.
135+
///
136+
/// Until the deferral is completed, subsequent attempts to initiate drag
137+
/// in the WebView2 will fail and if the cursor was changed as part of
138+
/// drag it will not restore.
139+
HRESULT GetDeferral(
140+
[out, retval] ICoreWebView2Deferral** value);
141+
142+
143+
}
144+
145+
/// Interop interface for the CoreWebView2DragStartingEventArgs WinRT object to
146+
/// allow WinRT end developers to be able to access the COM interface arguments.
147+
/// This interface is implemented by the
148+
/// Microsoft.Web.WebView2.Core.CoreWebView2DragStartingEventArgs runtime class.
149+
[uuid(7a4daef9-1701-463f-992d-2136460cf76e), object, pointer_default(unique)]
150+
interface ICoreWebView2StagingDragStartingEventArgsInterop : IUnknown {
151+
/// The operations this drag data supports.
152+
[propget] HRESULT AllowedOperations(
153+
[out, retval] COREWEBVIEW2_DRAG_EFFECTS* value);
154+
155+
156+
/// The data being dragged.
157+
[propget] HRESULT Data([out, retval] IDataObject** value);
158+
159+
/// The position at which drag was detected. This position is given in
160+
/// screen pixel coordinates as opposed to WebView2 relative coordinates.
161+
[propget] HRESULT Position([out, retval] POINT* value);
162+
163+
164+
/// Gets the `Handled` property.
165+
[propget] HRESULT Handled([out, retval] BOOL* value);
166+
167+
168+
/// Indicates whether this event has been handled by the app. If the
169+
/// app handles this event, WebView2 will not initiate drag drop. If
170+
/// the app does not handle the event, WebView2 will initiate its own
171+
/// drag drop logic.
172+
[propput] HRESULT Handled([in] BOOL value);
173+
174+
175+
127176
/// Returns an `ICoreWebView2Deferral` object. Use this operation to complete
128177
/// the CoreWebView2DragStartingEventArgs.
129178
///
@@ -166,39 +215,3 @@ interface ICoreWebView2CompositionController5 : IUnknown {
166215
167216
}
168217
```
169-
```c# (but really MIDL3)
170-
namespace Microoft.Web.WebView2 {
171-
runtimeclass CoreWebView2DragStartingEventArgs
172-
{
173-
174-
Windows.ApplicationModel.DataTransfer.DataPackageOperation
175-
AllowedOperations { get; };
176-
177-
Windows.ApplicationModel.DataTransfer.DataPackage Data { get; };
178-
179-
Windows.Foundation.Point Position { get; };
180-
181-
Boolean Handled { get; set; };
182-
183-
184-
Windows.Foundation.Deferral GetDeferral();
185-
186-
187-
188-
}
189-
190-
runtimeclass CoreWebView2CompositionController : CoreWebView2Controller
191-
{
192-
// ...
193-
[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2CompositionController5")]
194-
{
195-
event Windows.Foundation.TypedEventHandler<
196-
CoreWebView2CompositionController,
197-
CoreWebView2DragStartingEventArgs> DragStarting;
198-
199-
200-
}
201-
// ...
202-
}
203-
}
204-
```

0 commit comments

Comments
 (0)