[dali_1.0.7] Merge branch 'tizen' 13/27113/1 dali_1.0.7
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Thu, 4 Sep 2014 14:14:34 +0000 (15:14 +0100)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Thu, 4 Sep 2014 14:14:40 +0000 (15:14 +0100)
Change-Id: I5432b3250828c6fcc6b2edd192d2688e5668aa4d

24 files changed:
automated-tests/src/dali-toolkit-unmanaged/utc-Dali-Builder.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h
automated-tests/src/dali-toolkit/utc-Dali-Control.cpp
base/dali-toolkit/internal/builder/builder-impl.cpp
base/dali-toolkit/internal/builder/builder-impl.h
base/dali-toolkit/internal/builder/json-parser-impl.cpp
base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.cpp
base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-twist-effect-impl.h
base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp
base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp
base/dali-toolkit/public-api/builder/builder.cpp
base/dali-toolkit/public-api/builder/builder.h
base/dali-toolkit/public-api/controls/control-impl.cpp
base/dali-toolkit/public-api/controls/control-impl.h
base/dali-toolkit/public-api/controls/control.cpp
base/dali-toolkit/public-api/controls/control.h
base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.cpp
base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-twist-effect.h
optional/dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index 4742bed..833a40e 100644 (file)
@@ -381,3 +381,51 @@ int UtcDaliBuilderSetProperty(void)
 
   END_TEST;
 }
+
+int UtcDaliBuilderCreateFromJson(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline(" UtcDaliBuilderCreateFromJson");
+
+  Builder builder = Builder::New();
+
+  TextActor actor = TextActor::DownCast( builder.CreateFromJson("foobar") );
+
+  DALI_TEST_CHECK( !actor );
+
+  actor = TextActor::DownCast(
+    builder.CreateFromJson(
+      ReplaceQuotes("{'type':'TextActor','text':'Hi'}") ) );
+
+  DALI_TEST_CHECK( actor );
+
+  DALI_TEST_CHECK( actor.GetText() == "Hi" );
+
+  END_TEST;
+}
+
+int UtcDaliBuilderApplyFromJson(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline(" UtcDaliBuilderApplyFromJson");
+
+  Builder builder = Builder::New();
+
+  TextActor actor = TextActor::DownCast(
+    builder.CreateFromJson(
+      ReplaceQuotes("{'type':'TextActor','text':'Hi'}") ) );
+
+  DALI_TEST_CHECK( actor );
+
+  DALI_TEST_CHECK( actor.GetText() == "Hi" );
+
+  DALI_TEST_CHECK( !builder.ApplyFromJson(actor, ReplaceQuotes("foobar") ) );
+
+  builder.ApplyFromJson(actor, ReplaceQuotes("{'text':'low'}") );
+
+  DALI_TEST_CHECK( actor.GetText() == "low" );
+
+  END_TEST;
+}
index 082c2dd..5590b91 100644 (file)
@@ -303,20 +303,20 @@ void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* lo
  * @param[in] location The TEST_LOCATION macro should be used here
  */
 template<>
-inline void DALI_TEST_EQUALS<const TextArray&>( const TextArray& str1, const TextArray& str2, const char* location)
+inline void DALI_TEST_EQUALS<const Integration::TextArray&>( const Integration::TextArray& str1, const Integration::TextArray& str2, const char* location)
 {
-  if (!std::equal(str1.begin(), str1.end(), str2.begin()))
+  if (!std::equal(str1.Begin(), str1.End(), str2.Begin()))
   {
     fprintf(stderr, "%s, checking '", location);
 
-    for( unsigned int i = 0; i < str1.size(); ++i)
+    for( unsigned int i = 0; i < str1.Count(); ++i)
     {
       fprintf(stderr, "%c", str1[i]);
     }
 
     fprintf(stderr, "' == '");
 
-    for( unsigned int i = 0; i < str2.size(); ++i)
+    for( unsigned int i = 0; i < str2.Count(); ++i)
     {
       fprintf(stderr, "%c", str2[i]);
     }
index ea7e48e..c2680b2 100644 (file)
@@ -29,7 +29,8 @@ TestApplication::TestApplication( size_t surfaceWidth,
   mSurfaceWidth( surfaceWidth ),
   mSurfaceHeight( surfaceHeight ),
   mFrame( 0u ),
-  mDpi( horizontalDpi, verticalDpi )
+  mDpi( horizontalDpi, verticalDpi ),
+  mLastVSyncTime(0u)
 {
   Initialize();
 }
@@ -142,15 +143,23 @@ void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height )
   mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
 }
 
-bool TestApplication::Render( unsigned int intervalMilliseconds  )
+void TestApplication::DoUpdate( unsigned int intervalMilliseconds )
 {
-  // Update Time values
-  mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
   unsigned int seconds(0u), microseconds(0u);
   mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
+  mLastVSyncTime = ( seconds * 1e3 ) + ( microseconds / 1e3 );
+  unsigned int nextVSyncTime = mLastVSyncTime + 16;
+
+  // Update Time values
+  mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
+
+  float elapsedSeconds = intervalMilliseconds / 1e3f;
+  mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus );
+}
 
