Add window example 62/300262/5
authorWonsik Jung <sidein@samsung.com>
Thu, 19 Oct 2023 09:42:12 +0000 (18:42 +0900)
committerWonsik Jung <sidein@samsung.com>
Mon, 30 Oct 2023 08:54:27 +0000 (17:54 +0900)
<Summary>
DALi is a rendering engine of NUI and was previously a public interface that can be used by applications, but now it is only used as an internal engine, so most verifications are verified by NUI sample and UTC. This makes it difficult to verify whether it is DALi's own issue or NUI issue.

<What>
A window sample was added to the DALi-demo so that the APIs provided by DALi can be verified. This patch contains the DALi Window Function function.

<Why>
Other modules of the existing DALi had samples in the dali-demo, so it was possible to verify the function in the DALi layer, but the window did not have the sample, so it was difficult to verify the DALi window itself. In addition, the Window module itself had a strong dependence on external modules such as Display Server, AppFW, and Sensor FW, so it had no choice but to perform limited verification to the existing UTC.
To solve this problem, I am adding the sample.

<Plan>
Now the patch is only provided with samples for Window Function. We also plan to add function verification for Event or Signal.

Change-Id: I415a8795684964a492f1a229f17e129a02903724

com.samsung.dali-demo.xml
examples-reel/dali-examples-reel.cpp
examples/window/window-example.cpp [new file with mode: 0644]
resources/po/en_GB.po
resources/po/en_US.po
shared/dali-demo-strings.h

index 17fba75..59fceae 100644 (file)
        <ui-application appid="web-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/web-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
                <label>Web View</label>
        </ui-application>
+       <ui-application appid="window.example" exec="/usr/apps/com.samsung.dali-demo/bin/window.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
+               <label>Window</label>
+       </ui-application>
        <ui-application appid="waves.example" exec="/usr/apps/com.samsung.dali-demo/bin/waves.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
                <label>Waves</label>
        </ui-application>
index 7d5af30..b6c5e66 100644 (file)
@@ -111,6 +111,7 @@ int DALI_EXPORT_API main(int argc, char** argv)
   demo.AddExample(Example("tooltip.example", DALI_DEMO_STR_TITLE_TOOLTIP));
   demo.AddExample(Example("transitions.example", DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS));
   demo.AddExample(Example("web-view.example", DALI_DEMO_STR_TITLE_WEB_VIEW));
+  demo.AddExample(Example("window.example", DALI_DEMO_STR_TITLE_WINDOW));
 
   demo.SortAlphabetically(true);
 
