Add EmitWheelEventGeneratedSignal for custom wheel event
[platform/core/uifw/dali-core.git] / dali / internal / event / common / scene-impl.cpp
index 95104fb..5c54f76 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -41,7 +41,7 @@ namespace Dali
 {
 namespace Internal
 {
-ScenePtr Scene::New(Size size, int orientation)
+ScenePtr Scene::New(Size size, int32_t orientation)
 {
   ScenePtr scene = new Scene;
 
@@ -93,7 +93,7 @@ Scene::~Scene()
   // When this destructor is called, the scene has either already been removed from Core or Core has already been destroyed
 }
 
-void Scene::Initialize(Size size, int orientation)
+void Scene::Initialize(Size size, int32_t orientation)
 {
   ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
 
@@ -188,7 +188,7 @@ Dali::Layer Scene::GetLayer(uint32_t depth) const
   return Dali::Layer(mLayerList->GetLayer(depth));
 }
 
-CameraActor& Scene::GetDefaultCameraActor()
+CameraActor& Scene::GetDefaultCameraActor() const
 {
   return *mDefaultCamera;
 }
@@ -277,18 +277,23 @@ void Scene::EmitKeyEventSignal(const Dali::KeyEvent& event)
   }
 }
 
-void Scene::SurfaceRotated(float width, float height, int orientation)
+void Scene::SurfaceRotated(float width, float height, int32_t orientation)
 {
   mSurfaceOrientation = orientation;
   ChangedSurface(width, height, orientation);
 }
 
-int Scene::GetSurfaceOrientation()
+int32_t Scene::GetCurrentSurfaceOrientation() const
 {
-  return mSurfaceOrientation;
+  return mSceneObject->GetSurfaceOrientation();
 }
 
-void Scene::ChangedSurface(float width, float height, int orientation)
+const Rect<int32_t>& Scene::GetCurrentSurfaceRect() const
+{
+  return mSceneObject->GetSurfaceRect();
+}
+
+void Scene::ChangedSurface(float width, float height, int32_t orientation)
 {
   Rect<int32_t> newSize(0, 0, static_cast<int32_t>(width), static_cast<int32_t>(height)); // truncated
   mSize.width  = width;
@@ -316,6 +321,24 @@ bool Scene::IsSurfaceRectChanged() const
   return mSceneObject->IsSurfaceRectChanged();
 }
 
+bool Scene::IsRotationCompletedAcknowledgementSet() const
+{
+  return mSceneObject->IsRotationCompletedAcknowledgementSet();
+}
+
+void Scene::SetRotationCompletedAcknowledgement()
+{
+  ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
+  SetRotationCompletedAcknowledgementMessage(tls->GetEventThreadServices(), *mSceneObject);
+}
+
+void Scene::SetSurfaceRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo)
+{
+  // Send the surface render target to SceneGraph::Scene
+  ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
+  SetSurfaceRenderTargetCreateInfoMessage(tls->GetEventThreadServices(), *mSceneObject, renderTargetCreateInfo);
+}
+
 bool Scene::EmitKeyEventGeneratedSignal(const Dali::KeyEvent& event)
 {
   // Emit the KeyEventGenerated signal when KeyEvent is generated
@@ -350,6 +373,13 @@ void Scene::EmitWheelEventSignal(const Dali::WheelEvent& event)
   }
 }
 
+bool Scene::EmitWheelEventGeneratedSignal(const Dali::WheelEvent& event)
+{
+  // Emit the WheelEventGenerated signal when WheelEvent is generated
+  Dali::Integration::Scene handle(this);
+  return mWheelEventGeneratedSignal.Emit(event);
+}
+
 void Scene::AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
 {
   ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal();
@@ -397,9 +427,9 @@ Integration::Scene::WheelEventSignalType& Scene::WheelEventSignal()
   return mWheelEventSignal;
 }
 
-std::vector<Dali::Internal::SceneGraph::DirtyRect>& Scene::GetItemsDirtyRects()
+Integration::Scene::WheelEventGeneratedSignalType& Scene::WheelEventGeneratedSignal()
 {
-  return mItemsDirtyRects;
+  return mWheelEventGeneratedSignal;
 }
 
 } // namespace Internal