2020-03-24 01:44:02 +08:00
|
|
|
#pragma once
|
2020-07-14 02:49:09 +08:00
|
|
|
namespace winrt
|
|
|
|
{
|
|
|
|
struct hstring;
|
|
|
|
namespace Windows::Foundation
|
|
|
|
{
|
|
|
|
struct IInspectable;
|
|
|
|
namespace Collections
|
|
|
|
{
|
|
|
|
template<typename T>
|
|
|
|
struct IVector;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-03-24 01:44:02 +08:00
|
|
|
|
2020-04-20 23:22:36 +08:00
|
|
|
namespace KeyboardManagerHelper
|
2020-04-19 07:12:26 +08:00
|
|
|
{
|
2020-04-20 23:22:36 +08:00
|
|
|
// Type to distinguish between keys
|
|
|
|
enum class KeyType
|
|
|
|
{
|
|
|
|
Win,
|
|
|
|
Ctrl,
|
|
|
|
Alt,
|
|
|
|
Shift,
|
|
|
|
Action
|
|
|
|
};
|
2020-04-22 05:14:50 +08:00
|
|
|
|
2020-04-27 06:09:40 +08:00
|
|
|
// 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,
|
2020-05-12 01:10:36 +08:00
|
|
|
ShortcutNotMoreThanOneActionKey,
|
|
|
|
ShortcutMaxShortcutSizeOneActionKey
|
2020-04-27 06:09:40 +08:00
|
|
|
};
|
|
|
|
|
2020-05-05 06:49:37 +08:00
|
|
|
// Enum type to store possible decision for input in the low level hook
|
|
|
|
enum class KeyboardHookDecision
|
|
|
|
{
|
|
|
|
ContinueExec,
|
|
|
|
Suppress,
|
|
|
|
SkipHook
|
|
|
|
};
|
|
|
|
|
2020-04-20 23:22:36 +08:00
|
|
|
// 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);
|
2020-04-22 05:14:50 +08:00
|
|
|
|
2020-04-20 23:22:36 +08:00
|
|
|
// 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
|
2020-04-27 06:09:40 +08:00
|
|
|
bool IsExtendedKey(DWORD key);
|
2020-04-17 06:17:57 +08:00
|
|
|
|
2020-04-20 23:22:36 +08:00
|
|
|
// Function to check if the key is a modifier key
|
|
|
|
bool IsModifierKey(DWORD key);
|
2020-04-19 07:12:26 +08:00
|
|
|
|
2020-04-20 23:22:36 +08:00
|
|
|
// Function to get the type of the key
|
|
|
|
KeyType GetKeyType(DWORD key);
|
2020-04-19 07:12:26 +08:00
|
|
|
|
2020-04-27 06:09:40 +08:00
|
|
|
// 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);
|
2020-04-21 12:01:21 +08:00
|
|
|
|
|
|
|
// 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);
|
2020-05-29 05:47:32 +08:00
|
|
|
|
|
|
|
// Function to set the value of a key event based on the arguments
|
|
|
|
void SetKeyEvent(LPINPUT keyEventArray, int index, DWORD inputType, WORD keyCode, DWORD flags, ULONG_PTR extraInfo);
|
|
|
|
|
2020-07-07 07:45:53 +08:00
|
|
|
// Function to return window handle for a full screen UWP app
|
|
|
|
HWND GetFullscreenUWPWindowHandle();
|
2020-05-29 05:47:32 +08:00
|
|
|
|
|
|
|
// Function to return the executable name of the application in focus
|
|
|
|
std::wstring GetCurrentApplication(bool keepPath);
|
2020-04-21 12:01:21 +08:00
|
|
|
}
|