Use WindowData in the constructors of Application
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / application-devel.cpp
index d6403a5..11ab483 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
 // INTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/application-devel.h>
 #include <dali/integration-api/adaptor-framework/scene-holder.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/internal/adaptor/common/application-impl.h>
+#include <dali/internal/network/common/network-service-impl.h>
 
 namespace Dali
 {
-
 namespace DevelApplication
 {
+Application New(int* argc, char** argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize, WindowType type)
+{
+  Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
+  if(internal)
+  {
+    // Set Defaut Window type
+    internal->SetDefaultWindowType(type);
+
+    // pre-initialized application
+    internal->SetCommandLineOptions(argc, argv);
+    internal->SetStyleSheet(stylesheet);
+
+    internal->GetWindow().SetTransparency((windowMode == Application::TRANSPARENT));
 
+    // Store only the value before adaptor is created
+    internal->StoreWindowPositionSize(positionSize);
+  }
+  else
+  {
+    WindowData windowData;
+    windowData.SetPositionSize(positionSize);
+    windowData.SetTransparency(windowMode == Application::TRANSPARENT);
+    windowData.SetWindowType(type);
 
-bool AddIdleWithReturnValue( Application application, CallbackBase* callback )
+    internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, Internal::Adaptor::Framework::NORMAL, false, windowData);
+  }
+  return Application(internal.Get());
+}
+
+bool AddIdleWithReturnValue(Application application, CallbackBase* callback)
 {
-  return Internal::Adaptor::GetImplementation( application ).AddIdle( callback, true );
+  return Internal::Adaptor::GetImplementation(application).AddIdle(callback, true);
 }
 
 std::string GetDataPath()
@@ -37,18 +65,32 @@ std::string GetDataPath()
   return Internal::Adaptor::Application::GetDataPath();
 }
 
-Application DownCast( Dali::RefObject* refObject )
+Application DownCast(Dali::RefObject* refObject)
+{
+  return Application(dynamic_cast<Dali::Internal::Adaptor::Application*>(refObject));
+}
+
+CustomCommandReceivedSignalType& CustomCommandReceivedSignal(Application application)
+{
+  DALI_ASSERT_ALWAYS(Adaptor::IsAvailable() && "Adaptor is not available")
+
+  Internal::Adaptor::NetworkServicePtr networkService = Internal::Adaptor::NetworkService::Get();
+
+  DALI_ASSERT_ALWAYS(networkService && "Network Service Unavailable");
+
+  return networkService->CustomCommandReceivedSignal();
+}
+
+int32_t GetRenderThreadId(Application application)
 {
-  return Application( dynamic_cast<Dali::Internal::Adaptor::Application*>( refObject ) );
+  return Internal::Adaptor::GetImplementation(application).GetRenderThreadId();
 }
 
 } // namespace DevelApplication
 
 } // namespace Dali
 
-extern "C"
-void ApplicationPreInitialize( int* argc, char** argv[] )
+extern "C" void ApplicationPreInitialize(int* argc, char** argv[])
 {
-  Dali::Internal::Adaptor::Application::PreInitialize( argc, argv );
+  Dali::Internal::Adaptor::Application::PreInitialize(argc, argv);
 }
-