New Popup implementation 88/44788/10
authorTom Robinson <tom.robinson@samsung.com>
Mon, 27 Jul 2015 16:18:31 +0000 (17:18 +0100)
committerTom Robinson <tom.robinson@samsung.com>
Tue, 4 Aug 2015 15:59:37 +0000 (16:59 +0100)
Change-Id: I8657560f0a83ef7beadf2a312096477ccb1fbb7a

automated-tests/src/dali-devel/CMakeLists.txt
automated-tests/src/dali-devel/utc-Dali-SignalDelegate.cpp [new file with mode: 0644]
build/tizen/dali-core/Makefile.am
dali/devel-api/animation/animation-data.cpp [new file with mode: 0644]
dali/devel-api/animation/animation-data.h [new file with mode: 0644]
dali/devel-api/file.list
dali/devel-api/scripting/scripting.cpp
dali/devel-api/scripting/scripting.h
dali/devel-api/signals/signal-delegate.cpp [new file with mode: 0644]
dali/devel-api/signals/signal-delegate.h [new file with mode: 0644]
dali/public-api/animation/animation.h

index 72d7fc5..a63f773 100644 (file)
@@ -20,6 +20,7 @@ SET(TC_SOURCES
         utc-Dali-PropertyBuffer.cpp
         utc-Dali-Renderer.cpp
         utc-Dali-Sampler.cpp
+        utc-Dali-SignalDelegate.cpp
         utc-Dali-Scripting.cpp
         utc-Dali-Shader.cpp
 )
