+Dali::Accessibility::States PushButton::PushButtonAccessible::CalculateStates()
+{
+ auto state = Button::ButtonAccessible::CalculateStates();
+ auto self = Toolkit::Button::DownCast(Self());
+ state[Dali::Accessibility::State::PRESSED] = self.GetProperty<bool>(Toolkit::Button::Property::SELECTED);
+ return state;
+}
+
+void PushButton::OnStateChange(State newState)
+{
+ // TODO: replace it with OnPropertySet hook once Button::Property::SELECTED will be consistently used
+ if(newState == SELECTED_STATE || newState == UNSELECTED_STATE)
+ {
+ auto* accessible = GetAccessibleObject();
+ if(DALI_LIKELY(accessible) && accessible->IsHighlighted())
+ {
+ accessible->EmitStateChanged(Dali::Accessibility::State::PRESSED, newState == SELECTED_STATE ? 1 : 0, 0);
+
+ if(Self().GetProperty<bool>(Toolkit::Button::Property::TOGGLABLE))
+ {
+ accessible->EmitStateChanged(Dali::Accessibility::State::CHECKED, newState == SELECTED_STATE ? 1 : 0, 0);
+ }
+ }
+ }
+}
+