/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
std::vector<std::string> tips;
size_t tipsCount = tipArray->Count();
tips.resize(tipsCount);
+
+ bool valid = true;
for(size_t i = 0; i != tipsCount; ++i)
{
- tipArray->GetElementAt(i).Get(tips[i]);
+ if(DALI_UNLIKELY(!tipArray->GetElementAt(i).Get(tips[i])))
+ {
+ // Given array is invalid. Fast out.
+ valid = false;
+ break;
+ }
+ }
+
+ if(DALI_LIKELY(valid))
+ {
+ toggleButtonImpl.SetToggleTooltips(tips);
}
- toggleButtonImpl.SetToggleTooltips(tips);
}
break;
}
DevelControl::UnregisterVisual(*this, index);
}
- DevelControl::RegisterVisual(*this, index, visual, enabled);
+ DevelControl::RegisterVisual(*this, index, visual, enabled, DepthIndex::CONTENT);
}
void ToggleButton::RelayoutVisual(Property::Index index, const Vector2& size)
void ToggleButton::OnStateChange(State newState)
{
// TODO: replace it with OnPropertySet hook once Button::Property::SELECTED will be consistently used
- if((Self() == Dali::Accessibility::Accessible::GetCurrentlyHighlightedActor()) && (newState == SELECTED_STATE || newState == UNSELECTED_STATE))
+ if(newState == SELECTED_STATE || newState == UNSELECTED_STATE)
{
auto* accessible = GetAccessibleObject();
- if(DALI_LIKELY(accessible))
+ if(DALI_LIKELY(accessible) && accessible->IsHighlighted())
{
accessible->EmitStateChanged(Dali::Accessibility::State::CHECKED, mCurrentToggleIndex ? 1 : 0, 0);
accessible->Emit(Dali::Accessibility::ObjectPropertyChangeEvent::DESCRIPTION);