#include "pch.h" #include "ShortcutControl.h" #include "KeyDropDownControl.h" //Both static members are initialized to null HWND ShortcutControl::EditShortcutsWindowHandle = nullptr; KeyboardManagerState* ShortcutControl::keyboardManagerState = nullptr; // Initialized as new vector std::vector> ShortcutControl::shortcutRemapBuffer; // Function to add a new row to the shortcut table. If the originalKeys and newKeys args are provided, then the displayed shortcuts are set to those values. void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vector>>& keyboardRemapControlObjects, Shortcut originalKeys, Shortcut newKeys) { // Parent element for the row Windows::UI::Xaml::Controls::StackPanel tableRow; tableRow.Background(Windows::UI::Xaml::Media::SolidColorBrush{ Windows::UI::Colors::LightGray() }); tableRow.Spacing(100); tableRow.Orientation(Windows::UI::Xaml::Controls::Orientation::Horizontal); // Create new ShortcutControl objects dynamically so that we does not get destructed std::vector> newrow; newrow.push_back(std::move(std::unique_ptr(new ShortcutControl(shortcutRemapBuffer.size(), 0)))); newrow.push_back(std::move(std::unique_ptr(new ShortcutControl(shortcutRemapBuffer.size(), 1)))); keyboardRemapControlObjects.push_back(std::move(newrow)); // ShortcutControl for the original shortcut tableRow.Children().Append(keyboardRemapControlObjects[keyboardRemapControlObjects.size() - 1][0]->getShortcutControl()); // ShortcutControl for the new shortcut tableRow.Children().Append(keyboardRemapControlObjects[keyboardRemapControlObjects.size() - 1][1]->getShortcutControl()); // Delete row button Windows::UI::Xaml::Controls::Button deleteShortcut; FontIcon deleteSymbol; deleteSymbol.FontFamily(Xaml::Media::FontFamily(L"Segoe MDL2 Assets")); deleteSymbol.Glyph(L"\xE74D"); deleteShortcut.Content(deleteSymbol); deleteShortcut.Click([&](IInspectable const& sender, RoutedEventArgs const&) { StackPanel currentRow = sender.as