[Tizen] Remove graphics-api relative codes in public-api/application.h
[platform/core/uifw/dali-adaptor.git] / dali / public-api / adaptor-framework / application.cpp
index 676d658..17403d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 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.
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
+#include <dali/public-api/object/object-registry.h>
 
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/common/application-impl.h>
 
 namespace Dali
 {
-
 Application Application::New()
 {
-  return New( NULL, NULL );
+  return New(NULL, NULL);
 }
 
-Application Application::New( int* argc, char **argv[] )
+Application Application::New(int* argc, char** argv[])
 {
   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
-  if( internal )
+  if(internal)
   {
-    if( argc && ( *argc > 0 ) )
+    // pre-initialized application
+    internal->SetCommandLineOptions(argc, argv);
+    if(argc && (*argc > 0))
     {
-      internal->GetWindow().SetClass( (*argv)[0], "" );
+      internal->GetWindow().SetClass((*argv)[0], "");
     }
-
-    return Application( internal.Get() );
   }
   else
   {
-    internal = Internal::Adaptor::Application::New( argc, argv, "", OPAQUE, PositionSize(),
-      Internal::Adaptor::Framework::NORMAL);
-    return Application(internal.Get());
+    internal = Internal::Adaptor::Application::New(argc, argv, "", OPAQUE, PositionSize(), Internal::Adaptor::Framework::NORMAL, WindowType::NORMAL);
   }
+  return Application(internal.Get());
 }
 
-Application Application::New( int* argc, char **argv[], const std::string& stylesheet )
+Application Application::New(int* argc, char** argv[], const std::string& stylesheet)
 {
   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
-  if( internal )
+  if(internal)
   {
-    if( argc && ( *argc > 0 ) )
+    // pre-initialized application
+    internal->SetCommandLineOptions(argc, argv);
+    if(argc && (*argc > 0))
     {
-      internal->GetWindow().SetClass( (*argv)[0], "" );
+      internal->GetWindow().SetClass((*argv)[0], "");
     }
-    internal->SetStyleSheet( stylesheet );
-
-    return Application( internal.Get() );
+    internal->SetStyleSheet(stylesheet);
   }
   else
   {
-    internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, OPAQUE, PositionSize(),
-      Internal::Adaptor::Framework::NORMAL);
-    return Application(internal.Get());
+    internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, OPAQUE, PositionSize(), Internal::Adaptor::Framework::NORMAL, WindowType::NORMAL);
   }
+  return Application(internal.Get());
 }
 
-Application Application::New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode )
+Application Application::New(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode)
 {
   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
-  if( internal )
+  if(internal)
   {
-    if( argc && ( *argc > 0 ) )
+    // pre-initialized application
+    internal->SetCommandLineOptions(argc, argv);
+    if(argc && (*argc > 0))
     {
-      internal->GetWindow().SetClass( (*argv)[0], "" );
+      internal->GetWindow().SetClass((*argv)[0], "");
     }
-    internal->SetStyleSheet( stylesheet );
+    internal->SetStyleSheet(stylesheet);
 
-    internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) );
-
-    return Application( internal.Get() );
+    internal->GetWindow().SetTransparency((windowMode == Application::OPAQUE ? false : true));
   }
   else
   {
-    internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, PositionSize(),
-      Internal::Adaptor::Framework::NORMAL);
-    return Application(internal.Get());
+    internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, windowMode, PositionSize(), Internal::Adaptor::Framework::NORMAL, WindowType::NORMAL);
   }
+  return Application(internal.Get());
 }
 
-Application Application::New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize )
+Application Application::New(int* argc, char** argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize)
 {
   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
-  if( internal )
+  if(internal)
   {
-    if( argc && ( *argc > 0 ) )
+    // pre-initialized application
+    internal->SetCommandLineOptions(argc, argv);
+    if(argc && (*argc > 0))
     {
-      internal->GetWindow().SetClass( (*argv)[0], "" );
+      internal->GetWindow().SetClass((*argv)[0], "");
     }
-    internal->SetStyleSheet( stylesheet );
+    internal->SetStyleSheet(stylesheet);
 
-    internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) );
-    internal->GetWindow().SetSize( Window::WindowSize( positionSize.width, positionSize.height ) );
-    internal->GetWindow().SetPosition( Window::WindowPosition( positionSize.x, positionSize.y ) );
+    internal->GetWindow().SetTransparency((windowMode == Application::OPAQUE ? false : true));
 
