/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/integration-api/events/key-event-integ.h>
#include <dali-toolkit/devel-api/focus-manager/keyboard-focus-manager-devel.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/controls/table-view/table-view.h>
using namespace Dali;
using namespace Dali::Toolkit;
// Create the first actor and add it to the stage
Actor first = Actor::New();
first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(first);
+ application.GetScene().Add(first);
// Create the second actor and add it to the stage
Actor second = Actor::New();
second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(second);
+ application.GetScene().Add(second);
// Create the third actor but don't add it to the stage
Actor third = Actor::New();
DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
// Add the third actor to the stage
- Stage::GetCurrent().Add(third);
+ application.GetScene().Add(third);
// Check that it will fail to set focus on the third actor as it's not focusable
DALI_TEST_CHECK(manager.SetCurrentFocusActor(third) == false);
// Create the first actor and add it to the stage
Actor first = Actor::New();
first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(first);
+ application.GetScene().Add(first);
// Create the second actor and add it to the stage
Actor second = Actor::New();
second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(second);
+ application.GetScene().Add(second);
// Move the focus to the right
DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
// Create a 2x2 table view and try to move focus inside it
TableView tableView = TableView::New( 2, 2 );
- Stage::GetCurrent().Add(tableView);
+ application.GetScene().Add(tableView);
// Create the third actor
Actor third = Actor::New();
// Create the first actor and add it to the stage
Actor first = Actor::New();
first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(first);
+ application.GetScene().Add(first);
// Create the second actor and add it to the stage
Actor second = Actor::New();
second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(second);
+ application.GetScene().Add(second);
// Move the focus to the right
DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
PushButton button2 = PushButton::New();
button1.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
button2.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(button1);
- Stage::GetCurrent().Add(button2);
+ application.GetScene().Add(button1);
+ application.GetScene().Add(button2);
// Set the focus to the button1
DALI_TEST_CHECK(manager.SetCurrentFocusActor(button1) == true);
// Create a 1x1 table view and try to move focus inside it
TableView tableView = TableView::New( 1, 1 );
- Stage::GetCurrent().Add(tableView);
+ application.GetScene().Add(tableView);
PushButton button = PushButton::New();
button.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
// Create the first actor and add it to the stage
Actor first = Actor::New();
first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(first);
+ application.GetScene().Add(first);
// Create the second actor and add it to the stage
Actor second = Actor::New();
second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(second);
+ application.GetScene().Add(second);
// Check that the focus is set on the first actor
DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
Actor parent = Actor::New();
Actor child = Actor::New();
parent.Add(child);
- Stage::GetCurrent().Add(parent);
+ application.GetScene().Add(parent);
// Create three actors and add them as the children of the first child actor
Actor grandChild = Actor::New();
// Create the first button and add it to the stage
PushButton firstPushButton = PushButton::New();
firstPushButton.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(firstPushButton);
+ application.GetScene().Add(firstPushButton);
// Create the second button and add it to the stage
PushButton secondPushButton = PushButton::New();
secondPushButton.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(secondPushButton);
+ application.GetScene().Add(secondPushButton);
// Check that the focus is set on the first button
DALI_TEST_CHECK(manager.SetCurrentFocusActor(firstPushButton) == true);
// Create the first actor and add it to the stage
Actor first = Actor::New();
first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(first);
+ application.GetScene().Add(first);
// Create the second actor and add it to the stage
Actor second = Actor::New();
second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(second);
+ application.GetScene().Add(second);
// Create the third actor and add it to the stage
Actor third = Actor::New();
third.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(third);
+ application.GetScene().Add(third);
// Create the fourth actor and add it to the stage
Actor fourth = Actor::New();
fourth.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(fourth);
+ application.GetScene().Add(fourth);
// Check that the focus is set on the second actor
DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
{
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
manager.SetCurrentFocusActor(actor);
}
// Create a 2x2 table view and try to move focus inside it
TableView tableView = TableView::New( 2, 2 );
- Stage::GetCurrent().Add(tableView);
+ application.GetScene().Add(tableView);
// Create the first actor
Actor first = Actor::New();
// Create the first actor and add it to the stage
Control first = Control::New();
first.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(first);
+ application.GetScene().Add(first);
// Create the second actor and add it to the stage
Control second = Control::New();
second.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE,true);
- Stage::GetCurrent().Add(second);
+ application.GetScene().Add(second);
// Move the focus to the right
DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == false);
// Create a 2x2 table view and try to move focus inside it
TableView tableView = TableView::New( 2, 2 );
- Stage::GetCurrent().Add(tableView);
+ application.GetScene().Add(tableView);
// Create the third actor
Control third = Control::New();
DALI_TEST_CHECK( ! manager.GetCurrentFocusActor() );
tet_infoline( "Add actor to stage and attempt to set, our actor should be returned from KeyboardFocusManager" );
- Stage::GetCurrent().Add( actor );
+ application.GetScene().Add( actor );
manager.SetCurrentFocusActor( actor );
DALI_TEST_CHECK( manager.GetCurrentFocusActor() == actor );
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
- Stage::GetCurrent().Add( actor );
+ application.GetScene().Add( actor );
manager.SetCurrentFocusActor( actor );
// Press Any key to notice physical keyboard event is comming to KeyboardFocusManager