X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali%2Finternal%2Fwindow-system%2Fcommon%2Fwindow-impl.h;h=5bc3bb9287e9351f0bbdf9c4a25cc1938b28910c;hb=d6f38dadcefb4a766c84094cd099fa758fadb176;hp=fff44b760962de440e694ae7598761da537aeb01;hpb=2ee98a57619a579e1a33bbcb340bf538eee90fff;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h old mode 100644 new mode 100755 index fff44b7..5bc3bb9 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,23 +21,23 @@ // EXTERNAL INCLUDES #include #include +#include +#include +#include // INTERNAL INCLUDES -#include -#include -#include #include #include -#include +#include +#include +#include +#include namespace Dali { class Adaptor; - -namespace Integration -{ -class SystemOverlay; -} +class Actor; +class RenderSurfaceInterface; namespace Internal { @@ -48,22 +48,26 @@ class WindowRenderSurface; class WindowBase; class Window; -typedef IntrusivePtr WindowPtr; -typedef IntrusivePtr OrientationPtr; +using WindowPtr = IntrusivePtr< Window >; +using OrientationPtr = IntrusivePtr< Orientation >; +using EventHandlerPtr = IntrusivePtr< EventHandler >; /** * Window provides a surface to render onto with orientation & indicator properties. */ -class Window : public Dali::BaseObject, public IndicatorInterface::Observer, public LifeCycleObserver, public ConnectionTracker +class Window : public Dali::Internal::Adaptor::SceneHolder, public EventHandler::Observer, public ConnectionTracker { public: - typedef Dali::Window::IndicatorSignalType IndicatorSignalType; - typedef Dali::Window::FocusSignalType FocusSignalType; typedef Dali::Window::ResizedSignalType ResizedSignalType; + typedef Dali::Window::FocusChangeSignalType FocusChangeSignalType; + typedef Dali::Window::ResizeSignalType ResizeSignalType; + typedef Dali::DevelWindow::VisibilityChangedSignalType VisibilityChangedSignalType; + typedef Dali::DevelWindow::TransitionEffectEventSignalType TransitionEffectEventSignalType; + typedef Dali::DevelWindow::KeyboardRepeatSettingsChangedSignalType KeyboardRepeatSettingsChangedSignalType; typedef Signal< void () > SignalType; /** - * Create a new Window. This should only be called once by the Application class + * @brief Create a new Window. This should only be called once by the Application class * @param[in] positionSize The position and size of the window * @param[in] name The window title * @param[in] className The window class name @@ -73,56 +77,56 @@ public: static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false); /** - * Pass the adaptor back to the overlay. This allows the window to access Core's overlay. - * @param[in] adaptor An initialized adaptor - */ - void SetAdaptor(Dali::Adaptor& adaptor); - - /** - * Get the window surface - * @return The render surface + * @brief Create a new Window. This should only be called once by the Application class + * @param[in] surface The surface used to render on. + * @param[in] positionSize The position and size of the window + * @param[in] name The window title + * @param[in] className The window class name + * @param[in] isTransparent Whether window is transparent + * @return A newly allocated Window */ - WindowRenderSurface* GetSurface(); + static Window* New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false); /** - * @copydoc Dali::Window::ShowIndicator() + * @copydoc Dali::Window::SetClass() */ - void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode ); + void SetClass( std::string name, std::string className ); /** - * @copydoc Dali::Window::SetIndicatorBgOpacity() + * @brief Gets the window class name. + * @return The class of the window */ - void SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacity ); + std::string GetClassName() const; /** - * Set the indicator visible mode + * @copydoc Dali::Window::Raise() */ - void SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode ); + void Raise(); /** - * @copydoc Dali::Window::RotateIndicator() + * @copydoc Dali::Window::Lower() */ - void RotateIndicator( Dali::Window::WindowOrientation orientation ); + void Lower(); /** - * @copydoc Dali::Window::SetClass() + * @copydoc Dali::Window::Activate() */ - void SetClass( std::string name, std::string className ); + void Activate(); /** - * @copydoc Dali::Window::Raise() + * @copydoc Dali::Window::GetLayerCount() */ - void Raise(); + uint32_t GetLayerCount() const; /** - * @copydoc Dali::Window::Lower() + * @copydoc Dali::Window::GetLayer() */ - void Lower(); + Dali::Layer GetLayer( uint32_t depth ) const; /** - * @copydoc Dali::Window::Activate() + * @copydoc Dali::DevelWindow::GetRenderTaskList() */ - void Activate(); + Dali::RenderTaskList GetRenderTaskList() const; /** * @copydoc Dali::Window::AddAvailableOrientation() @@ -135,16 +139,6 @@ public: void RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation); /** - * @copydoc Dali::Window::SetAvailableOrientations() - */ - void SetAvailableOrientations(const std::vector& orientations); - - /** - * @copydoc Dali::Window::GetAvailableOrientations() - */ - const std::vector& GetAvailableOrientations(); - - /** * @copydoc Dali::Window::SetPreferredOrientation() */ void SetPreferredOrientation(Dali::Window::WindowOrientation orientation); @@ -155,16 +149,6 @@ public: Dali::Window::WindowOrientation GetPreferredOrientation(); /** - * @copydoc Dali::Window::GetDragAndDropDetector() const - */ - Dali::DragAndDropDetector GetDragAndDropDetector() const; - - /** - * @copydoc Dali::Window::GetNativeHandle() const - */ - Dali::Any GetNativeHandle() const; - - /** * @copydoc Dali::Window::SetAcceptFocus() */ void SetAcceptFocus( bool accept ); @@ -185,11 +169,6 @@ public: void Hide(); /** - * @copydoc Dali::Window::IsVisible() const - */ - bool IsVisible() const; - - /** * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount() */ unsigned int GetSupportedAuxiliaryHintCount() const; @@ -305,6 +284,11 @@ public: void SetPositionSize( PositionSize positionSize ); /** + * @copydoc Dali::Window::GetRootLayer() + */ + Dali::Layer GetRootLayer() const; + + /** * @copydoc Dali::Window::SetTransparency() */ void SetTransparency( bool transparent ); @@ -330,49 +314,86 @@ public: bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ); /** - * Called from Orientation after the Change signal has been sent + * @copydoc Dali::DevelWindow::Get() */ - void RotationDone( int orientation, int width, int height ); + static Dali::Window Get( Dali::Actor actor ); -private: + /** + * @copydoc Dali::DevelWindow::SetParent() + */ + void SetParent( Dali::Window& parent ); /** - * Private constructor. - * @sa Window::New() + * @copydoc Dali::DevelWindow::Unparent() */ - Window(); + void Unparent(); /** - * Destructor + * @copydoc Dali::DevelWindow::GetParent() */ - virtual ~Window(); + Dali::Window GetParent(); /** - * Second stage initialization + * @copydoc Dali::DevelWindow::GetCurrentOrientation() + */ + Dali::Window::WindowOrientation GetCurrentOrientation() const; + + /** + * @copydoc Dali::DevelWindow::SetAvailableOrientations() + */ + void SetAvailableOrientations( const Dali::Vector& orientations ); + + /** + * @copydoc Dali::DevelWindow::SetDamagedAreas() */ - void Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className); + void SetDamagedAreas(std::vector>& areas); + +public: // Dali::Internal::Adaptor::SceneHolder /** - * Shows / hides the indicator bar. - * Handles close/open if rotation changes whilst hidden + * @copydoc Dali::Internal::Adaptor::SceneHolder::GetNativeHandle */ - void DoShowIndicator( Dali::Window::WindowOrientation lastOrientation ); + Dali::Any GetNativeHandle() const override; /** - * Close current indicator and open a connection onto the new indicator service. - * Effect may not be synchronous if waiting for an indicator update on existing connection. + * @copydoc Dali::Internal::Adaptor::SceneHolder::IsVisible */ - void DoRotateIndicator( Dali::Window::WindowOrientation orientation ); + bool IsVisible() const override; /** - * Change the indicator actor's rotation to match the current orientation + * @copydoc Dali::DevelWindow::GetNativeId() */ - void SetIndicatorActorRotation(); + int32_t GetNativeId() const; + +private: /** - * Set the indicator properties on the window + * @brief Enumeration for orietation mode. + * The Orientation Mode is related to screen size. + * If screen width is longer than height, the Orientation Mode will have LANDSCAPE. + * Otherwise screen width is shorter than height or same, the Orientation Mode will have PORTRAIT. */ - void SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation ); + enum class OrientationMode + { + PORTRAIT = 0, + LANDSCAPE + }; + + /** + * Private constructor. + * @sa Window::New() + */ + Window(); + + /** + * Destructor + */ + virtual ~Window(); + + /** + * Second stage initialization + */ + void Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className); /** * Called when the window becomes iconified or deiconified. @@ -395,108 +416,161 @@ private: void OnDeleteRequest(); /** - * Called when the Ecore indicator event is received. + * Called when the window receives a Transition effect-start/end event. */ - void OnIndicatorFlicked(); + void OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type ); -private: // IndicatorInterface::Observer interface + /** + * @brief Called when window receives a keyboard repeat event. + */ + void OnKeyboardRepeatSettingsChanged(); /** - * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorTypeChanged() + * @brief Set available orientation to window base. */ - virtual void IndicatorTypeChanged( IndicatorInterface::Type type ); + void SetAvailableAnlges( const std::vector< int >& angles ); /** - * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorClosed() + * @brief Convert from window orientation to angle using OrientationMode. */ - virtual void IndicatorClosed( IndicatorInterface* indicator); + int ConvertToAngle( Dali::Window::WindowOrientation orientation ); /** - * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorVisibilityChanged() + * @brief Convert from angle to window orientation using OrientationMode. */ - virtual void IndicatorVisibilityChanged( bool isVisible ); + Dali::Window::WindowOrientation ConvertToOrientation( int angle ) const; -private: // Adaptor::Observer interface + /** + * @brief Check available window orientation for Available orientation. + */ + bool IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const; + +private: // Dali::Internal::Adaptor::SceneHolder /** - * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnStart() + * @copydoc Dali::Internal::Adaptor::SceneHolder::OnAdaptorSet */ - virtual void OnStart(); + void OnAdaptorSet( Dali::Adaptor& adaptor ) override; /** - * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnPause() + * @copydoc Dali::Internal::Adaptor::SceneHolder::OnSurfaceSet */ - virtual void OnPause(); + void OnSurfaceSet( Dali::RenderSurfaceInterface* surface ) override; /** - * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnResume() + * @copydoc Dali::Internal::Adaptor::SceneHolder::OnPause */ - virtual void OnResume(); + void OnPause() override; /** - * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnStop() + * @copydoc Dali::Internal::Adaptor::SceneHolder::OnResume */ - virtual void OnStop(); + void OnResume() override; /** - * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnDestroy() + * @copydoc Dali::Internal::Adaptor::SceneHolder::RecalculateTouchPosition */ - virtual void OnDestroy(); + void RecalculateTouchPosition( Integration::Point& point ) override; -public: // Signals +private: // Dali::Internal::Adaptor::EventHandler::Observer + + /** + * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnTouchPoint + */ + void OnTouchPoint( Dali::Integration::Point& point, int timeStamp ) override; + + /** + * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnWheelEvent + */ + void OnWheelEvent( Dali::Integration::WheelEvent& wheelEvent ) override; /** - * The user should connect to this signal to get a timing when indicator was shown / hidden. + * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnKeyEvent */ - IndicatorSignalType& IndicatorVisibilityChangedSignal() { return mIndicatorVisibilityChangedSignal; } + void OnKeyEvent( Dali::Integration::KeyEvent& keyEvent ) override; /** - * @copydoc Dali::Window::FocusChangedSignal() + * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnRotation */ - FocusSignalType& FocusChangedSignal() { return mFocusChangedSignal; } + void OnRotation( const RotationEvent& rotation ) override; + +public: // Signals /** + * @copydoc Dali::Window::FocusChangeSignal() + */ + FocusChangeSignalType& FocusChangeSignal() { return mFocusChangeSignal; } + /** * @copydoc Dali::Window::ResizedSignal() */ ResizedSignalType& ResizedSignal() { return mResizedSignal; } /** + * @copydoc Dali::Window::ResizedSignal() + */ + ResizeSignalType& ResizeSignal() { return mResizeSignal; } + + /** * This signal is emitted when the window is requesting to be deleted */ SignalType& DeleteRequestSignal() { return mDeleteRequestSignal; } + /** + * @copydoc Dali::DevelWindow::VisibilityChangedSignal() + */ + VisibilityChangedSignalType& VisibilityChangedSignal() { return mVisibilityChangedSignal; } + + /** + * @copydoc Dali::Window::SignalEventProcessingFinished() + */ + Dali::DevelWindow::EventProcessingFinishedSignalType& EventProcessingFinishedSignal() { return mScene.EventProcessingFinishedSignal(); } + + /** + * @copydoc Dali::DevelWindow::TransitionEffectEventSignal() + */ + TransitionEffectEventSignalType& TransitionEffectEventSignal() { return mTransitionEffectEventSignal; } + + /** + * @copydoc Dali::DevelWindow::KeyboardRepeatSettingsChangedSignal() + */ + KeyboardRepeatSettingsChangedSignalType& KeyboardRepeatSettingsChangedSignal() { return mKeyboardRepeatSettingsChangedSignal; } + private: - WindowRenderSurface* mSurface; + WindowRenderSurface* mWindowSurface; ///< The window rendering surface WindowBase* mWindowBase; - Dali::Window::IndicatorVisibleMode mIndicatorVisible; ///< public state - bool mIndicatorIsShown:1; ///< private state - bool mShowRotatedIndicatorOnClose:1; - bool mStarted:1; + std::string mName; + std::string mClassName; bool mIsTransparent:1; bool mIsFocusAcceptable:1; - bool mVisible:1; bool mIconified:1; bool mOpaqueState:1; bool mResizeEnabled:1; - std::unique_ptr< IndicatorInterface > mIndicator; - Dali::Window::WindowOrientation mIndicatorOrientation; - Dali::Window::WindowOrientation mNextIndicatorOrientation; - Dali::Window::IndicatorBgOpacity mIndicatorOpacityMode; - Integration::SystemOverlay* mOverlay; - Adaptor* mAdaptor; - Dali::DragAndDropDetector mDragAndDropDetector; Dali::Window::Type mType; + Dali::Window mParentWindow; + + OrientationPtr mOrientation; + std::vector< int > mAvailableAngles; + int mPreferredAngle; + + int mRotationAngle; ///< The angle of the rotation + int mWindowWidth; ///< The width of the window + int mWindowHeight; ///< The height of the window + + EventHandlerPtr mEventHandler; ///< The window events handler + + OrientationMode mOrientationMode; - OrientationPtr mOrientation; - std::vector mAvailableOrientations; - Dali::Window::WindowOrientation mPreferredOrientation; + int mNativeWindowId; ///< The Native Window Id // Signals - IndicatorSignalType mIndicatorVisibilityChangedSignal; - FocusSignalType mFocusChangedSignal; - ResizedSignalType mResizedSignal; - SignalType mDeleteRequestSignal; + ResizedSignalType mResizedSignal; + SignalType mDeleteRequestSignal; + FocusChangeSignalType mFocusChangeSignal; + ResizeSignalType mResizeSignal; + VisibilityChangedSignalType mVisibilityChangedSignal; + TransitionEffectEventSignalType mTransitionEffectEventSignal; + KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal; }; } // namespace Adaptor