1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/internal/window-system/common/window-base.h>
34 * WindowBaseAndroid class provides an WindowBase Android implementation.
36 class WindowBaseAndroid : public WindowBase
42 WindowBaseAndroid(PositionSize positionSize, Any surface, bool isTransparent);
47 virtual ~WindowBaseAndroid();
51 * @brief Called when the window property is changed.
53 bool OnWindowPropertyChanged(void* data, int type, void* event);
56 * @brief Called when the window receives a delete request
58 void OnDeleteRequest();
61 * @brief Called when the window gains focus.
63 void OnFocusIn(void* data, int type, void* event);
66 * @brief Called when the window loses focus.
68 void OnFocusOut(void* data, int type, void* event);
71 * @brief Called when the window is damaged.
73 void OnWindowDamaged(void* data, int type, void* event);
76 * @brief Called when a touch down is received.
78 void OnMouseButtonDown(void* data, int type, void* event);
81 * @brief Called when a touch up is received.
83 void OnMouseButtonUp(void* data, int type, void* event);
86 * @brief Called when a touch motion is received.
88 void OnMouseButtonMove(void* data, int type, void* event);
91 * @brief Called when a mouse wheel is received.
93 void OnMouseWheel(void* data, int type, void* event);
96 * @brief Called when a key down is received.
98 void OnKeyDown(void* data, int type, void* event);
101 * @brief Called when a key up is received.
103 void OnKeyUp(void* data, int type, void* event);
106 * @brief Called when the source window notifies us the content in clipboard is selected.
108 void OnSelectionClear(void* data, int type, void* event);
111 * @brief Called when the source window sends us about the selected content.
113 void OnSelectionNotify(void* data, int type, void* event);
117 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
119 Any GetNativeWindow() override;
122 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
124 int GetNativeWindowId() override;
127 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowResourceId()
129 std::string GetNativeWindowResourceId() override;
132 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
134 EGLNativeWindowType CreateEglWindow(int width, int height) override;
137 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
139 void DestroyEglWindow() override;
142 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
144 void SetEglWindowRotation(int angle) override;
147 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
149 void SetEglWindowBufferTransform(int angle) override;
152 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
154 void SetEglWindowTransform(int angle) override;
157 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
159 void ResizeEglWindow(PositionSize positionSize) override;
162 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
164 bool IsEglWindowRotationSupported() override;
167 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
169 void Move(PositionSize positionSize) override;
172 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
174 void Resize(PositionSize positionSize) override;
177 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
179 void MoveResize(PositionSize positionSize) override;
182 * @copydoc Dali::Internal::Adaptor::WindowBase::SetLayout()
184 void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) override;
187 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
189 void SetClass(const std::string& name, const std::string& className) override;
192 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
194 void Raise() override;
197 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
199 void Lower() override;
202 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
204 void Activate() override;
207 * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
209 void Maximize(bool maximize) override;
212 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
214 bool IsMaximized() const override;
217 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize()
219 void SetMaximumSize(Dali::Window::WindowSize size) override;
222 * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
224 void Minimize(bool minimize) override;
227 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
229 bool IsMinimized() const override;
232 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize()
234 void SetMimimumSize(Dali::Window::WindowSize size) override;
237 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
239 void SetAvailableAnlges(const std::vector<int>& angles) override;
242 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
244 void SetPreferredAngle(int angle) override;
247 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
249 void SetAcceptFocus(bool accept) override;
252 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
254 void Show() override;
257 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
259 void Hide() override;
262 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
264 unsigned int GetSupportedAuxiliaryHintCount() const override;
267 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
269 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
272 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
274 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
277 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
279 bool RemoveAuxiliaryHint(unsigned int id) override;
282 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
284 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
287 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
289 std::string GetAuxiliaryHintValue(unsigned int id) const override;
292 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
294 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
297 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
299 void SetInputRegion(const Rect<int>& inputRegion) override;
302 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
304 void SetType(Dali::WindowType type) override;
307 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
309 Dali::WindowType GetType() const override;
312 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
314 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
317 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
319 Dali::WindowNotificationLevel GetNotificationLevel() const override;
322 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
324 void SetOpaqueState(bool opaque) override;
327 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
329 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
332 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
334 WindowScreenOffMode GetScreenOffMode() const override;
337 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
339 Dali::WindowOperationResult SetBrightness(int brightness) override;
342 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
344 int GetBrightness() const override;
347 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
349 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
352 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
354 bool UngrabKey(Dali::KEY key) override;
357 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
359 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
362 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
364 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
367 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
369 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
372 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
374 int GetScreenRotationAngle() override;
377 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
379 void SetWindowRotationAngle(int degree) override;
382 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
384 void WindowRotationCompleted(int degree, int width, int height) override;
387 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
389 void SetTransparency(bool transparent) override;
392 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
394 void SetParent(WindowBase* parentWinBase, bool belowParent) override;
397 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
399 int CreateFrameRenderedSyncFence() override;
402 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
404 int CreateFramePresentedSyncFence() override;
407 * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
409 int GetWindowRotationAngle() const override;
412 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
414 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
417 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
419 void InitializeIme() override;
422 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
424 void ImeWindowReadyToRender() override;
428 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
430 void RequestMoveToServer() override;
433 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
435 void RequestResizeToServer(WindowResizeDirection direction) override;
438 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
440 void EnableFloatingMode(bool enable) override;
443 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
445 bool IsFloatingModeEnabled() const override;
448 * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
450 void IncludeInputRegion(const Rect<int>& inputRegion) override;
453 * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
455 void ExcludeInputRegion(const Rect<int>& inputRegion) override;
458 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerConstraintsLock()
460 bool PointerConstraintsLock() override;
463 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerConstraintsUnlock()
465 bool PointerConstraintsUnlock() override;
468 * @copydoc Dali::Internal::Adaptor::WindowBase::LockedPointerRegionSet()
470 void LockedPointerRegionSet(int32_t x, int32_t y, int32_t width, int32_t height) override;
473 * @copydoc Dali::Internal::Adaptor::WindowBase::LockedPointerCursorPositionHintSet()
475 void LockedPointerCursorPositionHintSet(int32_t x, int32_t y) override;
478 * @copydoc Dali::Internal::Adaptor::WindowBase::PointerWarp()
480 bool PointerWarp(int32_t x, int32_t y) override;
483 * @copydoc Dali::Internal::Adaptor::WindowBase::CursorVisibleSet()
485 void CursorVisibleSet(bool visible) override;
489 * Second stage initialization
491 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
494 * @brief Get the surface id if the surface parameter is not empty
495 * @param surface Any containing a surface id, or can be empty
496 * @return surface id, or zero if surface is empty
498 unsigned int GetSurfaceId(Any surface) const;
502 WindowBaseAndroid(const WindowBaseAndroid&) = delete;
505 WindowBaseAndroid& operator=(const WindowBaseAndroid& rhs) = delete;
508 ANativeWindow* mWindow; ///< Native window handle
509 bool mOwnSurface : 1; ///< Whether we own the surface (responsible for deleting it)
510 bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
511 bool mRotationAppSet : 1;
514 } // namespace Adaptor
516 } // namespace Internal
520 #endif // DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H