1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H
5 * Copyright (c) 2022 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::SetClass()
184 void SetClass(const std::string& name, const std::string& className) override;
187 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
189 void Raise() override;
192 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
194 void Lower() override;
197 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
199 void Activate() override;
202 * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
204 void Maximize(bool maximize) override;
207 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
209 bool IsMaximized() const override;
212 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize()
214 void SetMaximumSize(Dali::Window::WindowSize size) override;
217 * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
219 void Minimize(bool minimize) override;
222 * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
224 bool IsMinimized() const override;
227 * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize()
229 void SetMimimumSize(Dali::Window::WindowSize size) override;
232 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
234 void SetAvailableAnlges(const std::vector<int>& angles) override;
237 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
239 void SetPreferredAngle(int angle) override;
242 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
244 void SetAcceptFocus(bool accept) override;
247 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
249 void Show() override;
252 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
254 void Hide() override;
257 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
259 unsigned int GetSupportedAuxiliaryHintCount() const override;
262 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
264 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
267 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
269 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
272 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
274 bool RemoveAuxiliaryHint(unsigned int id) override;
277 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
279 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
282 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
284 std::string GetAuxiliaryHintValue(unsigned int id) const override;
287 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
289 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
292 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
294 void SetInputRegion(const Rect<int>& inputRegion) override;
297 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
299 void SetType(Dali::WindowType type) override;
302 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
304 Dali::WindowType GetType() const override;
307 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
309 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
312 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
314 Dali::WindowNotificationLevel GetNotificationLevel() const override;
317 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
319 void SetOpaqueState(bool opaque) override;
322 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
324 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
327 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
329 WindowScreenOffMode GetScreenOffMode() const override;
332 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
334 Dali::WindowOperationResult SetBrightness(int brightness) override;
337 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
339 int GetBrightness() const override;
342 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
344 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
347 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
349 bool UngrabKey(Dali::KEY key) override;
352 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
354 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
357 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
359 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
362 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
364 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
367 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
369 int GetScreenRotationAngle() override;
372 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
374 void SetWindowRotationAngle(int degree) override;
377 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
379 void WindowRotationCompleted(int degree, int width, int height) override;
382 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
384 void SetTransparency(bool transparent) override;
387 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
389 void SetParent(WindowBase* parentWinBase, bool belowParent) override;
392 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
394 int CreateFrameRenderedSyncFence() override;
397 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
399 int CreateFramePresentedSyncFence() override;
402 * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
404 int GetWindowRotationAngle() const override;
407 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
409 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
412 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
414 void InitializeIme() override;
417 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
419 void ImeWindowReadyToRender() override;
423 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
425 void RequestMoveToServer() override;
428 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
430 void RequestResizeToServer(WindowResizeDirection direction) override;
433 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
435 void EnableFloatingMode(bool enable) override;
438 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
440 bool IsFloatingModeEnabled() const override;
443 * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
445 void IncludeInputRegion(const Rect<int>& inputRegion) override;
448 * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
450 void ExcludeInputRegion(const Rect<int>& inputRegion) override;
454 * Second stage initialization
456 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
459 * @brief Get the surface id if the surface parameter is not empty
460 * @param surface Any containing a surface id, or can be empty
461 * @return surface id, or zero if surface is empty
463 unsigned int GetSurfaceId(Any surface) const;
467 WindowBaseAndroid(const WindowBaseAndroid&) = delete;
470 WindowBaseAndroid& operator=(const WindowBaseAndroid& rhs) = delete;
473 ANativeWindow* mWindow; ///< Native window handle
474 bool mOwnSurface : 1; ///< Whether we own the surface (responsible for deleting it)
475 bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
476 bool mRotationAppSet : 1;
479 } // namespace Adaptor
481 } // namespace Internal
485 #endif // DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H