csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
// -----------------------------------------------------------------------
|
|
// <copyright file="WindowsMouseDevice.cs" company="Steven Kirk">
|
|
// Copyright 2014 MIT Licence. See licence.md for more information.
|
|
// </copyright>
|
|
// -----------------------------------------------------------------------
|
|
|
|
namespace Perspex.Win32.Input
|
|
{
|
|
using System;
|
|
using Perspex.Input;
|
|
using Perspex.Interactivity;
|
|
using Perspex.Win32.Interop;
|
|
|
|
public class WindowsMouseDevice : MouseDevice
|
|
{
|
|
private static WindowsMouseDevice instance = new WindowsMouseDevice();
|
|
|
|
public static new WindowsMouseDevice Instance
|
|
{
|
|
get { return instance; }
|
|
}
|
|
|
|
public WindowImpl CurrentWindow
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public override void Capture(IInputElement control)
|
|
{
|
|
base.Capture(control);
|
|
|
|
if (control != null)
|
|
{
|
|
UnmanagedMethods.SetCapture(this.CurrentWindow.Handle.Handle);
|
|
}
|
|
else
|
|
{
|
|
UnmanagedMethods.ReleaseCapture();
|
|
}
|
|
}
|
|
}
|
|
}
|