/*
- * Copyright (c) 2018 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
{
-
-void PreInitialize( int* argc, char** argv[] )
+Application New(int* argc, char** argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize, WindowType type)
{
- Internal::Adaptor::Application::PreInitialize( argc, argv );
+ 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));
+
+ //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 )
+bool AddIdleWithReturnValue(Application application, CallbackBase* callback)
{
- return Internal::Adaptor::GetImplementation( application ).AddIdle( callback, true );
+ 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 )
+std::string GetDataPath()
{
- 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;
+ return Internal::Adaptor::Application::GetDataPath();
}
-bool DestroyWindow( Application application, Dali::Window* childWindow )
+Application DownCast(Dali::RefObject* refObject)
{
- auto& adaptor = Internal::Adaptor::GetImplementation( application ).GetAdaptor();
-
- return Internal::Adaptor::Adaptor::GetImplementation( adaptor ).RemoveWindow( childWindow );
+ return Application(dynamic_cast<Dali::Internal::Adaptor::Application*>(refObject));
}
-bool DestroyWindow( Application application, const std::string& childWindowName )
+CustomCommandReceivedSignalType& CustomCommandReceivedSignal(Application application)
{
- auto& adaptor = Internal::Adaptor::GetImplementation( application ).GetAdaptor();
+ 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 Internal::Adaptor::Adaptor::GetImplementation( adaptor ).RemoveWindow( childWindowName );
+ return networkService->CustomCommandReceivedSignal();
}
} // namespace DevelApplication
} // namespace Dali
+
+extern "C" void ApplicationPreInitialize(int* argc, char** argv[])
+{
+ Dali::Internal::Adaptor::Application::PreInitialize(argc, argv);
+}