1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H
5 * Copyright (c) 2021 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::CreateEglWindow()
129 EGLNativeWindowType CreateEglWindow(int width, int height) override;
132 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
134 void DestroyEglWindow() override;
137 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
139 void SetEglWindowRotation(int angle) override;
142 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
144 void SetEglWindowBufferTransform(int angle) override;
147 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
149 void SetEglWindowTransform(int angle) override;
152 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
154 void ResizeEglWindow(PositionSize positionSize) override;
157 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
159 bool IsEglWindowRotationSupported() override;
162 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
164 void Move(PositionSize positionSize) override;
167 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
169 void Resize(PositionSize positionSize) override;
172 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
174 void MoveResize(PositionSize positionSize) override;
177 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
179 void SetClass(const std::string& name, const std::string& className) override;
182 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
184 void Raise() override;
187 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
189 void Lower() override;
192 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
194 void Activate() override;
197 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
199 void SetAvailableAnlges(const std::vector<int>& angles) override;
202 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
204 void SetPreferredAngle(int angle) override;
207 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
209 void SetAcceptFocus(bool accept) override;
212 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
214 void Show() override;
217 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
219 void Hide() override;
222 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
224 unsigned int GetSupportedAuxiliaryHintCount() const override;
227 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
229 std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
232 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
234 unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
237 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
239 bool RemoveAuxiliaryHint(unsigned int id) override;
242 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
244 bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
247 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
249 std::string GetAuxiliaryHintValue(unsigned int id) const override;
252 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
254 unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
257 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
259 void SetInputRegion(const Rect<int>& inputRegion) override;
262 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
264 void SetType(Dali::WindowType type) override;
267 * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
269 Dali::WindowType GetType() const override;
272 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
274 Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
277 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
279 Dali::WindowNotificationLevel GetNotificationLevel() const override;
282 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
284 void SetOpaqueState(bool opaque) override;
287 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
289 Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
292 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
294 WindowScreenOffMode GetScreenOffMode() const override;
297 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
299 Dali::WindowOperationResult SetBrightness(int brightness) override;
302 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
304 int GetBrightness() const override;
307 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
309 bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
312 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
314 bool UngrabKey(Dali::KEY key) override;
317 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
319 bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
322 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
324 bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
327 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
329 void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
332 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
334 int GetScreenRotationAngle() override;
337 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
339 void SetWindowRotationAngle(int degree) override;
342 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
344 void WindowRotationCompleted(int degree, int width, int height) override;
347 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
349 void SetTransparency(bool transparent) override;
352 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
354 void SetParent(WindowBase* parentWinBase) override;
357 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
359 int CreateFrameRenderedSyncFence() override;
362 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
364 int CreateFramePresentedSyncFence() override;
367 * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
369 int GetOrientation() const override;
372 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
374 void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
377 * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
379 void InitializeIme() override;
382 * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
384 void ImeWindowReadyToRender() override;
388 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
390 void RequestMoveToServer() override;
393 * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
395 void RequestResizeToServer(WindowResizeDirection direction) override;
398 * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
400 void EnableFloatingMode(bool enable) override;
403 * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
405 bool IsFloatingModeEnabled() const override;
409 * Second stage initialization
411 void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
414 * @brief Get the surface id if the surface parameter is not empty
415 * @param surface Any containing a surface id, or can be empty
416 * @return surface id, or zero if surface is empty
418 unsigned int GetSurfaceId(Any surface) const;
422 WindowBaseAndroid(const WindowBaseAndroid&) = delete;
425 WindowBaseAndroid& operator=(const WindowBaseAndroid& rhs) = delete;
428 ANativeWindow* mWindow; ///< Native window handle
429 bool mOwnSurface : 1; ///< Whether we own the surface (responsible for deleting it)
430 bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
431 bool mRotationAppSet : 1;
434 } // namespace Adaptor
436 } // namespace Internal
440 #endif // DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H