[3.0] Enable to set the margin of indicator 40/102440/1
authorsuhyung Eom <suhyung.eom@samsung.com>
Fri, 9 Sep 2016 01:54:22 +0000 (10:54 +0900)
committersuhyung Eom <suhyung.eom@samsung.com>
Tue, 6 Dec 2016 00:17:09 +0000 (09:17 +0900)
Signed-off-by: suhyung Eom <suhyung.eom@samsung.com>
Change-Id: I729fc752b9c3683283d58d235f745bec9af304dd

adaptors/common/adaptor-impl.cpp
adaptors/common/adaptor-impl.h
adaptors/ecore/common/ecore-indicator-impl.cpp
adaptors/ecore/common/ecore-indicator-impl.h
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-application.h

index 6e59fbb..ab2ecac 100644 (file)
@@ -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();
index b2bd30a..479e10e 100644 (file)
@@ -326,6 +326,11 @@ public:
   void RequestUpdateOnce();
 
   /**
+   * Request adaptor to update indicator's height
+   */
+  void IndicatorSizeChanged(int height);
+
+  /**
    * @copydoc Dali::Adaptor::NotifySceneCreated()
    */
   void NotifySceneCreated();
index c5e6ba0..e3bf901 100644 (file)
@@ -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
   {
index 47a2ac5..1f0e693 100644 (file)
@@ -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
index f2e3cd7..e8d9be4 100644 (file)
@@ -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 &&
index d6dab48..49a7f51 100644 (file)
@@ -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 );