#ifndef DALI_ATSPI_ACCESSIBILITY_H\r
#define DALI_ATSPI_ACCESSIBILITY_H\r
/*\r
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
\r
// INTERNAL INCLUDES\r
#include <dali/devel-api/adaptor-framework/accessibility-bitset.h>\r
+#include <dali/public-api/actors/actor.h>\r
#include <dali/public-api/dali-adaptor-common.h>\r
\r
namespace Dali\r
MAX_COUNT\r
};\r
\r
+enum class ActionType\r
+{\r
+ ACTIVATE,\r
+ ESCAPE,\r
+ INCREMENT,\r
+ DECREMENT,\r
+ SCROLL_TO_CHILD,\r
+ MAX_COUNT\r
+};\r
+\r
using AtspiInterfaces = EnumBitSet<AtspiInterface, AtspiInterface::MAX_COUNT>;\r
using AtspiEvents = EnumBitSet<AtspiEvent, AtspiEvent::MAX_COUNT>;\r
using ReadingInfoTypes = EnumBitSet<ReadingInfoType, ReadingInfoType::MAX_COUNT>;\r
std::vector<Accessible*> mTargets;\r
};\r
\r
+struct DALI_ADAPTOR_API ActionInfo\r
+{\r
+ ActionInfo() = default;\r
+ ActionInfo(ActionType type, Actor target)\r
+ : type{type},\r
+ target{target}\r
+ {\r
+ }\r
+\r
+ ActionType type{ActionType::MAX_COUNT};\r
+ Actor target{};\r
+};\r
+\r
} // namespace Accessibility\r
} // namespace Dali\r
\r
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return {};
}
+std::string ActorAccessible::GetValue() const
+{
+ return {};
+}
+
Accessible* ActorAccessible::GetParent()
{
if(IsOnRootLevel())
#define DALI_ADAPTOR_ACTOR_ACCESSIBLE_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
std::string GetDescription() const override;
+ /**
+ * @copydoc Dali::Accessibility::Accessible::GetValue()
+ */
+ std::string GetValue() const override;
+
/**
* @copydoc Dali::Accessibility::Accessible::GetParent()
*/
#define DALI_ADAPTOR_PROXY_ACCESSIBLE_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return "";
}
+ std::string GetValue() const override
+ {
+ return "";
+ }
+
Accessible* GetParent() override
{
return mParent;
#define DALI_ADAPTOR_ATSPI_ACCESSIBLE_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/math/rect.h>
#include <dali/public-api/object/object-registry.h>
#include <cstdint>
+#include <map>
#include <string>
#include <vector>
*/
virtual std::string GetDescription() const = 0;
+ /**
+ * @brief Gets accessibility value.
+ *
+ * @return The value text
+ */
+ virtual std::string GetValue() const = 0;
+
/**
* @brief Gets parent.
*
ReadingInfoTypes mReadingInfoTypes = ~ReadingInfoTypes(); // all set
AtspiEvents mSuppressedEvents;
bool mIsOnRootLevel = false;
+ std::map<State, int> mLastEmittedState;
+
}; // Accessible class
namespace Internal
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
using namespace Dali::Accessibility;
+namespace
+{
+bool UpdateLastEmitted(std::map<State, int>& lastEmitted, State state, int newValue)
+{
+ bool updated = false;
+ const auto [iter, inserted] = lastEmitted.emplace(state, newValue);
+ if(!inserted && iter->second != newValue)
+ {
+ iter->second = newValue;
+ updated = true;
+ }
+
+ return inserted || updated;
+}
+
+} // namespace
+
Accessible::Accessible()
{
}
{
if(auto bridgeData = GetBridgeData())
{
- bridgeData->mBridge->EmitStateChanged(this, state, newValue, reserved);
+ if(UpdateLastEmitted(mLastEmittedState, state, newValue))
+ {
+ bridgeData->mBridge->EmitStateChanged(this, state, newValue, reserved);
+ }
}
}
void Accessible::EmitShowing(bool isShowing)
{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitStateChanged(this, State::SHOWING, isShowing ? 1 : 0, 0);
- }
+ EmitStateChanged(State::SHOWING, isShowing ? 1 : 0);
}
void Accessible::EmitVisible(bool isVisible)
{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitStateChanged(this, State::VISIBLE, isVisible ? 1 : 0, 0);
- }
+ EmitStateChanged(State::VISIBLE, isVisible ? 1 : 0);
}
void Accessible::EmitHighlighted(bool isHighlighted)
{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitStateChanged(this, State::HIGHLIGHTED, isHighlighted ? 1 : 0, 0);
- }
+ EmitStateChanged(State::HIGHLIGHTED, isHighlighted ? 1 : 0);
}
void Accessible::EmitFocused(bool isFocused)
{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitStateChanged(this, State::FOCUSED, isFocused ? 1 : 0, 0);
- }
+ EmitStateChanged(State::FOCUSED, isFocused ? 1 : 0);
}
+
void Accessible::EmitTextInserted(unsigned int position, unsigned int length, const std::string& content)
{
if(auto bridgeData = GetBridgeData())
void Accessible::NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive)
{
- if(auto data = GetBridgeData())
+ if(Accessibility::IsUp())
{
+ const auto newStates = GetStates();
for(auto i = 0u; i < static_cast<unsigned int>(Dali::Accessibility::State::MAX_COUNT); i++)
{
- auto index = static_cast<Dali::Accessibility::State>(i);
+ const auto index = static_cast<Dali::Accessibility::State>(i);
if(states[index])
{
- data->mBridge->EmitStateChanged(this, index, GetStates()[index], 0);
+ EmitStateChanged(index, newStates[index]);
}
}
/*
- f * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace
{
constexpr const char* FORCE_CHILD_SEARCH_ATTR{"forceChildSearch"};
+constexpr const char* VALUE_FORMAT_KEY = "value_format";
+constexpr const char* VALUE_FORMAT_TEXT_VAL = "text";
bool SortVertically(Component* lhs, Component* rhs)
{
std::string labeledByName = labellingObject ? labellingObject->GetName() : "";
auto describedByObject = findObjectByRelationType(RelationType::DESCRIBED_BY);
+ auto attributes = self->GetAttributes();
double currentValue = 0.0;
std::string currentValueText;
maximumValue = valueInterface->GetMaximum();
minimumValue = valueInterface->GetMinimum();
}
+ else
+ {
+ // value text support outside of IAtspiValue interface
+ currentValueText = self->GetValue();
+ if(!currentValueText.empty())
+ {
+ attributes.insert({VALUE_FORMAT_KEY, VALUE_FORMAT_TEXT_VAL});
+ }
+ }
int32_t firstSelectedChildIndex = -1;
int32_t selectedChildCount = 0;
}
}
- auto attributes = self->GetAttributes();
auto itemCount = attributes.find("item_count");
auto atspiRole = self->GetRole();
int32_t listChildrenCount = 0;
DBus::ValueOrError<std::map<std::string, std::string>> BridgeAccessible::GetAttributes()
{
- std::map<std::string, std::string> attributes = FindSelf()->GetAttributes();
+ auto self = FindSelf();
+ std::map<std::string, std::string> attributes = self->GetAttributes();
if(mIsScreenReaderSuppressed)
{
attributes.insert({"suppress-screen-reader", "true"});
}
+ auto* valueInterface = Value::DownCast(self);
+ if(!valueInterface && !self->GetValue().empty())
+ {
+ attributes.insert({VALUE_FORMAT_KEY, VALUE_FORMAT_TEXT_VAL});
+ }
+
return attributes;
}
#define DALI_INTERNAL_ACCESSIBILITY_BRIDGE_BASE_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
std::string GetDescription() const override
{
- return "";
+ return {};
+ }
+
+ std::string GetValue() const override
+ {
+ return {};
}
Dali::Accessibility::Accessible* GetParent() override
enum class CoalescableMessages
{
BOUNDS_CHANGED, ///< Bounds changed
- SET_OFFSET, ///< Set offset
+ SET_OFFSET, ///< Set offset
};
// Custom specialization of std::hash