diff --git a/automated-tests/src/dali-devel/utc-Dali-SignalDelegate.cpp b/automated-tests/src/dali-devel/utc-Dali-SignalDelegate.cpp
new file mode 100644 (file)
index 0000000..dc59cc6
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <iostream>
+#include <stdlib.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/signals/signal-delegate.h>
+#include <dali-test-suite-utils.h>
+
+using namespace Dali;
+
+
+void utc_dali_signal_delegate_startup(void)
+{
+  test_return_value = TET_UNDEF;
+}
+
+void utc_dali_signal_delegate_cleanup(void)
+{
+  test_return_value = TET_PASS;
+}
+
+// Test infrastructure:
+
+static bool gSignalReceived = false;
+
+/**
+ * This object allows us to test member function connection.
+ */
+class SignalDelegateTestClass : public Dali::ConnectionTracker
+{
+public:
+
+  SignalDelegateTestClass( Actor connectActor, std::string connectSignal )
+  {
+    mSignalDelegate = new SignalDelegate( connectActor, connectSignal );
+  }
+
+  void ConnectToInternalMember()
+  {
+    mSignalDelegate->Connect( this, &SignalDelegateTestClass::SignalHandlerMemberFunction );
+  }
+
+  bool IsConnected()
+  {
+    return mSignalDelegate->IsConnected();
+  }
+
+private:
+
+  void SignalHandlerMemberFunction()
+  {
+    tet_infoline( "Got signal in member function\n" );
+    gSignalReceived = true;
+  }
+
+  SignalDelegate* mSignalDelegate;
+};
+
+/**
+ * A connection tracker is required when connecting a signal delegate to a functor.
+ */
+class TestConnectionTrackerObject : public ConnectionTracker
+{
+};
+
+/**
+ * This functor is used to test the signal delegate's connect ( to functor ) method.
+ */
+struct SignalDelegateTestFunctor
+{
+  SignalDelegateTestFunctor()
+  {
+  }
+
+  void operator()()
+  {
+    gSignalReceived = true;
+  }
+};
+
+
+// Test cases:
+
+int UtcDaliSignalDelegateIsConnectedP(void)
+{
+  TestApplication application;
+  tet_infoline( " UtcDaliSignalDelegateIsConnectedP" );
+
+  // Set up an actor with a signal to connect to.
+  Actor connectActor = Actor::New();
+  std::string connectSignal = "on-stage";
+
+  // Create the test class (this will create the delegate, but not connect to it yet.
+  SignalDelegateTestClass testObject( connectActor, connectSignal );
+
+  // Tell the test class to connect the delegate to it's internal member.
+  // Note: It is at this point that the delegate internally makes the connection.
+  testObject.ConnectToInternalMember();
+
+  DALI_TEST_CHECK( testObject.IsConnected() );
+
+  END_TEST;
+}
+
+int UtcDaliSignalDelegateIsConnectedN(void)
+{
+  TestApplication application;
+  tet_infoline( " UtcDaliSignalDelegateIsConnectedN" );
+
+  // Set up an actor with a signal to connect to.
+  Actor connectActor = Actor::New();
+  std::string connectSignal = "on-stage";
+
+  // Create the test class (this will create the delegate, but not connect to it yet.
+  SignalDelegateTestClass testObject( connectActor, connectSignal );
+
+  DALI_TEST_CHECK( !testObject.IsConnected() );
+
+  END_TEST;
+}
+
+int UtcDaliSignalDelegateConnectToMemberP(void)
+{
+  TestApplication application;
+  tet_infoline( " UtcDaliSignalDelegateConnectToMemberP" );
+
+  // Set up an actor with a signal to connect to.
+  Actor connectActor = Actor::New();
+  std::string connectSignal = "on-stage";
+
+  gSignalReceived = false;
+
+  // Create the test class (this will create the delegate, but not connect to it yet.
+  SignalDelegateTestClass testObject( connectActor, connectSignal );
+
+  // Tell the test class to connect the delegate to it's internal member.
+  // Note: It is at this point that the delegate internally makes the connection.
+  testObject.ConnectToInternalMember();
+
+  // Add the actor to the stage to trigger it's "on-stage" signal.
+  // If the delegate connected correctly, this will call the member
+  // function in the test object and set a global flag.
+  Stage::GetCurrent().Add( connectActor );
+
+  // Check the global flag to confirm the signal was received.
+  DALI_TEST_CHECK( gSignalReceived );
+
+  END_TEST;
+}
+
+int UtcDaliSignalDelegateConnectToMemberN(void)
+{
+  TestApplication application;
+  tet_infoline( " UtcDaliSignalDelegateConnectToMemberN" );
+
+  // Set up an actor with a signal to connect to.
+  Actor connectActor = Actor::New();
+  std::string connectSignal = "on-stage";
+
+  gSignalReceived = false;
+
+  // Create the test class (this will create the delegate, but not connect to it yet.
+  SignalDelegateTestClass testObject( connectActor, connectSignal );
+
+  // Tell the test class to connect the delegate to it's internal member.
+  // Note: It is at this point that the delegate internally makes the connection.
+  testObject.ConnectToInternalMember();
+
+  // Check the global flag to confirm the signal was not received.
+  DALI_TEST_CHECK( !gSignalReceived );
+
+  END_TEST;
+}
+
+int UtcDaliSignalDelegateConnectToFunctorP(void)
+{
+  TestApplication application;
+  tet_infoline( " UtcDaliSignalDelegateConnectToFunctorP" );
+
+  // Set up an actor with a signal to connect to.
+  Actor connectActor = Actor::New();
+  std::string connectSignal = "on-stage";
+
+  // Initialise the signal delegate with the actor to connect to and it's signal.
+  SignalDelegate signalDelegate( connectActor, connectSignal );
+
+  // We need a connection tracker object to associated with the connection.
+  // This could normally be "this", but since we are not within a class, we pass
+  // in an external one.
+  TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject();
+
+  // Check the signal delegate currently has no connection.
+  DALI_TEST_CHECK( !signalDelegate.IsConnected() );
+
+  // Tell the signal delegate to connect to the given functor (via a functor delegate).
+  // Note: It is at this point that the delegate internally makes the connection.
+  signalDelegate.Connect( testTracker, FunctorDelegate::New( SignalDelegateTestFunctor() ) );
+
+  // Check the signal delegate has made the connection.
+  DALI_TEST_CHECK( signalDelegate.IsConnected() );
+
+  // Add the actor to the stage to trigger it's "on-stage" signal.
+  // If the delegate connected correctly, this will call the () operator of our
+  // passed-in functor, the functor will in turn set a global flag.
+  Stage::GetCurrent().Add( connectActor );
+
+  // Check the global flag to confirm the signal was received.
+  DALI_TEST_CHECK( gSignalReceived );
+
+  END_TEST;
+}
+
+int UtcDaliSignalDelegateConnectToFunctorN(void)
+{
+  TestApplication application;
+  tet_infoline( " UtcDaliSignalDelegateConnectToFunctorN" );
+
+  // Set up an actor with a signal to connect to.
+  Actor connectActor = Actor::New();
+  std::string connectSignal = "on-stage";
+
+  // Initialise the signal delegate with the actor to connect to and it's signal.
+  SignalDelegate signalDelegate( connectActor, connectSignal );
+
+  // We need a connection tracker object to associated with the connection.
+  // This could normally be "this", but since we are not within a class, we pass
+  // in an external one.
+  TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject();
+
+  // Check the signal delegate currently has no connection.
+  DALI_TEST_CHECK( !signalDelegate.IsConnected() );
+
+  // Tell the signal delegate to connect to the given functor (via a functor delegate).
+  // Note: It is at this point that the delegate internally makes the connection.
+  signalDelegate.Connect( testTracker, FunctorDelegate::New( SignalDelegateTestFunctor() ) );
+
+  // Check the signal delegate has made the connection.
+  DALI_TEST_CHECK( signalDelegate.IsConnected() );
+
+  // Check the global flag to confirm the signal was received.
+  DALI_TEST_CHECK( !gSignalReceived );
+
+  END_TEST;
+}
index 0f5f12e..9db8a2a 100644 (file)
@@ -90,6 +90,7 @@ develapimodelingdir = $(develapidir)/modeling
 develapiobjectdir = $(develapidir)/object
 develapirenderingdir = $(develapidir)/rendering
 develapiscriptingdir = $(develapidir)/scripting
