/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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-toolkit/public-api/controls/control-impl.h>
// EXTERNAL INCLUDES
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/object/type-info.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
#include <cstring> // for strcmp
#include <typeinfo>
// INTERNAL INCLUDES
+#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/public-api/align-enumerations.h>
#include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
#include <dali-toolkit/public-api/styling/style-manager.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
if((type & GestureType::PAN) && !mImpl->mPanGestureDetector)
{
mImpl->mPanGestureDetector = PanGestureDetector::New();
+ mImpl->mPanGestureDetector.SetMaximumTouchesRequired(2);
mImpl->mPanGestureDetector.DetectedSignal().Connect(mImpl, &Impl::PanDetected);
mImpl->mPanGestureDetector.Attach(Self());
}
bool Control::OnAccessibilityActivated()
{
- return false; // Accessibility activation is not handled by default
+ if(Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self()))
+ {
+ return OnKeyboardEnter();
+ }
+ return false;
}
bool Control::OnKeyboardEnter()
{
SetKeyboardNavigationSupport(true);
}
+
+ Dali::TypeInfo type;
+ Self().GetTypeInfo(type);
+ if(type)
+ {
+ auto typeName = type.GetName();
+ DevelControl::AppendAccessibilityAttribute(Self(), "class", typeName);
+ }
+
+ if(Accessibility::IsUp())
+ mImpl->AccessibilityRegister();
}
void Control::OnInitialize()
{
Dali::Toolkit::Control handle(GetOwner());
+ if(Accessibility::IsUp())
+ {
+ auto self = mImpl->GetAccessibilityObject(Self());
+ self->EmitFocused(focusGained);
+ auto parent = self->GetParent();
+ if(parent && !self->GetStates()[Dali::Accessibility::State::MANAGES_DESCENDANTS])
+ {
+ parent->EmitActiveDescendantChanged(parent, self);
+ }
+ }
+
if(focusGained)
{
// signals are allocated dynamically when someone connects
// Request to be laid out when the control is connected to the Scene.
// Signal that a Relayout may be needed
+ if(Accessibility::IsUp())
+ {
+ mImpl->AccessibilityRegister();
+ }
}
void Control::OnSceneDisconnection()
{
+ if(Accessibility::IsUp())
+ {
+ mImpl->AccessibilityDeregister(true);
+ }
mImpl->OnSceneDisconnection();
}
{
// If the clipping mode has been set, we may need to create a renderer.
// Only do this if we are already on-stage as the OnSceneConnection will handle the off-stage clipping controls.
- if((index == Actor::Property::CLIPPING_MODE) && Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
+ switch(index)
{
- // Note: This method will handle whether creation of the renderer is required.
- CreateClippingRenderer(*this);
+ case Actor::Property::CLIPPING_MODE:
+ {
+ if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
+ {
+ // Note: This method will handle whether creation of the renderer is required.
+ CreateClippingRenderer(*this);
+ }
+ break;
+ }
+ case Actor::Property::VISIBLE:
+ {
+ if(Dali::Accessibility::IsUp())
+ {
+ Dali::Accessibility::Accessible::Get(Self())->EmitVisible(Self().GetProperty(Actor::Property::VISIBLE).Get<bool>());
+ }
+ break;
+ }
+ case Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE:
+ {
+ if(Dali::Accessibility::IsUp())
+ {
+ Dali::Accessibility::Accessible::Get(Self())->Emit(Dali::Accessibility::ObjectPropertyChangeEvent::ROLE);
+ }
+ break;
+ }
}
}