X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Ftoggle-button-impl.cpp;h=ccc515ddf1f8d33b4819dc84ca8e6fa6a16958e0;hp=0ecae06eb5c1f61564da2d555bbe900bd109556c;hb=a507d54721445b44cfea7fb032a68d996bf17f09;hpb=ca4209fb071e5c353a7e528098a2e497765118d8 diff --git a/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp b/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp index 0ecae06..ccc515d 100755 --- a/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -305,8 +305,17 @@ const std::vector& ToggleButton::GetToggleTooltips() const void ToggleButton::PrepareVisual(Property::Index index, Toolkit::Visual::Base& visual) { - DevelControl::RegisterVisual( *this, index, visual, true ); - DevelControl::EnableVisual( *this, index, false ); + bool enabled = false; // Disabled by default + + // Unregister the visual with the given index if registered previously + if( DevelControl::GetVisual( *this, index ) ) + { + // Check whether it was enabled to ensure we do the same with the new visual we're registering + enabled = DevelControl::IsVisualEnabled( *this, index ); + DevelControl::UnregisterVisual( *this, index ); + } + + DevelControl::RegisterVisual( *this, index, visual, enabled ); } void ToggleButton::RelayoutVisual( Property::Index index, const Vector2& size )