mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-26 02:28:17 +08:00
29 lines
923 B
C++
29 lines
923 B
C++
|
#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);
|
||
|
}
|