X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fpopup%2Fpopup-impl.cpp;h=092569c5374e5d56ec7f28fe49a6887a783e8bbd;hb=5075ccc3be07ba0da557493efc026ecb2a5373fe;hp=f323bb69310e990cfd02f1160fe3b091daeefc48;hpb=29540fc153880d6949c85786b78b8583ae8f1d37;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 f323bb6..092569c 100644 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -39,10 +39,11 @@ #include #include #include -#include #include #include #include +#include +#include using namespace Dali; @@ -338,6 +339,13 @@ void Popup::OnInitialize() SetAsKeyboardFocusGroup( true ); SetupTouch(); + + DevelControl::AppendAccessibilityAttribute(self, "sub-role", "Alert"); + + DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) + { + return std::unique_ptr(new AccessibleImpl(actor, Dali::Accessibility::Role::DIALOG, true)); + }); } Popup::~Popup() @@ -563,8 +571,11 @@ void Popup::DisplayStateChangeComplete() bool Popup::OnAutoHideTimeReached() { - // Display timer has expired, auto hide the popup exactly as if the user had clicked outside. - SetDisplayState( Toolkit::Popup::HIDDEN ); + if (!Dali::Accessibility::IsUp() || true) // TODO: remove 'true' in sync with EFL (UX change) + { + // Display timer has expired, auto hide the popup exactly as if the user had clicked outside. + SetDisplayState( Toolkit::Popup::HIDDEN ); + } if( mAutoHideTimer ) { @@ -713,6 +724,18 @@ 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; @@ -1532,7 +1555,7 @@ bool Popup::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra return connected; } -bool Popup::OnBackingTouched( Actor actor, const TouchData& touch ) +bool Popup::OnBackingTouched( Actor actor, const TouchEvent& touch ) { // Allow events to pass through if the backing isn't the hit-actor if( (touch.GetHitActor(0) == actor) && @@ -1559,7 +1582,7 @@ bool Popup::OnBackingWheelEvent( Actor actor, const WheelEvent& event ) return true; } -bool Popup::OnDialogTouched( Actor actor, const TouchData& touch ) +bool Popup::OnDialogTouched( Actor actor, const TouchEvent& touch ) { // Only connecting this so the backing does not become the default hit-actor and inadvertently closes the popup return false; @@ -1795,9 +1818,9 @@ bool Popup::OnKeyEvent( const KeyEvent& event ) bool consumed = false; - if( event.state == KeyEvent::Down ) + if( event.GetState() == KeyEvent::DOWN ) { - if (event.keyCode == Dali::DALI_KEY_ESCAPE || event.keyCode == Dali::DALI_KEY_BACK) + if (event.GetKeyCode() == Dali::DALI_KEY_ESCAPE || event.GetKeyCode() == Dali::DALI_KEY_BACK) { SetDisplayState( Toolkit::Popup::HIDDEN ); consumed = true; @@ -1963,21 +1986,54 @@ void Popup::SetupTouch() if( ! mTouchTransparent ) { // Connect all the signals and set us up to consume all touch events - mBacking.TouchSignal().Connect( this, &Popup::OnBackingTouched ); - mPopupBackgroundImage.TouchSignal().Connect( this, &Popup::OnDialogTouched ); - mPopupLayout.TouchSignal().Connect( this, &Popup::OnDialogTouched ); + mBacking.TouchedSignal().Connect( this, &Popup::OnBackingTouched ); + mPopupBackgroundImage.TouchedSignal().Connect( this, &Popup::OnDialogTouched ); + mPopupLayout.TouchedSignal().Connect( this, &Popup::OnDialogTouched ); mLayer.SetProperty( Layer::Property::CONSUMES_TOUCH, true ); } else { // We are touch transparent so disconnect all signals and ensure our layer does not consumed all touch events - mBacking.TouchSignal().Disconnect( this, &Popup::OnBackingTouched ); - mPopupBackgroundImage.TouchSignal().Disconnect( this, &Popup::OnDialogTouched ); - mPopupLayout.TouchSignal().Disconnect( this, &Popup::OnDialogTouched ); + mBacking.TouchedSignal().Disconnect( this, &Popup::OnBackingTouched ); + mPopupBackgroundImage.TouchedSignal().Disconnect( this, &Popup::OnDialogTouched ); + mPopupLayout.TouchedSignal().Disconnect( this, &Popup::OnDialogTouched ); mLayer.SetProperty( Layer::Property::CONSUMES_TOUCH, false ); } } +std::string Popup::AccessibleImpl::GetNameRaw() +{ + 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; + } + else + { + Actor popupContent = popup.GetContent(); + if (popupContent) + { + std::string contentText = popupContent.GetProperty(Toolkit::TextLabel::Property::TEXT); + title = contentText; + } + } + return title; +} + +Dali::Accessibility::States Popup::AccessibleImpl::CalculateStates() +{ + auto states = Control::Impl::AccessibleImpl::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"); + + return states; +} + } // namespace Internal } // namespace Toolkit