-  mCore->VSync( mFrame, seconds, microseconds );
-  mCore->Update( mStatus );
+bool TestApplication::Render( unsigned int intervalMilliseconds  )
+{
+  DoUpdate( intervalMilliseconds );
   mCore->Render( mRenderStatus );
 
   mFrame++;
@@ -165,14 +174,7 @@ unsigned int TestApplication::GetUpdateStatus()
 
 bool TestApplication::UpdateOnly( unsigned int intervalMilliseconds  )
 {
-  // Update Time values
-  mPlatformAbstraction.IncrementGetTimeResult( intervalMilliseconds );
-  unsigned int seconds(0u), microseconds(0u);
-  mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
-
-  mCore->VSync( mFrame, seconds, microseconds );
-  mCore->Update( mStatus );
-
+  DoUpdate( intervalMilliseconds );
   return mStatus.KeepUpdating();
 }
 
index 4084f2d..bcc2dd8 100644 (file)
@@ -76,6 +76,9 @@ public:
   bool RenderOnly( );
   void ResetContext();
 
+private:
+  void DoUpdate( unsigned int intervalMilliseconds );
+
 protected:
   TestPlatformAbstraction   mPlatformAbstraction;
   TestRenderController      mRenderController;
@@ -93,6 +96,7 @@ protected:
   unsigned int mFrame;
 
   Vector2 mDpi;
+  unsigned int mLastVSyncTime;
 };
 
 } // Dali
index 4f749ce..ef3eb77 100644 (file)
@@ -322,7 +322,7 @@ void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int d
 /**
  * @copydoc PlatformAbstraction::GetFontFamilyForChars()
  */
