2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "toolkit-window.h"
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/actors/layer.h>
24 #include <dali/public-api/common/stage.h>
25 #include <dali/public-api/object/base-object.h>
27 #include <dali/integration-api/adaptors/scene-holder.h>
28 #include <toolkit-scene-holder-impl.h>
31 #include <dali/integration-api/adaptors/adaptor.h>
32 #include <toolkit-adaptor-impl.h>
35 #include "test-render-surface.h"
37 using AdaptorImpl = Dali::Internal::Adaptor::Adaptor;
44 /********************************************************************************
45 * Stub for Dali::Internal::Adaptor::Window
46 ********************************************************************************/
52 class Window : public SceneHolder
56 Window( const PositionSize& positionSize )
57 : SceneHolder( positionSize )
61 virtual ~Window() = default;
63 static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
65 return new Window( positionSize );
72 inline Internal::Adaptor::Window& GetImplementation(Dali::Window& window)
74 DALI_ASSERT_ALWAYS( window && "Window handle is empty" );
75 BaseObject& object = window.GetBaseObject();
76 return static_cast<Internal::Adaptor::Window&>(object);
87 Window::Window(const Window& handle)
88 : BaseHandle( handle )
92 Window& Window::operator=(const Window& rhs)
94 BaseHandle::operator=(rhs);
98 Dali::Window Window::New( PositionSize windowPosition, const std::string& name, bool isTransparent )
100 return New( windowPosition, name, "", isTransparent );
103 Dali::Window Window::New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent )
105 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, className, isTransparent );
107 Dali::Window result( window );
109 Dali::Integration::SceneHolder sceneHolder( static_cast<Dali::Internal::Adaptor::SceneHolder*>( window ) );
110 Dali::Internal::Adaptor::Adaptor::Get().WindowCreatedSignal().Emit( sceneHolder );
115 Dali::Layer Window::GetRootLayer() const
117 return Dali::Stage::GetCurrent().GetRootLayer();
120 Window::Window( Internal::Adaptor::Window* window )
121 : BaseHandle( window )
125 Integration::Scene Window::GetScene()
127 return GetImplementation( *this ).GetScene();
130 Integration::RenderSurface& Window::GetRenderSurface()
132 return GetImplementation( *this ).GetRenderSurface();
135 namespace DevelWindow
138 Window Get( Actor actor )
143 EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window )
145 return GetImplementation( window ).GetScene().EventProcessingFinishedSignal();
148 KeyEventSignalType& KeyEventSignal( Window window )
150 return GetImplementation( window ).KeyEventSignal();
153 KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Window window )
155 return GetImplementation( window ).KeyEventGeneratedSignal();
158 TouchSignalType& TouchSignal( Window window )
160 return GetImplementation( window ).TouchSignal();
163 WheelEventSignalType& WheelEventSignal( Window window )
165 return GetImplementation( window ).WheelEventSignal();
167 } // namespace DevelWindow