+develapisignalsdir = $(develapidir)/signals
 
 develapi_HEADERS = $(devel_api_header_files)
 develapiactors_HEADERS = $(devel_api_core_actors_header_files)
@@ -101,7 +102,7 @@ develapimodeling_HEADERS = $(devel_api_core_modeling_header_files)
 develapiobject_HEADERS = $(devel_api_core_object_header_files)
 develapirendering_HEADERS = $(devel_api_core_rendering_header_files)
 develapiscripting_HEADERS = $(devel_api_core_scripting_header_files)
-
+develapisignals_HEADERS = $(devel_api_core_signals_header_files)
 
 
 #public api
diff --git a/dali/devel-api/animation/animation-data.cpp b/dali/devel-api/animation/animation-data.cpp
new file mode 100644 (file)
index 0000000..bd8c067
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/animation/animation-data.h>
+
+namespace Dali
+{
+
+
+AnimationData::AnimationData()
+{
+}
+
+AnimationData::~AnimationData()
+{
+  Clear();
+}
+
+
+void AnimationData::Add( AnimationDataElement* animationDataElement )
+{
+  mAnimationDataList.PushBack( animationDataElement );
+}
+
+
+Dali::Animation AnimationData::CreateAnimation( Dali::Actor targetActor, float duration )
+{
+  Dali::Animation animation;
+
+  if( mAnimationDataList.Size() > 0 )
+  {
+    animation = Dali::Animation::New( duration );
+
+    // Setup an Animation from AnimationData.
+    AnimationData::AnimationDataList::Iterator end = mAnimationDataList.End();
+    for( AnimationData::AnimationDataList::Iterator iter = mAnimationDataList.Begin(); iter != end; ++iter )
+    {
+      // Override the actor in the animation.
+      animation.AnimateTo( Property( targetActor, ( *iter )->property ), ( *iter )->value,
+          ( *iter )->alphaFunction, TimePeriod( ( *iter )->timePeriodDelay, ( *iter )->timePeriodDuration ) );
+    }
+  }
+
+  return animation;
+}
+
+
+void AnimationData::Clear()
+{
+  AnimationData::AnimationDataList::Iterator end = mAnimationDataList.End();
+  for( AnimationData::AnimationDataList::Iterator iter = mAnimationDataList.Begin(); iter != end; ++iter )
+  {
+    delete ( *iter );
+  }
+  mAnimationDataList.Clear();
+}
+
+
+} // namespace Dali
diff --git a/dali/devel-api/animation/animation-data.h b/dali/devel-api/animation/animation-data.h
new file mode 100644 (file)
index 0000000..c429149
--- /dev/null
@@ -0,0 +1,111 @@
+#ifndef __DALI_ANIMATION_DATA_H__
+#define __DALI_ANIMATION_DATA_H__
+
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/animation/alpha-function.h>
+#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/object/property-value.h>
+
+namespace Dali
+{
+
+/**
+ * @brief This object stores description data that can be used to generate an Animation.
+ * This data can be produced from passing JSON.
+ *
+ * This then allows the same description data to be used to repeatedly create an animation multiple times.
+ */
+class DALI_IMPORT_API AnimationData
+{
+public:
+
+  AnimationData();
+
+  ~AnimationData();
+
+  /**
+   * @brief AnimationDataElement Describes one part of an animation.
+   */
+  struct AnimationDataElement
+  {
+    std::string actor;
+    std::string property;
+    Property::Value value;
+    AlphaFunction::BuiltinFunction alphaFunction;
+    float timePeriodDelay;
+    float timePeriodDuration;
+
+    AnimationDataElement()
+    : alphaFunction( AlphaFunction::DEFAULT ),
+      timePeriodDelay( 0.0f ),
+      timePeriodDuration( 1.0f )
+    {
+    }
+  };
+
+
+  /**
+   * @brief AnimationData holds the required data required to define an
+   * animation to be performed on an actor or actors.
+   */
+  typedef Dali::Vector< AnimationDataElement* > AnimationDataList;
+
+
+  /**
+   * @brief Adds one AnimationDataElement to the list to describe one animation.
+   * @param[in] animationDataElement A pre-populated struct to add
+   */
+  void Add( AnimationDataElement* animationDataElement );
+
+
+  /**
+   * @brief Creates a Dali::Animation from this AnimationData object.
+   * The AnimationData object can describe multiple individual property animations.
+   * Each one will be added to a created animation.
+   *
+   * If there is no animation data defined, an invalid Dali::Animation handle is returned.
+   * @param[in] targetActor The actor to target the property animations to.
+   * @param[in] duration The duration of the animation to create.
+   * @return    A ready-to-go Dali::Animation, or an invalid handle if there was no data.
+   */
+  Dali::Animation CreateAnimation( Dali::Actor targetActor, float duration );
+
+
+  /**
+   * @brief Empties this AnimationData object (and frees all memory).
+   */
+  void Clear();
+
+private:
+
+  AnimationDataList mAnimationDataList; ///< A vector of individual property animations from which to generate a Dali::Animation.
+
+};
+
+
+} // namespace Dali
+
+#endif // __DALI_ANIMATION_DATA_H__
+
index bae25e7..967fc28 100644 (file)
@@ -1,6 +1,7 @@
 # Add devel source files here for DALi internal developer files used by Adaptor & Toolkit
 
 devel_api_src_files = \
