void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event) { if(!mIsKeyboardFocusEnabled) { return; } AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get(); bool isAccessibilityEnabled = accessibilityAdaptor.IsEnabled(); Toolkit::AccessibilityManager accessibilityManager = Toolkit::AccessibilityManager::Get(); std::string keyName = event.keyPressedName; bool isFocusStartableKey = false; if(event.state == KeyEvent::Down) { if (keyName == "Left") { if(!isAccessibilityEnabled) { if(!mIsFocusIndicatorEnabled) { // Show focus indicator mIsFocusIndicatorEnabled = true; } else { // Move the focus towards left MoveFocus(Toolkit::Control::KeyboardFocus::LEFT); } isFocusStartableKey = true; } else { // Move the accessibility focus backward accessibilityManager.MoveFocusBackward(); } } else if (keyName == "Right") { if(!isAccessibilityEnabled) { if(!mIsFocusIndicatorEnabled) { // Show focus indicator mIsFocusIndicatorEnabled = true; } else { // Move the focus towards right MoveFocus(Toolkit::Control::KeyboardFocus::RIGHT); } } else { // Move the accessibility focus forward accessibilityManager.MoveFocusForward(); } isFocusStartableKey = true; } else if (keyName == "Up" && !isAccessibilityEnabled) { if(!mIsFocusIndicatorEnabled) { // Show focus indicator mIsFocusIndicatorEnabled = true; } else { // Move the focus towards up MoveFocus(Toolkit::Control::KeyboardFocus::UP); } isFocusStartableKey = true; } else if (keyName == "Down" && !isAccessibilityEnabled) { if(!mIsFocusIndicatorEnabled) { // Show focus indicator mIsFocusIndicatorEnabled = true; } else { // Move the focus towards down MoveFocus(Toolkit::Control::KeyboardFocus::DOWN); } isFocusStartableKey = true; } else if (keyName == "Tab" && !isAccessibilityEnabled) { if(!mIsFocusIndicatorEnabled) { // Show focus indicator mIsFocusIndicatorEnabled = true; } else { // "Tab" key changes the focus group in the forward direction and // "Shift-Tab" key changes it in the backward direction. DoMoveFocusToNextFocusGroup(!event.IsShiftModifier()); } isFocusStartableKey = true; } else if (keyName == "space" && !isAccessibilityEnabled) { if(!mIsFocusIndicatorEnabled) { // Show focus indicator mIsFocusIndicatorEnabled = true; } isFocusStartableKey = true; } else if (keyName == "" && !isAccessibilityEnabled) { // Check the fake key event for evas-plugin case if(!mIsFocusIndicatorEnabled) { // Show focus indicator mIsFocusIndicatorEnabled = true; } isFocusStartableKey = true; } else if (keyName == "Backspace" && !isAccessibilityEnabled) { // Emit signal to go back to the previous view??? } } else if(event.state == KeyEvent::Up) { if (keyName == "Return") { if(!mIsFocusIndicatorEnabled && !isAccessibilityEnabled) { // Show focus indicator mIsFocusIndicatorEnabled = true; } else { // The focused actor has enter pressed on it Actor actor; if( !isAccessibilityEnabled ) { actor = GetCurrentFocusActor(); } else { actor = accessibilityManager.GetCurrentFocusActor(); } if( actor ) { DoKeyboardEnter( actor ); } } isFocusStartableKey = true; } } if(isFocusStartableKey && mIsFocusIndicatorEnabled && !isAccessibilityEnabled) { Actor actor = GetCurrentFocusActor(); if( !actor ) { // No actor is focused but keyboard focus is activated by the key press // Let's try to move the initial focus MoveFocus(Toolkit::Control::KeyboardFocus::RIGHT); } else if(mFocusIndicatorActor) { // Make sure the focused actor is highlighted actor.Add(mFocusIndicatorActor); } } }