te
This commit is contained in:
parent
01151e679b
commit
57b2f0400e
265 changed files with 22828 additions and 6 deletions
82
Unused/Decal.Adapter.Wrappers/HotkeyWrapper.cs
Normal file
82
Unused/Decal.Adapter.Wrappers/HotkeyWrapper.cs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using Decal.Interop.DHS;
|
||||
|
||||
namespace Decal.Adapter.Wrappers;
|
||||
|
||||
[CLSCompliant(true)]
|
||||
public class HotkeyWrapper : MarshalByRefObject, IDisposable
|
||||
{
|
||||
private Hotkey myHotkey;
|
||||
|
||||
private bool isDisposed;
|
||||
|
||||
[CLSCompliant(false)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public Hotkey Underlying => myHotkey;
|
||||
|
||||
public bool AltState => myHotkey.AltState;
|
||||
|
||||
public bool ControlState => myHotkey.ControlState;
|
||||
|
||||
public bool ShiftState => myHotkey.ShiftState;
|
||||
|
||||
public int VirtualKey => myHotkey.VirtualKey;
|
||||
|
||||
public string Title => myHotkey.EventTitle;
|
||||
|
||||
public string Description => myHotkey.EventDescription;
|
||||
|
||||
internal HotkeyWrapper(Hotkey hotkey)
|
||||
{
|
||||
myHotkey = hotkey;
|
||||
}
|
||||
|
||||
public HotkeyWrapper(string title, string description)
|
||||
: this(new HotkeyClass())
|
||||
{
|
||||
myHotkey.EventTitle = title;
|
||||
myHotkey.EventDescription = description;
|
||||
}
|
||||
|
||||
public HotkeyWrapper(string title, string description, int virtualKey, bool altState, bool controlState, bool shiftState)
|
||||
: this(title, description)
|
||||
{
|
||||
myHotkey.VirtualKey = virtualKey;
|
||||
myHotkey.AltState = altState;
|
||||
myHotkey.ControlState = controlState;
|
||||
myHotkey.ShiftState = shiftState;
|
||||
}
|
||||
|
||||
~HotkeyWrapper()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!isDisposed)
|
||||
{
|
||||
}
|
||||
if (myHotkey != null)
|
||||
{
|
||||
Marshal.ReleaseComObject(myHotkey);
|
||||
}
|
||||
isDisposed = true;
|
||||
}
|
||||
|
||||
protected void EnforceDisposedOnce()
|
||||
{
|
||||
if (isDisposed)
|
||||
{
|
||||
throw new ObjectDisposedException("HotkeyWrapper");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue