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
32 class PropertyInputImpl;
41 } // namespace SceneGraph
44 * Helper template class to be used by class that implement Object
48 * typename ObjectImplHelper<DEFAULT_PROPERTY_COUNT, DEFAULT_PROPERTY_DETAILS> MyObjectImpl;
50 * MyObjectImpl::GetDefaultPropertyCount();
54 template<size_t DEFAULT_PROPERTY_COUNT>
55 struct ObjectImplHelper
57 const PropertyDetails* DEFAULT_PROPERTY_DETAILS;
59 unsigned int GetDefaultPropertyCount() const
61 return DEFAULT_PROPERTY_COUNT;
64 void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const
66 indices.reserve( DEFAULT_PROPERTY_COUNT );
68 for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
70 indices.push_back( DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX + i );
74 const char* GetDefaultPropertyName( Property::Index index ) const
76 const char* name = NULL;
78 if( index >= DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
80 name = DEFAULT_PROPERTY_DETAILS[index].name;
86 Property::Index GetDefaultPropertyIndex( const std::string& name ) const
88 Property::Index index = Property::INVALID_INDEX;
90 // Look for name in default properties
91 for( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i )
93 const Internal::PropertyDetails* property = &DEFAULT_PROPERTY_DETAILS[ i ];
94 if( 0 == strcmp( name.c_str(), property->name ) ) // dont want to convert rhs to string
104 bool IsDefaultPropertyWritable( Property::Index index ) const
106 bool isWritable = false;
108 if( index >= DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
110 isWritable = DEFAULT_PROPERTY_DETAILS[index].writable;
116 bool IsDefaultPropertyAnimatable( Property::Index index ) const
118 bool isAnimatable = false;
120 if( index >= DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
122 isAnimatable = DEFAULT_PROPERTY_DETAILS[index].animatable;
128 bool IsDefaultPropertyAConstraintInput( Property::Index index ) const
130 bool isConstraintInput = false;
132 if( index >= DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
134 isConstraintInput = DEFAULT_PROPERTY_DETAILS[index].constraintInput;
137 return isConstraintInput;
140 Property::Type GetDefaultPropertyType( Property::Index index ) const
142 Property::Type type = Property::NONE;
144 if( index >= DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX && index < DEFAULT_PROPERTY_COUNT )
146 type = DEFAULT_PROPERTY_DETAILS[index].type;
152 void SetDefaultProperty( Property::Index index,
153 const Property::Value& property ) const
156 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
159 void SetSceneGraphProperty( Property::Index index,
160 const CustomProperty& entry,
161 const Property::Value& value ) const
164 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
167 Property::Value GetDefaultProperty( Property::Index index ) const
169 Property::Value value;
172 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
177 const SceneGraph::PropertyOwner* GetPropertyOwner() const
180 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
184 const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const
187 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
191 const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const
194 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
198 int GetPropertyComponentIndex( Property::Index index ) const
201 DALI_ASSERT_ALWAYS( false && "TODO: MESH_REWORK" );
209 } // namespace Internal
213 #endif // DALI_INTERNAL_OBJECT_IMPL_HELPER_H