X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fpush-button-impl.cpp;h=dea0ee03935b842f03b1e799965ef3da1d59ad52;hb=refs%2Fchanges%2F06%2F301106%2F9;hp=9ff9531b4b6d926f8bcef4ef2747491280dc3d69;hpb=e1f62b191823249c41ecbdf79ac33b082e5b8dc9;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp index 9ff9531..dea0ee0 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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. @@ -198,8 +198,8 @@ Property::Value PushButton::GetProperty(BaseObject* object, Property::Index prop Dali::Accessibility::States PushButton::PushButtonAccessible::CalculateStates() { - auto state = Button::ButtonAccessible::CalculateStates(); - auto self = Toolkit::Button::DownCast(Self()); + auto state = Button::ButtonAccessible::CalculateStates(); + auto self = Toolkit::Button::DownCast(Self()); state[Dali::Accessibility::State::PRESSED] = self.GetProperty(Toolkit::Button::Property::SELECTED); return state; } @@ -210,12 +210,14 @@ void PushButton::OnStateChange(State newState) if((Dali::Accessibility::Accessible::GetCurrentlyHighlightedActor() == Self()) && (newState == SELECTED_STATE || newState == UNSELECTED_STATE)) { auto* accessible = GetAccessibleObject(); - - accessible->EmitStateChanged(Dali::Accessibility::State::PRESSED, newState == SELECTED_STATE ? 1 : 0, 0); - - if(Self().GetProperty(Toolkit::Button::Property::TOGGLABLE)) + if(DALI_LIKELY(accessible)) { - accessible->EmitStateChanged(Dali::Accessibility::State::CHECKED, newState == SELECTED_STATE ? 1 : 0, 0); + accessible->EmitStateChanged(Dali::Accessibility::State::PRESSED, newState == SELECTED_STATE ? 1 : 0, 0); + + if(Self().GetProperty(Toolkit::Button::Property::TOGGLABLE)) + { + accessible->EmitStateChanged(Dali::Accessibility::State::CHECKED, newState == SELECTED_STATE ? 1 : 0, 0); + } } } }