mirror of
https://github.com/chylex/TweetDuck.git
synced 2024-11-15 02:42:46 +01:00
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using CefSharp;
|
|
using CefSharp.Enums;
|
|
|
|
namespace TweetDuck.Browser.Handling {
|
|
sealed class DragHandlerBrowser : IDragHandler {
|
|
private readonly RequestHandlerBrowser requestHandler;
|
|
|
|
public DragHandlerBrowser(RequestHandlerBrowser requestHandler) {
|
|
this.requestHandler = requestHandler;
|
|
}
|
|
|
|
public bool OnDragEnter(IWebBrowser browserControl, IBrowser browser, IDragData dragData, DragOperationsMask mask) {
|
|
void TriggerDragStart(string type, string data = null) {
|
|
browserControl.BrowserCore.ExecuteScriptAsync("window.TDGF_onGlobalDragStart", type, data);
|
|
}
|
|
|
|
requestHandler.BlockNextUserNavUrl = dragData.LinkUrl; // empty if not a link
|
|
|
|
if (dragData.IsLink) {
|
|
TriggerDragStart("link", dragData.LinkUrl);
|
|
}
|
|
else if (dragData.IsFragment) {
|
|
TriggerDragStart("text", dragData.FragmentText.Trim());
|
|
}
|
|
else {
|
|
TriggerDragStart("unknown");
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public void OnDraggableRegionsChanged(IWebBrowser browserControl, IBrowser browser, IFrame frame, IList<DraggableRegion> regions) {}
|
|
}
|
|
}
|