1 #ifndef DALI_INTERNAL_OBJECT_IMPL_HELPER_H
2 #define DALI_INTERNAL_OBJECT_IMPL_HELPER_H
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/property.h> // Dali::Property
23 #include <dali/public-api/object/property-index-ranges.h> // DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX
24 #include <dali/internal/event/common/property-helper.h> // Dali::Internal::PropertyDetails
30 class PropertyMetadata;
31 class PropertyInputImpl;
40 } // namespace SceneGraph
43 * Helper template class to be used by class that implement Object
47 * typename ObjectImplHelper<DEFAULT_PROPERTY_COUNT, DEFAULT_PROPERTY_DETAILS> MyObjectImpl;
49 * MyObjectImpl::GetDefaultPropertyCount();
53 template<int DEFAULT_PROPERTY_COUNT>
54 struct ObjectImplHelper
56 const PropertyDetails* DEFAULT_PROPERTY_DETAILS;
58 unsigned int GetDefaultPropertyCount() const
60 return DEFAULT_PROPERTY_COUNT;
63 void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
65 indices.reserve( DEFAULT_PROPERTY_COUNT );
67 for( unsigned int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
69 indices.push_back( DEFAULT_OBJECT_PROPERTY_START_INDEX + i );
73 const char* GetDefaultPropertyName( Property::Index index ) const
75 const char* name = NULL;
77 if( index >= DEFAULT_OBJECT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
79 name = DEFAULT_PROPERTY_DETAILS[index].name;
85 Property::Index GetDefaultPropertyIndex( const std::string& name ) const
87 Property::Index index = Property::INVALID_INDEX;
89 // Look for name in default properties
90 for( unsigned int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
92 const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
93 if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
103 bool IsDefaultPropertyWritable( Property::Index index ) const
105 bool isWritable = false;
107 if( index >= DEFAULT_OBJECT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
109 isWritable = DEFAULT_PROPERTY_DETAILS[index].writable;
115 bool IsDefaultPropertyAnimatable( Property::Index index ) const
117 bool isAnimatable = false;
119 if( index >= DEFAULT_OBJECT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
121 isAnimatable = DEFAULT_PROPERTY_DETAILS[index].animatable;
127 bool IsDefaultPropertyAConstraintInput( Property::Index index ) const
129 bool isConstraintInput = false;
131 if( index >= DEFAULT_OBJECT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
133 isConstraintInput = DEFAULT_PROPERTY_DETAILS[index].constraintInput;
136 return isConstraintInput;
139 Property::Type GetDefaultPropertyType( Property::Index index ) const
141 Property::Type type = Property::NONE;
143 if( index >= DEFAULT_OBJECT_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
145 type = DEFAULT_PROPERTY_DETAILS[index].type;
151 void SetDefaultProperty( Property::Index index,
152 const Property::Value& property ) const
155 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
158 void SetSceneGraphProperty( Property::Index index,
159 const PropertyMetadata& entry,
160 const Property::Value& value ) const
163 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
166 Property::Value GetDefaultProperty( Property::Index index ) const
168 Property::Value value;
171 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
176 const SceneGraph::PropertyOwner* GetPropertyOwner() const
179 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
183 const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const
186 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
190 const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const
193 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
197 int GetPropertyComponentIndex( Property::Index index ) const
200 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
208 } // namespace Internal
212 #endif // DALI_INTERNAL_OBJECT_IMPL_HELPER_H