Add to set Available Orientations 62/221362/7
authorWonsik Jung <sidein@samsung.com>
Wed, 1 Jan 2020 17:36:00 +0000 (02:36 +0900)
committerWonsik Jung <sidein@samsung.com>
Fri, 31 Jan 2020 07:16:48 +0000 (16:16 +0900)
Add to set Available Orientations.
This API is for adding several  orientations one time.

Change-Id: Ie11ccd2d62d940fe14603e4241a257ed6fe9dff7

dali/devel-api/adaptor-framework/window-devel.cpp
dali/devel-api/adaptor-framework/window-devel.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-impl.h

index f36a5fc..ad84d95 100644 (file)
@@ -100,6 +100,11 @@ Dali::Window::WindowOrientation GetCurrentOrientation( Window window )
   return GetImplementation( window ).GetCurrentOrientation();
 }
 
+void SetAvailableOrientations( Window window, const Dali::Vector<Dali::Window::WindowOrientation>& orientations )
+{
+  GetImplementation( window ).SetAvailableOrientations( orientations );
+}
+
 } // namespace DevelWindow
 
 } // namespace Dali
index 39bc90d..9418282 100644 (file)
@@ -208,6 +208,16 @@ DALI_ADAPTOR_API Window DownCast(  BaseHandle handle );
  */
 DALI_ADAPTOR_API Dali::Window::WindowOrientation GetCurrentOrientation( Window window );
 
+/**
+ * @brief Sets available orientations of the window.
+ *
+ * This API is for setting several orientations one time.
+ *
+ * @param[in] window The window instance
+ * @param[in] orientations The available orientation list to add
+ */
+DALI_ADAPTOR_API void SetAvailableOrientations( Window window, const Dali::Vector<Dali::Window::WindowOrientation>& orientations );
+
 } // namespace DevelWindow
 
 } // namespace Dali
index b505b22..be836c1 100644 (file)
@@ -872,6 +872,38 @@ Dali::Window::WindowOrientation Window::GetCurrentOrientation() const
   return ConvertToOrientation( mRotationAngle );
 }
 
+void Window::SetAvailableOrientations( const Dali::Vector<Dali::Window::WindowOrientation>& orientations )
+{
+  Dali::Vector<float>::SizeType count = orientations.Count();
+  for( Dali::Vector<float>::SizeType index = 0; index < count; ++index )
+  {
+    if( IsOrientationAvailable( orientations[index] ) == false )
+    {
+      DALI_LOG_ERROR("Window::SetAvailableOrientations, invalid orientation: %d\n", orientations[index]);
+      continue;
+    }
+
+    bool found = false;
+    int convertedAngle = ConvertToAngle( orientations[index] );
+
+    for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
+    {
+      if( mAvailableAngles[i] == convertedAngle )
+      {
+        found = true;
+        break;
+      }
+    }
+
+    if( !found )
+    {
+      DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetAvailableOrientations: %d\n", this, mNativeWindowId, convertedAngle );
+      mAvailableAngles.push_back( convertedAngle );
+    }
+  }
+  SetAvailableAnlges( mAvailableAngles );
+}
+
 } // Adaptor
 
 } // Internal
index 1dd9ca6..0705340 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/render-tasks/render-task-list.h>
+#include <dali/public-api/object/property-array.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/window.h>
@@ -342,6 +343,11 @@ public:
    */
   Dali::Window::WindowOrientation GetCurrentOrientation() const;
 
+  /**
+   * @copydoc Dali::DevelWindow::SetAvailableOrientations()
+   */
+  void SetAvailableOrientations( const Dali::Vector<Dali::Window::WindowOrientation>& orientations );
+
 public: // Dali::Internal::Adaptor::SceneHolder
 
   /**