Merge "Direct Rendering" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / application-devel.cpp
index 7e93fca..8ce55e2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 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.
 // 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);
+    if(argc && (*argc > 0))
+    {
+      internal->GetWindow().SetClass((*argv)[0], "");
+    }
+    internal->SetStyleSheet(stylesheet);
 
+    internal->GetWindow().SetTransparency((windowMode == Application::OPAQUE ? false : true));
 
-bool AddIdleWithReturnValue( Application application, CallbackBase* callback )
+    //Store only the value before adaptor is created
+    internal->StoreWindowPositionSize(positionSize);
+  } else
+  {
+    internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL, type, false);
+  }
+  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 +63,27 @@ 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)
 {
-  return Application( dynamic_cast<Dali::Internal::Adaptor::Application*>( refObject ) );
+  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();
 }
 
 } // namespace DevelApplication
 
 } // namespace Dali
 
-extern "C"
-void PreInitialize( 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);
 }
-