X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fwindow-system%2Fcommon%2Fwindow-impl.h;h=0d4a4e10e689b38e97d2a13e9575ee1837ee074c;hb=6e77f2f2c059b23e19ee8387397192431a88232a;hp=8a3bcd1a5d5aa20b79d153eacc35f00a65c2aca3;hpb=fe8f8ee27e49309bfe4b1400ee0c279da3d8336d;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 index 8a3bcd1..0d4a4e1 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_WINDOW_H__ -#define __DALI_INTERNAL_WINDOW_H__ +#ifndef DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H +#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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,49 +21,54 @@ // EXTERNAL INCLUDES #include #include +#include +#include +#include // INTERNAL INCLUDES -#include -#include -#include #include -#include -#include -#include +#include +#include +#include +#include +#include namespace Dali { class Adaptor; -class RenderSurface; - -namespace Integration -{ -class SystemOverlay; -} +class Actor; +class RenderSurfaceInterface; namespace Internal { namespace Adaptor { class Orientation; +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 +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 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,16 +78,15 @@ 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 */ - RenderSurface* GetSurface(); + static Window* New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false); /** * @copydoc Dali::Window::ShowIndicator() @@ -102,7 +106,13 @@ public: /** * @copydoc Dali::Window::SetClass() */ - void SetClass( std::string name, std::string klass ); + void SetClass( std::string name, std::string className ); + + /** + * @brief Gets the window class name. + * @return The class of the window + */ + std::string GetClassName() const; /** * @copydoc Dali::Window::Raise() @@ -120,24 +130,29 @@ public: void Activate(); /** - * @copydoc Dali::Window::AddAvailableOrientation() + * @copydoc Dali::Window::GetLayerCount() */ - void AddAvailableOrientation(Dali::Window::WindowOrientation orientation); + uint32_t GetLayerCount() const; /** - * @copydoc Dali::Window::RemoveAvailableOrientation() + * @copydoc Dali::Window::GetLayer() */ - void RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation); + Dali::Layer GetLayer( uint32_t depth ) const; + + /** + * @copydoc Dali::DevelWindow::GetRenderTaskList() + */ + Dali::RenderTaskList GetRenderTaskList() const; /** - * @copydoc Dali::Window::SetAvailableOrientations() + * @copydoc Dali::Window::AddAvailableOrientation() */ - void SetAvailableOrientations(const std::vector& orientations); + void AddAvailableOrientation(Dali::Window::WindowOrientation orientation); /** - * @copydoc Dali::Window::GetAvailableOrientations() + * @copydoc Dali::Window::RemoveAvailableOrientation() */ - const std::vector& GetAvailableOrientations(); + void RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation); /** * @copydoc Dali::Window::SetPreferredOrientation() @@ -150,16 +165,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 ); @@ -180,18 +185,13 @@ public: void Hide(); /** - * @copydoc Dali::Window::IsVisible() const + * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount() */ - bool IsVisible() const; + unsigned int GetSupportedAuxiliaryHintCount() const; /** - * @copydoc Dali::Window::GetSupportedAuxiliaryHintCount() + * @copydoc Dali::Window::GetSupportedAuxiliaryHint() */ - unsigned int GetSupportedAuxiliaryHintCount() const; - - /** - * @copydoc Dali::Window::GetSupportedAuxiliaryHint() - */ std::string GetSupportedAuxiliaryHint( unsigned int index ) const; /** @@ -295,21 +295,96 @@ public: Dali::Window::WindowPosition GetPosition() const; /** + * @copydoc Dali::DevelWindow::SetPositionSize() + */ + void SetPositionSize( PositionSize positionSize ); + + /** + * @copydoc Dali::Window::GetRootLayer() + */ + Dali::Layer GetRootLayer() const; + + /** * @copydoc Dali::Window::SetTransparency() */ void SetTransparency( bool transparent ); /** - * Called from Orientation after the Change signal has been sent + * @copydoc Dali::KeyGrab::GrabKey() + */ + bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ); + + /** + * @copydoc Dali::KeyGrab::UngrabKey() + */ + bool UngrabKey( Dali::KEY key ); + + /** + * @copydoc Dali::KeyGrab::GrabKeyList() + */ + bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ); + + /** + * @copydoc Dali::KeyGrab::UngrabKeyList() + */ + bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ); + + /** + * @copydoc Dali::DevelWindow::Get() + */ + static Dali::Window Get( Dali::Actor actor ); + + /** + * @copydoc Dali::DevelWindow::SetParent() + */ + void SetParent( Dali::Window& parent ); + + /** + * @copydoc Dali::DevelWindow::Unparent() + */ + void Unparent(); + + /** + * @copydoc Dali::DevelWindow::GetParent() + */ + Dali::Window GetParent(); + + /** + * @copydoc Dali::DevelWindow::GetCurrentOrientation() + */ + Dali::Window::WindowOrientation GetCurrentOrientation() const; + + /** + * @copydoc Dali::DevelWindow::SetAvailableOrientations() + */ + void SetAvailableOrientations( const Dali::Vector& orientations ); + +public: // Dali::Internal::Adaptor::SceneHolder + + /** + * @copydoc Dali::Internal::Adaptor::SceneHolder::GetNativeHandle */ - void RotationDone( int orientation, int width, int height ); + Dali::Any GetNativeHandle() const override; /** - * Set the indicator visible mode + * @copydoc Dali::Internal::Adaptor::SceneHolder::IsVisible */ - void SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode ); + bool IsVisible() const override; private: + + /** + * @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. + */ + enum class OrientationMode + { + PORTRAIT = 0, + LANDSCAPE + }; + /** * Private constructor. * @sa Window::New() @@ -324,73 +399,101 @@ private: /** * Second stage initialization */ - void Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className); + void Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className); + + /** + * Called when the window becomes iconified or deiconified. + */ + void OnIconifyChanged( bool iconified ); + + /** + * Called when the window focus is changed. + */ + void OnFocusChanged( bool focusIn ); + + /** + * Called when the output is transformed. + */ + void OnOutputTransformed(); + + /** + * Called when the window receives a delete request. + */ + void OnDeleteRequest(); + + /** + * Called when the window receives a Transition effect-start/end event. + */ + void OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type ); /** - * Shows / hides the indicator bar. - * Handles close/open if rotation changes whilst hidden + * @brief Set available orientation to window base. */ - void DoShowIndicator( Dali::Window::WindowOrientation lastOrientation ); + void SetAvailableAnlges( const std::vector< int >& angles ); /** - * 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. + * @brief Convert from window orientation to angle using OrientationMode. */ - void DoRotateIndicator( Dali::Window::WindowOrientation orientation ); + int ConvertToAngle( Dali::Window::WindowOrientation orientation ); /** - * Change the indicator actor's rotation to match the current orientation + * @brief Convert from angle to window orientation using OrientationMode. */ - void SetIndicatorActorRotation(); + Dali::Window::WindowOrientation ConvertToOrientation( int angle ) const; /** - * Set the indicator properties on the window + * @brief Check available window orientation for Available orientation. */ - void SetIndicatorProperties( bool isShown, Dali::Window::WindowOrientation lastOrientation ); + bool IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const; -private: // IndicatorInterface::Observer interface +private: // Dali::Internal::Adaptor::SceneHolder /** - * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorTypeChanged() + * @copydoc Dali::Internal::Adaptor::SceneHolder::OnAdaptorSet */ - virtual void IndicatorTypeChanged( IndicatorInterface::Type type ); + void OnAdaptorSet( Dali::Adaptor& adaptor ) override; /** - * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorClosed() + * @copydoc Dali::Internal::Adaptor::SceneHolder::OnSurfaceSet */ - virtual void IndicatorClosed( IndicatorInterface* indicator); + void OnSurfaceSet( Dali::RenderSurfaceInterface* surface ) override; /** - * @copydoc Dali::Internal::Adaptor::IndicatorInterface::Observer::IndicatorVisibilityChanged() + * @copydoc Dali::Internal::Adaptor::SceneHolder::OnPause */ - virtual void IndicatorVisibilityChanged( bool isVisible ); + void OnPause() override; -private: // Adaptor::Observer interface + /** + * @copydoc Dali::Internal::Adaptor::SceneHolder::OnResume + */ + void OnResume() override; /** - * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnStart() + * @copydoc Dali::Internal::Adaptor::SceneHolder::RecalculateTouchPosition */ - virtual void OnStart(); + void RecalculateTouchPosition( Integration::Point& point ) override; + +private: // Dali::Internal::Adaptor::EventHandler::Observer /** - * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnPause() + * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnTouchPoint */ - virtual void OnPause(); + void OnTouchPoint( Dali::Integration::Point& point, int timeStamp ) override; /** - * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnResume() + * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnWheelEvent */ - virtual void OnResume(); + void OnWheelEvent( Dali::Integration::WheelEvent& wheelEvent ) override; /** - * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnStop() + * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnKeyEvent */ - virtual void OnStop(); + void OnKeyEvent( Dali::Integration::KeyEvent& keyEvent ) override; /** - * @copydoc Dali::Internal::Adaptor::Adaptor::Observer::OnDestroy() + * @copydoc Dali::Internal::Adaptor::EventHandler::Observer::OnRotation */ - virtual void OnDestroy(); + void OnRotation( const RotationEvent& rotation ) override; public: // Signals @@ -405,56 +508,76 @@ public: // Signals FocusSignalType& FocusChangedSignal() { return mFocusChangedSignal; } /** + * @copydoc Dali::Window::WindowFocusChangedSignal() + */ + 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; } + private: - typedef std::vector< std::pair< std::string, std::string > > AuxiliaryHints; - - RenderSurface* mSurface; - Dali::Window::IndicatorVisibleMode mIndicatorVisible; ///< public state - bool mIndicatorIsShown:1; ///< private state - bool mShowRotatedIndicatorOnClose:1; - bool mStarted:1; - bool mIsTransparent:1; - bool mWMRotationAppSet:1; - bool mEcoreEventHander:1; - bool mIsFocusAcceptable:1; - bool mVisible:1; - bool mIconified:1; - bool mOpaqueState:1; - bool mResizeEnabled:1; - 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; - - struct EventHandler; - EventHandler* mEventHandler; - - OrientationPtr mOrientation; - std::vector mAvailableOrientations; - Dali::Window::WindowOrientation mPreferredOrientation; - - std::vector< std::string > mSupportedAuxiliaryHints; - AuxiliaryHints mAuxiliaryHints; + WindowRenderSurface* mWindowSurface; ///< The window rendering surface + WindowBase* mWindowBase; + std::string mName; + std::string mClassName; + bool mIsTransparent:1; + bool mIsFocusAcceptable:1; + bool mIconified:1; + bool mOpaqueState:1; + bool mResizeEnabled:1; + 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; + + int mNativeWindowId; ///< The Native Window Id // Signals - IndicatorSignalType mIndicatorVisibilityChangedSignal; - FocusSignalType mFocusChangedSignal; - ResizedSignalType mResizedSignal; - SignalType mDeleteRequestSignal; + IndicatorSignalType mIndicatorVisibilityChangedSignal; + FocusSignalType mFocusChangedSignal; + ResizedSignalType mResizedSignal; + SignalType mDeleteRequestSignal; + FocusChangeSignalType mFocusChangeSignal; + ResizeSignalType mResizeSignal; + VisibilityChangedSignalType mVisibilityChangedSignal; + TransitionEffectEventSignalType mTransitionEffectEventSignal; }; } // namespace Adaptor @@ -478,5 +601,4 @@ inline const Internal::Adaptor::Window& GetImplementation(const Dali::Window& wi } // namespace Dali - -#endif // __DALI_INTERNAL_WINDOW_H__ +#endif // DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_H