2 * Copyright (c) 2021 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/adaptor-framework/window-enumerations.h>
20 #include <dali/public-api/events/key-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>
31 Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent)
33 return DevelWindow::New(surface, windowPosition, name, "", isTransparent);
36 Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent)
40 const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
41 bool isNewWindowAllowed = true;
43 if(isAdaptorAvailable)
45 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
46 isNewWindowAllowed = Internal::Adaptor::Adaptor::GetImplementation(adaptor).IsMultipleWindowSupported();
49 if(isNewWindowAllowed)
51 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(surface, windowPosition, name, className, isTransparent);
53 Integration::SceneHolder sceneHolder = Integration::SceneHolder(window);
54 if(isAdaptorAvailable)
56 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
57 Internal::Adaptor::Adaptor::GetImplementation(adaptor).AddWindow(sceneHolder);
59 newWindow = Window(window);
63 DALI_LOG_ERROR("This device can't support multiple windows.\n");
69 void SetPositionSize(Window window, PositionSize positionSize)
71 GetImplementation(window).SetPositionSize(positionSize);
74 Window Get(Actor actor)
76 return Internal::Adaptor::Window::Get(actor);
79 EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window)
81 return GetImplementation(window).EventProcessingFinishedSignal();
84 WheelEventSignalType& WheelEventSignal(Window window)
86 return GetImplementation(window).WheelEventSignal();
89 VisibilityChangedSignalType& VisibilityChangedSignal(Window window)
91 return GetImplementation(window).VisibilityChangedSignal();
94 TransitionEffectEventSignalType& TransitionEffectEventSignal(Window window)
96 return GetImplementation(window).TransitionEffectEventSignal();
99 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal(Window window)
101 return GetImplementation(window).KeyboardRepeatSettingsChangedSignal();
104 void SetParent(Window window, Window parent)
106 GetImplementation(window).SetParent(parent);
109 void Unparent(Window window)
111 GetImplementation(window).Unparent();
114 Window GetParent(Window window)
116 return GetImplementation(window).GetParent();
119 Window DownCast(BaseHandle handle)
121 return Window(dynamic_cast<Dali::Internal::Adaptor::Window*>(handle.GetObjectPtr()));
124 WindowOrientation GetCurrentOrientation(Window window)
126 return GetImplementation(window).GetCurrentOrientation();
129 void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations)
131 GetImplementation(window).SetAvailableOrientations(orientations);
134 int32_t GetNativeId(Window window)
136 return GetImplementation(window).GetNativeId();
139 void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId)
141 GetImplementation(window).AddFrameRenderedCallback(std::move(callback), frameId);
144 void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId)
146 GetImplementation(window).AddFramePresentedCallback(std::move(callback), frameId);
149 } // namespace DevelWindow