#include <algorithm>
#include <iostream>
+// INTERNAL INCLUDES
+#include <dali/devel-api/atspi-interfaces/accessible.h>
+#include <dali/devel-api/atspi-interfaces/component.h>
+#include <dali/devel-api/atspi-interfaces/selection.h>
+#include <dali/devel-api/atspi-interfaces/text.h>
+#include <dali/devel-api/atspi-interfaces/value.h>
+
//comment out 2 lines below to get more logs
#undef LOG
#define LOG() _LoggerEmpty()
for(const auto& it : relations)
{
- if(it.relationType == RelationType::CONTROLLED_BY)
+ if(it.mRelationType == RelationType::CONTROLLED_BY)
{
return false;
}
void BridgeAccessible::RegisterInterfaces()
{
- DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceAccessible};
+ DBus::DBusInterfaceDescription desc{Accessible::GetInterfaceName(AtspiInterface::ACCESSIBLE)};
AddGetPropertyToInterface(desc, "ChildCount", &BridgeAccessible::GetChildCount);
AddGetPropertyToInterface(desc, "Name", &BridgeAccessible::GetName);
AddGetPropertyToInterface(desc, "Description", &BridgeAccessible::GetDescription);
AddFunctionToInterface(desc, "GetLocalizedRoleName", &BridgeAccessible::GetLocalizedRoleName);
AddFunctionToInterface(desc, "GetState", &BridgeAccessible::GetStates);
AddFunctionToInterface(desc, "GetAttributes", &BridgeAccessible::GetAttributes);
- AddFunctionToInterface(desc, "GetInterfaces", &BridgeAccessible::GetInterfaces);
+ AddFunctionToInterface(desc, "GetInterfaces", &BridgeAccessible::GetInterfacesAsStrings);
AddFunctionToInterface(desc, "GetChildAtIndex", &BridgeAccessible::GetChildAtIndex);
AddFunctionToInterface(desc, "GetChildren", &BridgeAccessible::GetChildren);
AddFunctionToInterface(desc, "GetIndexInParent", &BridgeAccessible::GetIndexInParent);
mDbusServer.addInterface("/", desc, true);
}
+Accessible* BridgeAccessible::FindSelf() const
+{
+ return FindCurrentObject();
+}
+
Component* BridgeAccessible::GetObjectInRelation(Accessible* obj, RelationType relationType)
{
if(!obj)
for(auto& relation : obj->GetRelationSet())
{
- if(relation.relationType == relationType)
+ if(relation.mRelationType == relationType)
{
- for(auto& address : relation.targets)
+ for(auto& target : relation.mTargets)
{
- auto component = dynamic_cast<Component*>(Find(address));
+ auto component = dynamic_cast<Component*>(target);
if(component)
{
return component;
auto relation = std::find_if(relations.begin(),
relations.end(),
[relationType](const Dali::Accessibility::Relation& relation) -> bool {
- return relation.relationType == relationType;
+ return relation.mRelationType == relationType;
});
- return relations.end() != relation && !relation->targets.empty() ? Find(relation->targets.back()) : nullptr;
+ return relations.end() != relation && !relation->mTargets.empty() ? relation->mTargets.back() : nullptr;
};
auto labellingObject = findObjectByRelationType(RelationType::LABELLED_BY);
double minimumIncrement = 0.0;
double maximumValue = 0.0;
double minimumValue = 0.0;
- auto* valueInterface = dynamic_cast<Dali::Accessibility::Value*>(self);
+ auto* valueInterface = Value::DownCast(self);
if(valueInterface)
{
currentValue = valueInterface->GetCurrent();
int32_t firstSelectedChildIndex = -1;
int32_t selectedChildCount = 0;
- auto* selfSelectionInterface = dynamic_cast<Dali::Accessibility::Selection*>(self);
+ auto* selfSelectionInterface = Selection::DownCast(self);
if(selfSelectionInterface)
{
selectedChildCount = selfSelectionInterface->GetSelectedChildrenCount();
listChildrenCount = GetItemCountOfFirstDescendantContainer(self, Role::POPUP_MENU, Role::MENU_ITEM, false);
}
- auto* textInterface = dynamic_cast<Dali::Accessibility::Text*>(self);
+ auto* textInterface = Text::DownCast(self);
std::string nameFromTextInterface = "";
if(textInterface)
{
auto parentChildCount = parent ? static_cast<int32_t>(parent->GetChildCount()) : 0;
auto parentStateSet = parent ? parent->GetStates() : States{};
bool isSelectedInParent = false;
- auto* parentSelectionInterface = dynamic_cast<Dali::Accessibility::Selection*>(parent);
+ auto* parentSelectionInterface = Selection::DownCast(parent);
if(parentSelectionInterface)
{
isSelectedInParent = parentSelectionInterface->IsChildSelected(indexInParent);
return attributes;
}
-DBus::ValueOrError<std::vector<std::string>> BridgeAccessible::GetInterfaces()
+DBus::ValueOrError<std::vector<std::string>> BridgeAccessible::GetInterfacesAsStrings()
{
- return FindSelf()->GetInterfaces();
+ return FindSelf()->GetInterfacesAsStrings();
}
int BridgeAccessible::GetChildCount()
for(auto& it : relations)
{
- ret.emplace_back(Relation{static_cast<uint32_t>(it.relationType), it.targets});
+ ret.emplace_back(Relation{static_cast<uint32_t>(it.mRelationType), it.mTargets});
}
return ret;