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>
30 Window New(Any surface, PositionSize windowPosition, const std::string& name, bool isTransparent)
32 return DevelWindow::New(surface, windowPosition, name, "", isTransparent);
35 Window New(Any surface, PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent)
39 const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable();
40 bool isNewWindowAllowed = true;
42 if(isAdaptorAvailable)
44 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
45 isNewWindowAllowed = Internal::Adaptor::Adaptor::GetImplementation(adaptor).IsMultipleWindowSupported();
48 if(isNewWindowAllowed)
50 Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(surface, windowPosition, name, className, isTransparent);
52 Integration::SceneHolder sceneHolder = Integration::SceneHolder(window);
53 if(isAdaptorAvailable)
55 Dali::Adaptor& adaptor = Internal::Adaptor::Adaptor::Get();
56 Internal::Adaptor::Adaptor::GetImplementation(adaptor).AddWindow(sceneHolder);
58 newWindow = Window(window);
62 DALI_LOG_ERROR("This device can't support multiple windows.\n");
68 void SetPositionSize(Window window, PositionSize positionSize)
70 GetImplementation(window).SetPositionSize(positionSize);
73 Window Get(Actor actor)
75 return Internal::Adaptor::Window::Get(actor);
78 EventProcessingFinishedSignalType& EventProcessingFinishedSignal(Window window)
80 return GetImplementation(window).EventProcessingFinishedSignal();
83 WheelEventSignalType& WheelEventSignal(Window window)
85 return GetImplementation(window).WheelEventSignal();
88 VisibilityChangedSignalType& VisibilityChangedSignal(Window window)
90 return GetImplementation(window).VisibilityChangedSignal();
93 TransitionEffectEventSignalType& TransitionEffectEventSignal(Window window)
95 return GetImplementation(window).TransitionEffectEventSignal();
98 KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal(Window window)
100 return GetImplementation(window).KeyboardRepeatSettingsChangedSignal();
103 void SetParent(Window window, Window parent)
105 GetImplementation(window).SetParent(parent);
108 void Unparent(Window window)
110 GetImplementation(window).Unparent();
113 Window GetParent(Window window)
115 return GetImplementation(window).GetParent();
118 Window DownCast(BaseHandle handle)
120 return Window(dynamic_cast<Dali::Internal::Adaptor::Window*>(handle.GetObjectPtr()));
123 Dali::Window::WindowOrientation GetCurrentOrientation(Window window)
125 return GetImplementation(window).GetCurrentOrientation();
128 void SetAvailableOrientations(Window window, const Dali::Vector<Dali::Window::WindowOrientation>& orientations)
130 GetImplementation(window).SetAvailableOrientations(orientations);
133 int32_t GetNativeId(Window window)
135 return GetImplementation(window).GetNativeId();
138 void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId)
140 GetImplementation(window).AddFrameRenderedCallback(std::move(callback), frameId);
143 void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId)
145 GetImplementation(window).AddFramePresentedCallback(std::move(callback), frameId);
148 } // namespace DevelWindow