Renamed TouchSignal to TouchedSignal
[platform/core/uifw/dali-adaptor.git] / dali / public-api / adaptor-framework / window.cpp
index f2a8068..9452630 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
 // CLASS HEADER
 #include <dali/public-api/adaptor-framework/window.h>
 
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
 // INTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
 #include <dali/internal/window-system/common/window-impl.h>
 #include <dali/internal/window-system/common/orientation-impl.h>
 
@@ -27,14 +31,41 @@ namespace Dali
 
 Window Window::New(PositionSize posSize, const std::string& name, bool isTransparent)
 {
-  Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, "", isTransparent);
-  return Window(window);
+  return Dali::Window::New(posSize, name, "", isTransparent);
 }
 
 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);
-  return Window(window);
+  Window newWindow;
+
+  const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
+  bool isNewWindowAllowed = true;
+
+  if (isAdaptorAvailable)
+  {
+    Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
+    isNewWindowAllowed = Internal::Adaptor::Adaptor::GetImplementation(adaptor).IsMultipleWindowSupported();
+  }
+
+  if (isNewWindowAllowed)
+  {
+    Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, isTransparent);
+
+    Integration::SceneHolder sceneHolder = Integration::SceneHolder(window);
+
+    if (isAdaptorAvailable)
+    {
+      Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
+      Internal::Adaptor::Adaptor::GetImplementation(adaptor).AddWindow(sceneHolder);
+    }
+    newWindow = Window(window);
+  }
+  else
+  {
+    DALI_LOG_ERROR("This device can't support multiple windows.\n");
+  }
+
+  return newWindow;
 }
 
 Window::Window()
@@ -45,35 +76,52 @@ Window::~Window()
 {
 }
 
-Window::Window(const Window& handle)
-: BaseHandle(handle)
+Window::Window( const Window& copy ) = default;
+
+Window& Window::operator=( const Window& rhs ) = default;
+
+Window::Window( Window&& rhs ) = default;
+
+Window& Window::operator=( Window&& rhs ) = default;
+
+void Window::Add( Dali::Actor actor )
 {
+  GetImplementation( *this ).Add( actor );
 }
 
-Window& Window::operator=(const Window& rhs)
+void Window::Remove( Dali::Actor actor )
 {
-  BaseHandle::operator=(rhs);
-  return *this;
+  GetImplementation( *this ).Remove( actor );
 }
 
-void Window::ShowIndicator( IndicatorVisibleMode visibleMode )
+void Window::SetBackgroundColor( const Vector4& color )
 {
-  GetImplementation(*this).ShowIndicator( visibleMode );
+  GetImplementation( *this ).SetBackgroundColor( color );
 }
 
-Window::IndicatorSignalType& Window::IndicatorVisibilityChangedSignal()
+Vector4 Window::GetBackgroundColor() const
 {
-  return GetImplementation(*this).IndicatorVisibilityChangedSignal();
+  return GetImplementation( *this ).GetBackgroundColor();
 }
 
-void Window::SetIndicatorBgOpacity( IndicatorBgOpacity opacity )
+Layer Window::GetRootLayer() const
 {
-  GetImplementation(*this).SetIndicatorBgOpacity( opacity );
+  return GetImplementation( *this ).GetRootLayer();
 }
 
-void Window::RotateIndicator( WindowOrientation orientation )
+uint32_t Window::GetLayerCount() const
 {
-  GetImplementation(*this).RotateIndicator( orientation );
+  return GetImplementation( *this ).GetLayerCount();
+}
+
+Layer Window::GetLayer( uint32_t depth ) const
+{
+  return GetImplementation( *this ).GetLayer( depth );
+}
+
+Uint16Pair Window::GetDpi() const
+{
+  return GetImplementation(*this).GetDpi();
 }
 
 void Window::SetClass( std::string name, std::string klass )
@@ -106,7 +154,7 @@ void Window::RemoveAvailableOrientation( WindowOrientation orientation )
   GetImplementation(*this).RemoveAvailableOrientation( orientation );
 }
 
-void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
+void Window::SetPreferredOrientation( WindowOrientation orientation )
 {
   GetImplementation(*this).SetPreferredOrientation( orientation );
 }
@@ -116,19 +164,14 @@ Dali::Window::WindowOrientation Window::GetPreferredOrientation()
   return GetImplementation(*this).GetPreferredOrientation();
 }
 
-DragAndDropDetector Window::GetDragAndDropDetector() const
-{
-  return GetImplementation(*this).GetDragAndDropDetector();
-}
-
 Any Window::GetNativeHandle() const
 {
   return GetImplementation(*this).GetNativeHandle();
 }
 
-Window::FocusSignalType& Window::FocusChangedSignal()
+Window::FocusChangeSignalType& Window::FocusChangeSignal()
 {
-  return GetImplementation(*this).FocusChangedSignal();
+  return GetImplementation(*this).FocusChangeSignal();
 }
 
 void Window::SetAcceptFocus( bool accept )
@@ -246,9 +289,9 @@ int Window::GetBrightness() const
   return GetImplementation(*this).GetBrightness();
 }
 
-Window::ResizedSignalType& Window::ResizedSignal()
+Window::ResizeSignalType& Window::ResizeSignal()
 {
-  return GetImplementation(*this).ResizedSignal();
+  return GetImplementation(*this).ResizeSignal();
 }
 
 void Window::SetSize( Window::WindowSize size )
@@ -276,6 +319,21 @@ void Window::SetTransparency( bool transparent )
   GetImplementation(*this).SetTransparency( transparent );
 }
 
+Dali::RenderTaskList Window::GetRenderTaskList()
+{
+  return GetImplementation(*this).GetRenderTaskList();
+}
+
+Window::KeyEventSignalType& Window::KeyEventSignal()
+{
+  return GetImplementation(*this).KeyEventSignal();
+}
+
+Window::TouchEventSignalType& Window::TouchedSignal()
+{
+  return GetImplementation(*this).TouchedSignal();
+}
+
 Window::Window( Internal::Adaptor::Window* window )
 : BaseHandle( window )
 {