#include <dali/public-api/animation/constraints.h>
#include <dali/devel-api/common/stage.h>
#include <dali/public-api/events/key-event.h>
-#include <dali/public-api/events/touch-data.h>
+#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/devel-api/actors/actor-devel.h>
#include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/devel-api/accessibility-manager/accessibility-manager.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/dali-toolkit.h>
using namespace Dali;
SetAsKeyboardFocusGroup( true );
SetupTouch();
+
+ DevelControl::AppendAccessibilityAttribute(self, "sub-role", "Alert");
+
+ DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor)
+ {
+ return std::unique_ptr<Dali::Accessibility::Accessible>(new AccessibleImpl(actor, Dali::Accessibility::Role::DIALOG, true));
+ });
}
Popup::~Popup()
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 )
{
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;
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) &&
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;
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;
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<std::string>(Toolkit::TextLabel::Property::TEXT);
+ title = titleText;
+ }
+ else
+ {
+ Actor popupContent = popup.GetContent();
+ if (popupContent)
+ {
+ std::string contentText = popupContent.GetProperty<std::string>(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<std::string>(Toolkit::Popup::Property::DISPLAY_STATE);
+
+ states[Dali::Accessibility::State::SHOWING] = (displayState == "SHOWN" || displayState == "SHOWING");
+
+ return states;
+}
+
} // namespace Internal
} // namespace Toolkit