/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
ControlAccessible::ControlAccessible(Dali::Actor self)
: ActorAccessible(self)
{
- auto control = Toolkit::Control::DownCast(self);
-
- Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
- Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
-
- self.PropertySetSignal().Connect(&controlImpl, [this, &controlImpl](Dali::Handle& handle, Dali::Property::Index index, Dali::Property::Value value) {
- if(this->Self() != Dali::Accessibility::Accessible::GetCurrentlyHighlightedActor())
- {
- return;
- }
-
- if(index == DevelControl::Property::ACCESSIBILITY_NAME || (index == GetNamePropertyIndex() && controlImpl.mAccessibilityName.empty()))
- {
- if(controlImpl.mAccessibilityGetNameSignal.Empty())
- {
- Emit(Dali::Accessibility::ObjectPropertyChangeEvent::NAME);
- }
- }
-
- if(index == DevelControl::Property::ACCESSIBILITY_DESCRIPTION || (index == GetDescriptionPropertyIndex() && controlImpl.mAccessibilityDescription.empty()))
- {
- if(controlImpl.mAccessibilityGetDescriptionSignal.Empty())
- {
- Emit(Dali::Accessibility::ObjectPropertyChangeEvent::DESCRIPTION);
- }
- }
- });
}
std::string ControlAccessible::GetName() const
states[State::HIGHLIGHTABLE] = self.GetProperty<bool>(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE);
states[State::HIGHLIGHTED] = GetCurrentlyHighlightedActor() == self;
states[State::ENABLED] = true;
- states[State::SENSITIVE] = self.GetProperty<bool>(Actor::Property::SENSITIVE);
+ states[State::SENSITIVE] = (Dali::DevelActor::IsHittable(self) && Dali::DevelActor::GetTouchRequired(self));
states[State::VISIBLE] = self.GetProperty<bool>(Actor::Property::VISIBLE);
states[State::SHOWING] = IsShowing();
states[State::DEFUNCT] = !self.GetProperty(Dali::DevelActor::Property::CONNECTED_TO_SCENE).Get<bool>();
controlImpl.UnregisterAccessibilityPositionPropertyNotification();
}
+void ControlAccessible::RegisterPropertySetSignal()
+{
+ auto control = Dali::Toolkit::Control::DownCast(Self());
+ Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
+ controlImpl.RegisterAccessibilityPropertySetSignal();
+}
+
+void ControlAccessible::UnregisterPropertySetSignal()
+{
+ auto control = Dali::Toolkit::Control::DownCast(Self());
+ Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
+ controlImpl.UnregisterAccessibilityPropertySetSignal();
+}
+
bool ControlAccessible::GrabHighlight()
{
Dali::Actor self = Self();
SetCurrentlyHighlightedActor(self);
EmitHighlighted(true);
RegisterPositionPropertyNotification();
+ RegisterPropertySetSignal();
return true;
}
if(GetCurrentlyHighlightedActor() == self)
{
+ UnregisterPropertySetSignal();
UnregisterPositionPropertyNotification();
self.Remove(mCurrentHighlightActor.GetHandle());
mCurrentHighlightActor = {};