-const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const TextArray& charsRequested) const
+const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const Integration::TextArray& charsRequested) const
 {
   mTrace.PushCall("GetFontFamilyForChars", "");
   return mGetDefaultFontFamilyResult;
@@ -331,7 +331,7 @@ const std::string& TestPlatformAbstraction::GetFontFamilyForChars(const TextArra
 /**
  * @copydoc PlatformAbstraction::AllGlyphsSupported()
  */
-bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const TextArray& text) const
+bool TestPlatformAbstraction::AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const
 {
   mTrace.PushCall("AllGlyphsSupported", "");
   return true;
index 4723d90..2d4c38c 100644 (file)
@@ -185,12 +185,12 @@ public:
   /**
    * @copydoc PlatformAbstraction::GetFontFamilyForChars()
    */
-  virtual const std::string& GetFontFamilyForChars(const TextArray& charsRequested) const;
+  virtual const std::string& GetFontFamilyForChars(const Integration::TextArray& charsRequested) const;
 
   /**
    * @copydoc PlatformAbstraction::AllGlyphsSupported()
    */
-  virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const TextArray& text) const;
+  virtual bool AllGlyphsSupported(const std::string& name, const std::string& fontStyle, const Integration::TextArray& text) const;
 
   /**
    * @copydoc PlatformAbstraction::ValidateFontFamilyName()
index 5e78d31..5cc1e0e 100644 (file)
@@ -44,13 +44,17 @@ void utc_dali_toolkit_control_cleanup(void)
 namespace
 {
 
-static bool gObjectCreatedCallBackCalled;
+bool gObjectCreatedCallBackCalled;
 
-static void TestCallback(BaseHandle handle)
+void TestCallback(BaseHandle handle)
 {
   gObjectCreatedCallBackCalled = true;
 }
 
+void TestVoidCallback()
+{
+}
+
 } // namespace
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -511,3 +515,29 @@ int UtcDaliControlKeyProperties(void)
 
   END_TEST;
 }
+
+int UtcDaliControlGestureSignals(void)
+{
+  ToolkitTestApplication application;
+  ConnectionTracker connectionTracker;
+  Control control = Control::New();
+
+  // Each gesture detector gets created when connecting to the gesture signals
+  DALI_TEST_CHECK( !control.GetTapGestureDetector() );
+  control.ConnectSignal( &connectionTracker, Control::SIGNAL_TAPPED, &TestVoidCallback );
+  DALI_TEST_CHECK( control.GetTapGestureDetector() );
+
+  DALI_TEST_CHECK( !control.GetPanGestureDetector() );
+  control.ConnectSignal( &connectionTracker, Control::SIGNAL_PANNED, &TestVoidCallback );
+  DALI_TEST_CHECK( control.GetPanGestureDetector() );
+
+  DALI_TEST_CHECK( !control.GetPinchGestureDetector() );
+  control.ConnectSignal( &connectionTracker, Control::SIGNAL_PINCHED, &TestVoidCallback );
+  DALI_TEST_CHECK( control.GetPinchGestureDetector() );
+
+  DALI_TEST_CHECK( !control.GetLongPressGestureDetector() );
+  control.ConnectSignal( &connectionTracker, Control::SIGNAL_LONG_PRESSED, &TestVoidCallback );
+  DALI_TEST_CHECK( control.GetLongPressGestureDetector() );
+
+  END_TEST;
+}
index 544c428..31def0e 100644 (file)
@@ -507,9 +507,7 @@ BaseHandle Builder::DoCreate( const TreeNode& root, const TreeNode& node,
         }
       }
 
-      ApplyProperties( root, node, handle, replacements );
-
-      if( actor)
+      if( actor )
       {
         // add children of all the styles
         if( OptionalChild actors = IsChild( node, KEYNAME_ACTORS ) )
@@ -529,7 +527,10 @@ BaseHandle Builder::DoCreate( const TreeNode& root, const TreeNode& node,
           parent.Add( actor );
         }
       }
-
+      else
+      {
+        ApplyProperties( root, node, handle, replacements );
+      }
     }
     else
     {
@@ -1029,6 +1030,44 @@ BaseHandle Builder::Create( const std::string& templateName, const Replacement&
   return baseHandle;
 }
 
+BaseHandle Builder::CreateFromJson( const std::string& json )
+{
+  BaseHandle ret;
+
+  // merge in new template, hoping no one else has one named '@temp@'
+  std::string newTemplate =
+    std::string("{\"templates\":{\"@temp@\":") +                      \
+    json +                                                            \
+    std::string("}}");
+
+  if( mParser.Parse(newTemplate) )
+  {
+    Replacement replacement( mReplacementMap );
+    ret = Create( "@temp@", replacement );
+  }
+
+  return ret;
+}
+
+bool Builder::ApplyFromJson(  Handle& handle, const std::string& json )
+{
+  bool ret = false;
+
+  // merge new style, hoping no one else has one named '@temp@'
+  std::string newStyle =
+    std::string("{\"styles\":{\"@temp@\":") +                           \
+    json +                                                              \
+    std::string("}}");
+
+  if( mParser.Parse(newStyle) )
+  {
+    Replacement replacement( mReplacementMap );
+    ret = ApplyStyle( "@temp@", handle, replacement );
+  }
+
+  return ret;
+}
+
 
 BaseHandle Builder::Create( const std::string& templateName )
 {
index 62e3e87..d533366 100644 (file)
@@ -129,6 +129,16 @@ public:
   BaseHandle Create( const std::string& templateName, const PropertyValueMap& map );
 
   /**
+   * @copydoc Toolkit::Builder::CreateFromJson( const std::string& json );
+   */
+  BaseHandle CreateFromJson( const std::string& json );
+
+  /**
+   * @copydoc Toolkit::Builder::ApplyFromJson( Handle& handle, const std::string& json );
+   */
+  bool ApplyFromJson(  Handle& handle, const std::string& json );
+
+  /**
    * @copydoc Toolkit::Builder::ApplyStyle
    */
   bool ApplyStyle( const std::string& styleName, Handle& handle );
index 9aea87b..5bce6fb 100644 (file)
@@ -114,6 +114,8 @@ int JsonParser::Parse(const std::string& source)
   }
   else
   {
+    mRoot = NULL;
+
     mErrorDescription   = parserState.GetErrorDescription();
     if(NULL == mErrorDescription)
     {
index 1a3b893..c93d264 100755 (executable)
@@ -541,9 +541,19 @@ void ScrollViewTwistEffect::Apply(Actor child)
   }
 }
 
