mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
72 lines
2.3 KiB
C#
72 lines
2.3 KiB
C#
using System.Windows.Input;
|
|
|
|
namespace Flow.Launcher.Plugin
|
|
{
|
|
/// <summary>
|
|
/// Context provided as a parameter when invoking a
|
|
/// <see cref="Result.Action"/> or <see cref="Result.AsyncAction"/>
|
|
/// </summary>
|
|
public class ActionContext
|
|
{
|
|
/// <summary>
|
|
/// Contains the press state of certain special keys.
|
|
/// </summary>
|
|
public SpecialKeyState SpecialKeyState { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Contains the press state of certain special keys.
|
|
/// </summary>
|
|
public class SpecialKeyState
|
|
{
|
|
/// <summary>
|
|
/// True if the Ctrl key is pressed.
|
|
/// </summary>
|
|
public bool CtrlPressed { get; set; }
|
|
|
|
/// <summary>
|
|
/// True if the Shift key is pressed.
|
|
/// </summary>
|
|
public bool ShiftPressed { get; set; }
|
|
|
|
/// <summary>
|
|
/// True if the Alt key is pressed.
|
|
/// </summary>
|
|
public bool AltPressed { get; set; }
|
|
|
|
/// <summary>
|
|
/// True if the Windows key is pressed.
|
|
/// </summary>
|
|
public bool WinPressed { get; set; }
|
|
public bool LeftShiftPressed { get; set; }
|
|
public bool RightShiftPressed { get; set; }
|
|
public bool LeftCtrlPressed { get; set; }
|
|
public bool RightCtrlPressed { get; set; }
|
|
public bool LeftAltPressed { get; set; }
|
|
public bool RightAltPressed { get; set; }
|
|
public bool LWinPressed { get; set; }
|
|
public bool RWinPressed { get; set; }
|
|
|
|
/// <summary>
|
|
/// Get this object represented as a <see cref="ModifierKeys"/> flag combination.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public ModifierKeys ToModifierKeys()
|
|
{
|
|
return (CtrlPressed ? ModifierKeys.Control : ModifierKeys.None) |
|
|
(ShiftPressed ? ModifierKeys.Shift : ModifierKeys.None) |
|
|
(AltPressed ? ModifierKeys.Alt : ModifierKeys.None) |
|
|
(WinPressed ? ModifierKeys.Windows : ModifierKeys.None);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Default <see cref="SpecialKeyState"/> object with all keys not pressed.
|
|
/// </summary>
|
|
public static readonly SpecialKeyState Default = new () {
|
|
CtrlPressed = false,
|
|
ShiftPressed = false,
|
|
AltPressed = false,
|
|
WinPressed = false
|
|
};
|
|
}
|
|
}
|