UIHelpers.h
1 #pragma once 2 3 namespace winrt 4 { 5 struct hstring; 6 namespace Windows::Foundation 7 { 8 struct IInspectable; 9 namespace Collections 10 { 11 template<typename T> 12 struct IVector; 13 } 14 } 15 } 16 17 // This namespace contains UI methods that are to be used for both KBM windows 18 namespace UIHelpers 19 { 20 // This method sets focus to the first "Select" button on the last row of the Grid of EditKeyboardWindow 21 void SetFocusOnFirstSelectButtonInLastRowOfEditKeyboardWindow(StackPanel& parent, long colCount); 22 23 // This method sets focus to the first "Select" button on the last row of the Grid of EditShortcutsWindow 24 void SetFocusOnFirstSelectButtonInLastRowOfEditShortcutsWindow(StackPanel& parent, long colCount); 25 26 RECT GetForegroundWindowDesktopRect(); 27 28 // Function to return the next sibling element for an element under a stack panel 29 winrt::Windows::Foundation::IInspectable GetSiblingElement(winrt::Windows::Foundation::IInspectable const& element); 30 31 winrt::Windows::Foundation::IInspectable GetWrapped(const winrt::Windows::Foundation::IInspectable& element, double width); 32 33 // Function to return a StackPanel with an element and a TextBlock label. 34 winrt::Windows::Foundation::IInspectable GetLabelWrapped(const winrt::Windows::Foundation::IInspectable& element, std::wstring label, double width, HorizontalAlignment horizontalAlignment = HorizontalAlignment::Left); 35 36 // Function to return the list of key name in the order for the drop down based on the key codes 37 winrt::Windows::Foundation::Collections::IVector<winrt::Windows::Foundation::IInspectable> ToBoxValue(const std::vector<std::pair<DWORD, std::wstring>>& list); 38 39 #ifndef NDEBUG 40 // Useful For debugging issues 41 std::vector<std::wstring> GetChildrenNames(StackPanel& s); 42 #endif 43 }