+void ScrollViewTwistEffect::SetMaxSwingAngle(const Vector2& maxSwingAngle)
+{
+  mMaxSwingAngle = maxSwingAngle;
+}
+
+Vector2 ScrollViewTwistEffect::GetMaxSwingAngle() const
+{
+  return mMaxSwingAngle;
+}
+
 void ScrollViewTwistEffect::SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function)
 {
-  if( mDropOffDistance.LengthSquared() > Math::MACHINE_EPSILON_1 && mDropOff.LengthSquared() > Math::MACHINE_EPSILON_1 )
+  if( distance.LengthSquared() > Math::MACHINE_EPSILON_1 && dropOff.LengthSquared() > Math::MACHINE_EPSILON_1 )
   {
     mFlags |= FlagDropOff;
     mDropOff = dropOff;
@@ -558,6 +568,13 @@ void ScrollViewTwistEffect::SetSwingDropOff(const Vector2& dropOff, const Vector
   mFlags = mFlags & ~FlagDefaultDropOff;
 }
 
+void ScrollViewTwistEffect::GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const
+{
+  dropOff = mDropOff;
+  distance = mDropOffDistance;
+  function = mDropOffFunction;
+}
+
 void ScrollViewTwistEffect::OnAttach(Toolkit::ScrollView& scrollView)
 {
   // Create effect-time property if not already created.
index d98a086..5aca6a0 100644 (file)
@@ -99,13 +99,23 @@ public:
   /**
    * @copydoc Toolkit::ScrollViewEffect::SetMaxSwingAngle
    */
-  void SetMaxSwingAngle(const Vector2& maxSwingAngle) { mMaxSwingAngle = maxSwingAngle; }
+  void SetMaxSwingAngle(const Vector2& maxSwingAngle);
+
+  /**
+   * @copydoc Toolkit::ScrollViewEffect::GetMaxSwingAngle
+   */
+  Vector2 GetMaxSwingAngle() const;
 
   /**
    * @copydoc Toolkit::ScrollViewEffect::SetSwingDropOff
    */
   void SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function = NULL);
 
+  /**
+   * @copydoc Toolkit::ScrollViewEffect::GetSwingDropOff
+   */
+  void GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const;
+
 public:
 
   /**
index 7a0729c..44c5aaf 100644 (file)
@@ -1951,11 +1951,7 @@ void TextInput::ScrollTextViewToMakeCursorVisible( const Vector3& cursorPosition
     scrollOffset.x += cursorPosition.x;
   }
 
-  if( cursorPosition.y - cursorSize.height < 0.f )
-  {
-    scrollOffset.y += ( cursorPosition.y - cursorSize.height );
-  }
-  else if( cursorPosition.y > controlSize.height )
+  if( cursorPosition.y - cursorSize.height < 0.f || cursorPosition.y > controlSize.height )
   {
     scrollOffset.y += cursorPosition.y;
   }
index dbf4146..8d90de6 100644 (file)
@@ -338,7 +338,10 @@ bool FocusManager::DoSetCurrentFocusActor(const unsigned int actorID)
       if(mIsAccessibilityTtsEnabled)
       {
         Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
-        soundPlayer.PlaySound(FOCUS_SOUND_FILE);
+        if(soundPlayer)
+        {
+          soundPlayer.PlaySound(FOCUS_SOUND_FILE);
+        }
 
         // Play the accessibility attributes with the TTS player.
         Dali::TtsPlayer player = Dali::TtsPlayer::Get(Dali::TtsPlayer::SCREEN_READER);
@@ -573,7 +576,10 @@ bool FocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapp
       {
         // play sound & skip moving once
         Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
-        soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE);
+        if(soundPlayer)
+        {
+          soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE);
+        }
 
         mIsEndcapFeedbackPlayed = true;
         return true;
index e900e5b..79173f1 100644 (file)
@@ -104,11 +104,21 @@ BaseHandle Builder::Create( const std::string& templateName, const PropertyValue
   return GetImpl(*this).Create( templateName, map );
 }
 
+BaseHandle Builder::CreateFromJson( const std::string& json )
+{
+  return GetImpl(*this).CreateFromJson( json );
+}
+
 bool Builder::ApplyStyle( const std::string& styleName, Handle& handle )
 {
   return GetImpl(*this).ApplyStyle( styleName, handle );
 }
 
+bool Builder::ApplyFromJson( Handle& handle, const std::string& json )
+{
+  return GetImpl(*this).ApplyFromJson( handle, json );
+}
+
 void Builder::AddActors( Actor toActor )
 {
   GetImpl(*this).AddActors( toActor );
index 5f33075..ddbb041 100644 (file)
@@ -35,15 +35,14 @@ class Builder;
 typedef std::map<std::string, Property::Value> PropertyValueMap;
 
 /**
- * Builder
- * This class provides the ability to load an actor tree from a string representation.
+ * This class provides the ability to load and style an actor tree from a string representation.
  *
- * The following example is hello world in JSON.
+ * The following is an example in JSON.
  *
  * @code
  *
  *  {
- *    "styles":
+ *    "templates": // are named instantiable actor trees
  *    {
  *      "default-text":
  *      {
@@ -53,6 +52,24 @@ typedef std::map<std::string, Property::Value> PropertyValueMap;
  *        "scale": [50,50,1]
  *      }
  *    },
+ *    "styles": // are named property sets applied to actor trees
+ *    {
+ *     "my-style":
+ *      {
+ *        "size": [10,10,1] // root properties applied to a given root actor
+ *        "actors":         // properties applied to actors found by name from root
+ *        {
+ *          "ok":           // properties for an actor named "ok"
+ *          {
+ *            "scale":[5,5,1],
+ *          },
+ *          "cancel":
+ *          {
+ *            "scale":[50,50,1],
+ *          }
+ *       },
+ *      },
+ *    },
  *    "stage":
  *    [
  *      {
@@ -63,29 +80,43 @@ typedef std::map<std::string, Property::Value> PropertyValueMap;
  *    ]
  *  }
  *
- *
- *
  * @endcode
  *
- * The following is how to load the json data.
- *
+ * The following shows a method to load the json file.
  * @code
- *
  * Builder builder = Builder::New();
- *
  * std::string json_data(ReadFile("layout.json"));
- *
  * builder.LoadFromString(json_data);
- *
- * // 1) load all actors in the "stage" section to the root layer
+ * @endcode
+ * Examples
+ * - Load all actors in the "stage" section to the root layer
+ * @code
  * builder.AddActors( Stage::GetCurrent().GetRootLayer() );
+ * @endcode
  *
- * // or 2) create an actor from the library "templates" section
+ * - Create an actor tree from the "templates" section
+ * @code
  * TextActor actor = TextActor::DownCast( builder.Create( "default-text" ) );
+ * @endcode
  *
+ * - Style an actor tree from the "styles" section
+ * @code
+ * builder.ApplyStyle( "my-style", actor );
  * @endcode
+ *
+ * - Create an actor tree from json
+ * @code
+ * TextActor actor = TextActor::DownCast( builder.CreateFromJson("{\"type\":\"TextActor\",\"font\":\"\",\"scale\":[50,50,1]}") );
+ * @endcode
+ *
+ * - Apply a style to an actor tree from json
+ * @code
+ * builder.ApplyFromJson( textActor, ("{\"scale\":[5,5,1]}") );
+ * @endcode
+ *
  */
- class Builder : public BaseHandle
+
+class Builder : public BaseHandle
  {
  public:
    /**
@@ -286,6 +317,19 @@ typedef std::map<std::string, Property::Value> PropertyValueMap;
   BaseHandle Create( const std::string& templateName, const PropertyValueMap& map );
 
   /**
+   * @brief Creates an object (e.g. an actor) from given json snippet
+   *
+   * e.g.
+   *   Actor a = Actor::DownCast(builder.CreateFromJson( "{\"type\":\"TextActor\"}"));
+   *
+   * @pre The Builder has been initialized.
+   * @pre Preconditions have been met for creating dali objects ie Images, Actors etc
+   * @param json The json snippet used to create the object.
+   * @returns The base handle of the created object if any
+   */
+  BaseHandle CreateFromJson( const std::string& json );
+
+  /**
    * Apply a style (a collection of properties) to an actor.
    * @pre The Builder has been initialized.
    * @pre Preconditions have been met for creating dali objects ie Images, Actors etc
@@ -297,6 +341,18 @@ typedef std::map<std::string, Property::Value> PropertyValueMap;
   bool ApplyStyle( const std::string& styleName, Handle& handle );
 
   /**
+   * Apply a style (a collection of properties) to an actor from the given json snippet
+   * @pre The Builder has been initialized.
+   * @pre Preconditions have been met for creating dali objects ie Images, Actors etc
+   * @param handle Then handle of the object on which to set the properties.
+   * @param json The json snippet used to create the object.
+   *
+   * @return Return true if the json snippet was parsed
+   */
+  bool ApplyFromJson(  Handle& handle, const std::string& json );
+
+
+  /**
    * Add the actor tree in the "stage" section to the actor toActor.
    * ie if the representation has a 'stage' section that contains a tree of
    * actors then
index 975152e..e45436f 100644 (file)
@@ -76,6 +76,12 @@ TypeRegistration CONTROL_TYPE( typeid(Control), typeid(CustomActor), Create );
 
 TypeAction ACTION_TYPE_1( CONTROL_TYPE, Toolkit::Control::ACTION_CONTROL_ACTIVATED, &Internal::Control::DoAction );
 
+SignalConnectorType SIGNAL_CONNECTOR_1( CONTROL_TYPE, Toolkit::Control::SIGNAL_KEY_EVENT,     &Internal::Control::DoConnectSignal );
+SignalConnectorType SIGNAL_CONNECTOR_2( CONTROL_TYPE, Toolkit::Control::SIGNAL_TAPPED,        &Internal::Control::DoConnectSignal );
+SignalConnectorType SIGNAL_CONNECTOR_3( CONTROL_TYPE, Toolkit::Control::SIGNAL_PANNED,        &Internal::Control::DoConnectSignal );
+SignalConnectorType SIGNAL_CONNECTOR_4( CONTROL_TYPE, Toolkit::Control::SIGNAL_PINCHED,       &Internal::Control::DoConnectSignal );
+SignalConnectorType SIGNAL_CONNECTOR_5( CONTROL_TYPE, Toolkit::Control::SIGNAL_LONG_PRESSED,  &Internal::Control::DoConnectSignal );
+
 /**
  * Structure which holds information about the background of a control
  */
@@ -945,6 +951,50 @@ bool Control::DoAction(BaseObject* object, const std::string& actionName, const
   return ret;
 }
 
+bool Control::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+  Dali::BaseHandle handle( object );
+
+  bool connected( false );
+  Toolkit::Control control = Toolkit::Control::DownCast(handle);
+  if ( control )
+  {
+    Control& controlImpl( control.GetImplementation() );
+    connected = true;
+
+    if ( Toolkit::Control::SIGNAL_KEY_EVENT == signalName )
+    {
+      controlImpl.KeyEventSignal().Connect( tracker, functor );
+    }
+    else if( Toolkit::Control::SIGNAL_TAPPED == signalName )
+    {
+      controlImpl.EnableGestureDetection( Gesture::Tap );
+      controlImpl.GetTapGestureDetector().DetectedSignal().Connect( tracker, functor );
+    }
+    else if( Toolkit::Control::SIGNAL_PANNED == signalName )
+    {
+      controlImpl.EnableGestureDetection( Gesture::Pan );
+      controlImpl.GetPanGestureDetector().DetectedSignal().Connect( tracker, functor );
+    }
+    else if( Toolkit::Control::SIGNAL_PINCHED == signalName )
+    {
+      controlImpl.EnableGestureDetection( Gesture::Pinch );
+      controlImpl.GetPinchGestureDetector().DetectedSignal().Connect( tracker, functor );
+    }
+    else if( Toolkit::Control::SIGNAL_LONG_PRESSED == signalName )
+    {
+      controlImpl.EnableGestureDetection( Gesture::LongPress );
+      controlImpl.GetLongPressGestureDetector().DetectedSignal().Connect( tracker, functor );
+    }
+    else
+    {
+      // signalName does not match any signal
+      connected = false;
+    }
+  }
+  return connected;
+}
+
 void Control::DoStyleChange( Toolkit::StyleManager styleManager, StyleChange change )
 {
   if( change.themeChange )
@@ -1280,11 +1330,6 @@ void Control::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* call
   mImpl->SignalDisconnected( slotObserver, callback );
 }
 
-std::size_t Control::GetConnectionCount() const
-{
-  return mImpl->GetConnectionCount();
-}
-
 Control::Control( ControlBehaviour behaviourFlags )
 : CustomActorImpl( behaviourFlags & REQUIRES_TOUCH_EVENTS ),
   mImpl(new Impl(*this))
index df822ef..fdcc05f 100644 (file)
@@ -179,6 +179,17 @@ public:
   static bool DoAction(BaseObject* object, const std::string& actionName, const std::vector<Property::Value>& attributes);
 
   /**
+   * Connects a callback function with the object's signals.
+   * @param[in] object The object providing the signal.
+   * @param[in] tracker Used to disconnect the signal.
+   * @param[in] signalName The signal to connect to.
+   * @param[in] functor A newly allocated FunctorDelegate.
+   * @return True if the signal was connected.
+   * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+   */
+  static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+
+  /**
    * @brief If deriving classes wish to fine tune pinch gesture
    * detection then they can access the gesture detector through this
    * API and modify the detection.
@@ -638,11 +649,6 @@ public:
    */
   virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback );
 
-  /**
-   * @copydoc ConnectionTrackerInterface::GetConnectionCount
-   */
-  virtual std::size_t GetConnectionCount() const;
-
 protected:
 
   /**
index 917a5b9..d01ad83 100644 (file)
@@ -25,7 +25,12 @@ namespace Toolkit
 {
 
 const char* const Control::ACTION_CONTROL_ACTIVATED = "control-activated";
+
 const char* const Control::SIGNAL_KEY_EVENT = "key-event";
+const char* const Control::SIGNAL_TAPPED = "tapped";
+const char* const Control::SIGNAL_PANNED = "panned";
+const char* const Control::SIGNAL_PINCHED = "pinched";
+const char* const Control::SIGNAL_LONG_PRESSED = "long-pressed";
 
 Control Control::New()
 {
index 82ab066..951c2b6 100644 (file)
@@ -58,6 +58,10 @@ public:
   /// @name Signals
   /** @{ */
   static const char* const SIGNAL_KEY_EVENT;                 ///< name "key-event"
+  static const char* const SIGNAL_TAPPED;                    ///< name "tapped"
+  static const char* const SIGNAL_PANNED;                    ///< name "panned"
+  static const char* const SIGNAL_PINCHED;                   ///< name "pinched"
+  static const char* const SIGNAL_LONG_PRESSED;              ///< name "long-pressed"
   /** @} */
 
   /// @name Actions
index 5ad2e57..0472917 100644 (file)
@@ -85,11 +85,21 @@ void ScrollViewTwistEffect::SetMaxSwingAngle(const Vector2& maxSwingAngle)
   GetImpl(*this).SetMaxSwingAngle(maxSwingAngle);
 }
 
