// CLASS HEADER
#include <dali/internal/accessibility/bridge/bridge-component.h>
-// EXTERNAL INCLUDES
-#include <iostream>
-
#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties"
using namespace Dali::Accessibility;
// Screen Reader will call the methods with the exact names as specified in the AT-SPI Component interface:
// https://gitlab.gnome.org/GNOME/at-spi2-core/-/blob/master/xml/Component.xml
- DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceComponent};
+ DBus::DBusInterfaceDescription desc{Accessible::GetInterfaceName(AtspiInterface::COMPONENT)};
AddFunctionToInterface(desc, "Contains", &BridgeComponent::IsAccessibleContainingPoint);
AddFunctionToInterface(desc, "GetAccessibleAtPoint", &BridgeComponent::GetAccessibleAtPoint);
AddFunctionToInterface(desc, "GetExtents", &BridgeComponent::GetExtents);
Component* BridgeComponent::FindSelf() const
{
- auto self = BridgeBase::FindSelf();
- assert(self);
- auto componentInterface = dynamic_cast<Component*>(self);
- if(!componentInterface)
- {
- throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Component interface"};
- }
- return componentInterface;
+ return FindCurrentObjectWithInterface<Dali::Accessibility::AtspiInterface::COMPONENT>();
}
DBus::ValueOrError<bool> BridgeComponent::IsAccessibleContainingPoint(int32_t x, int32_t y, uint32_t coordType)
DBus::ValueOrError<std::tuple<int32_t, int32_t, int32_t, int32_t> > BridgeComponent::GetExtents(uint32_t coordType)
{
auto rect = FindSelf()->GetExtents(static_cast<CoordinateType>(coordType));
+
+ rect.x += mData->mExtentsOffset.first;
+ rect.y += mData->mExtentsOffset.second;
+
return std::tuple<int32_t, int32_t, int32_t, int32_t>{rect.x, rect.y, rect.width, rect.height};
}
DBus::ValueOrError<int32_t, int32_t> BridgeComponent::GetPosition(uint32_t coordType)
{
auto rect = FindSelf()->GetExtents(static_cast<CoordinateType>(coordType));
+
+ rect.x += mData->mExtentsOffset.first;
+ rect.y += mData->mExtentsOffset.second;
+
return {static_cast<int32_t>(rect.x), static_cast<int32_t>(rect.y)};
}