X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftoolkit-window.cpp;h=9e9ca359ccb96c25a36e2c22399fe34ee90e2210;hb=7c81ee521e33d47e386d60eb7ccf07b98073542c;hp=506bee8407074fd159d454de2b3dc9290313318d;hpb=b3a97840ef9163145f3adc947cf1c6679911d754;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp index 506bee8..9e9ca35 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 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. @@ -16,24 +16,17 @@ */ // CLASS HEADER -#include "toolkit-window.h" +#include "toolkit-window-impl.h" // EXTERNAL INCLUDES #include #include -#include #include -#include -#include - #define DALI_WINDOW_H -#include +#include #include -// INTERNAL INCLUDES -#include "test-render-surface.h" - using AdaptorImpl = Dali::Internal::Adaptor::Adaptor; namespace Dali @@ -49,22 +42,18 @@ namespace Internal { namespace Adaptor { -class Window : public SceneHolder -{ -public: - - Window( const PositionSize& positionSize ) - : SceneHolder( positionSize ) - { - } - virtual ~Window() = default; +Window::Window( const PositionSize& positionSize ) +: SceneHolder( positionSize ), + mFocusChangeSignal(), + mVisibilityChangedSignal() +{ +} - static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent) - { - return new Window( positionSize ); - } -}; +Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent) +{ + return new Window( positionSize ); +} } // Adaptor } // Internal @@ -76,24 +65,28 @@ inline Internal::Adaptor::Window& GetImplementation(Dali::Window& window) return static_cast(object); } -Window::Window() +inline const Internal::Adaptor::Window& GetImplementation(const Dali::Window& window) { + DALI_ASSERT_ALWAYS( window && "Window handle is empty" ); + const BaseObject& object = window.GetBaseObject(); + return static_cast(object); } -Window::~Window() +Window::Window() { } -Window::Window(const Window& handle) -: BaseHandle( handle ) +Window::~Window() { } -Window& Window::operator=(const Window& rhs) -{ - BaseHandle::operator=(rhs); - return *this; -} +Window::Window( const Window& copy ) = default; + +Window& Window::operator=( const Window& rhs ) = default; + +Window::Window( Window&& rhs ) = default; + +Window& Window::operator=( Window&& rhs ) = default; Dali::Window Window::New( PositionSize windowPosition, const std::string& name, bool isTransparent ) { @@ -106,17 +99,12 @@ Dali::Window Window::New(PositionSize windowPosition, const std::string& name, c Dali::Window result( window ); - Dali::Integration::SceneHolder sceneHolder( static_cast( window ) ); - Dali::Internal::Adaptor::Adaptor::Get().WindowCreatedSignal().Emit( sceneHolder ); + // This will also emit the window created signals + AdaptorImpl::GetImpl( AdaptorImpl::Get() ).AddWindow( window ); return result; } -Dali::Layer Window::GetRootLayer() const -{ - return Dali::Stage::GetCurrent().GetRootLayer(); -} - Window::Window( Internal::Adaptor::Window* window ) : BaseHandle( window ) { @@ -127,43 +115,116 @@ Integration::Scene Window::GetScene() return GetImplementation( *this ).GetScene(); } -Integration::RenderSurface& Window::GetRenderSurface() +Dali::RenderSurfaceInterface& Window::GetRenderSurface() { return GetImplementation( *this ).GetRenderSurface(); } +void Window::Add( Actor actor ) +{ + GetImplementation( *this ).Add( actor ); +} + +void Window::Remove( Actor actor ) +{ + GetImplementation( *this ).Remove( actor ); +} + +Dali::Layer Window::GetRootLayer() const +{ + return GetImplementation( *this ).GetRootLayer(); +} + +void Window::SetBackgroundColor( const Vector4& color ) +{ + GetImplementation( *this ).SetBackgroundColor( color ); +} + +Vector4 Window::GetBackgroundColor() const +{ + return GetImplementation( *this ).GetBackgroundColor(); +} + +void Window::Raise() +{ + GetImplementation( *this ).mFocusChangeSignal.Emit(*this, true); +} + +void Window::Hide() +{ + GetImplementation( *this ).mVisibilityChangedSignal.Emit( *this, false ); +} + +FocusChangeSignalType& Window::FocusChangeSignal() +{ + return GetImplementation( *this ).mFocusChangeSignal; +} + +Window::KeyEventSignalType& Window::KeyEventSignal() +{ + return GetImplementation( *this ).KeyEventSignal(); +} + +Window::TouchEventSignalType& Window::TouchedSignal() +{ + return GetImplementation( *this ).TouchedSignal(); +} + namespace DevelWindow { Window Get( Actor actor ) { - return Window(); + Internal::Adaptor::Window* windowImpl = nullptr; + + if ( Dali::Adaptor::IsAvailable() ) + { + windowImpl = static_cast( AdaptorImpl::GetImpl( AdaptorImpl::Get() ).GetWindow( actor ) ); + } + + return Dali::Window( windowImpl ); } -EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window ) +Window DownCast( BaseHandle handle ) { - return GetImplementation( window ).GetScene().EventProcessingFinishedSignal(); + Internal::Adaptor::Window* windowImpl = nullptr; + if ( Dali::Adaptor::IsAvailable() ) + { + windowImpl = dynamic_cast( handle.GetObjectPtr()); + } + return Dali::Window( windowImpl ); } -KeyEventSignalType& KeyEventSignal( Window window ) +void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId ) { - return GetImplementation( window ).KeyEventSignal(); + CallbackBase::Execute( *callback, frameId ); } -KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Window window ) +void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId ) { - return GetImplementation( window ).KeyEventGeneratedSignal(); + CallbackBase::Execute( *callback, frameId ); } -TouchSignalType& TouchSignal( Window window ) +EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window ) { - return GetImplementation( window ).TouchSignal(); + return GetImplementation( window ).GetScene().EventProcessingFinishedSignal(); +} + +KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Window window ) +{ + return GetImplementation( window ).KeyEventGeneratedSignal(); } WheelEventSignalType& WheelEventSignal( Window window ) { return GetImplementation( window ).WheelEventSignal(); } + +VisibilityChangedSignalType& VisibilityChangedSignal( Window window ) +{ + return GetImplementation( window ).mVisibilityChangedSignal; +} + } // namespace DevelWindow } // Dali