#pragma once #include #include #include #include "KeyDropDownControl.h" class ShortcutControl { private: // Textblock to display the selected shortcut TextBlock shortcutText; // Stack panel for the drop downs to display the selected shortcut StackPanel shortcutDropDownStackPanel; // Button to type the shortcut Button typeShortcut; // StackPanel to parent the above controls StackPanel shortcutControlLayout; public: // Handle to the current Edit Shortcuts Window static HWND EditShortcutsWindowHandle; // Pointer to the keyboard manager state static KeyboardManagerState* keyboardManagerState; // Stores the current list of remappings static std::vector> shortcutRemapBuffer; // Vector to store dynamically allocated KeyDropDownControl objects to avoid early destruction std::vector> keyDropDownControlObjects; ShortcutControl(const size_t rowIndex, const size_t colIndex) { shortcutDropDownStackPanel.Spacing(10); shortcutDropDownStackPanel.Orientation(Windows::UI::Xaml::Controls::Orientation::Horizontal); KeyDropDownControl::AddDropDown(shortcutDropDownStackPanel, rowIndex, colIndex, shortcutRemapBuffer, keyDropDownControlObjects); typeShortcut.Content(winrt::box_value(winrt::to_hstring("Type Shortcut"))); typeShortcut.Click([&, rowIndex, colIndex](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { keyboardManagerState->SetUIState(KeyboardManagerUIState::DetectShortcutWindowActivated, EditShortcutsWindowHandle); // Using the XamlRoot of the typeShortcut to get the root of the XAML host createDetectShortcutWindow(sender, sender.as