Updated Model3dView control to use SetTexture
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / decorator / text-decorator.cpp
index 47e3694..74fc924 100644 (file)
@@ -24,7 +24,7 @@
 #include <dali/public-api/adaptor-framework/timer.h>
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/common/stage.h>
-#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/events/pan-gesture.h>
 #include <dali/public-api/images/resource-image.h>
 #include <dali/public-api/object/property-notification.h>
@@ -284,7 +284,7 @@ struct Decorator::Impl : public ConnectionTracker
   {
     mQuadVertexFormat[ "aPosition" ] = Property::VECTOR2;
     mHighlightShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
-    SetupTouchEvents();
+    SetupGestures();
   }
 
   /**
@@ -486,7 +486,6 @@ struct Decorator::Impl : public ConnectionTracker
     {
       const HandleImpl& primaryHandle = mHandle[LEFT_SELECTION_HANDLE];
       const HandleImpl& secondaryHandle = mHandle[RIGHT_SELECTION_HANDLE];
-      const HandleImpl& grabHandle = mHandle[GRAB_HANDLE];
       const CursorImpl& cursor = mCursor[PRIMARY_CURSOR];
 
       if( primaryHandle.active || secondaryHandle.active )
@@ -502,7 +501,15 @@ struct Decorator::Impl : public ConnectionTracker
       else
       {
         // Calculates the popup's position if the grab handle is active.
-        mCopyPastePopup.position = Vector3( cursor.position.x, -0.5f * popupSize.height - grabHandle.size.height + cursor.position.y, 0.0f );
+        const HandleImpl& grabHandle = mHandle[GRAB_HANDLE];
+        if( grabHandle.verticallyFlipped )
+        {
+          mCopyPastePopup.position = Vector3( cursor.position.x, -0.5f * popupSize.height - grabHandle.size.height + cursor.position.y, 0.0f );
+        }
+        else
+        {
+          mCopyPastePopup.position = Vector3( cursor.position.x, -0.5f * popupSize.height + cursor.position.y, 0.0f );
+        }
       }
     }
 
@@ -614,7 +621,7 @@ struct Decorator::Impl : public ConnectionTracker
     return true;
   }
 
-  void SetupTouchEvents()
+  void SetupGestures()
   {
     mTapDetector = TapGestureDetector::New();
     mTapDetector.DetectedSignal().Connect( this, &Decorator::Impl::OnTap );
@@ -687,7 +694,7 @@ struct Decorator::Impl : public ConnectionTracker
         grabHandle.actor.Add( grabHandle.grabArea );
         grabHandle.actor.SetColor( mHandleColor );
 
-        grabHandle.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnGrabHandleTouched );
+        grabHandle.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnGrabHandleTouched );
         mTapDetector.Attach( grabHandle.grabArea );
         mPanGestureDetector.Attach( grabHandle.grabArea );
 
@@ -750,7 +757,7 @@ struct Decorator::Impl : public ConnectionTracker
 
         mTapDetector.Attach( primary.grabArea );
         mPanGestureDetector.Attach( primary.grabArea );
-        primary.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnHandleOneTouched );
+        primary.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnHandleOneTouched );
 
         primary.actor.Add( primary.grabArea );
 
@@ -787,7 +794,7 @@ struct Decorator::Impl : public ConnectionTracker
 
         mTapDetector.Attach( secondary.grabArea );
         mPanGestureDetector.Attach( secondary.grabArea );
-        secondary.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnHandleTwoTouched );
+        secondary.grabArea.TouchSignal().Connect( this, &Decorator::Impl::OnHandleTwoTouched );
 
         secondary.actor.Add( secondary.grabArea );
 
@@ -1090,11 +1097,11 @@ struct Decorator::Impl : public ConnectionTracker
   {
     if( Gesture::Started == gesture.state )
     {
-      handle.grabDisplacementX = handle.grabDisplacementY = 0;
+      handle.grabDisplacementX = handle.grabDisplacementY = 0.f;
     }
 
     handle.grabDisplacementX += gesture.displacement.x;
-    handle.grabDisplacementY += gesture.displacement.y;
+    handle.grabDisplacementY += ( handle.verticallyFlipped ? -gesture.displacement.y : gesture.displacement.y );
 
     const float x = handle.position.x + handle.grabDisplacementX;
     const float y = handle.position.y + handle.lineHeight*0.5f + handle.grabDisplacementY;
@@ -1172,20 +1179,20 @@ struct Decorator::Impl : public ConnectionTracker
     }
   }
 
-  bool OnGrabHandleTouched( Actor actor, const TouchEvent& event )
+  bool OnGrabHandleTouched( Actor actor, const TouchData& touch )
   {
     // Switch between pressed/release grab-handle images
-    if( event.GetPointCount() > 0 &&
+    if( touch.GetPointCount() > 0 &&
         mHandle[GRAB_HANDLE].actor )
     {
-      const TouchPoint& point = event.GetPoint(0);
+      const PointState::Type state = touch.GetState( 0 );
 
-      if( TouchPoint::Down == point.state )
+      if( PointState::DOWN == state )
       {
         mHandle[GRAB_HANDLE].pressed = true;
       }
-      else if( ( TouchPoint::Up == point.state ) ||
-               ( TouchPoint::Interrupted == point.state ) )
+      else if( ( PointState::UP == state ) ||
+               ( PointState::INTERRUPTED == state ) )
       {
         mHandle[GRAB_HANDLE].pressed = false;
       }
@@ -1197,20 +1204,20 @@ struct Decorator::Impl : public ConnectionTracker
     return true;
   }
 
-  bool OnHandleOneTouched( Actor actor, const TouchEvent& event )
+  bool OnHandleOneTouched( Actor actor, const TouchData& touch )
   {
     // Switch between pressed/release selection handle images
-    if( event.GetPointCount() > 0 &&
+    if( touch.GetPointCount() > 0 &&
         mHandle[LEFT_SELECTION_HANDLE].actor )
     {
-      const TouchPoint& point = event.GetPoint(0);
+      const PointState::Type state = touch.GetState( 0 );
 
-      if( TouchPoint::Down == point.state )
+      if( PointState::DOWN == state )
       {
         mHandle[LEFT_SELECTION_HANDLE].pressed = true;
       }
-      else if( ( TouchPoint::Up == point.state ) ||
-               ( TouchPoint::Interrupted == point.state ) )
+      else if( ( PointState::UP == state ) ||
+               ( PointState::INTERRUPTED == state ) )
       {
         mHandle[LEFT_SELECTION_HANDLE].pressed = false;
         mHandlePreviousCrossed = mHandleCurrentCrossed;
@@ -1224,20 +1231,20 @@ struct Decorator::Impl : public ConnectionTracker
     return true;
   }
 
-  bool OnHandleTwoTouched( Actor actor, const TouchEvent& event )
+  bool OnHandleTwoTouched( Actor actor, const TouchData& touch )
   {
     // Switch between pressed/release selection handle images
-    if( event.GetPointCount() > 0 &&
+    if( touch.GetPointCount() > 0 &&
         mHandle[RIGHT_SELECTION_HANDLE].actor )
     {
-      const TouchPoint& point = event.GetPoint(0);
+      const PointState::Type state = touch.GetState( 0 );
 
-      if( TouchPoint::Down == point.state )
+      if( PointState::DOWN == state )
       {
         mHandle[RIGHT_SELECTION_HANDLE].pressed = true;
       }
-      else if( ( TouchPoint::Up == point.state ) ||
-               ( TouchPoint::Interrupted == point.state ) )
+      else if( ( PointState::UP == state ) ||
+               ( PointState::INTERRUPTED == state ) )
       {
         mHandle[RIGHT_SELECTION_HANDLE].pressed = false;
         mHandlePreviousCrossed = mHandleCurrentCrossed;