X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Ffocus-manager%2Ffocus-manager-impl.cpp;h=986c4759beedc77ff3885c3a4b7b56291ad7bd81;hb=7e315a440bad7033d19fefa8f9952d625ee6f076;hp=2ca17e50604f9565685e6b526def6dd60f74ca0b;hpb=9db0a074bbad5b5f1f29f22b0e39e8fb3f108a32;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp b/base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp index 2ca17e5..986c475 100644 --- a/base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp +++ b/base/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp @@ -1,22 +1,31 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // CLASS HEADER #include "focus-manager-impl.h" +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include +#include + // INTERNAL INCLUDES #include #include @@ -93,7 +102,7 @@ bool IsActorFocusableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType FocusManager::FocusManager() : mIsWrapped(false), mIsFocusWithinGroup(false), - mIsEndcapFeedbackEnabled(true), + mIsEndcapFeedbackEnabled(false), mIsEndcapFeedbackPlayed(false), mCurrentFocusActor(FocusIDPair(0, 0)), mFocusIndicatorActor(Actor()), @@ -329,7 +338,7 @@ bool FocusManager::DoSetCurrentFocusActor(const unsigned int actorID) } // Send notification for the change of focus actor - mFocusChangedSignalV2.Emit( GetCurrentFocusActor(), actor ); + mFocusChangedSignal.Emit( GetCurrentFocusActor(), actor ); // Save the current focused actor mCurrentFocusActor = FocusIDPair(GetFocusOrder(actor), actorID); @@ -337,7 +346,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); @@ -447,11 +459,11 @@ void FocusManager::DoActivate(Actor actor) if(control) { // Notify the control that it is activated - control.GetImplementation().OnActivated(); + control.GetImplementation().Activate(); } // Send notification for the activation of focused actor - mFocusedActorActivatedSignalV2.Emit(actor); + mFocusedActorActivatedSignal.Emit(actor); } } @@ -466,7 +478,7 @@ void FocusManager::ClearFocus() mCurrentFocusActor = FocusIDPair(0, 0); // Send notification for the change of focus actor - mFocusChangedSignalV2.Emit(actor, Actor()); + mFocusChangedSignal.Emit(actor, Actor()); if(mIsAccessibilityTtsEnabled) { @@ -491,7 +503,7 @@ void FocusManager::SetFocusGroup(Actor actor, bool isFocusGroup) Property::Index propertyIsFocusGroup = actor.GetPropertyIndex(IS_FOCUS_GROUP); if(propertyIsFocusGroup == Property::INVALID_INDEX) { - propertyIsFocusGroup = actor.RegisterProperty(IS_FOCUS_GROUP, isFocusGroup); + actor.RegisterProperty(IS_FOCUS_GROUP, isFocusGroup); } else { @@ -548,16 +560,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 +578,25 @@ 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 moving once + Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get(); + if(soundPlayer) { - // play sound & skip to move 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,15 +609,9 @@ 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); + mFocusOvershotSignal.Emit(GetCurrentFocusActor(), forward ? Toolkit::FocusManager::OVERSHOT_NEXT : Toolkit::FocusManager::OVERSHOT_PREVIOUS); return false; // Try to move the focus out of the scope } @@ -647,7 +646,7 @@ void FocusManager::SetFocusable(Actor actor, bool focusable) Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE); if(propertyActorFocusable == Property::INVALID_INDEX) { - propertyActorFocusable = actor.RegisterProperty(ACTOR_FOCUSABLE, focusable); + actor.RegisterProperty(ACTOR_FOCUSABLE, focusable); } else { @@ -708,10 +707,11 @@ bool FocusManager::ChangeAccessibilityStatus() return true; } -bool FocusManager::AccessibilityActionNext() +bool FocusManager::AccessibilityActionNext(bool allowEndFeedback) { if(mIsAccessibilityTtsEnabled) { + mIsEndcapFeedbackEnabled = allowEndFeedback; return MoveFocusForward(); } else @@ -720,10 +720,11 @@ bool FocusManager::AccessibilityActionNext() } } -bool FocusManager::AccessibilityActionPrevious() +bool FocusManager::AccessibilityActionPrevious(bool allowEndFeedback) { if(mIsAccessibilityTtsEnabled) { + mIsEndcapFeedbackEnabled = allowEndFeedback; return MoveFocusBackward(); } else @@ -772,7 +773,7 @@ bool FocusManager::AccessibilityActionRead(bool allowReadAgain) return ret; } -bool FocusManager::AccessibilityActionReadNext() +bool FocusManager::AccessibilityActionReadNext(bool allowEndFeedback) { if(mIsAccessibilityTtsEnabled) { @@ -784,7 +785,7 @@ bool FocusManager::AccessibilityActionReadNext() } } -bool FocusManager::AccessibilityActionReadPrevious() +bool FocusManager::AccessibilityActionReadPrevious(bool allowEndFeedback) { if(mIsAccessibilityTtsEnabled) { @@ -858,6 +859,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; @@ -935,19 +951,19 @@ bool FocusManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent return handled; } -Toolkit::FocusManager::FocusChangedSignalV2& FocusManager::FocusChangedSignal() +Toolkit::FocusManager::FocusChangedSignalType& FocusManager::FocusChangedSignal() { - return mFocusChangedSignalV2; + return mFocusChangedSignal; } -Toolkit::FocusManager::FocusOvershotSignalV2& FocusManager::FocusOvershotSignal() +Toolkit::FocusManager::FocusOvershotSignalType& FocusManager::FocusOvershotSignal() { - return mFocusOvershotSignalV2; + return mFocusOvershotSignal; } -Toolkit::FocusManager::FocusedActorActivatedSignalV2& FocusManager::FocusedActorActivatedSignal() +Toolkit::FocusManager::FocusedActorActivatedSignalType& FocusManager::FocusedActorActivatedSignal() { - return mFocusedActorActivatedSignalV2; + return mFocusedActorActivatedSignal; } bool FocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )