terminal/src/types/IUiaEventDispatcher.h
Carlos Zamora 2b8b034b89
Attach UiaRenderer and Fire Selection Changed Events (#2989)
This PR makes use of the UiaRenderer by attaching it to the TerminalControl and setting up selectionChanged events for accessibility.

Part 1: attaching the UiaRenderer
The uiaRenderer is treated very similarly to the dxRenderer. We have a unique_ptr ref to it in the TermControl. This gets populated when the TermControlAutomationPeer is created (thus enabling accessibility).

To prevent every TermControl from sending signals simultaneously, we specifically only enable whichever one is in an active pane.

The UiaRenderer needs to send encoded events to the automation provider (in this case, TermControlAutomationPeer). We needed our own automation events so that we can reuse this model for ConHost. This is the purpose of IUiaEventDispatcher.

We need a dispatcher for the UiaRenderer. Otherwise, we would do a lot of work to find out when to fire an event, but we wouldn't have a way of doing that.

Part 2: hooking up selection events
This provides a little bit of polish to hooking it up before. Primarily to actually make it work. This includes returning S_FALSE instead of E_NOTIMPL.

The main thing here really is just how to detect if a selection has changed. This also shows how clean adding more events will be in the future!
2019-12-11 13:52:49 -08:00

28 lines
675 B
C++

/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- IUiaEventDispatcher.h
Abstract:
- This serves as the interface allowing accessibility providers to detect and respond to accessibility events
- This interface should allow accessibility events to be supported across different implementation patterns
Author(s):
- Carlos Zamora (CaZamor) Sept-2019
--*/
#pragma once
namespace Microsoft::Console::Types
{
class IUiaEventDispatcher
{
public:
virtual void SignalSelectionChanged() = 0;
virtual void SignalTextChanged() = 0;
virtual void SignalCursorChanged() = 0;
};
}