-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <dali/internal/event/common/proxy-object.h>
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/internal/event/common/object-impl.h>
#include <dali/internal/event/animation/property-constraint.h>
#include <dali/internal/event/animation/property-input-accessor.h>
#include <dali/internal/event/animation/property-input-indexer.h>
#include <dali/internal/update/common/scene-graph-property-notification.h>
#include <dali/internal/update/common/property-condition-functions.h>
-using namespace std;
-
namespace Dali
{
namespace SceneGraph
{
-PropertyNotification* PropertyNotification::New(ProxyObject& proxy,
+PropertyNotification* PropertyNotification::New(Object& object,
Property::Index propertyIndex,
Property::Type propertyType,
int componentIndex,
ConditionType condition,
- const RawArgumentContainer& arguments,
+ RawArgumentContainer& arguments,
NotifyMode notifyMode)
{
- return new PropertyNotification( proxy, propertyIndex, propertyType, componentIndex, condition, arguments, notifyMode );
+ return new PropertyNotification( object, propertyIndex, propertyType, componentIndex, condition, arguments, notifyMode );
}
-PropertyNotification::PropertyNotification(ProxyObject& proxy,
+PropertyNotification::PropertyNotification(Object& object,
Property::Index propertyIndex,
Property::Type propertyType,
int componentIndex,
ConditionType condition,
- const RawArgumentContainer& arguments,
+ RawArgumentContainer& arguments,
NotifyMode notifyMode)
-: mProxy(&proxy),
+: mObject(&object),
mPropertyIndex(propertyIndex),
mPropertyType(propertyType),
mProperty(NULL),
mComponentIndex(componentIndex),
mConditionType(condition),
mArguments(arguments),
- mValid(false)
+ mValid(false),
+ mNotifyMode( Dali::PropertyNotification::Disabled ),
+ mConditionFunction(NULL)
{
SetNotifyMode(notifyMode);
mConditionFunction = Outside::GetFunction(mPropertyType);
break;
}
- case PropertyCondition::False:
+ case PropertyCondition::Step:
{
- mConditionFunction = PropertyNotification::EvalFalse;
+ mConditionFunction = Step::GetFunction(mPropertyType);
+ break;
+ }
+ case PropertyCondition::VariableStep:
+ {
+ mConditionFunction = VariableStep::GetFunction(mPropertyType);
break;
}
- default:
+ case PropertyCondition::False:
{
- DALI_ASSERT_ALWAYS(false && "Unrecognized ConditionType");
+ mConditionFunction = PropertyNotification::EvalFalse;
break;
}
}
- mProperty = mProxy->GetSceneObjectInputProperty( mPropertyIndex );
- int internalComponentIndex = mProxy->GetPropertyComponentIndex(mPropertyIndex);
- if( internalComponentIndex != INVALID_PROPERTY_COMPONENT_INDEX )
+ mProperty = mObject->GetSceneObjectInputProperty( mPropertyIndex );
+ int internalComponentIndex = mObject->GetPropertyComponentIndex(mPropertyIndex);
+ if( internalComponentIndex != Property::INVALID_COMPONENT_INDEX )
{
// override the one passed in
mComponentIndex = internalComponentIndex;
{
}
-bool PropertyNotification::EvalFalse( const Dali::PropertyInput& value, const RawArgumentContainer& arg )
+bool PropertyNotification::EvalFalse( const Dali::PropertyInput& value, RawArgumentContainer& arg )
{
return false;
}
void PropertyNotification::SetNotifyMode( NotifyMode notifyMode )
{
- switch(notifyMode)
- {
- case Dali::PropertyNotification::Disabled:
- {
- mNotifyValidity[0] = false;
- mNotifyValidity[1] = false;
- break;
- }
- case Dali::PropertyNotification::NotifyOnTrue:
- {
- mNotifyValidity[0] = false;
- mNotifyValidity[1] = true;
- break;
- }
- case Dali::PropertyNotification::NotifyOnFalse:
- {
- mNotifyValidity[0] = true;
- mNotifyValidity[1] = false;
- break;
- }
- case Dali::PropertyNotification::NotifyOnChanged:
- {
- mNotifyValidity[0] = true;
- mNotifyValidity[1] = true;
- break;
- }
- }
+ mNotifyMode = notifyMode;
}
bool PropertyNotification::Check( BufferIndex bufferIndex )
{
- bool validityChanged = false;
+ bool notifyRequired = false;
bool currentValid = false;
- if ( INVALID_PROPERTY_COMPONENT_INDEX != mComponentIndex )
+ 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
currentValid = mConditionFunction(input, mArguments);
}
- if( mValid != currentValid )
+ if( mValid != currentValid
+ || (currentValid && ((mConditionType == PropertyCondition::Step)
+ || (mConditionType == PropertyCondition::VariableStep))) )
{
mValid = currentValid;
- validityChanged = mNotifyValidity[currentValid];
+ // means don't notify so notifyRequired stays false
+ switch( mNotifyMode )
+ {
+ case Dali::PropertyNotification::Disabled:
+ {
+ // notify never, already initialized to false
+ break;
+ }
+ case Dali::PropertyNotification::NotifyOnTrue:
+ {
+ notifyRequired = mValid; // notify if value is true
+ break;
+ }
+ case Dali::PropertyNotification::NotifyOnFalse:
+ {
+ notifyRequired = !mValid; // notify when its false
+ break;
+ }
+ case Dali::PropertyNotification::NotifyOnChanged:
+ {
+ notifyRequired = true; // notify whenever changed
+ break;
+ }
+ }
}
- return validityChanged;
+ return notifyRequired;
}
bool PropertyNotification::GetValidity() const