+  $(devel_api_src_dir)/animation/animation-data.cpp \
   $(devel_api_src_dir)/animation/path-constrainer.cpp \
   $(devel_api_src_dir)/common/hash.cpp \
   $(devel_api_src_dir)/common/mutex.cpp \
@@ -14,11 +15,13 @@ devel_api_src_files = \
   $(devel_api_src_dir)/rendering/renderer.cpp \
   $(devel_api_src_dir)/rendering/sampler.cpp \
   $(devel_api_src_dir)/rendering/shader.cpp \
-  $(devel_api_src_dir)/scripting/scripting.cpp
+  $(devel_api_src_dir)/scripting/scripting.cpp \
+  $(devel_api_src_dir)/signals/signal-delegate.cpp
 
 # Add devel header files here DALi internal developer files used by Adaptor & Toolkit
 
 devel_api_core_animation_header_files = \
+  $(devel_api_src_dir)/animation/animation-data.h \
   $(devel_api_src_dir)/animation/path-constrainer.h
 
 devel_api_core_common_header_files = \
@@ -47,6 +50,9 @@ devel_api_core_rendering_header_files = \
   $(devel_api_src_dir)/rendering/sampler.h \
   $(devel_api_src_dir)/rendering/shader.h
 
+devel_api_core_signals_header_files = \
+  $(devel_api_src_dir)/signals/signal-delegate.h
+
 devel_api_core_scripting_header_files = \
   $(devel_api_src_dir)/scripting/scripting.h
 
index 98483c5..82be7cc 100644 (file)
@@ -672,6 +672,107 @@ void CreatePropertyMap( Image image, Property::Map& map )
   }
 }
 
