From 6803eb3070acee94adde01ee517084a42c5acfa0 Mon Sep 17 00:00:00 2001 From: suhyung Eom Date: Fri, 9 Sep 2016 10:54:22 +0900 Subject: [PATCH] Enable to set the margin of indicator Signed-off-by: suhyung Eom Change-Id: I6a82e7289b364401e9a5e4b957448278d1d636d3 --- 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 da9476b51..6c08db4d8 100644 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -751,6 +751,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 704d414de..faf19b3af 100644 --- a/adaptors/common/adaptor-impl.h +++ b/adaptors/common/adaptor-impl.h @@ -319,6 +319,11 @@ public: */ void RequestUpdateOnce(); + /** + * Request adaptor to update indicator's height + */ + void IndicatorSizeChanged(int height); + /** * @copydoc Dali::Adaptor::NotifySceneCreated() */ diff --git a/adaptors/ecore/common/ecore-indicator-impl.cpp b/adaptors/ecore/common/ecore-indicator-impl.cpp index 746544420..c817c4789 100644 --- a/adaptors/ecore/common/ecore-indicator-impl.cpp +++ b/adaptors/ecore/common/ecore-indicator-impl.cpp @@ -557,7 +557,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 ); @@ -704,6 +705,7 @@ void Indicator::SetOpacityMode( Dali::Window::IndicatorBgOpacity mode ) mIndicatorContentActor.RemoveRenderer( mBackgroundRenderer ); mBackgroundVisible = false; } + UpdateTopMargin(); } void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool forceUpdate ) @@ -734,6 +736,7 @@ void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool } mVisible = visibleMode; + UpdateTopMargin(); if( mForegroundRenderer && mForegroundRenderer.GetTextures().GetTexture( 0u ) ) { @@ -932,6 +935,7 @@ void Indicator::Resize( int width, int height ) mIndicatorContentActor.SetSize( mImageWidth, mImageHeight ); mIndicatorActor.SetSize( mImageWidth, mImageHeight ); mEventActor.SetSize(mImageWidth, mImageHeight); + UpdateTopMargin(); } } @@ -1070,6 +1074,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() ) @@ -1155,6 +1169,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 47a2ac54c..1f0e69364 100644 --- a/adaptors/ecore/common/ecore-indicator-impl.h +++ b/adaptors/ecore/common/ecore-indicator-impl.h @@ -288,6 +288,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 */ @@ -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 f2e3cd739..e8d9be429 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 d6dab48f0..49a7f5178 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.34.1