1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H
5 * Copyright (c) 2018 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>
35 * WindowBaseAndroid class provides an WindowBase Android implementation.
37 class WindowBaseAndroid : public WindowBase
44 WindowBaseAndroid( PositionSize positionSize, Any surface, bool isTransparent );
49 virtual ~WindowBaseAndroid();
54 * @brief Called when the window property is changed.
56 bool OnWindowPropertyChanged( void* data, int type, void* event );
59 * @brief Called when the window receives a delete request
61 void OnDeleteRequest();
64 * @brief Called when the window gains focus.
66 void OnFocusIn( void* data, int type, void* event );
69 * @brief Called when the window loses focus.
71 void OnFocusOut( void* data, int type, void* event );
74 * @brief Called when the window is damaged.
76 void OnWindowDamaged( void* data, int type, void* event );
79 * @brief Called when a touch down is received.
81 void OnMouseButtonDown( void* data, int type, void* event );
84 * @brief Called when a touch up is received.
86 void OnMouseButtonUp( void* data, int type, void* event );
89 * @brief Called when a touch motion is received.
91 void OnMouseButtonMove( void* data, int type, void* event );
94 * @brief Called when a mouse wheel is received.
96 void OnMouseWheel( void* data, int type, void* event );
99 * @brief Called when a key down is received.
101 void OnKeyDown( void* data, int type, void* event );
104 * @brief Called when a key up is received.
106 void OnKeyUp( void* data, int type, void* event );
109 * @brief Called when the source window notifies us the content in clipboard is selected.
111 void OnSelectionClear( void* data, int type, void* event );
114 * @brief Called when the source window sends us about the selected content.
116 void OnSelectionNotify( void* data, int type, void* event );
121 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
123 virtual Any GetNativeWindow() override;
126 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
128 virtual int GetNativeWindowId() override;
131 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
133 virtual EGLNativeWindowType CreateEglWindow( int width, int height ) override;
136 * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
138 virtual void DestroyEglWindow() override;
141 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
143 virtual void SetEglWindowRotation( int angle ) override;
146 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
148 virtual void SetEglWindowBufferTransform( int angle ) override;
151 * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
153 virtual void SetEglWindowTransform( int angle ) override;
156 * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
158 virtual void ResizeEglWindow( PositionSize positionSize ) override;
161 * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
163 virtual bool IsEglWindowRotationSupported() override;
166 * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
168 virtual void Move( PositionSize positionSize ) override;
171 * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
173 virtual void Resize( PositionSize positionSize ) override;
176 * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
178 virtual void MoveResize( PositionSize positionSize ) override;
181 * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
183 virtual void SetClass( const std::string& name, const std::string& className ) override;
186 * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
188 virtual void Raise() override;
191 * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
193 virtual void Lower() override;
196 * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
198 virtual void Activate() override;
201 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
203 virtual void SetAvailableAnlges( const std::vector< int >& angles ) override;
206 * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
208 virtual void SetPreferredAngle( int angle ) override;
211 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
213 virtual void SetAcceptFocus( bool accept ) override;
216 * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
218 virtual void Show() override;
221 * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
223 virtual void Hide() override;
226 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
228 virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
231 * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
233 virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
236 * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
238 virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
241 * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
243 virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
246 * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
248 virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
251 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
253 virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
256 * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
258 virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
261 * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
263 virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
266 * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
268 virtual void SetType( Dali::Window::Type type ) override;
271 * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
273 virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
276 * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
278 virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
281 * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
283 virtual void SetOpaqueState( bool opaque ) override;
286 * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
288 virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
291 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
293 virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
296 * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
298 virtual bool SetBrightness( int brightness ) override;
301 * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
303 virtual int GetBrightness() const override;
306 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
308 virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
311 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
313 virtual bool UngrabKey( Dali::KEY key ) override;
316 * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
318 virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
321 * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
323 virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
326 * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
328 virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
331 * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
333 virtual int GetScreenRotationAngle() override;
336 * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
338 virtual void SetWindowRotationAngle( int degree ) override;
341 * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
343 virtual void WindowRotationCompleted( int degree, int width, int height ) override;
346 * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
348 virtual void SetTransparency( bool transparent ) override;
351 * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
353 virtual void SetParent( WindowBase* parentWinBase ) override;
356 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
358 virtual int CreateFrameRenderedSyncFence() override;
361 * @copydoc Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
363 virtual int CreateFramePresentedSyncFence() override;
368 * Second stage initialization
370 void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
373 * @brief Get the surface id if the surface parameter is not empty
374 * @param surface Any containing a surface id, or can be empty
375 * @return surface id, or zero if surface is empty
377 unsigned int GetSurfaceId( Any surface ) const;
382 WindowBaseAndroid(const WindowBaseAndroid&) = delete;
385 WindowBaseAndroid& operator=(const WindowBaseAndroid& rhs) = delete;
389 ANativeWindow* mWindow; ///< Native window handle
390 bool mOwnSurface:1; ///< Whether we own the surface (responsible for deleting it)
391 bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
392 bool mRotationAppSet:1;
395 } // namespace Adaptor
397 } // namespace internal
401 #endif // DALI_INTERNAL_WINDOWSYSTEM_ANDROID_WINDOW_BASE_ANDROID_H