Updated demos to use DALi clang-format
[platform/core/uifw/dali-demo.git] / examples / transitions / shadow-button-impl.cpp
index 51867d6..1b1ece8 100644 (file)
@@ -16,9 +16,9 @@
 
 #include "shadow-button-impl.h"
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali/devel-api/scripting/enum-helper.h>
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali/devel-api/scripting/enum-helper.h>
 
 #include <cstdio>
 
@@ -29,58 +29,54 @@ namespace Demo
 {
 namespace Internal
 {
-
 namespace
 {
-
-
 Dali::BaseHandle Create()
 {
   return Demo::ShadowButton::New();
 }
 
-DALI_TYPE_REGISTRATION_BEGIN( ShadowButton, Dali::Toolkit::Button, Create );
+DALI_TYPE_REGISTRATION_BEGIN(ShadowButton, Dali::Toolkit::Button, Create);
 
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "activeTransition", ARRAY, ACTIVE_TRANSITION );
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "inactiveTransition", ARRAY, INACTIVE_TRANSITION );
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkTransition", ARRAY, CHECK_TRANSITION );
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "uncheckTransition", ARRAY, UNCHECK_TRANSITION );
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "backgroundVisual", MAP, BACKGROUND_VISUAL );
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkboxBgVisual", MAP, CHECKBOX_BG_VISUAL );
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkboxFgVisual", MAP, CHECKBOX_FG_VISUAL );
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "labelVisual", MAP, LABEL_VISUAL );
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkState", BOOLEAN, ACTIVE_STATE );
-DALI_PROPERTY_REGISTRATION( Demo, ShadowButton, "checkState", BOOLEAN, CHECK_STATE );
+DALI_PROPERTY_REGISTRATION(Demo, ShadowButton, "activeTransition", ARRAY, ACTIVE_TRANSITION);
+DALI_PROPERTY_REGISTRATION(Demo, ShadowButton, "inactiveTransition", ARRAY, INACTIVE_TRANSITION);
+DALI_PROPERTY_REGISTRATION(Demo, ShadowButton, "checkTransition", ARRAY, CHECK_TRANSITION);
+DALI_PROPERTY_REGISTRATION(Demo, ShadowButton, "uncheckTransition", ARRAY, UNCHECK_TRANSITION);
+DALI_PROPERTY_REGISTRATION(Demo, ShadowButton, "backgroundVisual", MAP, BACKGROUND_VISUAL);
+DALI_PROPERTY_REGISTRATION(Demo, ShadowButton, "checkboxBgVisual", MAP, CHECKBOX_BG_VISUAL);
+DALI_PROPERTY_REGISTRATION(Demo, ShadowButton, "checkboxFgVisual", MAP, CHECKBOX_FG_VISUAL);
+DALI_PROPERTY_REGISTRATION(Demo, ShadowButton, "labelVisual", MAP, LABEL_VISUAL);
+DALI_PROPERTY_REGISTRATION(Demo, ShadowButton, "checkState", BOOLEAN, ACTIVE_STATE);
+DALI_PROPERTY_REGISTRATION(Demo, ShadowButton, "checkState", BOOLEAN, CHECK_STATE);
 
 DALI_TYPE_REGISTRATION_END();
 
-DALI_ENUM_TO_STRING_TABLE_BEGIN( VISUAL_PROPERTIES )
-{ "backgroundVisual", Demo::ShadowButton::Property::BACKGROUND_VISUAL },
-"checkboxBgVisual", Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL},
-"checkboxFgVisual", Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL},
-{ "labelVisual",      Demo::ShadowButton::Property::LABEL_VISUAL}
-DALI_ENUM_TO_STRING_TABLE_END( VISUAL_PROPERTIES )
+DALI_ENUM_TO_STRING_TABLE_BEGIN(VISUAL_PROPERTIES)
+  {"backgroundVisual", Demo::ShadowButton::Property::BACKGROUND_VISUAL},
+    {"checkboxBgVisual", Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL},
+    {"checkboxFgVisual", Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL},
+    {"labelVisual", Demo::ShadowButton::Property::LABEL_VISUAL}
+DALI_ENUM_TO_STRING_TABLE_END(VISUAL_PROPERTIES)
 
