Update the preferred size after relayoutting
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-property-handler.cpp
index 111a088..cce13c8 100644 (file)
@@ -25,6 +25,7 @@
 #include <dali/devel-api/actors/actor-devel.h>
 
 #include <dali/internal/event/actors/actor-impl.h>
+#include <dali/internal/event/actors/actor-relayouter.h>
 #include <dali/internal/event/common/property-helper.h>
 #include <dali/internal/update/nodes/node-declarations.h>
 #include <dali/internal/update/nodes/node-messages.h>
@@ -536,7 +537,7 @@ void Actor::PropertyHandler::SetDefaultProperty(Internal::Actor& actor, Property
 
       if(Scripting::GetEnumerationProperty<LayoutDirection::Type>(property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction))
       {
-        actor.InheritLayoutDirectionRecursively(direction, true);
+        actor.mParentImpl.InheritLayoutDirectionRecursively(direction, true);
       }
       break;
     }
@@ -597,6 +598,26 @@ void Actor::PropertyHandler::SetDefaultProperty(Internal::Actor& actor, Property
       break;
     }
 
+    case Dali::DevelActor::Property::TOUCH_FOCUSABLE:
+    {
+      bool value = false;
+      if(property.Get(value))
+      {
+        actor.SetTouchFocusable(value);
+      }
+      break;
+    }
+
+    case Dali::DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN:
+    {
+      bool value = false;
+      if(property.Get(value))
+      {
+        actor.SetKeyboardFocusableChildren(value);
+      }
+      break;
+    }
+
     default:
     {
       // this can happen in the case of a non-animatable default property so just do nothing
@@ -781,6 +802,12 @@ void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& a
             actor.mAnimatedSize    = actor.mTargetSize;
             actor.mUseAnimatedSize = AnimatedSizeFlag::WIDTH | AnimatedSizeFlag::HEIGHT | AnimatedSizeFlag::DEPTH;
 
+            if(actor.mRelayoutData && !actor.mRelayoutData->relayoutRequested)
+            {
+              actor.mRelayoutData->preferredSize.width  = actor.mAnimatedSize.width;
+              actor.mRelayoutData->preferredSize.height = actor.mAnimatedSize.height;
+            }
+
             // Notify deriving classes
             actor.OnSizeAnimation(animation, actor.mTargetSize);
           }
@@ -794,6 +821,11 @@ void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& a
             actor.mAnimatedSize.width = actor.mTargetSize.width;
             actor.mUseAnimatedSize |= AnimatedSizeFlag::WIDTH;
 
+            if(actor.mRelayoutData && !actor.mRelayoutData->relayoutRequested)
+            {
+              actor.mRelayoutData->preferredSize.width = actor.mAnimatedSize.width;
+            }
+
             // Notify deriving classes
             actor.OnSizeAnimation(animation, actor.mTargetSize);
           }
@@ -807,6 +839,11 @@ void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& a
             actor.mAnimatedSize.height = actor.mTargetSize.height;
             actor.mUseAnimatedSize |= AnimatedSizeFlag::HEIGHT;
 
+            if(actor.mRelayoutData && !actor.mRelayoutData->relayoutRequested)
+            {
+              actor.mRelayoutData->preferredSize.height = actor.mAnimatedSize.height;
+            }
+
             // Notify deriving classes
             actor.OnSizeAnimation(animation, actor.mTargetSize);
           }
@@ -937,6 +974,12 @@ void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& a
             actor.mAnimatedSize    = actor.mTargetSize;
             actor.mUseAnimatedSize = AnimatedSizeFlag::WIDTH | AnimatedSizeFlag::HEIGHT | AnimatedSizeFlag::DEPTH;
 
+            if(actor.mRelayoutData && !actor.mRelayoutData->relayoutRequested)
+            {
+              actor.mRelayoutData->preferredSize.width  = actor.mAnimatedSize.width;
+              actor.mRelayoutData->preferredSize.height = actor.mAnimatedSize.height;
+            }
+
             // Notify deriving classes
             actor.OnSizeAnimation(animation, actor.mTargetSize);
           }
@@ -950,6 +993,11 @@ void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& a
             actor.mAnimatedSize.width = actor.mTargetSize.width;
             actor.mUseAnimatedSize |= AnimatedSizeFlag::WIDTH;
 
+            if(actor.mRelayoutData && !actor.mRelayoutData->relayoutRequested)
+            {
+              actor.mRelayoutData->preferredSize.width = actor.mAnimatedSize.width;
+            }
+
             // Notify deriving classes
             actor.OnSizeAnimation(animation, actor.mTargetSize);
           }
@@ -963,6 +1011,11 @@ void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& a
             actor.mAnimatedSize.height = actor.mTargetSize.height;
             actor.mUseAnimatedSize |= AnimatedSizeFlag::HEIGHT;
 
+            if(actor.mRelayoutData && !actor.mRelayoutData->relayoutRequested)
+            {
+              actor.mRelayoutData->preferredSize.height = actor.mAnimatedSize.height;
+            }
+
             // Notify deriving classes
             actor.OnSizeAnimation(animation, actor.mTargetSize);
           }
@@ -1646,6 +1699,18 @@ bool Actor::PropertyHandler::GetCachedPropertyValue(const Internal::Actor& actor
       break;
     }
 
+    case Dali::DevelActor::Property::TOUCH_FOCUSABLE:
+    {
+      value = actor.IsTouchFocusable();
+      break;
+    }
+
+    case Dali::DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN:
+    {
+      value = actor.AreChildrenKeyBoardFocusable();
+      break;
+    }
+
     default:
     {
       // Must be a scene-graph only property