From b2c3e32b52490698ad2ec4784b3291f527e4bec1 Mon Sep 17 00:00:00 2001 From: suhyung Eom Date: Fri, 9 Sep 2016 10:54:22 +0900 Subject: [PATCH] [3.0] Enable to set the margin of indicator Signed-off-by: suhyung Eom Change-Id: I729fc752b9c3683283d58d235f745bec9af304dd --- adaptors/common/adaptor-impl.cpp | 6 ++++++ adaptors/common/adaptor-impl.h | 5 +++++ adaptors/ecore/common/ecore-indicator-impl.cpp | 17 ++++++++++++++++- adaptors/ecore/common/ecore-indicator-impl.h | 6 ++++++ .../dali-test-suite-utils/test-application.cpp | 5 +++++ .../dali-test-suite-utils/test-application.h | 1 + 6 files changed, 39 insertions(+), 1 deletion(-) diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index 6e59fbb..ab2ecac 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -757,6 +757,12 @@ void Adaptor::RequestUpdateOnce() } } +void Adaptor::IndicatorSizeChanged(int height) +{ + // let the core know the indicator height is changed + mCore->SetTopMargin(height); +} + void Adaptor::ProcessCoreEventsFromIdle() { ProcessCoreEvents(); diff --git a/adaptors/common/adaptor-impl.h b/adaptors/common/adaptor-impl.h index b2bd30a..479e10e 100644 --- a/adaptors/common/adaptor-impl.h +++ b/adaptors/common/adaptor-impl.h @@ -326,6 +326,11 @@ public: void RequestUpdateOnce(); /** + * Request adaptor to update indicator's height + */ + void IndicatorSizeChanged(int height); + + /** * @copydoc Dali::Adaptor::NotifySceneCreated() */ void NotifySceneCreated(); diff --git a/adaptors/ecore/common/ecore-indicator-impl.cpp b/adaptors/ecore/common/ecore-indicator-impl.cpp index c5e6ba0..e3bf901 100644 --- a/adaptors/ecore/common/ecore-indicator-impl.cpp +++ b/adaptors/ecore/common/ecore-indicator-impl.cpp @@ -501,7 +501,8 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat mCurrentSharedFile( 0 ), mSharedBufferType( BUFFER_TYPE_SHM ), mImpl( NULL ), - mBackgroundVisible( false ) + mBackgroundVisible( false ), + mTopMargin( 0 ) { mIndicatorContentActor = Dali::Actor::New(); mIndicatorContentActor.SetParentOrigin( ParentOrigin::TOP_CENTER ); @@ -648,6 +649,7 @@ void Indicator::SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ) mIndicatorContentActor.RemoveRenderer( mBackgroundRenderer ); mBackgroundVisible = false; } + UpdateTopMargin(); } void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate ) @@ -678,6 +680,7 @@ void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool } mVisible = visibleMode; + UpdateTopMargin(); if( mForegroundRenderer && mForegroundRenderer.GetTextures().GetTexture( 0u ) ) { @@ -876,6 +879,7 @@ void Indicator::Resize( int width, int height ) mIndicatorContentActor.SetSize( mImageWidth, mImageHeight ); mIndicatorActor.SetSize( mImageWidth, mImageHeight ); mEventActor.SetSize(mImageWidth, mImageHeight); + UpdateTopMargin(); } } @@ -1014,6 +1018,16 @@ void Indicator::LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent ) } } +void Indicator::UpdateTopMargin() +{ + int newMargin = (mVisible == Dali::Window::VISIBLE && mOpacityMode == Dali::Window::OPAQUE) ? mImageHeight : 0; + if (mTopMargin != newMargin) + { + mTopMargin = newMargin; + mAdaptor->IndicatorSizeChanged( mTopMargin ); + } +} + void Indicator::UpdateVisibility() { if( CheckVisibleState() ) @@ -1095,6 +1109,7 @@ void Indicator::CreateNewPixmapImage() mIndicatorContentActor.SetSize( mImageWidth, mImageHeight ); mIndicatorActor.SetSize( mImageWidth, mImageHeight ); mEventActor.SetSize( mImageWidth, mImageHeight ); + UpdateTopMargin(); } else { diff --git a/adaptors/ecore/common/ecore-indicator-impl.h b/adaptors/ecore/common/ecore-indicator-impl.h index 47a2ac5..1f0e693 100644 --- a/adaptors/ecore/common/ecore-indicator-impl.h +++ b/adaptors/ecore/common/ecore-indicator-impl.h @@ -289,6 +289,11 @@ private: void LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent ); /** + * Update top margin of the stage as much as indicator height + */ + void UpdateTopMargin(); + + /** * Update the visibility and position of the actors */ void UpdateVisibility(); @@ -444,6 +449,7 @@ private: Impl* mImpl; ///< Created on construction and destroyed on destruction. bool mBackgroundVisible; ///< Indicate whether background is visible + int mTopMargin; ///< Top margin of the stage for indicator }; } // Adaptor diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.cpp b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.cpp index f2e3cd7..e8d9be4 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.cpp +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.cpp @@ -154,6 +154,11 @@ void TestApplication::SetSurfaceWidth( unsigned int width, unsigned height ) mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight ); } +void TestApplication::SetTopMargin( unsigned int margin ) +{ + mCore->SetTopMargin( margin ); +} + void TestApplication::DoUpdate( unsigned int intervalMilliseconds, const char* location ) { if( GetUpdateStatus() == 0 && diff --git a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.h b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.h index d6dab48..49a7f51 100644 --- a/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.h +++ b/automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.h @@ -73,6 +73,7 @@ public: void ProcessEvent(const Integration::Event& event); void SendNotification(); void SetSurfaceWidth( unsigned int width, unsigned height ); + void SetTopMargin( unsigned int margin ); bool Render( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL ); unsigned int GetUpdateStatus(); bool UpdateOnly( unsigned int intervalMilliseconds = DEFAULT_RENDER_INTERVAL ); -- 2.7.4