2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/event/object/custom-object-internal.h>
22 #include <dali/internal/event/common/stage-impl.h>
23 #include <dali/internal/update/common/animatable-property.h>
24 #include <dali/internal/update/common/property-owner.h>
25 #include <dali/internal/update/manager/update-manager.h>
26 #include <dali/internal/update/animation/scene-graph-constraint-base.h>
28 using Dali::Internal::SceneGraph::PropertyOwner;
29 using Dali::Internal::SceneGraph::PropertyBase;
30 using Dali::Internal::SceneGraph::UpdateManager;
31 using Dali::Internal::SceneGraph::AnimatableProperty;
39 CustomObject* CustomObject::New()
41 return new CustomObject();
44 const SceneGraph::PropertyOwner* CustomObject::GetSceneObject() const
49 const PropertyBase* CustomObject::GetSceneObjectAnimatableProperty( Property::Index index ) const
51 CustomPropertyMetadata* custom = FindCustomProperty( index );
52 DALI_ASSERT_ALWAYS( custom && "Property index is invalid" );
53 return custom->GetSceneGraphProperty();
56 const PropertyInputImpl* CustomObject::GetSceneObjectInputProperty( Property::Index index ) const
58 return GetSceneObjectAnimatableProperty( index );
61 unsigned int CustomObject::GetDefaultPropertyCount() const
66 void CustomObject::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
70 const char* CustomObject::GetDefaultPropertyName( Property::Index index ) const
75 Property::Index CustomObject::GetDefaultPropertyIndex(const std::string& name) const
77 return Property::INVALID_INDEX;
80 bool CustomObject::IsDefaultPropertyWritable(Property::Index index) const
85 bool CustomObject::IsDefaultPropertyAnimatable(Property::Index index) const
90 bool CustomObject::IsDefaultPropertyAConstraintInput( Property::Index index ) const
95 Property::Type CustomObject::GetDefaultPropertyType(Property::Index index) const
97 return Property::NONE;
100 void CustomObject::SetDefaultProperty( Property::Index index, const Property::Value& property )
105 Property::Value CustomObject::GetDefaultProperty(Property::Index index) const
107 return Property::Value();
110 CustomObject::~CustomObject()
112 // Guard to allow handle destruction after Core has been destroyed
113 if( Stage::IsInstalled() )
115 if( NULL != mUpdateObject )
117 RemoveObjectMessage( GetEventThreadServices().GetUpdateManager(), mUpdateObject );
118 mUpdateObject = NULL; // object is about to be destroyed
123 CustomObject::CustomObject()
125 PropertyOwner* updateObject = PropertyOwner::New();
127 // Pass ownership to the update-thread
128 AddObjectMessage( GetEventThreadServices().GetUpdateManager(), updateObject );
130 // Keep as const since this should only be modified from update-thread
131 mUpdateObject = updateObject;
134 } // namespace Internal