-    return Application( internal.Get() );
+    //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 );
-    return Application( internal.Get() );
+    internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL, WindowType::NORMAL);
   }
+  return Application(internal.Get());
 }
 
 Application::~Application()
@@ -128,28 +126,17 @@ Application::Application()
 {
 }
 
-Application::Application(const Application& application)
-: BaseHandle(application)
-{
-}
+Application::Application(const Application& copy) = default;
 
-Application& Application::operator=(const Application& application)
-{
-  if( *this != application )
-  {
-    BaseHandle::operator=( application );
-  }
-  return *this;
-}
+Application& Application::operator=(const Application& rhs) = default;
 
-void Application::MainLoop()
-{
-  Internal::Adaptor::GetImplementation(*this).MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS);
-}
+Application::Application(Application&& rhs) = default;
+
+Application& Application::operator=(Application&& rhs) = default;
 
-void Application::MainLoop(Configuration::ContextLoss configuration)
+void Application::MainLoop()
 {
-  Internal::Adaptor::GetImplementation(*this).MainLoop(configuration);
+  Internal::Adaptor::GetImplementation(*this).MainLoop();
 }
 
 void Application::Lower()
@@ -162,9 +149,9 @@ void Application::Quit()
   Internal::Adaptor::GetImplementation(*this).Quit();
 }
 
-bool Application::AddIdle( CallbackBase* callback )
+bool Application::AddIdle(CallbackBase* callback)
 {
-  return Internal::Adaptor::GetImplementation(*this).AddIdle( callback, false );
+  return Internal::Adaptor::GetImplementation(*this).AddIdle(callback, false);
 }
 
 Window Application::GetWindow()
@@ -172,13 +159,6 @@ Window Application::GetWindow()
   return Internal::Adaptor::GetImplementation(*this).GetWindow();
 }
 
-void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
-{
-  DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ReplaceWindow is deprecated and will be removed from next release.\n" );
-
-  Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name);
-}
-
 std::string Application::GetResourcePath()
 {
   return Internal::Adaptor::Application::GetResourcePath();
@@ -194,24 +174,9 @@ std::string Application::GetLanguage() const
   return Internal::Adaptor::GetImplementation(*this).GetLanguage();
 }
 
-void Application::SetViewMode( ViewMode viewMode )
+ObjectRegistry Application::GetObjectRegistry() const
 {
-  Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode );
-}
-
-ViewMode Application::GetViewMode() const
-{
-  return Internal::Adaptor::GetImplementation(*this).GetViewMode();
-}
-
-void Application::SetStereoBase( float stereoBase )
-{
-  Internal::Adaptor::GetImplementation(*this).SetStereoBase( stereoBase );
-}
-
-float Application::GetStereoBase() const
-{
-  return Internal::Adaptor::GetImplementation(*this).GetStereoBase();
+  return Internal::Adaptor::GetImplementation(*this).GetObjectRegistry();
 }
 
 Application::AppSignalType& Application::InitSignal()
@@ -239,14 +204,7 @@ Application::AppSignalType& Application::ResetSignal()
   return Internal::Adaptor::GetImplementation(*this).ResetSignal();
 }
 
-Application::AppSignalType& Application::ResizeSignal()
-{
-  DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: ResizeSignal() is deprecated and will be removed from next release. Use Window::ResizedSignal() instead.\n" );
-
-  return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
-}
-
-Application::AppControlSignalType & Application::AppControlSignal()
+Application::AppControlSignalType& Application::AppControlSignal()
 {
   return Internal::Adaptor::GetImplementation(*this).AppControlSignal();
 }
@@ -261,18 +219,6 @@ Application::AppSignalType& Application::RegionChangedSignal()
   return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
 }
 
-Application::AppSignalType& Application::BatteryLowSignal()
-{
-  DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: BatteryLowSignal() is deprecated and will be removed from next release. Use Application::LowBatterySignal() instead.\n" );
-  return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal();
-}
-
-Application::AppSignalType& Application::MemoryLowSignal()
-{
-  DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: MemoryLowSignal() is deprecated and will be removed from next release. Use Application::LowMemorySignal() instead.\n" );
-  return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal();
-}
-
 Application::LowBatterySignalType& Application::LowBatterySignal()
 {
   return Internal::Adaptor::GetImplementation(*this).LowBatterySignal();
@@ -288,5 +234,4 @@ Application::Application(Internal::Adaptor::Application* application)
 {
 }
 
-
 } // namespace Dali