28 lines
1.1 KiB
C++
28 lines
1.1 KiB
C++
// SPDX-License-Identifier: LGPL-2.1-or-later
|
|
#pragma once
|
|
#include <oleacc.h>
|
|
#include <string>
|
|
|
|
// accState is a bitmask, not a role identifier. Keep protocol values stable
|
|
// and omit focus/visibility bookkeeping from spoken state descriptions.
|
|
inline std::string msaa_states(DWORD states, LONG role) {
|
|
std::string result;
|
|
const auto append = [&result](const char *text) {
|
|
if (!result.empty()) result += ", ";
|
|
result += text;
|
|
};
|
|
if (states & STATE_SYSTEM_MIXED) append("half checked");
|
|
else if (states & STATE_SYSTEM_CHECKED) append("checked");
|
|
else if (role == ROLE_SYSTEM_CHECKBUTTON || role == ROLE_SYSTEM_RADIOBUTTON)
|
|
append("not checked");
|
|
if (states & STATE_SYSTEM_SELECTED) append("selected");
|
|
if (states & STATE_SYSTEM_PRESSED) append("pressed");
|
|
if (states & STATE_SYSTEM_EXPANDED) append("expanded");
|
|
if (states & STATE_SYSTEM_COLLAPSED) append("collapsed");
|
|
if (states & STATE_SYSTEM_UNAVAILABLE) append("unavailable");
|
|
if (states & STATE_SYSTEM_READONLY) append("read only");
|
|
if (states & STATE_SYSTEM_PROTECTED) append("password");
|
|
if (states & STATE_SYSTEM_BUSY) append("busy");
|
|
return result;
|
|
}
|