mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Edit Shortcuts UI (dev/keyboardManager) (#1647)
* Added EditShortcuts Window and added Detecting shortcuts functionality * Fixed build error * Changed detection to take place only when window is in focus * Added solution folder * Added a common project and refactored shared variables to an object with wrapper functions * Added dynamic addition of shortcuts * Moved all shared variables in detection to state variable with wrapper functions * Added code to re-load saved shortcuts in the UI * Added comments * Fixed argument modifiers in Helpers * Updated arg modifiers in all functions * Removed unused headers and added precompiled headers
This commit is contained in:
committed by
Udit Singh
parent
fc7e7074ce
commit
b713083574
28
src/modules/keyboardmanager/common/Helpers.cpp
Normal file
28
src/modules/keyboardmanager/common/Helpers.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "pch.h"
|
||||
#include "Helpers.h"
|
||||
#include <sstream>
|
||||
|
||||
// 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)
|
||||
{
|
||||
std::wstringstream ss(input);
|
||||
std::wstring item;
|
||||
std::vector<std::wstring> splittedStrings;
|
||||
while (std::getline(ss, item, L' '))
|
||||
{
|
||||
splittedStrings.push_back(item);
|
||||
}
|
||||
|
||||
return splittedStrings;
|
||||
}
|
||||
|
||||
// Function to return the next sibling element for an element under a stack panel
|
||||
IInspectable getSiblingElement(IInspectable const& element)
|
||||
{
|
||||
FrameworkElement frameworkElement = element.as<FrameworkElement>();
|
||||
StackPanel parentElement = frameworkElement.Parent().as<StackPanel>();
|
||||
uint32_t index;
|
||||
|
||||
parentElement.Children().IndexOf(frameworkElement, index);
|
||||
return parentElement.Children().GetAt(index + 1);
|
||||
}
|
||||
Reference in New Issue
Block a user