d749df70ed
**BE NOT AFRAID**. I know that there's 107 files in this PR, but almost all of it is just find/replacing `TerminalControl` with `Control`. This is the start of the work to move TermControl into multiple pieces, for #5000. The PR starts this work by: * Splits `TerminalControl` into separate lib and dll projects. We'll want control tests in the future, and for that, we'll need a lib. * Moves `ICoreSettings` back into the `Microsoft.Terminal.Core` namespace. We'll have other types in there soon too. * I could not tell you why this works suddenly. New VS versions? New cppwinrt version? Maybe we're just better at dealing with mdmerge bugs these days. * RENAMES `Microsoft.Terminal.TerminalControl` to `Microsoft.Terminal.Control`. This touches pretty much every file in the sln. Sorry about that (not sorry). An upcoming PR will move much of the logic in TermControl into a new `ControlCore` class that we'll add in `Microsoft.Terminal.Core`. `ControlCore` will then be unittest-able in the `UnitTests_TerminalCore`, which will help prevent regressions like #9455 ## Detailed Description of the Pull Request / Additional comments You're really gonna want to clean the sln first, then merge this into your branch, then rebuild. It's very likely that old winmds will get left behind. If you see something like ``` Error MDM2007 Cannot create type Microsoft.Terminal.TerminalControl.KeyModifiers in read-only metadata file Microsoft.Terminal.TerminalControl. ``` then that's what happened to you.
88 lines
4 KiB
C++
88 lines
4 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- TermControlAutomationPeer.h
|
|
|
|
Abstract:
|
|
- This module provides UI Automation access to the TermControl
|
|
to support both automation tests and accessibility (screen
|
|
reading) applications. This mainly interacts with ScreenInfoUiaProvider
|
|
to allow for shared code between ConHost and Windows Terminal
|
|
accessibility providers.
|
|
- Based on the Custom Automation Peers guide on msdn
|
|
(https://docs.microsoft.com/en-us/windows/uwp/design/accessibility/custom-automation-peers)
|
|
- Wraps the UIAutomationCore ITextProvider
|
|
(https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-itextprovider)
|
|
with a XAML ITextProvider
|
|
(https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.automation.provider.itextprovider)
|
|
|
|
Author(s):
|
|
- Carlos Zamora (CaZamor) 2019
|
|
--*/
|
|
|
|
#pragma once
|
|
|
|
#include "TermControl.h"
|
|
#include "TermControlAutomationPeer.g.h"
|
|
#include <winrt/Microsoft.Terminal.Control.h>
|
|
#include "../types/TermControlUiaProvider.hpp"
|
|
#include "../types/IUiaEventDispatcher.h"
|
|
#include "../types/IControlAccessibilityInfo.h"
|
|
|
|
namespace winrt::Microsoft::Terminal::Control::implementation
|
|
{
|
|
struct TermControlAutomationPeer :
|
|
public TermControlAutomationPeerT<TermControlAutomationPeer>,
|
|
::Microsoft::Console::Types::IUiaEventDispatcher,
|
|
::Microsoft::Console::Types::IControlAccessibilityInfo
|
|
{
|
|
public:
|
|
TermControlAutomationPeer(Microsoft::Terminal::Control::implementation::TermControl* owner);
|
|
|
|
#pragma region FrameworkElementAutomationPeer
|
|
hstring GetClassNameCore() const;
|
|
Windows::UI::Xaml::Automation::Peers::AutomationControlType GetAutomationControlTypeCore() const;
|
|
hstring GetLocalizedControlTypeCore() const;
|
|
Windows::Foundation::IInspectable GetPatternCore(Windows::UI::Xaml::Automation::Peers::PatternInterface patternInterface) const;
|
|
Windows::UI::Xaml::Automation::Peers::AutomationOrientation GetOrientationCore() const;
|
|
hstring GetNameCore() const;
|
|
hstring GetHelpTextCore() const;
|
|
Windows::UI::Xaml::Automation::Peers::AutomationLiveSetting GetLiveSettingCore() const;
|
|
#pragma endregion
|
|
|
|
#pragma region IUiaEventDispatcher
|
|
void SignalSelectionChanged() override;
|
|
void SignalTextChanged() override;
|
|
void SignalCursorChanged() override;
|
|
#pragma endregion
|
|
|
|
#pragma region ITextProvider Pattern
|
|
Windows::UI::Xaml::Automation::Provider::ITextRangeProvider RangeFromPoint(Windows::Foundation::Point screenLocation);
|
|
Windows::UI::Xaml::Automation::Provider::ITextRangeProvider RangeFromChild(Windows::UI::Xaml::Automation::Provider::IRawElementProviderSimple childElement);
|
|
com_array<Windows::UI::Xaml::Automation::Provider::ITextRangeProvider> GetVisibleRanges();
|
|
com_array<Windows::UI::Xaml::Automation::Provider::ITextRangeProvider> GetSelection();
|
|
Windows::UI::Xaml::Automation::SupportedTextSelection SupportedTextSelection();
|
|
Windows::UI::Xaml::Automation::Provider::ITextRangeProvider DocumentRange();
|
|
#pragma endregion
|
|
|
|
#pragma region IControlAccessibilityInfo Pattern
|
|
// Inherited via IControlAccessibilityInfo
|
|
virtual COORD GetFontSize() const override;
|
|
virtual RECT GetBounds() const override;
|
|
virtual RECT GetPadding() const override;
|
|
virtual double GetScaleFactor() const override;
|
|
virtual void ChangeViewport(SMALL_RECT NewWindow) override;
|
|
virtual HRESULT GetHostUiaProvider(IRawElementProviderSimple** provider) override;
|
|
#pragma endregion
|
|
|
|
RECT GetBoundingRectWrapped();
|
|
|
|
private:
|
|
::Microsoft::WRL::ComPtr<::Microsoft::Terminal::TermControlUiaProvider> _uiaProvider;
|
|
winrt::Microsoft::Terminal::Control::implementation::TermControl* _termControl;
|
|
winrt::com_array<Windows::UI::Xaml::Automation::Provider::ITextRangeProvider> WrapArrayOfTextRangeProviders(SAFEARRAY* textRanges);
|
|
};
|
|
}
|