Merge "Stagehand documentation" into tizen
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Thu, 28 May 2015 15:29:12 +0000 (08:29 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 28 May 2015 15:29:12 +0000 (08:29 -0700)
dali-toolkit/internal/text/decorator/text-decorator.cpp

index f529f70..e92866b 100644 (file)
@@ -30,6 +30,7 @@
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/events/tap-gesture.h>
 #include <dali/public-api/events/tap-gesture-detector.h>
+#include <dali/public-api/events/touch-event.h>
 #include <dali/public-api/events/pan-gesture.h>
 #include <dali/public-api/events/pan-gesture-detector.h>
 #include <dali/devel-api/geometry/mesh.h>
@@ -530,6 +531,7 @@ struct Decorator::Impl : public ConnectionTracker
       grabHandle.grabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE );
       grabHandle.actor.Add( grabHandle.grabArea );
 
+      grabHandle.grabArea.TouchedSignal().Connect( this, &Decorator::Impl::OnGrabHandleTouched );
       mTapDetector.Attach( grabHandle.grabArea );
       mPanGestureDetector.Attach( grabHandle.grabArea );
 
@@ -733,10 +735,6 @@ struct Decorator::Impl : public ConnectionTracker
     if( Gesture::Started == gesture.state )
     {
       handle.grabDisplacementX = handle.grabDisplacementY = 0;
-      if( mHandleImages[type][HANDLE_IMAGE_PRESSED] )
-      {
-        handle.actor.SetImage( mHandleImages[type][HANDLE_IMAGE_PRESSED] );
-      }
     }
 
     handle.grabDisplacementX += gesture.displacement.x;
@@ -804,16 +802,42 @@ struct Decorator::Impl : public ConnectionTracker
     }
   }
 
+  bool OnGrabHandleTouched( Actor actor, const TouchEvent& event )
+  {
+    // Switch between pressed/release grab-handle images
+    if( event.GetPointCount() > 0 &&
+        mHandle[GRAB_HANDLE].actor )
+    {
+      const TouchPoint& point = event.GetPoint(0);
+
+      if( TouchPoint::Down == point.state &&
+          mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_PRESSED] )
+      {
+        mHandle[GRAB_HANDLE].actor.SetImage( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_PRESSED] );
+      }
+      else if( TouchPoint::Up == point.state &&
+               mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] )
+      {
+        mHandle[GRAB_HANDLE].actor.SetImage( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] );
+      }
+    }
+
+    // Consume to avoid pop-ups accidentally closing, when handle is outside of pop-up area
+    return true;
+  }
+
   bool OnHandleOneTouched( Actor actor, const TouchEvent& touch )
   {
     // TODO
-    return false;
+    // Consume to avoid pop-ups accidentally closing, when handle is outside of pop-up area
+    return true;
   }
 
   bool OnHandleTwoTouched( Actor actor, const TouchEvent& touch )
   {
     // TODO
-    return false;
+    // Consume to avoid pop-ups accidentally closing, when handle is outside of pop-up area
+    return true;
   }
 
   // Popup