2 * Copyright (c) 2020 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 <dali/public-api/events/key-event.h>
20 #include <dali/public-api/events/touch-event.h>
21 #include <dali/public-api/events/wheel-event.h>
24 #include <dali/devel-api/adaptor-framework/window-devel.h>
25 #include <dali/internal/window-system/common/window-impl.h>
33 Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent)
35 return DevelWindow::New(surface, windowPosition, name, "", isTransparent);
38 Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent)
42 const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
43 bool isNewWindowAllowed = true;
45 if (isAdaptorAvailable)
47 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
48 isNewWindowAllowed = Internal::Adaptor::Adaptor::GetImplementation(adaptor).IsMultipleWindowSupported();
51 if (isNewWindowAllowed)
53 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(surface, windowPosition, name, className, isTransparent);
55 Integration::SceneHolder sceneHolder = Integration::SceneHolder(window);
56 if (isAdaptorAvailable)
58 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
59 Internal::Adaptor::Adaptor::GetImplementation(adaptor).AddWindow(sceneHolder, name, className, isTransparent);
61 newWindow = Window(window);
65 DALI_LOG_ERROR("This device can't support multiple windows.\n");
71 void SetPositionSize( Window window, PositionSize positionSize )
73 GetImplementation( window ).SetPositionSize( positionSize );
76 Window Get( Actor actor )
78 return Internal::Adaptor::Window::Get( actor );
81 EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window )
83 return GetImplementation( window ).EventProcessingFinishedSignal();
86 WheelEventSignalType& WheelEventSignal( Window window )
88 return GetImplementation( window ).WheelEventSignal();
91 VisibilityChangedSignalType& VisibilityChangedSignal( Window window )
93 return GetImplementation( window ).VisibilityChangedSignal();
96 TransitionEffectEventSignalType& TransitionEffectEventSignal( Window window )
98 return GetImplementation( window ).TransitionEffectEventSignal();
101 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal( Window window )
103 return GetImplementation( window ).KeyboardRepeatSettingsChangedSignal();
106 void SetParent( Window window, Window parent )
108 GetImplementation( window ).SetParent( parent );
111 void Unparent( Window window )
113 GetImplementation( window ).Unparent();
116 Window GetParent( Window window )
118 return GetImplementation( window ).GetParent();
121 Window DownCast( BaseHandle handle )
123 return Window( dynamic_cast<Dali::Internal::Adaptor::Window*>( handle.GetObjectPtr()) );
126 Dali::Window::WindowOrientation GetCurrentOrientation( Window window )
128 return GetImplementation( window ).GetCurrentOrientation();
131 void SetAvailableOrientations( Window window, const Dali::Vector<Dali::Window::WindowOrientation>& orientations )
133 GetImplementation( window ).SetAvailableOrientations( orientations );
136 int32_t GetNativeId( Window window )
138 return GetImplementation( window ).GetNativeId();
141 void SetDamagedAreas(Window window, std::vector<Dali::Rect<int>>& areas)
143 GetImplementation(window).SetDamagedAreas(areas);
146 void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId )
148 GetImplementation( window ).AddFrameRenderedCallback( std::move( callback ), frameId );
151 void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId )
153 GetImplementation( window ).AddFramePresentedCallback( std::move( callback ), frameId );
156 } // namespace DevelWindow