END_TEST;
}
+int utcDaliActorInheritedVisibilityChangeSignal5(void)
+{
+ TestApplication application;
+ tet_infoline("Check that the inherited visibility change signal is called when the scene visibility is changed");
+
+ Actor parentActor = Actor::New();
+ Actor actor = Actor::New();
+
+ InheritedVisibilityChangedFunctorData data;
+ actor.InheritedVisibilityChangedSignal().Connect(&application, InheritedVisibilityChangedFunctor(data));
+
+ application.GetScene().Hide();
+
+ parentActor.Add(actor);
+ data.Check(false, TEST_LOCATION);
+
+ data.Reset();
+ application.GetScene().Add(parentActor);
+ data.Check(false, TEST_LOCATION);
+
+ data.Reset();
+ application.GetScene().Show();
+ data.Check(true, actor, true, TEST_LOCATION);
+
+ data.Reset();
+ actor.SetProperty(Actor::Property::VISIBLE, false);
+ data.Check(true, actor, false, TEST_LOCATION);
+
+ data.Reset();
+ actor.SetProperty(Actor::Property::VISIBLE, false);
+ data.Check(false, TEST_LOCATION);
+
+ data.Reset();
+ actor.SetProperty(Actor::Property::VISIBLE, true);
+ data.Check(true, actor, true, TEST_LOCATION);
+
+ data.Reset();
+ actor.SetProperty(Actor::Property::VISIBLE, true);
+ data.Check(false, TEST_LOCATION);
+
+ data.Reset();
+ application.GetScene().Hide();
+ data.Check(true, actor, false, TEST_LOCATION);
+
+ data.Reset();
+ actor.SetProperty(Actor::Property::VISIBLE, false);
+ data.Check(false, TEST_LOCATION);
+
+ data.Reset();
+ application.GetScene().Show();
+ data.Check(false, TEST_LOCATION);
+
+ data.Reset();
+ actor.SetProperty(Actor::Property::VISIBLE, true);
+ data.Check(true, actor, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
{
gLayoutDirectionType = type;
GetImplementation(*this).Remove(GetImplementation(actor));
}
+void Scene::Show()
+{
+ GetImplementation(*this).Show();
+}
+
+void Scene::Hide()
+{
+ GetImplementation(*this).Hide();
+}
+
+bool Scene::IsVisible() const
+{
+ return GetImplementation(*this).IsVisible();
+}
+
Size Scene::GetSize() const
{
return GetImplementation(*this).GetSize();
*/
void Remove(Actor actor);
+ /**
+ * @brief Shows the scene if it is hidden.
+ * @SINCE_2_3.35
+ */
+ void Show();
+
+ /**
+ * @brief Hides the scene if it is showing.
+ * @SINCE_2_3.35
+ */
+ void Hide();
+
+ /**
+ * @brief Returns whether the window is visible or not.
+ * @SINCE_2_3.35
+ * @return True if the window is visible, false otherwise.
+ */
+ bool IsVisible() const;
+
/**
* @brief Returns the size of the Scene in pixels as a Vector.
*
DALI_LOG_TIMER_END(depthTimer, gLogFilter, Debug::Concise, "Depth tree traversal time: ");
}
+void Actor::EmitInheritedVisibilityChangedSignalRecursively(bool visible)
+{
+ ActorContainer inheritedVisibilityChangedList;
+ mParentImpl.InheritVisibilityRecursively(inheritedVisibilityChangedList);
+ // Notify applications about the newly connected actors.
+ for(const auto& actor : inheritedVisibilityChangedList)
+ {
+ actor->EmitInheritedVisibilityChangedSignal(visible);
+ }
+}
+
void Actor::SetDefaultProperty(Property::Index index, const Property::Value& property)
{
PropertyHandler::SetDefaultProperty(*this, index, property);
ConnectToScene(parentActor->GetHierarchyDepth(), parentActor->GetLayer3DParentCount(), notify);
Actor* actor = this;
- emitInheritedVisible = true;
+ // OnScene should be checked, this actor can be removed during OnSceneConnection.
+ emitInheritedVisible = OnScene() && mScene->IsVisible();
while(emitInheritedVisible && actor)
{
emitInheritedVisible &= actor->GetProperty(Dali::Actor::Property::VISIBLE).Get<bool>();
OnScene())
{
Actor* actor = this;
- emitInheritedVisible = true;
+ emitInheritedVisible = mScene->IsVisible();
while(emitInheritedVisible && actor)
{
emitInheritedVisible &= actor->GetProperty(Dali::Actor::Property::VISIBLE).Get<bool>();
}
Actor* actor = this->GetParent();
- bool emitInheritedVisible = OnScene();
+ bool emitInheritedVisible = OnScene() && mScene->IsVisible();
while(emitInheritedVisible && actor)
{
emitInheritedVisible &= actor->GetProperty(Dali::Actor::Property::VISIBLE).Get<bool>();
}
}
-void Actor::EmitInheritedVisibilityChangedSignalRecursively(bool visible)
-{
- ActorContainer inheritedVisibilityChangedList;
- mParentImpl.InheritVisibilityRecursively(inheritedVisibilityChangedList);
- // Notify applications about the newly connected actors.
- for(const auto& actor : inheritedVisibilityChangedList)
- {
- actor->EmitInheritedVisibilityChangedSignal(visible);
- }
-}
-
void Actor::SetSiblingOrderOfChild(Actor& child, uint32_t order)
{
mParentImpl.SetSiblingOrderOfChild(child, order);
*/
void RebuildDepthTree();
+ /**
+ * Emits the visibility flag of an actor.
+ * @param[in] visible The new visibility flag.
+ * @param[in] sendMessage Whether to send a message to the update thread or not.
+ */
+ void EmitInheritedVisibilityChangedSignalRecursively(bool visible);
+
public:
// Default property extensions from Object
*/
void SetVisibleInternal(bool visible, SendMessage::Type sendMessage);
- /**
- * Emits the visibility flag of an actor.
- * @param[in] visible The new visibility flag.
- * @param[in] sendMessage Whether to send a message to the update thread or not.
- */
- void EmitInheritedVisibilityChangedSignalRecursively(bool visible);
-
/**
* @copydoc ActorParent::SetSiblingOrderOfChild
*/
mDepthTreeDirty(false),
mPartialUpdateEnabled(true),
mGeometryHittest(false),
+ mIsVisible(true),
mEventProcessor(*this, ThreadLocalStorage::GetInternal()->GetGestureEventProcessor()),
mSurfaceOrientation(0),
mScreenOrientation(0),
mRootLayer->Remove(actor);
}
+void Scene::Show()
+{
+ if(!mIsVisible)
+ {
+ mIsVisible = true;
+ mRootLayer->EmitInheritedVisibilityChangedSignalRecursively(true);
+ }
+}
+
+void Scene::Hide()
+{
+ if(mIsVisible)
+ {
+ mIsVisible = false;
+ mRootLayer->EmitInheritedVisibilityChangedSignalRecursively(false);
+ }
+}
+
+bool Scene::IsVisible() const
+{
+ return mIsVisible;
+}
+
Size Scene::GetSize() const
{
return mSize;
*/
void Remove(Actor& actor);
+ /**
+ * @copydoc Dali::Integration::Scene::Show
+ */
+ void Show();
+
+ /**
+ * @copydoc Dali::Integration::Scene::Hide
+ */
+ void Hide();
+
+ /**
+ * @copydoc Dali::Integration::Scene::IsVisible
+ */
+ bool IsVisible() const;
+
/**
* @copydoc Dali::Integration::Scene::GetSize
*/
bool mDepthTreeDirty : 1; ///< True if the depth tree needs recalculating
bool mPartialUpdateEnabled : 1; ///< True if the partial update is enabled
bool mGeometryHittest : 1; ///< True if the geometry hittest is enabled
+ bool mIsVisible : 1; ///< True if this Scene is visible
EventProcessor mEventProcessor;