#include <stdlib.h>
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/object/handle-devel.h>
#include "dali-test-suite-utils/dali-test-suite-utils.h"
#include <mesh-builder.h>
const float withFlake(99.f);
Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
- Property::Index index2 = actor.RegisterProperty( key1, "sideColor", testColor);
+ Property::Index index2 = DevelHandle::RegisterProperty( actor, key1, "sideColor", testColor);
Property::Index index3 = actor.RegisterProperty( "MyPropertyTwo", Vector3::ONE );
- Property::Index index4 = actor.RegisterProperty( key2, "iceCream", withFlake );
+ Property::Index index4 = DevelHandle::RegisterProperty( actor, key2, "iceCream", withFlake );
Property::Index index5 = actor.RegisterProperty( "MyPropertyThree", Vector3::ONE );
application.SendNotification();
application.Render();
// Test that we can get the property index from the integer key
- Property::Index testIndex1 = actor.GetPropertyIndex( key1 );
- Property::Index testIndex2 = actor.GetPropertyIndex( key2 );
+ Property::Index testIndex1 = DevelHandle::GetPropertyIndex( actor, key1 );
+ Property::Index testIndex2 = DevelHandle::GetPropertyIndex( actor, key2 );
DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION );
DALI_TEST_EQUALS( index4, testIndex2, TEST_LOCATION );
std::string myName("croydon");
Property::Index intKey = CORE_PROPERTY_MAX_INDEX+1;
Property::Value value( Color::GREEN );
- Property::Index myIndex = actor.RegisterProperty( intKey, myName, value );
+ Property::Index myIndex = DevelHandle::RegisterProperty( actor, intKey, myName, value );
- DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( intKey ), TEST_LOCATION );
+ DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, intKey ), TEST_LOCATION );
Property::Key key1(myName);
Property::Key key2(intKey);
- DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( key1 ), TEST_LOCATION );
- DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( key2 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, key1 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( myIndex, DevelHandle::GetPropertyIndex( actor, key2 ), TEST_LOCATION );
END_TEST;
}
const float withFlake(99.f);
Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
- Property::Index index2 = actor.RegisterProperty( key1, "sideColor", testColor);
- Property::Index index3 = actor.RegisterProperty( key2, "iceCream", withFlake );
+ Property::Index index2 = DevelHandle::RegisterProperty( actor, key1, "sideColor", testColor);
+ Property::Index index3 = DevelHandle::RegisterProperty( actor, key2, "iceCream", withFlake );
application.SendNotification();
application.Render();
Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
- actor.RegisterProperty( key1, "sideColor", testColor);
+ DevelHandle::RegisterProperty( actor, key1, "sideColor", testColor);
actor.RegisterProperty( "MyPropertyTwo", 1234 );
- Property::Index index4 = actor.RegisterProperty( key2, "iceCream", withFlake );
+ Property::Index index4 = DevelHandle::RegisterProperty( actor, key2, "iceCream", withFlake );
actor.RegisterProperty( "MyPropertyThree", Vector2(.2f,.7f) );
actor.GetPropertyIndices( indices );
$(devel_api_src_dir)/images/distance-field.cpp \
$(devel_api_src_dir)/images/texture-set-image.cpp \
$(devel_api_src_dir)/images/nine-patch-image.cpp \
+ $(devel_api_src_dir)/object/handle-devel.cpp \
$(devel_api_src_dir)/object/weak-handle.cpp \
$(devel_api_src_dir)/object/csharp-type-registry.cpp \
$(devel_api_src_dir)/scripting/scripting.cpp \
$(devel_api_src_dir)/images/nine-patch-image.h
devel_api_core_object_header_files = \
- $(devel_api_src_dir)/object/weak-handle.h \
$(devel_api_src_dir)/object/csharp-type-info.h \
- $(devel_api_src_dir)/object/csharp-type-registry.h
+ $(devel_api_src_dir)/object/csharp-type-registry.h \
+ $(devel_api_src_dir)/object/handle-devel.h \
+ $(devel_api_src_dir)/object/weak-handle.h
devel_api_core_rendering_header_files = \
$(devel_api_src_dir)/rendering/renderer-devel.h
--- /dev/null
+/*
+ * 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.
+ *
+ */
+
+// FILE HEADER
+#include <dali/devel-api/object/handle-devel.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/object/property-key.h>
+#include <dali/internal/event/common/object-impl.h>
+
+namespace Dali
+{
+
+namespace DevelHandle
+{
+
+Property::Index GetPropertyIndex( const Handle& handle, Property::Index key )
+{
+ return GetImplementation( handle ).GetPropertyIndex( key );
+}
+
+Property::Index GetPropertyIndex( const Handle& handle, Property::Key key )
+{
+ return GetImplementation( handle ).GetPropertyIndex( key );
+}
+
+Property::Index RegisterProperty( Handle handle, Property::Index key, const std::string& name, const Property::Value& propertyValue )
+{
+ return GetImplementation( handle ).RegisterProperty( name, key, propertyValue );
+}
+
+} // namespace DevelHandle
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_HANDLE_DEVEL_H
+#define DALI_HANDLE_DEVEL_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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/object/handle.h>
+
+namespace Dali
+{
+
+namespace DevelHandle
+{
+
+/**
+ * @brief Query the index of a custom property matching the given key.
+ *
+ * Returns the first custom property that matches the given integer key. This is
+ * useful for other classes that know the key but not the name. Requires the property
+ * to have been registered with the associated key.
+ *
+ * @note This key is not the same as the Property enum found in
+ * objects such as Actor (which is a preset index).
+ *
+ * @param[in] handle The handle from where to retrieve the property index.
+ * @param[in] key The integer key of the property
+ *
+ * @return The index of the property, or Property::INVALID_INDEX if no property exists with the given key.
+ *
+ * @note The key is not the same as the returned index, though it has the same type.
+ */
+DALI_IMPORT_API Property::Index GetPropertyIndex( const Handle& handle, Property::Index key );
+
+/**
+ * @brief Query the index of a property using the given key from a Property::Map
+ *
+ * @param[in] handle The handle from where to retrieve the property index.
+ * @param[in] key The key of the property to search for.
+ *
+ * @return the matching property index of either the string key or the matching
+ * custom property index of the index key, or Property::INVALID_INDEX if no
+ * property matches the given key.
+ *
+ * @note See also, GetPropertyIndex(Property::Index) and GetPropertyIndex(const std::string&)
+ */
+DALI_IMPORT_API Property::Index GetPropertyIndex( const Handle& handle, Property::Key key );
+
+/**
+ * @brief Register a new animatable property with an integer key.
+ *
+ * @param[in] handle The handle where to register the property.
+ * @param[in] key The integer key of the property.
+ * @param[in] name The text key of the property.
+ * @param[in] propertyValue The new value of the property.
+ *
+ * @return The index of the property or Property::INVALID_INDEX if registration failed
+ *
+ * @pre The object supports dynamic properties i.e. Supports(Handle::DYNAMIC_PROPERTIES) returns true.
+ * Property names and keys are expected to be unique, but this is not enforced.
+ * Property indices are unique to each registered custom property in a given object.
+ *
+ * @note Returns Property::INVALID_INDEX if registration failed. This can happen if you try to register
+ * animatable property on an object that does not have scene graph object.
+ *
+ * @note The returned property index is not the same as the integer key (though it shares a type)
+ *
+ * This version of RegisterProperty associates both an integer key
+ * and the text key with the property, allowing for lookup of the
+ * property index by either key or name ( which is useful when other
+ * classes know the key but not the name )
+ *
+ * @note Only the following types can be animated:
+ * - Property::BOOLEAN
+ * - Property::FLOAT
+ * - Property::INTEGER
+ * - Property::VECTOR2
+ * - Property::VECTOR3
+ * - Property::VECTOR4
+ * - Property::MATRIX3
+ * - Property::MATRIX
+ * - Property::ROTATION
+ * @note If a property with the desired name already exists, then the value given is just set.
+ */
+DALI_IMPORT_API Property::Index RegisterProperty( Handle handle, Property::Index key, const std::string& name, const Property::Value& propertyValue );
+
+} // namespace DevelHandle
+
+} // namespace Dali
+
+#endif // DALI_HANDLE_DEVEL_H
return GetImplementation(*this).GetPropertyIndex( name );
}
-Property::Index Handle::GetPropertyIndex( Property::Index key ) const
-{
- return GetImplementation(*this).GetPropertyIndex( key );
-}
-
-Property::Index Handle::GetPropertyIndex( Property::Key key ) const
-{
- return GetImplementation(*this).GetPropertyIndex( key );
-}
-
bool Handle::IsPropertyWritable( Property::Index index ) const
{
return GetImplementation(*this).IsPropertyWritable( index );
return GetImplementation(*this).RegisterProperty( name, propertyValue );
}
-Property::Index Handle::RegisterProperty( Property::Index key, const std::string& name, const Property::Value& propertyValue )
-{
- return GetImplementation(*this).RegisterProperty( name, key, propertyValue );
-}
-
Property::Index Handle::RegisterProperty( const std::string& name, const Property::Value& propertyValue, Property::AccessMode accessMode )
{
return GetImplementation(*this).RegisterProperty( name, propertyValue, accessMode );
Property::Index GetPropertyIndex( const std::string& name ) const;
/**
- * @brief Query the index of a custom property matching the given key.
- *
- * Returns the first custom property that matches the given integer key. This is
- * useful for other classes that know the key but not the name. Requires the property
- * to have been registered with the associated key.
- *
- * @note This key is not the same as the Property enum found in
- * objects such as Actor (which is a preset index).
- *
- * @SINCE_1_2.1
- * @param [in] key The integer key of the property
- * @return The index of the property, or Property::INVALID_INDEX if no property exists with the given key.
- * @note The key is not the same as the returned index, though it has the same type.
- */
- Property::Index GetPropertyIndex( Property::Index key ) const;
-
- /**
- * @brief Query the index of a property using the given key from a Property::Map
- * @SINCE_1_2.7
- *
- * @param[in] key The key of the property to search for.
- * @return the matching property index of either the string key or the matching
- * custom property index of the index key, or Property::INVALID_INDEX if no
- * property matches the given key.
- *
- * @note See also, GetPropertyIndex(Property::Index) and GetPropertyIndex(const std::string&)
- */
- Property::Index GetPropertyIndex( Property::Key key ) const;
-
- /**
* @brief Query whether a property can be set using SetProperty().
*
* @SINCE_1_0.0
Property::Index RegisterProperty( const std::string& name, const Property::Value& propertyValue );
/**
- * @brief Register a new animatable property with an integer key.
- *
- * @SINCE_1_2.1
- * @param [in] key The integer key of the property.
- * @param [in] name The text key of the property.
- * @param [in] propertyValue The new value of the property.
- * @return The index of the property or Property::INVALID_INDEX if registration failed
- * @pre The object supports dynamic properties i.e. Supports(Handle::DYNAMIC_PROPERTIES) returns true.
- * Property names and keys are expected to be unique, but this is not enforced.
- * Property indices are unique to each registered custom property in a given object.
- * @note Returns Property::INVALID_INDEX if registration failed. This can happen if you try to register
- * animatable property on an object that does not have scene graph object.
- * @note The returned property index is not the same as the integer key (though it shares a type)
- *
- * This version of RegisterProperty associates both an integer key
- * and the text key with the property, allowing for lookup of the
- * property index by either key or name ( which is useful when other
- * classes know the key but not the name )
- *
- * @note Only the following types can be animated:
- * - Property::BOOLEAN
- * - Property::FLOAT
- * - Property::INTEGER
- * - Property::VECTOR2
- * - Property::VECTOR3
- * - Property::VECTOR4
- * - Property::MATRIX3
- * - Property::MATRIX
- * - Property::ROTATION
- * @note If a property with the desired name already exists, then the value given is just set.
- */
- Property::Index RegisterProperty( Property::Index key, const std::string& name, const Property::Value& propertyValue );
-
- /**
* @brief Register a new property.
*
* Properties can be set as non animatable using property attributes.