(FocusManager) Updated Accessibility features (Part2)
authorSinjae Lee <sinjae4b.lee@samsung.com>
Sat, 24 May 2014 07:24:40 +0000 (16:24 +0900)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 11 Jun 2014 07:50:14 +0000 (08:50 +0100)
base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp
base/dali-toolkit/internal/focus-manager/focus-manager-impl.h
base/dali-toolkit/public-api/controls/control-impl.cpp
base/dali-toolkit/public-api/focus-manager/focus-manager.cpp
capi/dali-toolkit/public-api/controls/control-impl.h
capi/dali-toolkit/public-api/focus-manager/focus-manager.h

index 2ca17e5..cb1ce25 100644 (file)
@@ -548,16 +548,6 @@ bool FocusManager::GetWrapMode() const
   return mIsWrapped;
 }
 
-void FocusManager::SetEndCapFeedbackEnabled(bool enabled)
-{
-  mIsEndcapFeedbackEnabled = enabled;
-}
-
-bool FocusManager::GetEndCapFeedbackEnabled() const
-{
-  return mIsEndcapFeedbackEnabled;
-}
-
 void FocusManager::SetFocusIndicatorActor(Actor indicator)
 {
   mFocusIndicatorActor = indicator;
@@ -576,22 +566,22 @@ bool FocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapp
   if( (forward && ++focusIDIter == mFocusIDContainer.end())
     || (!forward && focusIDIter-- == mFocusIDContainer.begin()) )
   {
-    if(wrapped)
+    if(mIsEndcapFeedbackEnabled)
     {
-      if(mIsEndcapFeedbackEnabled)
+      if(mIsEndcapFeedbackPlayed == false)
       {
-        if(mIsEndcapFeedbackPlayed == false)
-        {
-          // play sound & skip to move once
-          Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
-          soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE);
+        // play sound & skip moving once
+        Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
+        soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE);
 
-          mIsEndcapFeedbackPlayed = true;
-          return true;
-        }
-        mIsEndcapFeedbackPlayed = false;
+        mIsEndcapFeedbackPlayed = true;
+        return true;
       }
+      mIsEndcapFeedbackPlayed = false;
+    }
 
+    if(wrapped)
+    {
       if(forward)
       {
         focusIDIter = mFocusIDContainer.begin();
@@ -604,12 +594,6 @@ bool FocusManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapp
     }
     else
     {
-      if(mIsEndcapFeedbackEnabled)
-      {
-        Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
-        soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE);
-      }
-
       DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] Overshot\n", __FUNCTION__, __LINE__);
       // Send notification for handling overshooted situation
       mFocusOvershotSignalV2.Emit(GetCurrentFocusActor(), forward ? Toolkit::FocusManager::OVERSHOT_NEXT : Toolkit::FocusManager::OVERSHOT_PREVIOUS);
@@ -708,10 +692,11 @@ bool FocusManager::ChangeAccessibilityStatus()
   return true;
 }
 
-bool FocusManager::AccessibilityActionNext()
+bool FocusManager::AccessibilityActionNext(bool allowEndFeedback)
 {
   if(mIsAccessibilityTtsEnabled)
   {
+    mIsEndcapFeedbackEnabled = allowEndFeedback;
     return MoveFocusForward();
   }
   else
@@ -720,10 +705,11 @@ bool FocusManager::AccessibilityActionNext()
   }
 }
 
-bool FocusManager::AccessibilityActionPrevious()
+bool FocusManager::AccessibilityActionPrevious(bool allowEndFeedback)
 {
   if(mIsAccessibilityTtsEnabled)
   {
+    mIsEndcapFeedbackEnabled = allowEndFeedback;
     return MoveFocusBackward();
   }
   else
@@ -772,7 +758,7 @@ bool FocusManager::AccessibilityActionRead(bool allowReadAgain)
   return ret;
 }
 
-bool FocusManager::AccessibilityActionReadNext()
+bool FocusManager::AccessibilityActionReadNext(bool allowEndFeedback)
 {
   if(mIsAccessibilityTtsEnabled)
   {
@@ -784,7 +770,7 @@ bool FocusManager::AccessibilityActionReadNext()
   }
 }
 
