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/wheel-event.h>
23 #include <dali/devel-api/adaptor-framework/window-devel.h>
24 #include <dali/internal/window-system/common/window-impl.h>
32 Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent)
34 return DevelWindow::New(surface, windowPosition, name, "", isTransparent);
37 Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent)
41 const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
42 bool isNewWindowAllowed = true;
44 if (isAdaptorAvailable)
46 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
47 isNewWindowAllowed = Internal::Adaptor::Adaptor::GetImplementation(adaptor).IsMultipleWindowSupported();
50 if (isNewWindowAllowed)
52 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(surface, windowPosition, name, className, isTransparent);
54 Integration::SceneHolder sceneHolder = Integration::SceneHolder(window);
55 if (isAdaptorAvailable)
57 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
58 Internal::Adaptor::Adaptor::GetImplementation(adaptor).AddWindow(sceneHolder);
60 newWindow = Window(window);
64 DALI_LOG_ERROR("This device can't support multiple windows.\n");
70 void SetPositionSize( Window window, PositionSize positionSize )
72 GetImplementation( window ).SetPositionSize( positionSize );
75 Window Get( Actor actor )
77 return Internal::Adaptor::Window::Get( actor );
80 EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window )
82 return GetImplementation( window ).EventProcessingFinishedSignal();
85 WheelEventSignalType& WheelEventSignal( Window window )
87 return GetImplementation( window ).WheelEventSignal();
90 VisibilityChangedSignalType& VisibilityChangedSignal( Window window )
92 return GetImplementation( window ).VisibilityChangedSignal();
95 TransitionEffectEventSignalType& TransitionEffectEventSignal( Window window )
97 return GetImplementation( window ).TransitionEffectEventSignal();
100 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal( Window window )
102 return GetImplementation( window ).KeyboardRepeatSettingsChangedSignal();
105 void SetParent( Window window, Window parent )
107 GetImplementation( window ).SetParent( parent );
110 void Unparent( Window window )
112 GetImplementation( window ).Unparent();
115 Window GetParent( Window window )
117 return GetImplementation( window ).GetParent();
120 Window DownCast( BaseHandle handle )
122 return Window( dynamic_cast<Dali::Internal::Adaptor::Window*>( handle.GetObjectPtr()) );
125 Dali::Window::WindowOrientation GetCurrentOrientation( Window window )
127 return GetImplementation( window ).GetCurrentOrientation();
130 void SetAvailableOrientations( Window window, const Dali::Vector<Dali::Window::WindowOrientation>& orientations )
132 GetImplementation( window ).SetAvailableOrientations( orientations );
135 int32_t GetNativeId( Window window )
137 return GetImplementation( window ).GetNativeId();
140 void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId )
142 GetImplementation( window ).AddFrameRenderedCallback( std::move( callback ), frameId );
145 void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId )
147 GetImplementation( window ).AddFramePresentedCallback( std::move( callback ), frameId );
150 } // namespace DevelWindow