// Copyright © 2021 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System.Collections.Generic;
using CefSharp.Enums;
namespace CefSharp.Handler
{
///
/// Inherit from this class to handle events related to dragging.
/// The methods of this class will be called on the UI thread.
///
public class DragHandler : IDragHandler
{
///
/// Called when an external drag event enters the browser window.
///
/// the ChromiumWebBrowser control
/// the browser object
/// contains the drag event data
/// represents the type of drag operation
/// Return false for default drag handling behavior or true to cancel the drag event.
bool IDragHandler.OnDragEnter(IWebBrowser chromiumWebBrowser, IBrowser browser, IDragData dragData, DragOperationsMask mask)
{
return OnDragEnter(chromiumWebBrowser, browser, dragData, mask);
}
///
/// Called when an external drag event enters the browser window.
///
/// the ChromiumWebBrowser control
/// the browser object
/// contains the drag event data
/// represents the type of drag operation
/// Return false for default drag handling behavior or true to cancel the drag event.
protected virtual bool OnDragEnter(IWebBrowser chromiumWebBrowser, IBrowser browser, IDragData dragData, DragOperationsMask mask)
{
return false;
}
///
/// Called whenever draggable regions for the browser window change.
/// These can be specified using the '-webkit-app-region: drag/no-drag' CSS-property.
/// If draggable regions are never defined in a document this method will also never be called.
/// If the last draggable region is removed from a document this method will be called with an empty IList.
///
/// the ChromiumWebBrowser control
/// the browser object
/// The frame
/// List of objects or null if last region was removed.
void IDragHandler.OnDraggableRegionsChanged(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IList regions)
{
OnDraggableRegionsChanged(chromiumWebBrowser, browser, frame, regions);
}
///
/// Called whenever draggable regions for the browser window change.
/// These can be specified using the '-webkit-app-region: drag/no-drag' CSS-property.
/// If draggable regions are never defined in a document this method will also never be called.
/// If the last draggable region is removed from a document this method will be called with an empty IList.
///
/// the ChromiumWebBrowser control
/// the browser object
/// The frame
/// List of objects or null if last region was removed.
protected virtual void OnDraggableRegionsChanged(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IList regions)
{
}
}
}