terminal/src/types/IUiaTraceable.h
Carlos Zamora 286af380c9
Add more object ID tracing for Accessibility (#5215)
## Summary of the Pull Request

In preparation for getting more accessibility-related issues, I added an ID to the `ScreenInfoUiaProvider` (SIUP) and abstracted the one from `UiaTextRange`. Using this, I noticed that we are creating SIUPs when a new tab/pane is created. This is _good_. This means that we need to somehow notify a UIA Client that out structure has changed, and we need to use the new SIUP because the old one has been removed.

I'll be investigating that more after this PR lands.
2020-04-03 20:06:47 +00:00

55 lines
1.2 KiB
C++

/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- IUiaTraceable.hpp
Abstract:
- This module is used for assigning and retrieving IDs to UIA objects
Author(s):
- Carlos Zamora (cazamor) Apr 2020
--*/
#pragma once
namespace Microsoft::Console::Types
{
typedef unsigned long long IdType;
constexpr IdType InvalidId = 0;
class IUiaTraceable
{
public:
const IdType GetId() const noexcept
{
return _id;
}
// Routine Description:
// - assigns an ID to the IUiaTraceable object if it doesn't have one
// Arguments:
// - id - the id value that we are trying to assign
// Return Value:
// - true if the assignment was successful, false otherwise (it already has an id).
bool AssignId(IdType id) noexcept
{
if (_id == InvalidId)
{
_id = id;
return true;
}
else
{
return false;
}
}
private:
// used to debug objects passed back and forth
// between the provider and the client
IdType _id{};
};
}