diff --git a/examples/window/window-example.cpp b/examples/window/window-example.cpp
new file mode 100644 (file)
index 0000000..7eb40d5
--- /dev/null
@@ -0,0 +1,585 @@
+/*
+ * Copyright (c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali/integration-api/scene.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
+#include <dali/integration-api/debug.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+const int MARGIN = 50;
+static int count = 0;
+
+// This example shows how to create and display Hello World! using a simple TextActor
+//
+class WindowExampleController : public ConnectionTracker
+{
+public:
+  WindowExampleController(Application &application)
+      : mApplication(application),
+        manual_rotation_flag(false),
+        rotation_count(0),
+        rot(0),
+        bColor(0)
+  {
+    // Connect to the Application's Init signal
+    mApplication.InitSignal().Connect(this, &WindowExampleController::Create);
+    mApplication.PauseSignal().Connect(this, &WindowExampleController::Pause);
+    mApplication.ResumeSignal().Connect(this, &WindowExampleController::Resume);
+    mApplication.DeviceOrientationChangedSignal().Connect(this, &WindowExampleController::OnDeviceOrientationChanged);
+    mApplication.LowMemorySignal().Connect(this, &WindowExampleController::OnLowMemory);
+  }
+
+  ~WindowExampleController() = default;
+
+  // The Init signal is received once (only) during the Application lifetime
+  void Create(Application &application)
+  {
+    // Get a handle to the window and set the background colour
+    Window window = application.GetWindow();
+    window.AddAuxiliaryHint("wm.policy.win.user.geometry", "1");
+    window.SetBackgroundColor(Color::WHITE);
+    window.SetTransparency(false);
+
+    window.SetType(WindowType::NOTIFICATION);
+    window.SetNotificationLevel(WindowNotificationLevel::MEDIUM);
+
+    currentOrientation = Dali::WindowOrientation::PORTRAIT;
+    enableTimer = false;
+    bChangedOrientation = false;
+    manual_rotation_flag = false;
+
+    // Add a text label to the window
+    TextLabel textLabel = TextLabel::New("Window Example");
+    textLabel.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+    textLabel.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+    textLabel.SetProperty(Actor::Property::NAME, "WindowExampleLabel");
+    textLabel.SetBackgroundColor(Color::RED);
+    window.Add(textLabel);
+
+    // Create a clipping control and add a child to it
+    mClipControl = Control::New();
+    mClipControl.SetProperty(Actor::Property::SIZE, Vector2(250.0f, 100.0f));
+    mClipControl.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.75f, 0.75f, 0.5f));
+    mClipControl.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+    mClipControl.SetBackgroundColor(Color::BLUE);
+    window.Add(mClipControl);
+
+    auto child = Control::New();
+    child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 250.0f));
+    child.SetProperty(Actor::Property::PARENT_ORIGIN, AnchorPoint::CENTER);
+    child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+    child.SetBackgroundColor(Color::GREEN);
+    mClipControl.Add(child);
+
+    // Respond to key events
+    window.KeyEventSignal().Connect(this, &WindowExampleController::OnKeyEvent);
+
+    // Respond to a click anywhere on the window
+    window.GetRootLayer().TouchedSignal().Connect(this, &WindowExampleController::OnTouch);
+    window.ResizeSignal().Connect(this, &WindowExampleController::OnWindowResized);
+    DevelWindow::MovedSignal(window).Connect(this, &WindowExampleController::OnWindowMoved);
+    DevelWindow::OrientationChangedSignal(window).Connect(this, &WindowExampleController::OnWindowOrientationChanged);
+    DevelWindow::MoveCompletedSignal(window).Connect(this, &WindowExampleController::OnWindowMovedByServer);
+    DevelWindow::ResizeCompletedSignal(window).Connect(this, &WindowExampleController::OnWindowResizedByServer);
+
+
+    window.AddAvailableOrientation(Dali::WindowOrientation::PORTRAIT);
+    window.AddAvailableOrientation(Dali::WindowOrientation::LANDSCAPE);
+    window.AddAvailableOrientation(Dali::WindowOrientation::PORTRAIT_INVERSE);
+    window.AddAvailableOrientation(Dali::WindowOrientation::LANDSCAPE_INVERSE);
+
+    window.Show();
+
+    mTimer = Timer::New(50);
+    mTimer.TickSignal().Connect(this, &WindowExampleController::OnTimerTick);
+  }
+
+  void Pause(Application &application)
+  {
+    DALI_LOG_RELEASE_INFO("Application is paused..***********************\n");
+  }
+
+  void Resume(Application &application)
+  {
+    DALI_LOG_RELEASE_INFO("Application is resumed..***********************\n");
+  }
+
+  void PresentedCallback( int frameId )
+  {
+    DALI_LOG_RELEASE_INFO("PresentedCallback: FrameId %d\n",frameId);
+  }
+
+  void OnDeviceOrientationChanged(DeviceStatus::Orientation::Status status)
+  {
+    DALI_LOG_RELEASE_INFO("orientation status: %d\n",status);
+  }
+
+  void OnLowMemory(DeviceStatus::Memory::Status status)
+  {
+    DALI_LOG_RELEASE_INFO("low memory status: %d\n",status);
+  }
+
+  bool OnTimerTick()
+  {
+    Dali::Window window = mApplication.GetWindow();
+    bool ret = true;
+
+    if (DevelWindow::IsWindowRotating(window) == true)
+    {
+      isRotating = true;
+      DALI_LOG_RELEASE_INFO("Window is rotating!!!!\n");
+      count++;
+      if(count > 100)
+      {
+        DALI_LOG_RELEASE_INFO("Send AckWindowRotation in Timer\n");
+        DevelWindow::SendRotationCompletedAcknowledgement(window);
+        count = 0;
+        ret = false;
+      }
+    }
+    else
+    {
+      DALI_LOG_RELEASE_INFO("Window is not rotating!!!!\n");
+    }
+    return ret;
+  }
+
+  void OnWindowMoved(Dali::Window winHandle, Dali::Window::WindowPosition position)
+  {
+    DALI_LOG_RELEASE_INFO("OnWindowMoved, x:%d, y:%d, width:%d\n", position.GetX(), position.GetY());
+  }
+
+  void OnWindowMovedByServer(Dali::Window winHandle, Dali::Window::WindowPosition position)
+  {
+    DALI_LOG_RELEASE_INFO("OnWindowMovedByServer, x:%d, y:%d, width:%d\n", position.GetX(), position.GetY());
+  }
+
+  void OnWindowResizedByServer(Dali::Window winHandle, Dali::Window::WindowSize size)
+  {
+    DALI_LOG_RELEASE_INFO("OnWindowResizedByServer, x:%d, y:%d, width:%d\n", size.GetWidth(), size.GetHeight());
+  }
+
+  void OnWindowOrientationChanged(Dali::Window window, Dali::WindowOrientation orientation)
+  {
+    DALI_LOG_RELEASE_INFO("OnWindowOrientationChanged, changed window orientation: %d\n", orientation);
+  }
+
+  void OnWindowResized(Dali::Window winHandle, Dali::Window::WindowSize size)
+  {
+    DALI_LOG_RELEASE_INFO("Resize finish %d  x heigt %d\n", size.GetWidth(), size.GetHeight());
+    if(bChangedOrientation)
+    {
+     if( DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::PORTRAIT)
+      {
+        DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, current orientation is Dali::WindowOrientation::PORTRAIT\n");
+        PositionSize newWindowPosition(0, 0, 400, 300);
+        DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, SetPositionSize(720 * 1280)\n");
+        DevelWindow::SetPositionSize(winHandle, newWindowPosition);
+      }
+      else if( DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::LANDSCAPE)
+      {
+        DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, current orientation is Dali::WindowOrientation::LANDSCAPE\n");
+        PositionSize newWindowPosition(0, 0, 1280, 720);
+        DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, SetPositionSize(1280 * 720)\n");
+        DevelWindow::SetPositionSize(winHandle, newWindowPosition);
+      }
+      else if( DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::PORTRAIT_INVERSE)
+      {
+        DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, current orientation is Dali::WindowOrientation::PORTRAIT_INVERSE\n");
+        PositionSize newWindowPosition(100, 100, 720, 1280);
+        DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, SetPositionSize(100, 100, 720 * 1280)\n");
+        DevelWindow::SetPositionSize(winHandle, newWindowPosition);
+      }
+      else if( DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::LANDSCAPE_INVERSE)
+      {
+        DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, current orientation is Dali::WindowOrientation::LANDSCAPE_INVERSE\n");
+        PositionSize newWindowPosition(100, 100, 1280, 720);
+        DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, SetPositionSize(100, 100, 1280 * 720)\n");
+        DevelWindow::SetPositionSize(winHandle, newWindowPosition);
+      }
+    }
+  }
+
+  bool OnTouch(Actor actor, const TouchEvent &touch)
+  {
+    if (touch.GetState(0) == PointState::DOWN)
+    {
+      const int local_x = static_cast<int>(touch.GetLocalPosition(0).x);
+      const int local_y = static_cast<int>(touch.GetLocalPosition(0).y);
+      const int global_x = static_cast<int>(touch.GetScreenPosition(0).x);
+      const int global_y = static_cast<int>(touch.GetScreenPosition(0).y);
+
+      DALI_LOG_RELEASE_INFO("Main Window Touch Event : x:%d, y:%d\n", local_x, local_y);
+      DALI_LOG_RELEASE_INFO("global position: x:%d, y:%d\n", global_x, global_y);
+
+      Dali::Window window = mApplication.GetWindow();
+      Window::WindowSize windowSize = window.GetSize();
+
+      DALI_LOG_RELEASE_INFO("window size: w:%d, h:%d\n", windowSize.GetWidth(), windowSize.GetHeight());
+      DevelWindow::EnableFloatingMode(window, true);
+
+      if ((local_x < MARGIN) && (local_y < MARGIN)) // left top corner
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP_LEFT\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP_LEFT);
+      }
+      else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN)) // rigth top corner
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP_RIGHT\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP_RIGHT);
+      }
+      else if ((local_x > MARGIN) && (local_x < (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN))
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP);
+      }
+      else if ((local_x < MARGIN) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN))
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::LEFT);
+      }
+      else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN))
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: LEFT\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::RIGHT);
+      }
+      else if ((local_x < MARGIN) && (local_y > (windowSize.GetHeight() - MARGIN))) // left bottom corner
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: RIGHT\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::BOTTOM_LEFT);
+      }
+      else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y > (windowSize.GetHeight() - MARGIN))) // right bottom corner
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: BOTTOM_RIGHT\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::BOTTOM_RIGHT);
+      }
+      else
+      {
+        DALI_LOG_RELEASE_INFO("RequestMoveToServer\n", local_x, local_y);
+        DevelWindow::RequestMoveToServer(window);
+      }
+    }
+    return true;
+  }
+
+  //////////////////////////////////////////////////////////////////////////
+  // Test Sub Window Resize
+
+  void CreateSubWindow()
+  {
+  mSecondWindow = Window::New(PositionSize(0, 0, 600, 400), "", false);
+  mSecondWindow.SetTransparency(true);
+  mSecondWindow.SetBackgroundColor(Vector4(1.0, 0.3, 0.3, 0.5));
+
+  mTextLabel2 = TextLabel::New( "Second window" );
+  mTextLabel2.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+  mTextLabel2.SetProperty( Actor::Property::NAME, "Second Window");
+  mSecondWindow.Add( mTextLabel2 );
+
+  mSecondWindow.GetRootLayer().TouchedSignal().Connect(this, &WindowExampleController::OnSubWindowTouch);
+  mSecondWindow.ResizeSignal().Connect(this, &WindowExampleController::OnSubWindowResized);
+  DevelWindow::MovedSignal(mSecondWindow).Connect(this, &WindowExampleController::OnSubWindowMoved);
+  DevelWindow::MoveCompletedSignal(mSecondWindow).Connect(this, &WindowExampleController::OnSubWindowMovedByServer);
+  DevelWindow::ResizeCompletedSignal(mSecondWindow).Connect(this, &WindowExampleController::OnSubWindowResizedByServer);
+
+  mSecondWindow.AddAvailableOrientation( Dali::WindowOrientation::PORTRAIT );
+  mSecondWindow.AddAvailableOrientation( Dali::WindowOrientation::LANDSCAPE );
+  mSecondWindow.AddAvailableOrientation( Dali::WindowOrientation::PORTRAIT_INVERSE );
+  mSecondWindow.AddAvailableOrientation( Dali::WindowOrientation::LANDSCAPE_INVERSE );
+  mSecondWindow.Show();
+
+  Rect<int> setInputRegion(0, 0, 1920, 1080);
+  //mSecondWindow.SetInputRegion(setInputRegion);
+  DevelWindow::ExcludeInputRegion(mSecondWindow, setInputRegion);
+
+  Dali::Window window = mApplication.GetWindow();
+  DevelWindow::SetParent(mSecondWindow, window);
+  }
+
+  void OnSubWindowMoved(Dali::Window winHandle, Dali::Window::WindowPosition position)
+  {
+    DALI_LOG_RELEASE_INFO("OnWindowMoved, x:%d, y:%d, width:%d\n", position.GetX(), position.GetY());
+  }
+
+  void OnSubWindowResized(Dali::Window winHandle, Dali::Window::WindowSize size)
+  {
+    DALI_LOG_RELEASE_INFO("OnSubWindowResized %d  x heigt %d\n", size.GetWidth(), size.GetHeight());
+  }
+
+  void OnSubWindowMovedByServer(Dali::Window winHandle, Dali::Window::WindowPosition position)
+  {
+    DALI_LOG_RELEASE_INFO("OnWindowMovedByServer, x:%d, y:%d, width:%d\n", position.GetX(), position.GetY());
+  }
+
+  void OnSubWindowResizedByServer(Dali::Window winHandle, Dali::Window::WindowSize size)
+  {
+    DALI_LOG_RELEASE_INFO("OnWindowResizedByServer, x:%d, y:%d, width:%d\n", size.GetWidth(), size.GetHeight());
+  }
+
+  bool OnSubWindowTouch(Actor actor, const TouchEvent &touch)
+  {
+    if (touch.GetState(0) == PointState::DOWN)
+    {
+      const int local_x = static_cast<int>(touch.GetLocalPosition(0).x);
+      const int local_y = static_cast<int>(touch.GetLocalPosition(0).y);
+      const int global_x = static_cast<int>(touch.GetScreenPosition(0).x);
+      const int global_y = static_cast<int>(touch.GetScreenPosition(0).y);
+
+      DALI_LOG_RELEASE_INFO("SubWindow Touch Event : x:%d, y:%d\n", local_x, local_y);
+      DALI_LOG_RELEASE_INFO("global position: x:%d, y:%d\n", global_x, global_y);
+
+      Dali::Window window = mSecondWindow;
+      Window::WindowSize windowSize = window.GetSize();
+
+      DALI_LOG_RELEASE_INFO("window size: w:%d, h:%d\n", windowSize.GetWidth(), windowSize.GetHeight());
+      DevelWindow::EnableFloatingMode(window, true);
+
+      if ((local_x < MARGIN) && (local_y < MARGIN)) // left top corner
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP_LEFT\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP_LEFT);
+      }
+      else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN)) // rigth top corner
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP_RIGHT\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP_RIGHT);
+      }
+      else if ((local_x > MARGIN) && (local_x < (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN))
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP);
+      }
+      else if ((local_x < MARGIN) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN))
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::LEFT);
+      }
+      else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN))
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: LEFT\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::RIGHT);
+      }
+      else if ((local_x < MARGIN) && (local_y > (windowSize.GetHeight() - MARGIN))) // left bottom corner
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: RIGHT\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::BOTTOM_LEFT);
+      }
+      else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y > (windowSize.GetHeight() - MARGIN))) // right bottom corner
+      {
+        DALI_LOG_RELEASE_INFO("RequestResizeToServer: BOTTOM_RIGHT\n", local_x, local_y);
+        DevelWindow::RequestResizeToServer(window, WindowResizeDirection::BOTTOM_RIGHT);
+      }
+      else
+      {
+        DALI_LOG_RELEASE_INFO("RequestMoveToServer\n", local_x, local_y);
+        DevelWindow::RequestMoveToServer(window);
+      }
+    }
+    return true;
+  }
+
+  void OnKeyEvent(const KeyEvent &event)
+  {
+    Dali::Window window = mApplication.GetWindow();
+    if (event.GetState() == KeyEvent::DOWN)
+    {
+      if (IsKey(event, Dali::DALI_KEY_ESCAPE) || IsKey(event, Dali::DALI_KEY_BACK))
+      {
+        mApplication.Quit();
+      }
+      else if (event.GetKeyName() == "1")
+      {
+        DALI_LOG_RELEASE_INFO("Move/Resize Test  ::: window move and resize (10, 10) (600 x 400)\n");
+        PositionSize windowPosition(10, 10, 600, 400);
+        DevelWindow::SetPositionSize(window, windowPosition);
+      }
+      else if (event.GetKeyName() == "2")
+      {
+        DALI_LOG_RELEASE_INFO("Present Callback Test\n");
+
+        Dali::Window window = mApplication.GetWindow();
+        if(bColor == 0)
+        {
+            window.SetBackgroundColor(Color::WHITE);
+            bColor = 1;
+        }
+        else
+        {
+            window.SetBackgroundColor(Color::BLACK);
+            bColor = 0;
+        }
+
+        DevelWindow::AddFramePresentedCallback(window, std::unique_ptr<Dali::CallbackBase>(MakeCallback(this, &WindowExampleController::PresentedCallback)), count);
+      }
+      else if (event.GetKeyName() == "3")
+      {
+        DALI_LOG_RELEASE_INFO("Send AckWindowRotation test\n");
+        if(manual_rotation_flag == true)
+        {
+          if(isRotating)
+          {
+            DALI_LOG_RELEASE_INFO("Send AckWindowRotation in Key Event Callback\n");
+            DevelWindow::SendRotationCompletedAcknowledgement(window);
+            manual_rotation_flag = false;
+            isRotating = false;
+          }
+          else
+          {
+            DALI_LOG_RELEASE_INFO("is not Rotating\n");
+          }
+        }
+        else if (event.GetKeyName() == "4")
+        {
+          DALI_LOG_RELEASE_INFO("Set Manual Window Rotation Test\n");
+          if(manual_rotation_flag)
+          {
+            mTimer.Start();
+          }
+          else
+          {
+            mTimer.Stop();
+          }
+          DALI_LOG_RELEASE_INFO("call SetNeedsRotationCompletedAcknowledgement with flag %d\n", manual_rotation_flag);
+          DevelWindow::SetNeedsRotationCompletedAcknowledgement(window, manual_rotation_flag);
+        }
+        else
+        {
+          DALI_LOG_RELEASE_INFO("set flag %d\n", manual_rotation_flag);
+          manual_rotation_flag = true;
+        }
+      }
+      else if (event.GetKeyName() == "5")
+      {
+        DALI_LOG_RELEASE_INFO("Window Rotation and Resize test together\n");
+        if(!bChangedOrientation)
+        {
+          DALI_LOG_RELEASE_INFO("Both Window Rotation and Resize Test\n");
+          bChangedOrientation = true;
+        }
+        else
+        {
+          DALI_LOG_RELEASE_INFO("Only Window Rotation Test\n");
+          bChangedOrientation = false;
+        }
+      }
+      else if (event.GetKeyName() == "6")
+      {
+        DALI_LOG_RELEASE_INFO("Maximize Test\n");
+        if(DevelWindow::IsMaximized(window))
+        {
+          DevelWindow::Maximize(window, false);
+        }
+        else
+        {
+          DevelWindow::Maximize(window, true);
+        }
+      }
+      else if (event.GetKeyName() == "7")
+      {
+        DALI_LOG_RELEASE_INFO("Minimize Test\n");
+        if(DevelWindow::IsMinimized(window))
+        {
+          DevelWindow::Minimize(window, false);
+        }
+        else
+        {
+          DevelWindow::Minimize(window, true);
+        }
+      }
+
+      else if (event.GetKeyName() == "8")
+      {
+        DALI_LOG_RELEASE_INFO("Set/Get Full Screen window Test\n");
+        if(DevelWindow::GetFullScreen(window))
+        {
+          DevelWindow::SetFullScreen(window, false);
+        }
+        else
+        {
+          DevelWindow::SetFullScreen(window, true);
+        }
+
+      }
+      else if (event.GetKeyName() == "9")
+      {
+        DALI_LOG_RELEASE_INFO("Sub window Test\n");
+        CreateSubWindow();
+      }
+      else if(event.GetKeyName() == "0")
+      {
+        // scissor test for Window Rotation
+        // Toggle the clipping mode on mClippingControl if any other actor by pressing any key
+        DALI_LOG_RELEASE_INFO("Scissor Test\n");
+        ClippingMode::Type currentMode;
+        mClipControl.GetProperty( Actor::Property::CLIPPING_MODE ).Get( currentMode );
+        mClipControl.SetProperty( Actor::Property::CLIPPING_MODE,
+           ( ( currentMode == ClippingMode::DISABLED ) ? ClippingMode::CLIP_TO_BOUNDING_BOX : ClippingMode::DISABLED ) );
+      }
+
+    }
+  }
+
+  void OnAuxMessageEvent(const std::string &key, const std::string &value, const Property::Array &options)
+  {
+    if (!key.empty())
+    {
+      std::cout << "Key: " << key << std::endl;
+      if (!value.empty())
+      {
+        std::cout << "Value : " << value << std::endl;
+      }
+
+      if (!options.Empty())
+      {
+        uint32_t options_count = static_cast<uint32_t>(options.Count());
+        for (uint32_t i(0); i != options_count; ++i)
+        {
+          std::cout << "Option : " << options.GetElementAt(i) << std::endl;
+        }
+      }
+    }
+  }
+
+private:
+  Application &mApplication;
+  Control mClipControl;
+  bool manual_rotation_flag;
+  int rotation_count;
+  int rot;
+  Timer mTimer;
+  TextLabel mTextLabel2;
+  bool enableTimer;
+  bool bChangedOrientation;
+  bool isRotating;
+  bool bColor;
+
+  Dali::Window mSecondWindow;
+  Dali::WindowOrientation currentOrientation;
+
+  CallbackBase* mPresentCallback{};
+};
+
+int DALI_EXPORT_API main(int argc, char **argv)
+{
+  Application application = Application::New(&argc, &argv);
+  WindowExampleController test(application);
+  application.MainLoop();
+  return 0;
+}
index 89b8938..ad38e07 100755 (executable)
@@ -331,6 +331,9 @@ msgstr "Waves"
 msgid "DALI_DEMO_STR_TITLE_WEB_VIEW"
 msgstr "Web View"
 
+msgid "DALI_DEMO_STR_TITLE_WINDOW"
+msgstr "Window"
+
 msgid "DALI_DEMO_STR_TITLE_ANIMATED_VECTOR_IMAGES"
 msgstr "Animated Vector Images"
 
index 6ffb4b4..7c96551 100755 (executable)
@@ -337,6 +337,9 @@ msgstr "PBR"
 msgid "DALI_DEMO_STR_TITLE_WEB_VIEW"
 msgstr "Web View"
 
+msgid "DALI_DEMO_STR_TITLE_WINDOW"
+msgstr "Window"
+
 msgid "DALI_DEMO_STR_TITLE_ANIMATED_VECTOR_IMAGES"
 msgstr "Animated Vector Images"
 
index 3e8f37d..90e16f1 100644 (file)
@@ -148,6 +148,7 @@ extern "C"
 #define DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS")
 #define DALI_DEMO_STR_TITLE_WAVES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_WAVES")
 #define DALI_DEMO_STR_TITLE_WEB_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_WEB_VIEW")
+#define DALI_DEMO_STR_TITLE_WINDOW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_WINDOW")
 #define DALI_DEMO_STR_TITLE_TEXT_RENDERER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_RENDERER")
 #define DALI_DEMO_STR_TITLE_TEXT_VISUAL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_VISUAL")
 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT")
@@ -269,6 +270,7 @@ extern "C"
 #define DALI_DEMO_STR_TITLE_VISUAL_TRANSITIONS "Visual Transitions"
 #define DALI_DEMO_STR_TITLE_WAVES "Waves"
 #define DALI_DEMO_STR_TITLE_WEB_VIEW "Web View"
+#define DALI_DEMO_STR_TITLE_WINDOW "Window"
 #define DALI_DEMO_STR_TITLE_TEXT_RENDERER "Text Renderer"
 #define DALI_DEMO_STR_TITLE_TEXT_VISUAL "Text Visual"
 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_BITMAP_FONT "Text Bitmap Font"