Create additional window using Window::New instead of DevelApplication::CreateWindow 42/205242/1
authorRichard Huang <r.huang@samsung.com>
Tue, 30 Apr 2019 14:42:56 +0000 (15:42 +0100)
committerRichard Huang <r.huang@samsung.com>
Tue, 30 Apr 2019 14:42:56 +0000 (15:42 +0100)
Change-Id: Idccaa2e79b577605aeef7195522205fb7352fcbc

dali/devel-api/adaptor-framework/application-devel.cpp
dali/devel-api/adaptor-framework/application-devel.h
dali/internal/adaptor/common/application-impl.cpp
dali/public-api/adaptor-framework/window.cpp
dali/public-api/adaptor-framework/window.h

index cfdd55d..196664a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -31,29 +31,6 @@ bool AddIdleWithReturnValue( Application application, CallbackBase* callback )
   return Internal::Adaptor::GetImplementation( application ).AddIdle( callback, true );
 }
 
-Dali::Window CreateWindow( Application application, PositionSize childPosSize, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode )
-{
-  auto& adaptor = Internal::Adaptor::GetImplementation( application ).GetAdaptor();
-
-  Dali::Window childWindow = Dali::Window::New( childPosSize, childWindowName, childWindowClassName, childWindowMode );
-  Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &childWindow, childWindowName, childWindowClassName, childWindowMode );
-  return childWindow;
-}
-
-bool DestroyWindow( Application application, Dali::Window* childWindow )
-{
-  auto& adaptor = Internal::Adaptor::GetImplementation( application ).GetAdaptor();
-
-  return Internal::Adaptor::Adaptor::GetImplementation( adaptor ).RemoveWindow( childWindow );
-}
-
-bool DestroyWindow( Application application, const std::string& childWindowName )
-{
-  auto& adaptor = Internal::Adaptor::GetImplementation( application ).GetAdaptor();
-
-  return Internal::Adaptor::Adaptor::GetImplementation( adaptor ).RemoveWindow( childWindowName );
-}
-
 std::string GetDataPath()
 {
   return Internal::Adaptor::Application::GetDataPath();
index bc96727..86da07a 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_APPLICATION_DEVEL_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -47,37 +47,6 @@ namespace DevelApplication
 DALI_ADAPTOR_API bool AddIdleWithReturnValue( Application application, CallbackBase* callback );
 
 /**
- * @brief Create and Add a child window to the application instance
- * @param[in] application A handle to the Application
- * @param[in] childPosSize The position and size of the child window to be created
- * @param[in] childWindowName The title of the child window
- * @param[in] childWindowClassName The class name of the child window
- * @param[in] childWindowMode The mode of the newly created child window
- * @return @c a window handle if added successfully, @c null otherwise
- *
- * @note Function must be called from main event thread only
- */
-DALI_ADAPTOR_API Dali::Window CreateWindow( Application application, PositionSize childPosSize, const std::string& childWindowName, const std::string& childWindowClassName, bool childWindowMode );
-
-/**
- * @brief Removes a previously created Window instance from the Adaptor internal list
- * @note Function must be called from the main event thread only.
- * @param[in] application A handle to the Application
- * @param[in] childWindow The created Window instance
- * @return true if removed successfully, false otherwise
- */
-DALI_ADAPTOR_API bool DestroyWindow( Application application, Dali::Window* childWindow );
-
-/**
- * @brief Removes a previously created Window instance from the Adaptor internal list
- * @note Function must be called from the main event thread only.
- * @param[in] application A handle to the Application
- * @param[in] childWindowName The title of the window
- * @return true if removed successfully, false otherwise
- */
-DALI_ADAPTOR_API bool DestroyWindow( Application application, const std::string& childWindowName );
-
-/**
 * @brief Gets the absolute path to the application's data directory which is used to store private data of the application.
 * @return The absolute path to the application's data directory
 */
index 387c3ae..ce49e60 100755 (executable)
@@ -167,7 +167,9 @@ void Application::CreateWindow()
   }
 
   const std::string& windowClassName = mEnvironmentOptions.GetWindowClassName();
-  mMainWindow = Dali::Window::New( mWindowPositionSize, mMainWindowName, windowClassName, mMainWindowMode == Dali::Application::TRANSPARENT );
+
+  Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( mWindowPositionSize, mMainWindowName, windowClassName, mMainWindowMode == Dali::Application::TRANSPARENT );
+  mMainWindow = Dali::Window( window );
 
   // Quit the application when the window is closed
   GetImplementation( mMainWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &Application::Quit );
@@ -381,7 +383,15 @@ Dali::Window Application::GetWindow()
 {
   // Changed to return a different window handle after ReplaceWindow is called
   // just for backward compatibility to make the test case pass
-  return mMainWindowReplaced ? Dali::Window::New( PositionSize(), "ReplacedWindow" ) : mMainWindow;
+  if ( mMainWindowReplaced )
+  {
+    Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( PositionSize(), "ReplacedWindow", "", false );
+    return Dali::Window( window );
+  }
+  else
+  {
+    return mMainWindow;
+  }
 }
 
 // Stereoscopy
index ea9e4ae..34eb7b0 100644 (file)
@@ -28,13 +28,23 @@ namespace Dali
 
 Window Window::New(PositionSize posSize, const std::string& name, bool isTransparent)
 {
-  Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, "", isTransparent);
+  Internal::Adaptor::Window* windowImpl = Internal::Adaptor::Window::New(posSize, name, "", isTransparent);
+
+  Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
+  Dali::Window window = Dali::Window( windowImpl );
+  Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &window, name, "", isTransparent );
+
   return Window(window);
 }
 
 Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent)
 {
-  Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
+  Internal::Adaptor::Window* windowImpl = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
+
+  Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
+  Dali::Window window = Dali::Window( windowImpl );
+  Internal::Adaptor::Adaptor::GetImplementation( adaptor ).AddWindow( &window, name, className, isTransparent );
+
   return Window(window);
 }
 
index 404fd3e..78b5d44 100755 (executable)
@@ -171,6 +171,7 @@ public:
    * @param[in] name The Window title
    * @param[in] isTransparent Whether Window is transparent
    * @return A new window
+   * @note This creates an extra window in addition to the default main window
    */
   static Window New(PositionSize windowPosition, const std::string& name, bool isTransparent = false);
 
@@ -181,6 +182,7 @@ public:
    * @param[in] name The Window title
    * @param[in] className The Window class name
    * @param[in] isTransparent Whether Window is transparent
+   * @note This creates an extra window in addition to the default main window
    * @return A new Window
    */
   static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false);