-Toolkit::TransitionData ConvertPropertyToTransition( const Property::Value& value )
+Toolkit::TransitionData ConvertPropertyToTransition(const Property::Value& value)
 {
   Toolkit::TransitionData transitionData;
 
-  if( value.GetType() == Property::ARRAY )
+  if(value.GetType() == Property::ARRAY)
   {
-    transitionData = Toolkit::TransitionData::New( *value.GetArray());
+    transitionData = Toolkit::TransitionData::New(*value.GetArray());
   }
-  else if( value.GetType() == Property::MAP )
+  else if(value.GetType() == Property::MAP)
   {
-    transitionData = Toolkit::TransitionData::New( *value.GetMap() );
+    transitionData = Toolkit::TransitionData::New(*value.GetMap());
   }
   return transitionData;
 }
 
 } // anonymous namespace
 
-
 Internal::ShadowButton::ShadowButton()
-: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
+: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)),
   mCheckState(false),
   mActiveState(false)
 {
@@ -92,24 +88,24 @@ Internal::ShadowButton::~ShadowButton()
 
 Demo::ShadowButton Internal::ShadowButton::New()
 {
-  IntrusivePtr<Internal::ShadowButton> impl = new Internal::ShadowButton();
-  Demo::ShadowButton handle = Demo::ShadowButton( *impl );
+  IntrusivePtr<Internal::ShadowButton> impl   = new Internal::ShadowButton();
+  Demo::ShadowButton                   handle = Demo::ShadowButton(*impl);
   impl->Initialize();
   return handle;
 }
 
-void ShadowButton::SetActiveState( bool active )
+void ShadowButton::SetActiveState(bool active)
 {
-  if( active != mActiveState )
+  if(active != mActiveState)
   {
     mActiveState = active;
-    if( active )
+    if(active)
     {
-      StartTransition( Demo::ShadowButton::Property::ACTIVE_TRANSITION );
+      StartTransition(Demo::ShadowButton::Property::ACTIVE_TRANSITION);
     }
     else
     {
-      StartTransition( Demo::ShadowButton::Property::INACTIVE_TRANSITION );
+      StartTransition(Demo::ShadowButton::Property::INACTIVE_TRANSITION);
     }
   }
 }
@@ -119,19 +115,19 @@ bool ShadowButton::GetActiveState()
   return mActiveState;
 }
 
-void ShadowButton::SetCheckState( bool checkState )
+void ShadowButton::SetCheckState(bool checkState)
 {
   mCheckState = checkState;
-  DevelControl::EnableVisual( *this, Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, true );
-  if( Self().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) )
+  DevelControl::EnableVisual(*this, Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, true);
+  if(Self().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
   {
-    if( checkState )
+    if(checkState)
     {
-      StartTransition( Demo::ShadowButton::Property::CHECK_TRANSITION );
+      StartTransition(Demo::ShadowButton::Property::CHECK_TRANSITION);
     }
     else
     {
-      StartTransition( Demo::ShadowButton::Property::UNCHECK_TRANSITION );
+      StartTransition(Demo::ShadowButton::Property::UNCHECK_TRANSITION);
     }
   }
   RelayoutRequest();
@@ -142,38 +138,38 @@ bool ShadowButton::GetCheckState()
   return mCheckState;
 }
 
-void ShadowButton::StartTransition( Property::Index transitionId )
+void ShadowButton::StartTransition(Property::Index transitionId)
 {
-  Transitions::iterator iter = FindTransition( transitionId );
-  if( iter != mTransitions.end() )
+  Transitions::iterator iter = FindTransition(transitionId);
+  if(iter != mTransitions.end())
   {
-    if( iter->mAnimation )
+    if(iter->mAnimation)
     {
       iter->mAnimation.Stop();
       iter->mPlaying = false;
 
-      iter->mAnimation.FinishedSignal().Disconnect( this, &ShadowButton::OnTransitionFinished );
+      iter->mAnimation.FinishedSignal().Disconnect(this, &ShadowButton::OnTransitionFinished);
     }
 
-    iter->mAnimation = DevelControl::CreateTransition( *this, iter->mTransitionData );
-    StoreTargetLayouts( iter->mTransitionData );
+    iter->mAnimation = DevelControl::CreateTransition(*this, iter->mTransitionData);
+    StoreTargetLayouts(iter->mTransitionData);
 
-    iter->mAnimation.FinishedSignal().Connect( this, &ShadowButton::OnTransitionFinished );
+    iter->mAnimation.FinishedSignal().Connect(this, &ShadowButton::OnTransitionFinished);
     iter->mAnimation.Play();
     iter->mPlaying = true;
   }
 }
 