-bool FocusManager::AccessibilityActionReadPrevious()
+bool FocusManager::AccessibilityActionReadPrevious(bool allowEndFeedback)
 {
   if(mIsAccessibilityTtsEnabled)
   {
@@ -858,6 +844,21 @@ bool FocusManager::AccessibilityActionBack()
   return mIsAccessibilityTtsEnabled;
 }
 
+bool FocusManager::AccessibilityActionTouch(const TouchEvent& touchEvent)
+{
+  bool handled = false;
+
+  // TODO: Need to convert the touchevent for the focused actor?
+
+  Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor());
+  if(control)
+  {
+    handled = control.GetImplementation().OnAccessibilityTouch(touchEvent);
+  }
+
+  return handled;
+}
+
 bool FocusManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent)
 {
   bool handled = false;
index c69557c..89dc225 100644 (file)
@@ -170,16 +170,6 @@ public:
   bool GetWrapMode() const;
 
   /**
-   * @copydoc Toolkit::FocusManager::SetEndCapFeedbackEnabled
-   */
-  void SetEndCapFeedbackEnabled(bool enabled);
-
-  /**
-   * @copydoc Toolkit::FocusManager::GetEndCapFeedbackEnabled
-   */
-  bool GetEndCapFeedbackEnabled() const;
-
-  /**
    * @copydoc Toolkit::FocusManager::SetFocusIndicatorActor
    */
   void SetFocusIndicatorActor(Actor indicator);
@@ -303,27 +293,31 @@ private:
 
   /**
    * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick up).
+   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
    * @return whether the accessibility action is performed or not.
    */
-  virtual bool AccessibilityActionPrevious();
+  virtual bool AccessibilityActionPrevious(bool allowEndFeedback);
 
   /**
    * Perform the accessibility action to move focus to the next focusable actor (by one finger flick down).
+   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
    * @return whether the accessibility action is performed or not.
    */
-  virtual bool AccessibilityActionNext();
+  virtual bool AccessibilityActionNext(bool allowEndFeedback);
 
   /**
    * Perform the accessibility action to move focus to the previous focusable actor (by one finger flick left).
+   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
    * @return whether the accessibility action is performed or not.
    */
-  virtual bool AccessibilityActionReadPrevious();
+  virtual bool AccessibilityActionReadPrevious(bool allowEndFeedback);
 
   /**
    * Perform the accessibility action to move focus to the next focusable actor (by one finger flick right).
+   * @param allowEndFeedback true if end of list feedback should be played when the focus is alread reached to the end
    * @return whether the accessibility action is performed or not.
    */
-  virtual bool AccessibilityActionReadNext();
+  virtual bool AccessibilityActionReadNext(bool allowEndFeedback);
 
   /**
    * Perform the accessibility action to focus and read the actor (by one finger tap or move).
@@ -359,6 +353,13 @@ private:
    */
   virtual bool AccessibilityActionBack();
 
+  /**
+   * Perform the accessibility action to mouse move (by one finger tap & hold and move).
+   * @param touchEvent touch event structure
+   * @return whether the accessibility action is performed or not.
+   */
+  virtual bool AccessibilityActionTouch(const TouchEvent& touchEvent);
+
 private:
 
   // Undefined
index 18b0a8c..9e85139 100644 (file)
@@ -846,6 +846,11 @@ bool Control::OnAccessibilityPan(PanGesture gesture)
   return false; // Accessibility pan gesture is not handled by default
 }
 
+bool Control::OnAccessibilityTouch(const TouchEvent& touchEvent)
+{
+  return false; // Accessibility touch event is not handled by default
+}
+
 bool Control::OnAccessibilityValueChange(bool isIncrease)
 {
   return false; // Accessibility value change action is not handled by default
index 873ec65..d172135 100644 (file)
@@ -170,16 +170,6 @@ bool FocusManager::GetWrapMode() const
   return GetImpl(*this).GetWrapMode();
 }
 
-void FocusManager::SetEndCapFeedbackEnabled(bool enabled)
-{
-  GetImpl(*this).SetEndCapFeedbackEnabled(enabled);
-}
-
-bool FocusManager::GetEndCapFeedbackEnabled() const
-{
-  return GetImpl(*this).GetEndCapFeedbackEnabled();
-}
-
 void FocusManager::SetFocusIndicatorActor(Actor indicator)
 {
   GetImpl(*this).SetFocusIndicatorActor(indicator);
index b024d9a..3fbcba9 100644 (file)
@@ -99,6 +99,15 @@ public:
   virtual bool OnAccessibilityPan(PanGesture gesture);
 
   /**
+   * @brief This method should be overridden by deriving classes when they wish to respond the accessibility
+   * touch event.
+   *
+   * @param[in] touchEvent The touch event.
+   * @return true if the touch event has been consumed by this control
+   */
+  virtual bool OnAccessibilityTouch(const TouchEvent& touchEvent);
+
+  /**
    * @brief This method should be overridden by deriving classes when they wish to respond
    * the accessibility up and down action (i.e. value change of slider control).
    *
index 750716f..7f3b31e 100644 (file)
@@ -336,25 +336,6 @@ public:
   bool GetWrapMode() const;
 
   /**
-   * @brief Set whether focus manager will play a feedback when the focus leaves the end or vice versa.
-   *
-   * If wrap mode is enabled, the feedback will be played once. In next time, focus will move continueously.
-   * Otherwise, feedback will be played with overshot signal
-   *
-   * @pre The FocusManager has been initialized.
-   * @param enabled Whether the endcap feedback is enabled or not
-   */
-  void SetEndCapFeedbackEnabled(bool enabled);
-
-  /**
-   * @brief Get whether the endcap feedback is enabled or not.
-   *
-   * @pre The FocusManager has been initialized.
-   * @return Whether the endcap feedback is enabled or not.
-   */
-  bool GetEndCapFeedbackEnabled() const;
-
-  /**
    * @brief Set the focus indicator actor.
    *
    * This will replace the default focus indicator actor in