mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-27 03:14:18 +08:00
592c55c524
* Fixed foreground issue and added arrow * Tweaked Remap Keyboard UI * Fix errors in warning handling and update UI layout * Tweaked sizes and centered to screen * Fixed flyouts appearing on search for Single key remaps * Fixed flyouts appearing on search for Shortcut remaps * Remove warning exclamation icon and tooltip * Fixed a bug where setting None on a drop down which would create a shortcut with a conflict would cause a crash * Remove IsTypeKey logic * Changed warning text * Resolve comments
72 lines
2.3 KiB
C++
72 lines
2.3 KiB
C++
#pragma once
|
|
#include <vector>
|
|
#include <winrt/Windows.System.h>
|
|
#include <winrt/Windows.Foundation.h>
|
|
|
|
namespace KeyboardManagerHelper
|
|
{
|
|
// Type to distinguish between keys
|
|
enum class KeyType
|
|
{
|
|
Win,
|
|
Ctrl,
|
|
Alt,
|
|
Shift,
|
|
Action
|
|
};
|
|
|
|
// Type to store codes for different errors
|
|
enum class ErrorType
|
|
{
|
|
NoError,
|
|
SameKeyPreviouslyMapped,
|
|
MapToSameKey,
|
|
ConflictingModifierKey,
|
|
SameShortcutPreviouslyMapped,
|
|
MapToSameShortcut,
|
|
ConflictingModifierShortcut,
|
|
WinL,
|
|
CtrlAltDel,
|
|
RemapUnsuccessful,
|
|
SaveFailed,
|
|
MissingKey,
|
|
ShortcutStartWithModifier,
|
|
ShortcutCannotHaveRepeatedModifier,
|
|
ShortcutAtleast2Keys,
|
|
ShortcutOneActionKey,
|
|
ShortcutNotMoreThanOneActionKey,
|
|
ShortcutMaxShortcutSizeOneActionKey
|
|
};
|
|
|
|
// Enum type to store possible decision for input in the low level hook
|
|
enum class KeyboardHookDecision
|
|
{
|
|
ContinueExec,
|
|
Suppress,
|
|
SkipHook
|
|
};
|
|
|
|
// Function to split a wstring based on a delimiter and return a vector of split strings
|
|
std::vector<std::wstring> splitwstring(const std::wstring& input, wchar_t delimiter);
|
|
|
|
// Function to return the next sibling element for an element under a stack panel
|
|
winrt::Windows::Foundation::IInspectable getSiblingElement(winrt::Windows::Foundation::IInspectable const& element);
|
|
|
|
// Function to return if the key is an extended key which requires the use of the extended key flag
|
|
bool IsExtendedKey(DWORD key);
|
|
|
|
// Function to check if the key is a modifier key
|
|
bool IsModifierKey(DWORD key);
|
|
|
|
// Function to get the type of the key
|
|
KeyType GetKeyType(DWORD key);
|
|
|
|
// Function to check if two keys are equal or cover the same set of keys. Return value depends on type of overlap
|
|
ErrorType DoKeysOverlap(DWORD first, DWORD second);
|
|
|
|
// Function to return the error message
|
|
winrt::hstring GetErrorMessage(ErrorType errorType);
|
|
|
|
// Function to return the list of key name in the order for the drop down based on the key codes
|
|
winrt::Windows::Foundation::Collections::IVector<winrt::Windows::Foundation::IInspectable> ToBoxValue(const std::vector<std::wstring>& list);
|
|
} |