X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fpopup%2Fpopup-impl.cpp;h=9c9a1f2691c458c39d79128108a46a61aebed95c;hb=HEAD;hp=768a9786ad1c770db5f5a34b55257fcaa6c5750e;hpb=2ca1c3856ce848a94f54444f1014a820e91ee207;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index 768a978..9c9a1f2 100644 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -36,6 +36,7 @@ // INTERNAL INCLUDES #include #include +#include #include #include #include @@ -342,11 +343,12 @@ void Popup::OnInitialize() SetupTouch(); - DevelControl::AppendAccessibilityAttribute(self, "sub-role", "Alert"); + self.SetProperty(DevelControl::Property::ACCESSIBILITY_ROLE, Dali::Accessibility::Role::DIALOG); +} - DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) { - return std::unique_ptr(new AccessibleImpl(actor, Dali::Accessibility::Role::DIALOG, true)); - }); +DevelControl::ControlAccessible* Popup::CreateAccessibleObject() +{ + return new PopupAccessible(Self()); } Popup::~Popup() @@ -725,25 +727,16 @@ void Popup::SetDisplayState(Toolkit::Popup::DisplayState displayState) return; } - auto* accessible = Dali::Accessibility::Accessible::Get(Self()); - if(display) - { - Dali::Accessibility::Bridge::GetCurrentBridge()->AddPopup(accessible); - accessible->EmitStateChanged(Dali::Accessibility::State::SHOWING, 1, 0); - } - else - { - accessible->EmitStateChanged(Dali::Accessibility::State::SHOWING, 0, 0); - Dali::Accessibility::Bridge::GetCurrentBridge()->RemovePopup(accessible); - } - // Convert the bool state to the actual display state to use. - mDisplayState = display ? Toolkit::Popup::SHOWING : Toolkit::Popup::HIDING; + mDisplayState = display ? Toolkit::Popup::SHOWING : Toolkit::Popup::HIDING; + auto* accessible = Dali::Accessibility::Accessible::Get(Self()); if(display) { // Update the state to indicate the current intent. mDisplayState = Toolkit::Popup::SHOWING; + Dali::Accessibility::Bridge::GetCurrentBridge()->RegisterDefaultLabel(accessible); + accessible->EmitShowing(true); // We want the popup to have key input focus when it is displayed SetKeyInputFocus(); @@ -797,8 +790,9 @@ void Popup::SetDisplayState(Toolkit::Popup::DisplayState displayState) else // Not visible. { mDisplayState = Toolkit::Popup::HIDING; + Dali::Accessibility::Bridge::GetCurrentBridge()->UnregisterDefaultLabel(accessible); ClearKeyInputFocus(); - + accessible->EmitShowing(false); // Restore the keyboard focus when popup is hidden. if(mPreviousFocusedActor && mPreviousFocusedActor.GetProperty(Actor::Property::KEYBOARD_FOCUSABLE)) { @@ -993,7 +987,7 @@ void Popup::SetTailVisibility(bool visible) mLayoutDirty = true; } -const bool Popup::IsTailVisible() const +bool Popup::IsTailVisible() const { return mTailVisible; } @@ -1071,7 +1065,7 @@ void Popup::SetBackingEnabled(bool enabled) mLayoutDirty = true; } -const bool Popup::IsBackingEnabled() const +bool Popup::IsBackingEnabled() const { return mBackingEnabled; } @@ -1090,7 +1084,7 @@ const Vector4& Popup::GetBackingColor() const void Popup::SetTailUpImage(std::string image) { - mTailUpImage = image; + mTailUpImage = std::move(image); mLayoutDirty = true; LayoutTail(); } @@ -1102,7 +1096,7 @@ const std::string& Popup::GetTailUpImage() const void Popup::SetTailDownImage(std::string image) { - mTailDownImage = image; + mTailDownImage = std::move(image); mLayoutDirty = true; LayoutTail(); } @@ -1114,7 +1108,7 @@ const std::string& Popup::GetTailDownImage() const void Popup::SetTailLeftImage(std::string image) { - mTailLeftImage = image; + mTailLeftImage = std::move(image); mLayoutDirty = true; LayoutTail(); } @@ -1126,7 +1120,7 @@ const std::string& Popup::GetTailLeftImage() const void Popup::SetTailRightImage(std::string image) { - mTailRightImage = image; + mTailRightImage = std::move(image); mLayoutDirty = true; LayoutTail(); } @@ -1145,7 +1139,7 @@ void Popup::SetTouchTransparent(bool enabled) } } -const bool Popup::IsTouchTransparent() const +bool Popup::IsTouchTransparent() const { return mTouchTransparent; } @@ -1312,7 +1306,7 @@ void Popup::SetProperty(BaseObject* object, Property::Index propertyIndex, const std::string valueString; if(value.Get(valueString)) { - Toolkit::ImageView actor = Toolkit::ImageView::New(valueString); + Toolkit::ImageView actor = Toolkit::ImageView::New(std::move(valueString)); popupImpl.SetPopupBackgroundImage(actor); } break; @@ -1347,7 +1341,7 @@ void Popup::SetProperty(BaseObject* object, Property::Index propertyIndex, const std::string valueString; if(value.Get(valueString)) { - popupImpl.SetTailUpImage(valueString); + popupImpl.SetTailUpImage(std::move(valueString)); } break; } @@ -1356,7 +1350,7 @@ void Popup::SetProperty(BaseObject* object, Property::Index propertyIndex, const std::string valueString; if(value.Get(valueString)) { - popupImpl.SetTailDownImage(valueString); + popupImpl.SetTailDownImage(std::move(valueString)); } break; } @@ -1365,7 +1359,7 @@ void Popup::SetProperty(BaseObject* object, Property::Index propertyIndex, const std::string valueString; if(value.Get(valueString)) { - popupImpl.SetTailLeftImage(valueString); + popupImpl.SetTailLeftImage(std::move(valueString)); } break; } @@ -1374,7 +1368,7 @@ void Popup::SetProperty(BaseObject* object, Property::Index propertyIndex, const std::string valueString; if(value.Get(valueString)) { - popupImpl.SetTailRightImage(valueString); + popupImpl.SetTailRightImage(std::move(valueString)); } break; } @@ -1398,21 +1392,21 @@ Property::Value Popup::GetProperty(BaseObject* object, Property::Index propertyI { Property::Map map; Scripting::CreatePropertyMap(popupImpl.GetTitle(), map); - value = map; + value = std::move(map); break; } case Toolkit::Popup::Property::CONTENT: { Property::Map map; Scripting::CreatePropertyMap(popupImpl.GetContent(), map); - value = map; + value = std::move(map); break; } case Toolkit::Popup::Property::FOOTER: { Property::Map map; Scripting::CreatePropertyMap(popupImpl.GetFooter(), map); - value = map; + value = std::move(map); break; } case Toolkit::Popup::Property::DISPLAY_STATE: @@ -1454,14 +1448,14 @@ Property::Value Popup::GetProperty(BaseObject* object, Property::Index propertyI { // Note: Cannot retrieve property map from animation. Property::Map map; - value = map; + value = std::move(map); break; } case Toolkit::Popup::Property::EXIT_ANIMATION: { // Note: Cannot retrieve property map from animation. Property::Map map; - value = map; + value = std::move(map); break; } case Toolkit::Popup::Property::AUTO_HIDE_DELAY: @@ -2001,15 +1995,15 @@ void Popup::SetupTouch() } } -std::string Popup::AccessibleImpl::GetNameRaw() +std::string Popup::PopupAccessible::GetNameRaw() const { - auto popup = Toolkit::Popup::DownCast(self); + auto popup = Toolkit::Popup::DownCast(Self()); std::string title; Actor popupTitle = popup.GetTitle(); if(popupTitle) { std::string titleText = popupTitle.GetProperty(Toolkit::TextLabel::Property::TEXT); - title = titleText; + title = std::move(titleText); } else { @@ -2017,19 +2011,20 @@ std::string Popup::AccessibleImpl::GetNameRaw() if(popupContent) { std::string contentText = popupContent.GetProperty(Toolkit::TextLabel::Property::TEXT); - title = contentText; + title = std::move(contentText); } } return title; } -Dali::Accessibility::States Popup::AccessibleImpl::CalculateStates() +Dali::Accessibility::States Popup::PopupAccessible::CalculateStates() { - auto states = Control::Impl::AccessibleImpl::CalculateStates(); - auto popup = Toolkit::Popup::DownCast(self); + auto states = DevelControl::ControlAccessible::CalculateStates(); + auto popup = Toolkit::Popup::DownCast(Self()); auto displayState = popup.GetProperty(Toolkit::Popup::Property::DISPLAY_STATE); states[Dali::Accessibility::State::SHOWING] = (displayState == "SHOWN" || displayState == "SHOWING"); + states[Dali::Accessibility::State::MODAL] = true; return states; }