-void ShadowButton::OnTransitionFinished( Animation& src )
+void ShadowButton::OnTransitionFinished(Animation& src)
 {
   ShadowButton::Transitions::iterator iter = mTransitions.begin();
-  for( ; iter != mTransitions.end(); ++iter )
+  for(; iter != mTransitions.end(); ++iter)
   {
-    if( iter->mAnimation == src )
+    if(iter->mAnimation == src)
     {
       iter->mPlaying = false;
       iter->mAnimation.Reset(); // Remove the animation when it's finished.
-      switch( iter->mTransitionId )
+      switch(iter->mTransitionId)
       {
         case Demo::ShadowButton::Property::ACTIVE_TRANSITION:
         {
@@ -187,7 +183,7 @@ void ShadowButton::OnTransitionFinished( Animation& src )
         }
         case Demo::ShadowButton::Property::UNCHECK_TRANSITION:
         {
-          DevelControl::EnableVisual( *this, Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, false );
+          DevelControl::EnableVisual(*this, Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, false);
           break;
         }
       }
@@ -201,9 +197,9 @@ void ShadowButton::OnInitialize()
   Actor self = Self();
 }
 
-void ShadowButton::OnSceneConnection( int depth )
+void ShadowButton::OnSceneConnection(int depth)
 {
-  Control::OnSceneConnection( depth );
+  Control::OnSceneConnection(depth);
 }
 
 void ShadowButton::OnSceneDisconnection()
@@ -211,55 +207,56 @@ void ShadowButton::OnSceneDisconnection()
   Control::OnSceneDisconnection();
 }
 
-void ShadowButton::OnSizeSet( const Vector3& targetSize )
+void ShadowButton::OnSizeSet(const Vector3& targetSize)
 {
-  Control::OnSizeSet( targetSize );
-  RelayoutVisuals( Vector2( targetSize ) );
+  Control::OnSizeSet(targetSize);
+  RelayoutVisuals(Vector2(targetSize));
 }
 
-void ShadowButton::OnRelayout( const Vector2& targetSize, RelayoutContainer& container )
+void ShadowButton::OnRelayout(const Vector2& targetSize, RelayoutContainer& container)
 {
-  RelayoutVisuals( targetSize );
+  RelayoutVisuals(targetSize);
 }
 
-void ShadowButton::RelayoutVisuals( const Vector2& targetSize )
+void ShadowButton::RelayoutVisuals(const Vector2& targetSize)
 {
-  bool transitioning = false;
-  ShadowButton::Transitions::iterator iter = mTransitions.begin();
-  for( ; iter != mTransitions.end(); ++iter )
+  bool                                transitioning = false;
+  ShadowButton::Transitions::iterator iter          = mTransitions.begin();
+  for(; iter != mTransitions.end(); ++iter)
   {
-    if( iter->mPlaying == true )
+    if(iter->mPlaying == true)
     {
       transitioning = true;
       break;
     }
   }
 
-  if( ! transitioning )
+  if(!transitioning)
   {
-    for( ShadowButton::Transforms::iterator iter = mTransforms.begin();
-         iter != mTransforms.end(); ++iter )
+    for(ShadowButton::Transforms::iterator iter = mTransforms.begin();
+        iter != mTransforms.end();
+        ++iter)
     {
-      switch( iter->mTransformId )
+      switch(iter->mTransformId)
       {
         case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
         {
-          mBackgroundVisual.SetTransformAndSize( iter->mTransform, targetSize );
+          mBackgroundVisual.SetTransformAndSize(iter->mTransform, targetSize);
           break;
         }
         case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
         {
-          mCheckboxBgVisual.SetTransformAndSize( iter->mTransform, targetSize );
+          mCheckboxBgVisual.SetTransformAndSize(iter->mTransform, targetSize);
           break;
         }
         case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
         {
-          mCheckboxFgVisual.SetTransformAndSize( iter->mTransform, targetSize );
+          mCheckboxFgVisual.SetTransformAndSize(iter->mTransform, targetSize);
           break;
         }
         case Demo::ShadowButton::Property::LABEL_VISUAL:
         {
-          mLabelVisual.SetTransformAndSize( iter->mTransform, targetSize );
+          mLabelVisual.SetTransformAndSize(iter->mTransform, targetSize);
           break;
         }
       }
@@ -275,54 +272,54 @@ Vector3 ShadowButton::GetNaturalSize()
   Vector2 checkboxBgSize;
   Vector2 checkboxFgSize;
   Vector2 labelSize;
-  mCheckboxBgVisual.GetNaturalSize( checkboxBgSize );
-  mCheckboxFgVisual.GetNaturalSize( checkboxFgSize );
-  mLabelVisual.GetNaturalSize( labelSize );
+  mCheckboxBgVisual.GetNaturalSize(checkboxBgSize);
+  mCheckboxFgVisual.GetNaturalSize(checkboxFgSize);
+  mLabelVisual.GetNaturalSize(labelSize);
 
-  width = std::max( checkboxBgSize.x, checkboxFgSize.x ) + labelSize.x;
-  height = std::max( std::max( checkboxFgSize.y, checkboxBgSize.y ), labelSize.y );
+  width  = std::max(checkboxBgSize.x, checkboxFgSize.x) + labelSize.x;
+  height = std::max(std::max(checkboxFgSize.y, checkboxBgSize.y), labelSize.y);
 
-  return Vector3( width, height, height );
+  return Vector3(width, height, height);
 }
 
-void ShadowButton::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
+void ShadowButton::OnStyleChange(Toolkit::StyleManager styleManager, StyleChange::Type change)
 {
   // Chain up.
-  Control::OnStyleChange( styleManager, change );
+  Control::OnStyleChange(styleManager, change);
 }
 
-ShadowButton::Transitions::iterator ShadowButton::FindTransition( Property::Index index )
+ShadowButton::Transitions::iterator ShadowButton::FindTransition(Property::Index index)
 {
-  bool found = false;
-  ShadowButton::Transitions::iterator iter = mTransitions.begin();
-  for( ; iter != mTransitions.end(); ++iter )
+  bool                                found = false;
+  ShadowButton::Transitions::iterator iter  = mTransitions.begin();
+  for(; iter != mTransitions.end(); ++iter)
   {
-    if( iter->mTransitionId == index )
+    if(iter->mTransitionId == index)
     {
       found = true;
       break;
     }
   }
-  if( ! found )
+  if(!found)
   {
     iter = mTransitions.end();
   }
   return iter;
 }
 
-ShadowButton::Transforms::iterator ShadowButton::FindTransform( Property::Index index )
+ShadowButton::Transforms::iterator ShadowButton::FindTransform(Property::Index index)
 {
-  bool found = false;
-  ShadowButton::Transforms::iterator iter = mTransforms.begin();
-  for( ; iter != mTransforms.end(); ++iter )
+  bool                               found = false;
+  ShadowButton::Transforms::iterator iter  = mTransforms.begin();
+  for(; iter != mTransforms.end(); ++iter)
   {
-    if( iter->mTransformId == index )
+    if(iter->mTransformId == index)
     {
       found = true;
       break;
     }
   }
-  if( ! found )
+  if(!found)
   {
     iter = mTransforms.end();
   }
@@ -332,74 +329,74 @@ ShadowButton::Transforms::iterator ShadowButton::FindTransform( Property::Index
 void ShadowButton::ResetVisual(
   Property::Index        index,
   Visual::Base&          visual,
-  const Property::Value& value )
+  const Property::Value& value)
 {
-  if( visual )
+  if(visual)
   {
     // we are replacing an existing visual, so force relayout
     RelayoutRequest();
   }
   Property::Map* map = value.GetMap();
-  if( map )
+  if(map)
   {
-    visual = Toolkit::VisualFactory::Get().CreateVisual( *map );
+    visual = Toolkit::VisualFactory::Get().CreateVisual(*map);
 
     // Set the appropriate depth index.
     // @todo Should be able to set this from the style sheet
-    switch( index )
+    switch(index)
     {
       case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
       {
-        DevelControl::RegisterVisual( *this, index, visual, 0 );
+        DevelControl::RegisterVisual(*this, index, visual, 0);
         break;
       }
       case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
       {
-        DevelControl::RegisterVisual( *this, index, visual, 1 );
+        DevelControl::RegisterVisual(*this, index, visual, 1);
         break;
       }
       case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
       {
-        DevelControl::RegisterVisual( *this, index, visual, mCheckState, 2 );
+        DevelControl::RegisterVisual(*this, index, visual, mCheckState, 2);
         break;
       }
       case Demo::ShadowButton::Property::LABEL_VISUAL:
       {
-        DevelControl::RegisterVisual( *this, index, visual, 1 );
+        DevelControl::RegisterVisual(*this, index, visual, 1);
         break;
       }
     }
 
     // Extract transform maps out of the visual definition and store them
-    Property::Value* value = map->Find( Visual::Property::TRANSFORM, "transform");
-    if( value )
+    Property::Value* value = map->Find(Visual::Property::TRANSFORM, "transform");
+    if(value)
     {
       Property::Map* transformMap = value->GetMap();
-      if( transformMap )
+      if(transformMap)
       {
-        ShadowButton::Transforms::iterator iter = FindTransform( index );
-        if( iter != mTransforms.end() )
+        ShadowButton::Transforms::iterator iter = FindTransform(index);
+        if(iter != mTransforms.end())
         {
           iter->mTransform = *transformMap;
         }
         else
         {
-          mTransforms.push_back( Transform( index, *transformMap ) );
+          mTransforms.push_back(Transform(index, *transformMap));
         }
       }
     }
   }
 }
 
-bool IsTransformProperty( const std::string& property )
+bool IsTransformProperty(const std::string& property)
 {
-  const char* transformProperties[]= { "size", "offset", "origin", "anchorPoint", "offsetPolicy", "sizePolicy" };
-  const int NUM_TRANSFORM_PROPERTIES = sizeof( transformProperties ) / sizeof( const char * );
+  const char* transformProperties[]    = {"size", "offset", "origin", "anchorPoint", "offsetPolicy", "sizePolicy"};
+  const int   NUM_TRANSFORM_PROPERTIES = sizeof(transformProperties) / sizeof(const char*);
 
-  bool found=false;
-  for( int i=0; i<NUM_TRANSFORM_PROPERTIES; ++i )
+  bool found = false;
+  for(int i = 0; i < NUM_TRANSFORM_PROPERTIES; ++i)
   {
-    if( property == transformProperties[i] )
+    if(property == transformProperties[i])
     {
       found = true;
       break;
@@ -408,38 +405,37 @@ bool IsTransformProperty( const std::string& property )
   return found;
 }
 
-void ShadowButton::StoreTargetLayouts( TransitionData transitionData )
+void ShadowButton::StoreTargetLayouts(TransitionData transitionData)
 {
   // Pseudo code
   // foreach animator in transitionData
   //   if animator{"property"} in [ "size", "offset", "origin", "anchorPoint", "offsetPolicy", "sizePolicy" ]
   //     transforms{ animator{"target"} }->{animator{"property"}} = animator{"targetValue"}
 
-
-  for( unsigned int i=0; i < transitionData.Count(); ++i )
+  for(unsigned int i = 0; i < transitionData.Count(); ++i)
   {
-    Property::Map animator = transitionData.GetAnimatorAt(i);
-    Property::Value* target = animator.Find( "target" );
-    if( target )
+    Property::Map    animator = transitionData.GetAnimatorAt(i);
+    Property::Value* target   = animator.Find("target");
+    if(target)
     {
       // Convert to index
       Property::Index index = Property::INVALID_INDEX;
-      if( Scripting::GetEnumerationProperty( *target, VISUAL_PROPERTIES_TABLE, VISUAL_PROPERTIES_TABLE_COUNT, index ) )
+      if(Scripting::GetEnumerationProperty(*target, VISUAL_PROPERTIES_TABLE, VISUAL_PROPERTIES_TABLE_COUNT, index))
       {
-        ShadowButton::Transforms::iterator iter = FindTransform( index );
-        if( iter != mTransforms.end() )
+        ShadowButton::Transforms::iterator iter = FindTransform(index);
+        if(iter != mTransforms.end())
         {
-          Property::Value* property = animator.Find( "property" );
-          if( property )
+          Property::Value* property = animator.Find("property");
+          if(property)
           {
             std::string propertyString;
             property->Get(propertyString);
-            if( IsTransformProperty( propertyString ) )
+            if(IsTransformProperty(propertyString))
             {
-              Property::Value* targetValue = animator.Find( "targetValue" );
-              if( targetValue )
+              Property::Value* targetValue = animator.Find("targetValue");
+              if(targetValue)
               {
-                iter->mTransform[ propertyString ] = *targetValue;
+                iter->mTransform[propertyString] = *targetValue;
               }
             }
           }
@@ -453,49 +449,48 @@ void ShadowButton::ResetTransition(
   Property::Index        index,
   const Property::Value& value)
 {
-  ShadowButton::Transitions::iterator iter = FindTransition( index );
-  if( iter != mTransitions.end() )
+  ShadowButton::Transitions::iterator iter = FindTransition(index);
+  if(iter != mTransitions.end())
   {
     // Already exists
-    iter->mTransitionData = ConvertPropertyToTransition( value );
+    iter->mTransitionData = ConvertPropertyToTransition(value);
     iter->mAnimation.Stop();
     iter->mAnimation.Clear();
   }
   else
   {
-    mTransitions.push_back( Transition( index, ConvertPropertyToTransition( value ) ) );
+    mTransitions.push_back(Transition(index, ConvertPropertyToTransition(value)));
   }
 }
 
-
-void ShadowButton::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+void ShadowButton::SetProperty(BaseObject* object, Property::Index index, const Property::Value& value)
 {
-  Demo::ShadowButton shadowButton = Demo::ShadowButton::DownCast( Dali::BaseHandle( object ) );
+  Demo::ShadowButton shadowButton = Demo::ShadowButton::DownCast(Dali::BaseHandle(object));
 
-  if( shadowButton )
+  if(shadowButton)
   {
-    ShadowButton& impl = GetImpl( shadowButton );
-    switch ( index )
+    ShadowButton& impl = GetImpl(shadowButton);
+    switch(index)
     {
       case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
       {
-        impl.ResetVisual( index, impl.mBackgroundVisual, value );
+        impl.ResetVisual(index, impl.mBackgroundVisual, value);
         break;
       }
       case Demo::ShadowButton::Property::CHECKBOX_BG_VISUAL:
       {
-        impl.ResetVisual( index, impl.mCheckboxBgVisual, value );
+        impl.ResetVisual(index, impl.mCheckboxBgVisual, value);
         break;
       }
       case Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL:
       {
-        impl.ResetVisual( index, impl.mCheckboxFgVisual, value );
-        DevelControl::EnableVisual( impl, Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, impl.mCheckState );
+        impl.ResetVisual(index, impl.mCheckboxFgVisual, value);
+        DevelControl::EnableVisual(impl, Demo::ShadowButton::Property::CHECKBOX_FG_VISUAL, impl.mCheckState);
         break;
       }
       case Demo::ShadowButton::Property::LABEL_VISUAL:
       {
-        impl.ResetVisual( index, impl.mLabelVisual, value );
+        impl.ResetVisual(index, impl.mLabelVisual, value);
         break;
       }
       case Demo::ShadowButton::Property::ACTIVE_TRANSITION:
@@ -503,23 +498,23 @@ void ShadowButton::SetProperty( BaseObject* object, Property::Index index, const
       case Demo::ShadowButton::Property::CHECK_TRANSITION:
       case Demo::ShadowButton::Property::UNCHECK_TRANSITION:
       {
-        impl.ResetTransition( index, value );
+        impl.ResetTransition(index, value);
         break;
       }
     }
   }
 }
 
-Property::Value ShadowButton::GetProperty( BaseObject* object, Property::Index propertyIndex )
+Property::Value ShadowButton::GetProperty(BaseObject* object, Property::Index propertyIndex)
 {
   Property::Value value;
 
-  Demo::ShadowButton shadowButton = Demo::ShadowButton::DownCast( Dali::BaseHandle( object ) );
+  Demo::ShadowButton shadowButton = Demo::ShadowButton::DownCast(Dali::BaseHandle(object));
 
-  if ( shadowButton )
+  if(shadowButton)
   {
-    ShadowButton& impl = GetImpl( shadowButton );
-    switch ( propertyIndex )
+    ShadowButton& impl = GetImpl(shadowButton);
+    switch(propertyIndex)
     {
       case Demo::ShadowButton::Property::BACKGROUND_VISUAL:
       {
@@ -558,6 +553,5 @@ Property::Value ShadowButton::GetProperty( BaseObject* object, Property::Index p
   return value;
 }
 
-
-} // Internal
-} // Demo
+} // namespace Internal
+} // namespace Demo