(Touch) Updated programming guide, Automated Tests & KeyboardFocusManager to use... 25/78225/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 4 Jul 2016 14:35:33 +0000 (15:35 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 4 Jul 2016 14:36:43 +0000 (15:36 +0100)
Change-Id: I886c10891e47ea65b41165912bb823bdcef57f0d

automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp
automated-tests/src/dali-toolkit/utc-Dali-Alignment.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h
docs/content/example-code/properties.cpp
docs/content/programming-guide/event-system.h
docs/content/programming-guide/hello-world.h
docs/content/shared-javascript-and-cpp-documentation/creating-custom-controls.md
docs/content/shared-javascript-and-cpp-documentation/multi-touch-guide.md
docs/content/shared-javascript-and-cpp-documentation/performance-profiling.md
docs/content/shared-javascript-and-cpp-documentation/programming-languages.md

index 69698fa..edaf7fd 100644 (file)
@@ -329,7 +329,7 @@ public:
   Test mTest;
 };
 
   Test mTest;
 };
 
-static bool TestCallback(Actor actor, const TouchEvent& event)
+static bool TestCallback(Actor actor, const TouchData& event)
 {
   return true;
 }
 {
   return true;
 }
@@ -384,7 +384,7 @@ int UtcDaliPushButtonInterruptEventWhenInsensitive(void)
 
   // * Actor's touch event is connected to a callback function
   //   and this callback function consumes the event.
 
   // * Actor's touch event is connected to a callback function
   //   and this callback function consumes the event.
-  actor.TouchedSignal().Connect( &TestCallback );
+  actor.TouchSignal().Connect( &TestCallback );
 
   // * Button's pressed signal is connected to a callback function
   //   which also consumes the event.
 
   // * Button's pressed signal is connected to a callback function
   //   which also consumes the event.
@@ -527,7 +527,7 @@ int UtcDaliPushButtonInterruptEventWhenNonVisible(void)
 
   // * Actor's touch event is connected to a callback function
   //   and this callback function consumes the event.
 
   // * Actor's touch event is connected to a callback function
   //   and this callback function consumes the event.
-  actor.TouchedSignal().Connect( &TestCallback );
+  actor.TouchSignal().Connect( &TestCallback );
 
   // * Button's pressed signal is connected to a callback function
   //   which also consumes the event.
 
   // * Button's pressed signal is connected to a callback function
   //   which also consumes the event.
index 0ae0611..fc015f1 100644 (file)
@@ -954,7 +954,7 @@ int UtcDaliAlignmentSizeSetP(void)
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-static bool TouchEventCallback(Actor actor, const TouchEvent& event)
+static bool TouchCallback(Actor actor, const TouchData& event)
 {
   return false;
 }
 {
   return false;
 }
@@ -970,7 +970,7 @@ int UtcDaliAlignmentOnTouchEvent(void)
   alignment.SetAnchorPoint(AnchorPoint::TOP_LEFT);
   Stage::GetCurrent().Add(alignment);
 
   alignment.SetAnchorPoint(AnchorPoint::TOP_LEFT);
   Stage::GetCurrent().Add(alignment);
 
-  alignment.TouchedSignal().Connect(&TouchEventCallback);
+  alignment.TouchSignal().Connect(&TouchCallback);
 
   application.Render();
   application.SendNotification();
 
   application.Render();
   application.SendNotification();
index 2a52cff..d503638 100644 (file)
@@ -26,6 +26,7 @@
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/events/key-event.h>
 #include <dali/public-api/animation/constraints.h>
 #include <dali/public-api/common/stage.h>
 #include <dali/public-api/events/key-event.h>
+#include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/public-api/images/resource-image.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <dali/public-api/images/resource-image.h>
@@ -120,7 +121,7 @@ KeyboardFocusManager::KeyboardFocusManager()
   OnPhysicalKeyboardStatusChanged(PhysicalKeyboard::Get());
 
   Toolkit::KeyInputFocusManager::Get().UnhandledKeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
   OnPhysicalKeyboardStatusChanged(PhysicalKeyboard::Get());
 
   Toolkit::KeyInputFocusManager::Get().UnhandledKeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
-  Stage::GetCurrent().TouchedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnTouched);
+  Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch );
   PhysicalKeyboard::Get().StatusChangedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnPhysicalKeyboardStatusChanged);
 }
 
   PhysicalKeyboard::Get().StatusChangedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnPhysicalKeyboardStatusChanged);
 }
 
