Add the accessible-position-in-set property

This commit is contained in:
Arnold Loubriat 2024-10-24 23:59:05 +02:00 committed by Simon Hausmann
parent d00655b059
commit 67166fcc2d
11 changed files with 50 additions and 0 deletions

View file

@ -3,6 +3,7 @@
#include "slint.h"
#include "slint_testing_internal.h"
#include <cstdint>
#include <optional>
#include <string_view>
#include <type_traits>
@ -355,6 +356,19 @@ public:
return std::nullopt;
}
/// Returns the accessible-position-in-set of that element, if any.
std::optional<uintptr_t> accessible_position_in_set() const
{
if (auto result = get_accessible_string_property(
cbindgen_private::AccessibleStringProperty::PositionInSet)) {
uintptr_t value = 0;
if (cbindgen_private::slint_string_to_usize(&*result, &value)) {
return value;
}
}
return std::nullopt;
}
/// Sets the accessible-value of that element.
///
/// Setting the value will invoke the `accessible-action-set-value` callback.