+void NewAnimation( const Property::Map& map, Dali::AnimationData& outputAnimationData )
+{
+  // Note: Builder cannot currently pass generic Property::Maps "{" that are nested, so currently we can only have one AnimateTo per animation.
+  Dali::AnimationData::AnimationDataElement* element = new Dali::AnimationData::AnimationDataElement();
+  element->alphaFunction = AlphaFunction::LINEAR;
+  element->timePeriodDelay = 0.0f;
+  element->timePeriodDuration = 1.0f;
+
+  // Now set the properties, or create children
+  for( unsigned int i = 0, animationMapCount = map.Count(); i < animationMapCount; ++i )
+  {
+    const StringValuePair& pair( map.GetPair( i ) );
+    const std::string& key( pair.first );
+    const Property::Value& value( pair.second );
+
+    if( key == "actor" )
+    {
+      element->actor = value.Get< std::string >();
+    }
+    else if( key == "property" )
+    {
+      element->property = value.Get< std::string >();
+    }
+    else if( key == "value" )
+    {
+      element->value = value;
+    }
+    else if( key == "alpha-function" )
+    {
+      std::string alphaFunctionValue = value.Get< std::string >();
+
+      if( alphaFunctionValue == "LINEAR" )
+      {
+        element->alphaFunction = AlphaFunction::LINEAR;
+      }
+      else if( alphaFunctionValue == "REVERSE" )
+      {
+        element->alphaFunction = AlphaFunction::REVERSE;
+      }
+      else if( alphaFunctionValue == "EASE_IN_SQUARE" )
+      {
+        element->alphaFunction = AlphaFunction::EASE_IN_SQUARE;
+      }
+      else if( alphaFunctionValue == "EASE_OUT_SQUARE" )
+      {
+        element->alphaFunction = AlphaFunction::EASE_OUT_SQUARE;
+      }
+      else if( alphaFunctionValue == "EASE_IN" )
+      {
+        element->alphaFunction = AlphaFunction::EASE_IN;
+      }
+      else if( alphaFunctionValue == "EASE_OUT" )
+      {
+        element->alphaFunction = AlphaFunction::EASE_OUT;
+      }
+      else if( alphaFunctionValue == "EASE_IN_OUT" )
+      {
+        element->alphaFunction = AlphaFunction::EASE_IN_OUT;
+      }
+      else if( alphaFunctionValue == "EASE_IN_SINE" )
+      {
+        element->alphaFunction = AlphaFunction::EASE_IN_SINE;
+      }
+      else if( alphaFunctionValue == "EASE_OUT_SINE" )
+      {
+        element->alphaFunction = AlphaFunction::EASE_OUT_SINE;
+      }
+      else if( alphaFunctionValue == "EASE_IN_OUT_SINE" )
+      {
+        element->alphaFunction = AlphaFunction::EASE_IN_OUT_SINE;
+      }
+      else if( alphaFunctionValue == "BOUNCE" )
+      {
+        element->alphaFunction = AlphaFunction::BOUNCE;
+      }
+      else if( alphaFunctionValue == "SIN" )
+      {
+        element->alphaFunction = AlphaFunction::SIN;
+      }
+      else if( alphaFunctionValue == "EASE_OUT_BACK" )
+      {
+        element->alphaFunction = AlphaFunction::EASE_OUT_BACK;
+      }
+    }
+    else if( key == "time-period" )
+    {
+      Property::Array timeArray = value.Get< Property::Array >();
+
+      // TODO: Builder treats "{" within a Property::Map as a Property::Array.
+      // This means there is no key to determine what the values belong to.
+      if( timeArray.Size() >= 2 )
+      {
+        element->timePeriodDelay = timeArray[0].Get< float >();
+        element->timePeriodDuration = timeArray[1].Get< float >();
+      }
+    }
+  }
+
+  outputAnimationData.Add( element );
+}
+
 } // namespace scripting
 
 } // namespace Dali
index 40787de..e125724 100644 (file)
@@ -21,6 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/actors/actor-enumerations.h>
 #include <dali/public-api/actors/draw-mode.h>
+#include <dali/devel-api/animation/animation-data.h>
 #include <dali/public-api/images/image.h>
 #include <dali/public-api/shader-effects/shader-effect.h>
 #include <dali/public-api/object/property-map.h>
