DALI_TEST_EQUALS(-1, control.GetProperty(DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID).Get<int>(), TEST_LOCATION);
DALI_TEST_EQUALS(-1, control.GetProperty(DevelControl::Property::UP_FOCUSABLE_ACTOR_ID).Get<int>(), TEST_LOCATION);
DALI_TEST_EQUALS(-1, control.GetProperty(DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID).Get<int>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, control.GetProperty( DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, control.GetProperty( DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION);
control.SetProperty(DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, 1);
DALI_TEST_EQUALS(1, control.GetProperty(DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID).Get<int>(), TEST_LOCATION);
DALI_TEST_EQUALS(17, control.GetProperty(DevelControl::Property::UP_FOCUSABLE_ACTOR_ID).Get<int>(), TEST_LOCATION);
control.SetProperty(DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, 18);
DALI_TEST_EQUALS(18, control.GetProperty(DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID).Get<int>(), TEST_LOCATION);
+ control.SetProperty(DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID, 19);
+ DALI_TEST_EQUALS(19, control.GetProperty( DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION);
+ control.SetProperty(DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID, 20);
+ DALI_TEST_EQUALS(20, control.GetProperty( DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID ).Get< int >(), TEST_LOCATION);
END_TEST;
}
button1.SetProperty(Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID, Property::Value((int)button2.GetProperty<int>(Actor::Property::ID)));
button1.SetProperty(Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, Property::Value((int)button2.GetProperty<int>(Actor::Property::ID)));
button1.SetProperty(Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, Property::Value((int)button2.GetProperty<int>(Actor::Property::ID)));
+ button1.SetProperty(Toolkit::DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::Value((int)button2.GetProperty< int >( Actor::Property::ID)));
+ button1.SetProperty(Toolkit::DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::Value((int)button2.GetProperty< int >( Actor::Property::ID)));
// set the navigation properties of button2
button2.SetProperty(Toolkit::DevelControl::Property::LEFT_FOCUSABLE_ACTOR_ID, Property::Value((int)button1.GetProperty<int>(Actor::Property::ID)));
button2.SetProperty(Toolkit::DevelControl::Property::RIGHT_FOCUSABLE_ACTOR_ID, Property::Value((int)button1.GetProperty<int>(Actor::Property::ID)));
button2.SetProperty(Toolkit::DevelControl::Property::UP_FOCUSABLE_ACTOR_ID, Property::Value((int)button1.GetProperty<int>(Actor::Property::ID)));
button2.SetProperty(Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID, Property::Value((int)button1.GetProperty<int>(Actor::Property::ID)));
+ button2.SetProperty(Toolkit::DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::Value((int)button1.GetProperty< int >( Actor::Property::ID)));
+ button2.SetProperty(Toolkit::DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::Value((int)button1.GetProperty< int >( Actor::Property::ID)));
// Move the focus towards left
DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == button1);
focusChangedCallback.Reset();
+ // Move the focus towards clockwise
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::CLOCKWISE) == true);
+
+ // Confirm whether focus is moved to button2
+ DALI_TEST_EQUALS(button2.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == button1);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == button2);
+ focusChangedCallback.Reset();
+
+ // Move the focus towards clockwise
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::COUNTER_CLOCKWISE) == true);
+
+ // Confirm whether focus is moved to button1
+ DALI_TEST_EQUALS(button1.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION );
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == button2);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == button1);
+ focusChangedCallback.Reset();
+
// Create a 1x1 table view and try to move focus inside it
TableView tableView = TableView::New(1, 1);
application.GetScene().Add(tableView);
END_TEST;
}
+
+int UtcDaliKeyboardFocusManagerChangeFocusDirectionByCustomWheelEvent(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerChangeFocusDirectionByCustomWheelEvent");
+ Dali::Integration::Scene scene = application.GetScene();
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool focusChangedSignalVerified = false;
+ FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
+ manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
+
+ Integration::WheelEvent clockwiseEvent(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u);
+ Integration::WheelEvent counterClockwiseEvent(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1100u);
+
+ // Create the first button
+ PushButton first = PushButton::New();
+ first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
+ scene.Add(first);
+
+ // Create the second button
+ PushButton second = PushButton::New();
+ second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
+ scene.Add(second);
+
+ // set the navigation properties
+ first.SetProperty(Toolkit::DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::Value((int)second.GetProperty< int >( Actor::Property::ID )));
+ second.SetProperty(Toolkit::DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::Value((int)first.GetProperty< int >( Actor::Property::ID )));
+
+ // Set the focus to the first actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ focusChangedCallback.Reset();
+
+ // Send the clockwise wheel event to move the focus towards clockwise
+ application.ProcessEvent(clockwiseEvent);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == first);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == second);
+ focusChangedCallback.Reset();
+
+ // Send the counter clockwise wheel event to move the focus towards count clockwise
+ application.ProcessEvent(counterClockwiseEvent);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == second);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == first);
+ focusChangedCallback.Reset();
+
+ // Clear the focus
+ manager.ClearFocus();
+
+ END_TEST;
+}
* @note The representative Accessible object will not appear in the AT-SPI tree.
*/
ACCESSIBILITY_HIDDEN,
+
+ /**
+ * @brief The actor ID of the clockwise focusable control.
+ * @details Name "clockwiseFocusableActorId", type Property::INTEGER.
+ *
+ */
+ CLOCKWISE_FOCUSABLE_ACTOR_ID,
+
+ /**
+ * @brief The actor ID of the conter-clockwise focusable control.
+ * @details Name "counterClockwiseFocusableActorId", type Property::INTEGER.
+ *
+ */
+ COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID,
};
} // namespace Property
const PropertyRegistration Control::Impl::PROPERTY_21(typeRegistration, "accessibilityAttributes", Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
const PropertyRegistration Control::Impl::PROPERTY_22(typeRegistration, "dispatchKeyEvents", Toolkit::DevelControl::Property::DISPATCH_KEY_EVENTS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
const PropertyRegistration Control::Impl::PROPERTY_23(typeRegistration, "accessibilityHidden", Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+const PropertyRegistration Control::Impl::PROPERTY_24(typeRegistration, "clockwiseFocusableActorId", Toolkit::DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+const PropertyRegistration Control::Impl::PROPERTY_25(typeRegistration, "counterClockwiseFocusableActorId", Toolkit::DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
// clang-format on
mRightFocusableActorId(-1),
mUpFocusableActorId(-1),
mDownFocusableActorId(-1),
+ mClockwiseFocusableActorId(-1),
+ mCounterClockwiseFocusableActorId(-1),
mStyleName(""),
mBackgroundColor(Color::TRANSPARENT),
mStartingPinchScale(nullptr),
}
break;
}
+ case Toolkit::DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID:
+ {
+ int focusId;
+ if(value.Get(focusId))
+ {
+ controlImpl.mImpl->mClockwiseFocusableActorId = focusId;
+ }
+ break;
+ }
+ case Toolkit::DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID:
+ {
+ int focusId;
+ if(value.Get(focusId))
+ {
+ controlImpl.mImpl->mCounterClockwiseFocusableActorId = focusId;
+ }
+ break;
+ }
}
}
}
value = controlImpl.mImpl->mAccessibilityHidden;
break;
}
+
+ case Toolkit::DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID:
+ {
+ value = controlImpl.mImpl->mClockwiseFocusableActorId;
+ break;
+ }
+
+ case Toolkit::DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID:
+ {
+ value = controlImpl.mImpl->mCounterClockwiseFocusableActorId;
+ break;
+ }
}
}
int mRightFocusableActorId; ///< Actor ID of Right focusable control.
int mUpFocusableActorId; ///< Actor ID of Up focusable control.
int mDownFocusableActorId; ///< Actor ID of Down focusable control.
+ int mClockwiseFocusableActorId; ///< Actor ID of Clockwise focusable control.
+ int mCounterClockwiseFocusableActorId; ///< Actor ID of Counter clockwise focusable control.
RegisteredVisualContainer mVisuals; ///< Stores visuals needed by the control, non trivial type so std::vector used.
std::string mStyleName;
static const PropertyRegistration PROPERTY_21;
static const PropertyRegistration PROPERTY_22;
static const PropertyRegistration PROPERTY_23;
+ static const PropertyRegistration PROPERTY_24;
+ static const PropertyRegistration PROPERTY_25;
private:
// Accessibility - notification for highlighted object to check if it is showing.
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/events/touch-event.h>
+#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/object/property-map.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/object/type-registry.h>
{
(*iter).KeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
(*iter).TouchedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnTouch);
- (*iter).WheelEventGeneratedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnWheelEvent);
+ (*iter).WheelEventGeneratedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnCustomWheelEvent);
+ (*iter).WheelEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnWheelEvent);
Dali::Window window = DevelWindow::DownCast(*iter);
if(window)
{
{
sceneHolder.KeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
sceneHolder.TouchedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnTouch);
- sceneHolder.WheelEventGeneratedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnWheelEvent);
+ sceneHolder.WheelEventGeneratedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnCustomWheelEvent);
+ sceneHolder.WheelEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnWheelEvent);
Dali::Window window = DevelWindow::DownCast(sceneHolder);
if(window)
{
index = Toolkit::DevelControl::Property::DOWN_FOCUSABLE_ACTOR_ID;
break;
}
+ case Toolkit::Control::KeyboardFocus::CLOCKWISE:
+ {
+ index = Toolkit::DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID;
+ break;
+ }
+ case Toolkit::Control::KeyboardFocus::COUNTER_CLOCKWISE:
+ {
+ index = Toolkit::DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID;
+ break;
+ }
default:
break;
}
}
}
-bool KeyboardFocusManager::OnWheelEvent(const WheelEvent& event)
+void KeyboardFocusManager::OnWheelEvent(const WheelEvent& event)
+{
+ if(event.GetType() == Dali::WheelEvent::CUSTOM_WHEEL)
+ {
+ Toolkit::Control::KeyboardFocus::Direction direction = (event.GetDelta() > 0) ? Toolkit::Control::KeyboardFocus::CLOCKWISE : Toolkit::Control::KeyboardFocus::COUNTER_CLOCKWISE;
+ // Move the focus
+ MoveFocus(direction);
+ }
+}
+
+bool KeyboardFocusManager::OnCustomWheelEvent(const WheelEvent& event)
{
bool consumed = false;
Actor actor = GetCurrentFocusActor();
if(actor)
{
// Notify the actor about the wheel event
- consumed = EmitWheelSignals(actor, event);
+ consumed = EmitCustomWheelSignals(actor, event);
}
return consumed;
}
-bool KeyboardFocusManager::EmitWheelSignals(Actor actor, const WheelEvent& event)
+bool KeyboardFocusManager::EmitCustomWheelSignals(Actor actor, const WheelEvent& event)
{
bool consumed = false;
if(parent &&
(parent == oldParent))
{
- consumed = EmitWheelSignals(parent, event);
+ consumed = EmitCustomWheelSignals(parent, event);
}
}
}
* Callback for the wheel event when the custom wheel event occurs.
* @param[in] wheel The WheelEvent information
*/
- bool OnWheelEvent(const WheelEvent& wheel);
+ bool OnCustomWheelEvent(const WheelEvent& wheel);
+
+ /**
+ * Callback for the wheel event when the wheel event occurs.
+ * @param[in] wheel The WheelEvent information
+ */
+ void OnWheelEvent(const WheelEvent& wheel);
/**
* Called when the window focus is changed.
* @param[in] event The WheelEvent.
* @return True if WheelEvent is consumed.
*/
- bool EmitWheelSignals(Actor actor, const WheelEvent& event);
+ bool EmitCustomWheelSignals(Actor actor, const WheelEvent& event);
private:
// Undefined
PAGE_DOWN, ///< Move keyboard focus towards the next page direction @SINCE_1_2.14
FORWARD, ///< Move keyboard focus towards the forward direction @SINCE_2_1.10
BACKWARD, ///< Move keyboard focus towards the backward direction @SINCE_2_1.10
+ CLOCKWISE, ///< Move keyboard focus towards the clockwise direction @SINCE_2_1.14
+ COUNTER_CLOCKWISE, ///< Move keyboard focus towards the counter clockwise direction @SINCE_2_1.14
};
};