@@ -681,11 +682,11 @@ void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
   }
 }
 
   }
 }
 
-void KeyboardFocusManager::OnTouched(const TouchEvent& touchEvent)
+void KeyboardFocusManager::OnTouch(const TouchData& touch)
 {
   // Clear the focus when user touch the screen.
   // We only do this on a Down event, otherwise the clear action may override a manually focused actor.
 {
   // Clear the focus when user touch the screen.
   // We only do this on a Down event, otherwise the clear action may override a manually focused actor.
-  if( ( touchEvent.GetPointCount() < 1 ) || ( touchEvent.GetPoint( 0 ).state == TouchPoint::Down ) )
+  if( ( touch.GetPointCount() < 1 ) || ( touch.GetState( 0 ) == PointState::DOWN ) )
   {
     ClearFocus();
   }
   {
     ClearFocus();
   }
index de3770f..f615731 100644 (file)
@@ -221,9 +221,9 @@ private:
   /**
    * Callback for the touch event when the screen is touched and when the touch ends
    * (i.e. the down & up touch events only).
   /**
    * Callback for the touch event when the screen is touched and when the touch ends
    * (i.e. the down & up touch events only).
-   * @param[in] touchEvent The touch event
+   * @param[in] touch The touch information
    */
    */
-  void OnTouched(const TouchEvent& touchEvent);
+  void OnTouch( const TouchData& touch );
 
   /**
    * Change the keyboard focus status when keyboard focus feature turned on or off.
 
   /**
    * Change the keyboard focus status when keyboard focus feature turned on or off.
index d0f8923..300d276 100644 (file)
@@ -79,7 +79,7 @@ public:
     mTagPropertyIndex = mImageView.RegisterProperty( TAG_PROPERTY_NAME, 0, Property::READ_WRITE /* Event-side only, i.e. not animatable */ );
 
     // Connect to the touch-event
     mTagPropertyIndex = mImageView.RegisterProperty( TAG_PROPERTY_NAME, 0, Property::READ_WRITE /* Event-side only, i.e. not animatable */ );
 
     // Connect to the touch-event
-    mImageView.TouchedSignal().Connect( this, &PropertyController::OnTouched );
+    mImageView.TouchSignal().Connect( this, &PropertyController::OnTouched );
 
     // Create text label
     mTagText = Toolkit::TextLabel::New( "0" );
 
     // Create text label
     mTagText = Toolkit::TextLabel::New( "0" );
@@ -95,7 +95,7 @@ public:
    * param[in] touch The touch-event
    * return Set to true if the signal was consumed correctly
    */
    * param[in] touch The touch-event
    * return Set to true if the signal was consumed correctly
    */
-  bool OnTouched( Actor actor, const TouchEvent& touch )
+  bool OnTouched( Actor actor, const TouchData& touch )
   {
     int touchedCount = 0;
 
   {
     int touchedCount = 0;
 
index f360947..98c650d 100644 (file)
@@ -2,25 +2,27 @@
 
 DALi emits several signals to an application to inform it of user actions.
 
 
 DALi emits several signals to an application to inform it of user actions.
 
-<h2 class="pg">Touch Events</h2>
+<h2 class="pg">Touch</h2>
 
 
-An application can be notified when a user interacts with the touch screen on the device by connecting to the touch signal provided by Dali::Actor.  This signal will be emitted by DALi whenever the touch occurs within the connected actor's bounds.
+An application can be notified when a user interacts with the touch screen on the device by connecting to the touch signal provided by Dali::Actor.
+This signal will be emitted by DALi whenever the touch occurs within the connected actor's bounds.
 
 
-Each point on the screen that is currently being touched or where touch has stopped is represented by a Dali::TouchPoint.  This object stores information about the state of the touch point (down, up, motion etc.) and the co-ordinates of the touch.
+Each point on the screen that is currently being touched or where touch has stopped is represented by a point.
+Dali::TouchData stores information about the state of each point (down, up, motion etc.) and the co-ordinates of the touch.
 
 
-A collection of touch points at a specific moment in time is collated into a Dali::TouchEvent.  When a multi-touch event occurs, each touch point represents the points that are currently being touched or the points where touch has stopped.
+When a multi-touch event occurs, each point represents the points that are currently being touched or the points where touch has stopped.
 
 The following example shows how a connection to a touch event signal can be established:
 
 @code
 
 The following example shows how a connection to a touch event signal can be established:
 
 @code
-bool OnTouch(Actor actor, const TouchEvent& touch)
+bool OnTouch( Dali::Actor actor, const Dali::TouchData& touch )
 {
   bool handled = false;
 
 {
   bool handled = false;
 
-  switch(touch.GetPointCount())
+  switch( touch.GetPointCount() )
   {
     case 1: // Single touch
   {
     case 1: // Single touch
-      if (touch.GetPoint(0).GetState == TouchPoint::Down)
+      if ( touch.GetState( 0 ) == Dali::PointState::DOWN )
       {
         // Do action when first touches the touch screen.
         ...
       {
         // Do action when first touches the touch screen.
         ...
@@ -39,41 +41,45 @@ bool OnTouch(Actor actor, const TouchEvent& touch)
 }
 
 // Elsewhere
 }
 
 // Elsewhere
-Actor actor = Actor::New();
-actor.SignalTouch().Connect(&OnTouch);
+Dali::Actor actor = Actor::New();
+actor.TouchSignal().Connect( &OnTouch );
 @endcode
 
 The primary touch point is the first point that the user touches.
 
 @endcode
 
 The primary touch point is the first point that the user touches.
 
-The touch event is first emitted to the actor which is hit by the primary touch point.  If this hit actor does not handle the event, then the event is offered to the hit actor's parent.  Again, if the parent does not handle this event, it is then offered to its parent and so on until the stage is reached or the event is consumed.
+The touch signal is first emitted to the actor which is hit by the primary touch point.
+If this hit actor does not handle (consume) the event, then the event is offered to the hit actor's parent.
+Again, if the parent does not handle this event, it is then offered to its parent and so on until the stage is reached or the event is consumed.
 
 
-If a parent and child both connect to the Touch signal, then the touch event is first offered to the child.  If it is consumed by the child, then the parent will not be informed.
+If the TouchSignal of both a parent and child are connected to, then the touch event is first offered to the child's listener.
+If it is consumed by the child's listener, then the parent will not be informed.
 
 <h2 class="pg">Gestures</h2>
 
 
 <h2 class="pg">Gestures</h2>
 
-A Dali::GestureDetector analyses a stream of touch events and attempts to determine the intention of the user.  An actor is attached to a gesture detector and if the detector recognises a pattern, it will emit a detected signal to the application.
+A Dali::GestureDetector analyses a stream of touch input and attempts to determine the intention of the user.
+An actor is attached to a gesture detector and if the detector recognises a pattern, it will emit a detected signal to the application.
 
 
-The following gesture detectors are currently supported in Dali:
+The following gesture detectors are currently supported in DALi:
 
 
+- Dali::LongPressGestureDetector - When the user presses and holds a particular point on the screen for a specified length of time.
 - Dali::PinchGestureDetector - When the user moves two fingers towards or away from each other.
 - Dali::PanGestureDetector - When the user moves one or more fingers in the same direction.
 - Dali::PinchGestureDetector - When the user moves two fingers towards or away from each other.
 - Dali::PanGestureDetector - When the user moves one or more fingers in the same direction.
+- Dali::TapGestureDetector - When the user taps the screen.
 
 The example below shows how an application can be notified of a pinch gesture:
 
 @code
 
 The example below shows how an application can be notified of a pinch gesture:
 
 @code
-void OnPinch(Actor actor, PinchGesture pinch)
+void OnPinch( Dali::Actor actor, const Dali::PinchGesture& pinch )
 {
   // Scale your actor according to the pinch scale
 {
   // Scale your actor according to the pinch scale
-  Vector3 newSize = actor.GetCurrentSize() * pinch.GetScale();
+  Vector3 newSize = actor.GetCurrentSize() * pinch.scale;
   actor.SetSize(newSize);
 }
 
 // Elsewhere
   actor.SetSize(newSize);
 }
 
 // Elsewhere
-PinchDetector detector = PinchDetector::New();
-detector.Attach(myActor);
-detector.SignalDetected().Connect(&OnPinch);
+Dali::PinchGestureDetector detector = Dali::PinchDetector::New();
+detector.Attach( myActor );
+detector.DetectedSignal().Connect( &OnPinch );
 @endcode
 
 @endcode
 
- */
-
-// @TODO: Add "Key Events" section
+*/
index 9c4383f..c7b5ddd 100644 (file)
@@ -48,10 +48,10 @@ public:
     stage.Add( mTextLabel );
 
     // Respond to a click anywhere on the stage
     stage.Add( mTextLabel );
 
     // Respond to a click anywhere on the stage
-    stage.GetRootLayer().TouchedSignal().Connect( this, &HelloWorldController::OnTouch );
+    stage.GetRootLayer().TouchSignal().Connect( this, &HelloWorldController::OnTouch );
   }
 
   }
 
-  bool OnTouch( Actor actor, const TouchEvent& touch )
+  bool OnTouch( Actor actor, const TouchData& touch )
   {
     // quit the application
     mApplication.Quit();
   {
     // quit the application
     mApplication.Quit();
index 7410978..946b4f0 100644 (file)
@@ -137,7 +137,6 @@ Dali::Toolkit::Internal::Control provides several behaviours which are specified
 | Behaviour                            | Description                                                             |
 |--------------------------------------|-------------------------------------------------------------------------|
 | ACTOR_BEHAVIOUR_NONE                 | No behaviour required.                                                  |
 | Behaviour                            | Description                                                             |
 |--------------------------------------|-------------------------------------------------------------------------|
 | ACTOR_BEHAVIOUR_NONE                 | No behaviour required.                                                  |
-| REQUIRES_TOUCH_EVENTS                | If our control requires [touch events](@ref creating-controls-events).  |
 | REQUIRES_HOVER_EVENTS                | If our control requires [hover events](@ref creating-controls-events).  |
 | REQUIRES_WHEEL_EVENTS                | If our control requires [wheel events](@ref creating-controls-events).  |
 | REQUIRES_STYLE_CHANGE_SIGNALS        | True if need to monitor style change signals such as Theme/Font change. |
 | REQUIRES_HOVER_EVENTS                | If our control requires [hover events](@ref creating-controls-events).  |
 | REQUIRES_WHEEL_EVENTS                | If our control requires [wheel events](@ref creating-controls-events).  |
 | REQUIRES_STYLE_CHANGE_SIGNALS        | True if need to monitor style change signals such as Theme/Font change. |
@@ -146,25 +145,11 @@ ________________________________________________________________________________
 
 ### Touch, Hover & Wheel Events {#creating-controls-events}
 
 
 ### Touch, Hover & Wheel Events {#creating-controls-events}
 
-+ A **touch event** is when any touch occurs within the bounds of the custom actor.
++ A **touch** is when any touch occurs within the bounds of the custom actor. Connect to Dali::Actor::TouchSignal().
 + A **hover event** is when a pointer moves within the bounds of a custom actor (e.g. mouse pointer or hover pointer).
 + A **wheel event** is when the mouse wheel (or similar) is moved while hovering over an actor (via a mouse pointer or hover pointer).
  
 + A **hover event** is when a pointer moves within the bounds of a custom actor (e.g. mouse pointer or hover pointer).
 + A **wheel event** is when the mouse wheel (or similar) is moved while hovering over an actor (via a mouse pointer or hover pointer).
  
-If the control should needs to utilise these events, then the correct behaviour flag should be used when constructing the control.
-Then the appropriate method should be overridden.
-~~~{.cpp}
-// C++
-bool MyUIControlImpl::OnTouchEvent( const TouchEvent& event )
-{
-  bool consumed = false;
-
-  // Handle touch event
-
-  // Return true if handled/consumed, false otherwise
-  return consumed;
-}
-~~~
+If the control needs to utilise hover and wheel events, then the correct behaviour flag should be used when constructing the control and then the appropriate method should be overridden.
 ~~~{.cpp}
 // C++
 bool MyUIControlImpl::OnHoverEvent( const HoverEvent& event )
 ~~~{.cpp}
 // C++
 bool MyUIControlImpl::OnHoverEvent( const HoverEvent& event )
index f3a1df2..d58019f 100644 (file)
@@ -6,9 +6,9 @@ Multi-Touch Events
 
 Touch events are received via signals.
 
 
 Touch events are received via signals.
 
-For C++ API see Dali::Actor::TouchedSignal() and Dali::Actor::HoveredSignal() for more details.
+For C++ API see Dali::Actor::TouchSignal() and Dali::Actor::HoveredSignal() for more details.
 
 
-For JavaScript use actor.connect( "touched", myCallback ) and actor.connect("hovered", myCallback );
+For JavaScript use actor.connect( "touch", myCallback ) and actor.connect("hovered", myCallback );
 
 ### Hit Testing Rules Summary:
 
 
 ### Hit Testing Rules Summary:
 
@@ -115,7 +115,7 @@ Hit Priority of above Actor tree (all overlays): 1 - Lowest. 6 - Highest.
     IF ( TOUCH-SIGNAL-NOT-EMPTY )
     {
       // Only do the emission if touch signal of actor has connections.
     IF ( TOUCH-SIGNAL-NOT-EMPTY )
     {
       // Only do the emission if touch signal of actor has connections.
-        CONSUMED = TOUCHED-SIGNAL( TOUCH-EVENT )
+        CONSUMED = TOUCH-SIGNAL( TOUCH-DATA )
     }
 
     IF ( NOT-CONSUMED )
     }
 
     IF ( NOT-CONSUMED )
index 60a4435..c53bee7 100644 (file)
@@ -174,7 +174,7 @@ $ INFO: DALI:  Event, min 0.04 ms, max 5.27 ms, total (0.1 secs), avg 0.28 ms, s
 ~~~
 
 Inside the event processing, the application may be listening for certain events.
 ~~~
 
 Inside the event processing, the application may be listening for certain events.
-For example when an actor is touched, some application code may be run in an OnTouchEvent callback.
+For example when an actor is touched, some application code may be run in an OnTouch callback.
 By checking the max times you can check for any spikes that occur when interacting with the application.
 
 Example:
 By checking the max times you can check for any spikes that occur when interacting with the application.
 
 Example:
index e2c4de2..5938e53 100644 (file)
@@ -13,15 +13,15 @@ actor.SetParentOrigin( Dali::ParentOrigin::CENTER );
 actor.SetAnchorPoint( Dali::AnchorPoint::CENTER );
 Dali::Stage::GetCurrent().Add( actor );
 ...
 actor.SetAnchorPoint( Dali::AnchorPoint::CENTER );
 Dali::Stage::GetCurrent().Add( actor );
 ...
-bool OnPressed( Dali::Actor, const TouchEvent& event )
+bool OnPressed( Dali::Actor, const TouchData& touch )
 {
   Dali::Animation anim = Dali::Animation::New( 1.5f );
 {
   Dali::Animation anim = Dali::Animation::New( 1.5f );
-  anim.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 200,-100,0), AlphaFunctions::Bounce );
+  anim.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 200, -100, 0 ), AlphaFunctions::Bounce );
   anim.play();
   return true; // consume the touch event
 }
 ...
   anim.play();
   return true; // consume the touch event
 }
 ...
-actor.TouchedSignal().Connect( &OnPressed );
+actor.TouchSignal().Connect( &OnPressed );
 ~~~
 
 */
 ~~~
 
 */
@@ -34,16 +34,16 @@ actor.parentOrigin = dali.CENTER;
 actor.anchorPoint = dali.CENTER;
 dali.stage.add( actor );
 ...
 actor.anchorPoint = dali.CENTER;
 dali.stage.add( actor );
 ...
-function onPressed( actor, touchEvent )
+function onPressed( actor, touch )
 {
   var animOptions = { alpha: "bounce", delay: 0, duration: 15 };
   var anim = new dali.Animation();
 {
   var animOptions = { alpha: "bounce", delay: 0, duration: 15 };
   var anim = new dali.Animation();
-  anim.animateTo( actor, "position", [ 200,-100,0], animOptions );
+  anim.animateTo( actor, "position", [ 200, -100, 0 ], animOptions );
   anim.play();
   return true; // consume the touch event
 }
 ...
   anim.play();
   return true; // consume the touch event
 }
 ...
-actor.connect( "touched", onPressed );
+actor.connect( "touch", onPressed );
 
 ~~~
 
 
 ~~~
 
@@ -76,7 +76,7 @@ actor.connect( "touched", onPressed );
       "parentOrigin": "CENTER",
       "signals" :
       [
       "parentOrigin": "CENTER",
       "signals" :
       [
-        { "name" : "touched", "action": "play", "animation": "move" }
+        { "name" : "touch", "action": "play", "animation": "move" }
       ]
     }
   ]
       ]
     }
   ]