Allow to check checkable support (#5186)

This commit is contained in:
Montel Laurent 2024-05-07 13:44:14 +02:00 committed by GitHub
parent afa295a511
commit f8f3316dc1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 0 deletions

View file

@ -105,6 +105,23 @@ public:
return std::nullopt;
}
/// Returns the accessible-checkable of that element, if any.
std::optional<bool> accessible_checkable() const
{
if (auto item = private_api::upgrade_item_weak(inner)) {
SharedString result;
if (item->item_tree.vtable()->accessible_string_property(
item->item_tree.borrow(), item->index,
cbindgen_private::AccessibleStringProperty::Checkable, &result)) {
if (result == "true")
return true;
else if (result == "false")
return false;
}
}
return std::nullopt;
}
/// Sets the accessible-value of that element.
///
/// Setting the value will invoke the `accessible-action-set-value` callback.