/*
- * Copyright (c) 2019 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.
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage )
+ UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene )
: GestureReceivedFunctor( data ),
- stateToUnstage( stateToUnstage )
+ stateToUnstage( stateToUnstage ),
+ scene( scene )
{
}
if ( pan.state == stateToUnstage )
{
- Stage::GetCurrent().Remove( actor );
+ scene.Remove( actor );
}
}
Gesture::State& stateToUnstage;
+ Integration::Scene scene;
};
// Functor for receiving a touch event
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
detector.Attach(actor);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor tempActor = Actor::New();
tempActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
tempActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
- Stage::GetCurrent().Add(tempActor);
+ application.GetScene().Add(tempActor);
detector.Attach(tempActor);
uint32_t time = 100;
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Remove the actor from stage and reset the data
- Stage::GetCurrent().Remove(actor);
+ application.GetScene().Remove(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor parent = Actor::New();
parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(parent);
+ application.GetScene().Add(parent);
// Set child to completely cover parent.
// Change rotation of child to be different from parent so that we can check if our local coordinate
Actor first = Actor::New();
first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(first);
+ application.GetScene().Add(first);
Actor second = Actor::New();
second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
second.SetProperty( Actor::Property::POSITION_X, 100.0f);
second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(second);
+ application.GetScene().Add(second);
// Render and notify
application.SendNotification();
detector.Attach(second);
detector.DetectedSignal().Connect(&application, functor);
- DALI_TEST_EQUALS(Stage::GetCurrent().GetRootLayer(), first.GetParent(), TEST_LOCATION);
- DALI_TEST_EQUALS(Stage::GetCurrent().GetRootLayer(), second.GetParent(), TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), first.GetParent(), TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), second.GetParent(), TEST_LOCATION);
// Start pan within second actor's area
uint32_t time = 100;
TestStartPan( application, Vector2( 110.0f, 20.0f ), Vector2( 126.0f, 20.0f ), time );
- DALI_TEST_EQUALS(Stage::GetCurrent().GetRootLayer(), first.GetParent(), TEST_LOCATION);
- DALI_TEST_EQUALS(Stage::GetCurrent().GetRootLayer(), second.GetParent(), TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), first.GetParent(), TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), second.GetParent(), TEST_LOCATION);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.pannedActor, TEST_LOCATION);
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
Actor actor2 = Actor::New();
actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
- Stage::GetCurrent().Add(actor2);
+ application.GetScene().Add(actor2);
// Render and notify
application.SendNotification();
Actor actor1 = Actor::New();
actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor1);
+ application.GetScene().Add(actor1);
SignalData data1;
GestureReceivedFunctor functor1(data1);
PanGestureDetector detector1 = PanGestureDetector::New();
actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
actor2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT);
- Stage::GetCurrent().Add(actor2);
+ application.GetScene().Add(actor2);
SignalData data2;
GestureReceivedFunctor functor2(data2);
PanGestureDetector detector2 = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor parent = Actor::New();
parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add( parent );
+ application.GetScene().Add( parent );
Actor child = Actor::New();
child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
// Attach actor to detector
SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage );
+ UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
PanGestureDetector detector = PanGestureDetector::New();
detector.Attach(actor);
detector.DetectedSignal().Connect( &application, functor );
application.Render();
// Re-add actor to stage
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
// Re-add actor to stage
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Create and add a second actor so that GestureDetector destruction does not come into play.
Actor dummyActor( Actor::New() );
dummyActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
dummyActor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
dummyActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(dummyActor);
+ application.GetScene().Add(dummyActor);
// Render and notify
application.SendNotification();
// Attach actor to detector
SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage );
+ UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
PanGestureDetector detector = PanGestureDetector::New();
detector.Attach(actor);
detector.Attach(dummyActor);
application.Render();
// Re add to the stage, we should not be signalled
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
Actor parent = Actor::New();
parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(parent);
+ application.GetScene().Add(parent);
Actor child = Actor::New();
child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
Actor parent = Actor::New();
parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(parent);
+ application.GetScene().Add(parent);
Actor child = Actor::New();
child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
Layer layer = Layer::New();
layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add( layer );
+ application.GetScene().Add( layer );
layer.RaiseToTop();
// Render and notify
data.Reset();
// Set layer to consume all touch
- layer.SetTouchConsumed( true );
+ layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
// Render and notify
application.SendNotification();
Actor actor = Actor::New();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(actor);
+ application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();