/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// EXTERNAL INCLUDES
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
-#include <dali/public-api/images/resource-image.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/public-api/object/property-array.h>
#include <dali/integration-api/debug.h>
{
DALI_LOG_INFO( gLogButtonFilter, Debug::General, "ToggleButton::Constructor\n" );
SetTogglableButton( false );
+ DevelControl::SetAccessibilityConstructor( Self(), []( Dali::Actor actor ) {
+ return std::unique_ptr< Dali::Accessibility::Accessible >(
+ new AccessibleImpl( actor, Dali::Accessibility::Role::TOGGLE_BUTTON ) );
+ } );
}
ToggleButton::~ToggleButton()
}
case Toolkit::ToggleButton::Property::TOOLTIPS:
{
- Property::Array* tipArray = value.GetArray();
+ const Property::Array* tipArray = value.GetArray();
if( tipArray )
{
std::vector<std::string> tips;
RelayoutRequest();
}
+void ToggleButton::OnStateChange( State newState )
+{
+ // TODO: replace it with OnPropertySet hook once Button::Property::SELECTED will be consistently used
+ if (Dali::Accessibility::IsUp() && (newState == SELECTED_STATE || newState == UNSELECTED_STATE))
+ {
+ Dali::Accessibility::Accessible::Get(Self())->EmitStateChanged(
+ Dali::Accessibility::State::CHECKED, newState == SELECTED_STATE ? 1 : 0, 0
+ );
+ }
+}
+
} // namespace Internal
} // namespace Toolkit