@@ -38,7 +39,7 @@ namespace Scripting
 {
 
 /**
- * @brief Template structure which stores an enumeration and its string equivalent.
+ * @brief Structure which stores an enumeration and its string equivalent.
  */
 struct StringEnum
 {
@@ -52,7 +53,7 @@ struct StringEnum
  * @param[in]  value       The string equivalent (case-insensitive).
  * @param[in]  table       A pointer to an array with the enumeration to string equivalents.
  * @param[in]  tableCount  Number of items in the array.
- * @return The index of the enumeration. If enumeration is not found, logs an error and returns tableCount.
+ * @return     The index of the enumeration. If enumeration is not found, logs an error and returns tableCount.
  */
 DALI_IMPORT_API unsigned int FindEnumIndex( const char* value, const StringEnum* table, unsigned int tableCount );
 
@@ -64,7 +65,7 @@ DALI_IMPORT_API unsigned int FindEnumIndex( const char* value, const StringEnum*
  * @param[in]  tableCount  Number of items in the array.
  * @param[out] result      The enum value
  *
- * @return True if the value was found from the table
+ * @return     True if the value was found from the table
  */
 template< typename T >
 bool GetEnumeration( const char* value, const StringEnum* table, unsigned int tableCount, T& result )
@@ -90,7 +91,7 @@ bool GetEnumeration( const char* value, const StringEnum* table, unsigned int ta
  * @param[in]  table       A pointer to an array with the enumeration to string equivalents.
  * @param[in]  tableCount  Number of items in the array.
  *
- * @return The equivalent enumeration for the given string. Will return NULL if the value does not exist
+ * @return     The equivalent enumeration for the given string. Will return NULL if the value does not exist
  *
  * @note The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.
  */
@@ -118,7 +119,7 @@ const char* GetEnumerationName( T value, const StringEnum* table, unsigned int t
  * @param[in]  table       A pointer to an array with the enumeration to string equivalents.
  * @param[in]  tableCount  Number of items in the array.
  *
- * @return The equivalent enumeration for the given string. Will return NULL if the value does not exist
+ * @return     The equivalent enumeration for the given string. Will return NULL if the value does not exist
  *
  * @note The caller is NOT responsible for cleaning up the returned pointer as it is statically allocated.
  */
@@ -136,7 +137,7 @@ const char * GetLinearEnumerationName( T value, const StringEnum* table, unsigne
  * @brief Takes a string and returns the appropriate color mode.
  *
  * @param[in] value The input string
- * @return The corresponding color-mode.
+ * @return    The corresponding color-mode.
  */
 DALI_IMPORT_API ColorMode GetColorMode( const std::string& value );
 
@@ -144,7 +145,7 @@ DALI_IMPORT_API ColorMode GetColorMode( const std::string& value );
  * @brief Takes a color mode and returns the appropriate string equivalent.
  *
  * @param[in] value The color mode
- * @return The corresponding string.
+ * @return    The corresponding string.
  */
 DALI_IMPORT_API std::string GetColorMode( ColorMode value );
 
@@ -152,7 +153,7 @@ DALI_IMPORT_API std::string GetColorMode( ColorMode value );
  * @brief Takes a string and returns the appropriate position inheritance mode.
  *
  * @param[in] value The input string
- * @return The corresponding position-inheritance-mode.
+ * @return    The corresponding position-inheritance-mode.
  */
 DALI_IMPORT_API PositionInheritanceMode GetPositionInheritanceMode( const std::string& value );
 
@@ -160,7 +161,7 @@ DALI_IMPORT_API PositionInheritanceMode GetPositionInheritanceMode( const std::s
  * @brief Takes a position inheritance mode and returns the string equivalent.
  *
  * @param[in] value The position-inheritance-mode.
- * @return The corresponding string.
+ * @return    The corresponding string.
  */
 DALI_IMPORT_API std::string GetPositionInheritanceMode( PositionInheritanceMode value );
 
@@ -168,7 +169,7 @@ DALI_IMPORT_API std::string GetPositionInheritanceMode( PositionInheritanceMode
  * @brief Takes a string and returns the appropriate draw mode.
  *
  * @param[in] value The input string
- * @return The corresponding draw-mode.
+ * @return    The corresponding draw-mode.
  */
 DALI_IMPORT_API DrawMode::Type GetDrawMode( const std::string& value );
 
@@ -176,7 +177,7 @@ DALI_IMPORT_API DrawMode::Type GetDrawMode( const std::string& value );
  * @brief Takes a draw-mode and returns the string equivalent.
  *
  * @param[in] value The draw-mode.
- * @return The corresponding string.
+ * @return    The corresponding string.
  */
 DALI_IMPORT_API std::string GetDrawMode( DrawMode::Type value );
 
@@ -184,7 +185,7 @@ DALI_IMPORT_API std::string GetDrawMode( DrawMode::Type value );
  * @brief Takes a string and returns the appropriate anchor-point or parent-origin constant.
  *
  * @param[in] value The input string
- * @return The corresponding anchor-point or parent-origin constant.
+ * @return    The corresponding anchor-point or parent-origin constant.
  */
 DALI_IMPORT_API Vector3 GetAnchorConstant( const std::string& value );
 
@@ -206,7 +207,7 @@ DALI_IMPORT_API Vector3 GetAnchorConstant( const std::string& value );
  * @endcode
  * Some fields are optional and some only pertain to a specific type.
  *
- * @return a pointer to a newly created object.
+ * @return A pointer to a newly created object.
  */
 DALI_IMPORT_API Image NewImage( const Property::Value& property );
 
@@ -239,7 +240,7 @@ DALI_IMPORT_API Image NewImage( const Property::Value& property );
  * "uUniform2":       type float, etc
  * @endcode
  *
- * @return a pointer to a newly created object.
+ * @return A pointer to a newly created object.
  */
 DALI_IMPORT_API ShaderEffect NewShaderEffect( const Property::Value& property );
 
@@ -265,14 +266,14 @@ DALI_IMPORT_API ShaderEffect NewShaderEffect( const Property::Value& property );
  * }
  * @endcode
  *
- * @return Handle to the newly created actor.
+ * @return A handle to the newly created actor.
  */
 DALI_IMPORT_API Actor NewActor( const Property::Map& map );
 
 /**
  * @brief Creates a Property::Map from the actor provided.
  *
- * @param[in] actor The base-actor from which a Property::Map should be created
+ * @param[in]  actor The base-actor from which a Property::Map should be created
  * @param[out] map This map is cleared and a property map of actor and its children is filled in
  */
 DALI_IMPORT_API void CreatePropertyMap( Actor actor, Property::Map& map );
@@ -280,12 +281,20 @@ DALI_IMPORT_API void CreatePropertyMap( Actor actor, Property::Map& map );
 /**
  * @brief Creates a Property::Map from the image provided.
  *
- * @param[in] image The image from which a Property::Map should be created
+ * @param[in]  image The image from which a Property::Map should be created
  * @param[out] map This map is cleared and a property map of the image is filled in
  */
 DALI_IMPORT_API void CreatePropertyMap( Image image, Property::Map& map );
 
-}
+/**
+ * @brief Creates description data required to create an Animation object from a property map.
+ *
+ * @param[in]  map The property value map containing the animation description
+ * @param[out] outputAnimationData Resultant data retrieved from the property map is written here
+ */
+DALI_IMPORT_API void NewAnimation( const Property::Map& map, Dali::AnimationData& outputAnimationData );
+
+} // namespace Scripting
 
 } // namespace Dali
 
diff --git a/dali/devel-api/signals/signal-delegate.cpp b/dali/devel-api/signals/signal-delegate.cpp
new file mode 100644 (file)
index 0000000..29d2ac0
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/signals/signal-delegate.h>
+
+namespace Dali
+{
+
+// CallbackBaseFunctor methods:
+
+SignalDelegate::CallbackBaseFunctor::CallbackBaseFunctor( CallbackBase* callback )
+: mCallback( callback )
+{
+}
+
+void SignalDelegate::CallbackBaseFunctor::operator()()
+{
+  if( mCallback )
+  {
+    CallbackBase::Execute( *mCallback );
+  }
+}
+
+SignalDelegate::CallbackBaseFunctor::~CallbackBaseFunctor()
+{
+  // Note: Deleting a CallbackBase will also call it's Reset method.
+  delete mCallback;
+}
+
+
+// SignalDelegate methods:
+
+SignalDelegate::SignalDelegate( Dali::Actor connectActor, const std::string& signalName )
+: mCallbackFunctor( NULL ),
+  mConnectActor( connectActor ),
+  mSignalName( signalName )
+{
+}
+
+bool SignalDelegate::IsConnected()
+{
+  return mCallbackFunctor;
+}
+
+
+} // namespace Dali
diff --git a/dali/devel-api/signals/signal-delegate.h b/dali/devel-api/signals/signal-delegate.h
new file mode 100644 (file)
index 0000000..03121eb
--- /dev/null
@@ -0,0 +1,172 @@
+#ifndef __DALI_SIGNAL_DELEGATE_H__
+#define __DALI_SIGNAL_DELEGATE_H__
+
+/*
+ * Copyright (c) 2015 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/actors/actor.h>
+#include <dali/public-api/signals/connection-tracker-interface.h>
+
+namespace Dali
+{
+
+/**
+ * @brief The SignalDelegate object allows direct connection to a signal that has been pre-configured internally.
+ *
+ * EG: The SignalDelegate can be created internally and exposed to the application-developer.
+ * They can then call the connect function to transparently bind to their callback.
+ */
+class DALI_IMPORT_API SignalDelegate
+{
+public:
+
+  /**
+   * @brief Create and set up a signal delegate.
+   *
+   * @param[in] connectActor The actor whose signal should be connected to.
+   * @param[in] signalName The name of the signal within the actor to connect to.
+   */
+  SignalDelegate( Dali::Actor connectActor, const std::string& signalName );
+
+  /**
+   * @brief Destructor.
+   */
+  ~SignalDelegate()
+  {
+  }
+
+public:
+
+  /**
+   * @brief Connect to a FunctorDelegate as received from a type-registry signal connection call.
+   *
+   * This is required to allow connection to an actor's signal. Typically this is done in a generic
+   * way (IE. via a string of the signal name) using the ConnectSignal function.
+   * This function requires a functor, and whilst we can bind to this with something like boost::bind
+   * we avoid this by providing a local functor built in to this delegate object.
+   *
+   * @param[in] connectionTracker Passed in to the ConnectSignal function of the actor.
+   * @param[in] functorDelegate A functor delegate object that must be executed when the signal is emitted.
+   * @return    True of the connection was made, false otherwise.
+   */
+  bool Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* functorDelegate )
+  {
+    if( !mCallbackFunctor )
+    {
+      // Note: We have to new the CallbackBaseFunctor rather than have it as a concrete object, as it
+      // is converted to a FunctorDelegate again within ConnectSignal. FunctorDelegates gain ownership
+      // of any functor they are created from and therefore always attempt to delete them.
+      mCallbackFunctor = new CallbackBaseFunctor( new CallbackFunctorDelegate0( functorDelegate ) );
+      mConnectActor.ConnectSignal( connectionTracker, mSignalName, *mCallbackFunctor );
+
+      return true;
+    }
+
+    return false;
+  }
+
+  /**
+   * @brief Connect to a non-static member function.
+   *
+   * The object that owns the member function must also inherit from ConnectionTracker.
+   *
+   * @param[in] object Object instance that houses the supplied member-function.
+   * @param[in] memberFunction The member-function to call when the signal is emitted.
+   * @return    True of the connection was made, false otherwise.
+   */
+  template< class T >
+  bool Connect( T* object, void ( T::*memberFunction )( void ) )
+  {
+    if( !mCallbackFunctor )
+    {
+      mCallbackFunctor = new CallbackBaseFunctor( MakeCallback( object, memberFunction ) );
+      mConnectActor.ConnectSignal( object, mSignalName, *mCallbackFunctor );
+
+      return true;
+    }
+
+    return false;
+  }
+
+  /**
+   * @brief Checks if this delegate has been connected yet, so it can be determined if it
+   * can be used or a new delegate must be created to set up a new connection (to the same signal).
+   *
+   * @return True if this SignalDelegate has been connected to it's signal.
+   */
+  bool IsConnected();
+
+
+private:
+
+  /**
+   * This functor is used by SignalDelegate in order to callback to a non-static member function
+   * (after it has been converted to a CallbackBase).
+   * The functor can be passed in to a ConnectSignal function of a BaseHandle and call into an
+   * object's member function on despatch.
+   */
+  struct CallbackBaseFunctor
+  {
+    /**
+     * @brief Create and initialise the functor with the callback to be called.
+     *
+     * @param[in] callback A CallbackBase which can be created from a member function, or a FunctorDelegate.
+     */
+    CallbackBaseFunctor( CallbackBase* callback );
+
+    /**
+     * @brief Executes the functor.
+     */
+    void operator()();
+
+    /**
+     * Destructor.
+     * Note that as this is passed in to a ConnectSignal method, it is converted to a FunctorDelegate.
+     * This means that this functor will automatically have it's destructor called, but we still own
+     * the CallbackBase, which must be destroyed manually here.
+     */
+    ~CallbackBaseFunctor();
+
+    private:
+
+      CallbackBase* mCallback;    ///< Stores (and owns) the callback to be called on execution.
+  };
+
+private:
+
+  /**
+   * @brief Not defined.
+   */
+  SignalDelegate( const SignalDelegate& rhs );
+
+  /**
+   * @brief Not defined.
+   */
+  const SignalDelegate& operator=( const SignalDelegate& rhs );
+
+private:
+
+  CallbackBaseFunctor*    mCallbackFunctor;   ///< The functor to allow connection to external callbacks.
+  Dali::Actor             mConnectActor;      ///< The actor owning the signal to connect to.
+  std::string             mSignalName;        ///< The name of the signal to connect to.
+
+};
+
+} // namespace Dali
+
+#endif // __DALI_SIGNAL_DELEGATE_H__
index fbd4435..f376f82 100644 (file)
@@ -262,12 +262,15 @@ public:
 
   /*
    * @brief Sets the progress of the animation.
-   * The animation will play (or continue playing) from this point. The progress
-   * must be in the 0-1 interval or in the play range interval if defined ( See SetPlayRange ),
-   * otherwise, it will be ignored.
    *
-   * @param[in] progress The new progress as a normalized value between [0,1] or between the
-   * play range if specified.
+   * When played, the animation will start from this point.
+   * If playing, the animation will jump to, and continue playing from this point.
+   *
+   * The progress must be in the 0-1 interval or in the play range interval
+   * if defined ( See SetPlayRange ), otherwise, it will be ignored.
+   *
+   * @param[in] progress The new progress as a normalized value between [0,1]
+   * or between the play range if specified.
    */
   void SetCurrentProgress( float progress );