+Vector2 ScrollViewTwistEffect::GetMaxSwingAngle() const
+{
+  return GetImpl( *this ).GetMaxSwingAngle();
+}
+
 void ScrollViewTwistEffect::SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function)
 {
   GetImpl(*this).SetSwingDropOff(dropOff, distance, function);
 }
 
+void ScrollViewTwistEffect::GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const
+{
+  GetImpl(*this).GetSwingDropOff(dropOff, distance, function);
+}
+
 } // namespace Toolkit
 
 } // namespace Dali
index 719fba2..a208fb0 100644 (file)
@@ -130,6 +130,13 @@ public:
   void SetMaxSwingAngle(const Vector2& maxSwingAngle);
 
   /**
+   * @brief Retrieve the maximum swing angle when at zero drop off.
+   *
+   * @return The maximum swing angle for x and y axes
+   */
+  Vector2 GetMaxSwingAngle() const;
+
+  /**
    * @brief Set the drop off values to affect the amount of swing
    * angle applied to an actor the further it is from the scroll
    * position.
@@ -146,6 +153,15 @@ public:
    */
   void SetSwingDropOff(const Vector2& dropOff, const Vector2& distance, AlphaFunction function = NULL);
 
+  /**
+   * @brief Get the drop off values that affect the amount of swing angle that is applied to an actor.
+   *
+   * @param[out]  dropOff   The current drop-off amount.
+   * @param[out]  distance  The current distance to apply drop-off in pixels.
+   * @param[out]  function  The current alpha function used to affect how the drop iff is applied over the distance.
+   */
+  void GetSwingDropOff( Vector2& dropOff, Vector2& distance, AlphaFunction& function ) const;
+
 protected:
 
   /**
index 57888b0..603eed8 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 6;
+const unsigned int TOOLKIT_MICRO_VERSION = 7;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 18086e8..e2d38e2 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.0.6
+Version:    1.0.7
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0