Merge "Add deprcated macro to newly deprecated Window API" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 9 May 2019 16:32:24 +0000 (16:32 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 9 May 2019 16:32:24 +0000 (16:32 +0000)
dali/devel-api/adaptor-framework/window-devel.cpp
dali/devel-api/adaptor-framework/window-devel.h
dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-impl.h

index 9453a93..2496c21 100644 (file)
@@ -35,6 +35,11 @@ void SetPositionSize( Window window, PositionSize positionSize )
   GetImplementation( window ).SetPositionSize( positionSize );
 }
 
+Window Get( Actor actor )
+{
+  return Internal::Adaptor::Window::Get( actor );
+}
+
 EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window )
 {
   return GetImplementation( window ).EventProcessingFinishedSignal();
index 0006b2b..e80e55a 100644 (file)
@@ -47,6 +47,14 @@ typedef Signal< void (const WheelEvent&) > WheelEventSignalType;   ///< Touched
 DALI_ADAPTOR_API void SetPositionSize( Window window, PositionSize positionSize );
 
 /**
+ * @brief Retrieve the window that the given actor is added to.
+ *
+ * @param[in] actor The actor
+ * @return The window the actor is added to or an empty handle if the actor is not added to any window.
+ */
+DALI_ADAPTOR_API Window Get( Actor actor );
+
+/**
  * @brief This signal is emitted just after the event processing is finished.
  *
  * @param[in] window The window instance
index 7406728..6899099 100755 (executable)
@@ -966,6 +966,21 @@ bool Adaptor::ProcessCoreEventsFromIdle()
   return false;
 }
 
+Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow( Dali::Actor& actor )
+{
+  Dali::Integration::Scene scene = Dali::Integration::Scene::Get( actor );
+
+  for( auto window : mWindows )
+  {
+    if ( scene == window->GetScene() )
+    {
+      return window.Get();
+    }
+  }
+
+  return nullptr;
+}
+
 Adaptor::Adaptor(Dali::Integration::SceneHolder window, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions)
 : mResizedSignal(),
   mLanguageChangedSignal(),
index ddcaf17..32df0ed 100755 (executable)
@@ -294,6 +294,14 @@ public: // AdaptorInternalServices implementation
    */
   bool RemoveWindow( Dali::Internal::Adaptor::SceneHolder* childWindow );
 
+  /**
+   * @brief Retrieve the window that the given actor is added to.
+   *
+   * @param[in] actor The actor
+   * @return The window the actor is added to or a null pointer if the actor is not added to any widnow.
+   */
+  Dali::Internal::Adaptor::SceneHolder* GetWindow( Dali::Actor& actor );
+
 public:
 
   /**
index 9d24fee..d606f10 100644 (file)
@@ -646,6 +646,18 @@ bool Window::SetRotationObserver( RotationObserver* observer )
   return false;
 }
 
+Dali::Window Window::Get( Dali::Actor actor )
+{
+  Internal::Adaptor::Window* windowImpl = nullptr;
+
+  if ( Internal::Adaptor::Adaptor::IsAvailable() )
+  {
+    Dali::Internal::Adaptor::Adaptor& adaptor = Internal::Adaptor::Adaptor::GetImplementation( Internal::Adaptor::Adaptor::Get() );
+    windowImpl = static_cast<Internal::Adaptor::Window*>( adaptor.GetWindow( actor ) );
+  }
+
+  return Dali::Window( windowImpl );
+}
 
 } // Adaptor
 
index 3dd82d7..1249b3e 100644 (file)
@@ -335,6 +335,11 @@ public:
    */
   bool SetRotationObserver( RotationObserver* observer );
 
+  /**
+   * @copydoc Dali::DevelWindow::Get()
+   */
+  static Dali::Window Get( Dali::Actor actor );
+
 public: // Dali::Internal::Adaptor::SceneHolder
 
   /**