2 * Copyright (c) 2023 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, WindowType::NORMAL, 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 AuxiliaryMessageSignalType& AuxiliaryMessageSignal(Window window)
106 return GetImplementation(window).AuxiliaryMessageSignal();
109 AccessibilityHighlightSignalType& AccessibilityHighlightSignal(Window window)
111 return GetImplementation(window).AccessibilityHighlightSignal();
114 MovedSignalType& MovedSignal(Window window)
116 return GetImplementation(window).MovedSignal();
119 OrientationChangedSignalType& OrientationChangedSignal(Window window)
121 return GetImplementation(window).OrientationChangedSignal();
124 MoveCompletedSignalType& MoveCompletedSignal(Window window)
126 return GetImplementation(window).MoveCompletedSignal();
129 ResizeCompletedSignalType& ResizeCompletedSignal(Window window)
131 return GetImplementation(window).ResizeCompletedSignal();
134 void SetParent(Window window, Window parent)
136 GetImplementation(window).SetParent(parent);
139 void SetParent(Window window, Window parent, bool belowParent)
141 GetImplementation(window).SetParent(parent, belowParent);
144 void Unparent(Window window)
146 GetImplementation(window).Unparent();
149 Window GetParent(Window window)
151 return GetImplementation(window).GetParent();
154 WindowOrientation GetCurrentOrientation(Window window)
156 return GetImplementation(window).GetCurrentOrientation();
159 int GetPhysicalOrientation(Window window)
161 return GetImplementation(window).GetPhysicalOrientation();
164 void SetAvailableOrientations(Window window, const Dali::Vector<WindowOrientation>& orientations)
166 GetImplementation(window).SetAvailableOrientations(orientations);
169 int32_t GetNativeId(Window window)
171 return GetImplementation(window).GetNativeId();
174 void AddFrameRenderedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId)
176 GetImplementation(window).AddFrameRenderedCallback(std::move(callback), frameId);
179 void AddFramePresentedCallback(Window window, std::unique_ptr<CallbackBase> callback, int32_t frameId)
181 GetImplementation(window).AddFramePresentedCallback(std::move(callback), frameId);
184 void SetPositionSizeWithOrientation(Window window, PositionSize positionSize, WindowOrientation orientation)
186 GetImplementation(window).SetPositionSizeWithOrientation(positionSize, orientation);
189 void RequestMoveToServer(Window window)
191 GetImplementation(window).RequestMoveToServer();
194 void RequestResizeToServer(Window window, WindowResizeDirection direction)
196 GetImplementation(window).RequestResizeToServer(direction);
199 void EnableFloatingMode(Window window, bool enable)
201 GetImplementation(window).EnableFloatingMode(enable);
204 void IncludeInputRegion(Window window, const Rect<int>& inputRegion)
206 GetImplementation(window).IncludeInputRegion(inputRegion);
209 void ExcludeInputRegion(Window window, const Rect<int>& inputRegion)
211 GetImplementation(window).ExcludeInputRegion(inputRegion);
214 void SetNeedsRotationCompletedAcknowledgement(Window window, bool needAcknowledgement)
216 GetImplementation(window).SetNeedsRotationCompletedAcknowledgement(needAcknowledgement);
219 void SendRotationCompletedAcknowledgement(Window window)
221 GetImplementation(window).SendRotationCompletedAcknowledgement();
224 void FeedTouchPoint(Window window, const Dali::TouchPoint& point, int32_t timeStamp)
226 Integration::Point convertedPoint(point);
227 GetImplementation(window).FeedTouchPoint(convertedPoint, timeStamp);
230 void FeedWheelEvent(Window window, const Dali::WheelEvent& wheelEvent)
232 Integration::WheelEvent convertedEvent(static_cast<Integration::WheelEvent::Type>(wheelEvent.GetType()), wheelEvent.GetDirection(), wheelEvent.GetModifiers(), wheelEvent.GetPoint(), wheelEvent.GetDelta(), wheelEvent.GetTime());
233 GetImplementation(window).FeedWheelEvent(convertedEvent);
236 void FeedKeyEvent(Window window, const Dali::KeyEvent& keyEvent)
238 Integration::KeyEvent convertedEvent(keyEvent.GetKeyName(), keyEvent.GetLogicalKey(), keyEvent.GetKeyString(), keyEvent.GetKeyCode(), keyEvent.GetKeyModifier(), keyEvent.GetTime(), static_cast<Integration::KeyEvent::State>(keyEvent.GetState()), keyEvent.GetCompose(), keyEvent.GetDeviceName(), keyEvent.GetDeviceClass(), keyEvent.GetDeviceSubclass());
239 GetImplementation(window).FeedKeyEvent(convertedEvent);
242 void Maximize(Window window, bool maximize)
244 GetImplementation(window).Maximize(maximize);
247 bool IsMaximized(Window window)
249 return GetImplementation(window).IsMaximized();
252 void SetMaximumSize(Window window, Dali::Window::WindowSize size)
254 GetImplementation(window).SetMaximumSize(size);
257 void Minimize(Window window, bool miniimize)
259 GetImplementation(window).Minimize(miniimize);
262 bool IsMinimized(Window window)
264 return GetImplementation(window).IsMinimized();
267 void SetMimimumSize(Window window, Dali::Window::WindowSize size)
269 GetImplementation(window).SetMimimumSize(size);
272 bool IsWindowRotating(Window window)
274 return GetImplementation(window).IsWindowRotating();
277 const KeyEvent& GetLastKeyEvent(Window window)
279 return GetImplementation(window).GetLastKeyEvent();
282 const TouchEvent& GetLastTouchEvent(Window window)
284 return GetImplementation(window).GetLastTouchEvent();
287 InterceptKeyEventSignalType& InterceptKeyEventSignal(Window window)
289 return GetImplementation(window).InterceptKeyEventSignal();
292 MouseInOutEventSignalType& MouseInOutEventSignal(Window window)
294 return GetImplementation(window).MouseInOutEventSignal();
297 } // namespace DevelWindow