Fix property notificaition's bug for SIZE
[platform/core/uifw/dali-core.git] / dali / internal / update / common / scene-graph-property-notification.cpp
index ed33b3c..57a78eb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -39,9 +39,10 @@ PropertyNotification* PropertyNotification::New(Object& object,
                                                 int componentIndex,
                                                 ConditionType condition,
                                                 RawArgumentContainer& arguments,
-                                                NotifyMode notifyMode)
+                                                NotifyMode notifyMode,
+                                                bool compare)
 {
-  return new PropertyNotification( object, propertyIndex, propertyType, componentIndex, condition, arguments, notifyMode );
+  return new PropertyNotification( object, propertyIndex, propertyType, componentIndex, condition, arguments, notifyMode, compare );
 }
 
 
@@ -51,7 +52,8 @@ PropertyNotification::PropertyNotification(Object& object,
                                            int componentIndex,
                                            ConditionType condition,
                                            RawArgumentContainer& arguments,
-                                           NotifyMode notifyMode)
+                                           NotifyMode notifyMode,
+                                           bool compare)
 : mObject(&object),
   mPropertyIndex(propertyIndex),
   mPropertyType(propertyType),
@@ -60,7 +62,8 @@ PropertyNotification::PropertyNotification(Object& object,
   mConditionType(condition),
   mArguments(arguments),
   mValid(false),
-  mNotifyMode( Dali::PropertyNotification::Disabled )
+  mNotifyMode( Dali::PropertyNotification::Disabled ),
+  mConditionFunction(NULL)
 {
   SetNotifyMode(notifyMode);
 
@@ -88,7 +91,14 @@ PropertyNotification::PropertyNotification(Object& object,
     }
     case PropertyCondition::Step:
     {
-      mConditionFunction = Step::GetFunction(mPropertyType);
+      if( compare == true )
+      {
+        mConditionFunction = Step::GetCompareFunction(mPropertyType);
+      }
+      else
+      {
+        mConditionFunction = Step::GetFunction(mPropertyType);
+      }
       break;
     }
     case PropertyCondition::VariableStep:
@@ -134,8 +144,8 @@ bool PropertyNotification::Check( BufferIndex bufferIndex )
   if ( Property::INVALID_COMPONENT_INDEX != mComponentIndex )
   {
     // Evaluate Condition
-    const PropertyInputComponentAccessor component( mProperty, mComponentIndex );
-    const PropertyInputIndexer< PropertyInputComponentAccessor > input( bufferIndex, &component );
+    const PropertyInputAccessor component( mProperty, mComponentIndex );
+    const PropertyInputIndexer< PropertyInputAccessor > input( bufferIndex, &component );
     currentValid = mConditionFunction(input, mArguments);
   }
   else
@@ -146,8 +156,8 @@ bool PropertyNotification::Check( BufferIndex bufferIndex )
   }
 
   if( mValid != currentValid
-      || (currentValid && ((mConditionType == PropertyCondition::Step)
-                        || (mConditionType == PropertyCondition::VariableStep))) )
+      || ( currentValid && ( ( mConditionType == PropertyCondition::Step )
+                        || ( mConditionType == PropertyCondition::VariableStep ) ) ) )
   {
     mValid = currentValid;
     //  means don't notify so notifyRequired stays false