X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fview%2Fview-impl.cpp;h=a1d0c09beacf322417b68297d91e1d278b74cc1f;hb=cc82bd9b187cda8fe2c8336b73fd1fa9376cfebd;hp=6c374c08aab6383a67180622d329a9d0c88e153b;hpb=306d2f61a1b64179e801fa8a0bb2bd7b4e9dd682;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/view/view-impl.cpp b/dali-toolkit/internal/controls/view/view-impl.cpp index 6c374c0..a1d0c09 100644 --- a/dali-toolkit/internal/controls/view/view-impl.cpp +++ b/dali-toolkit/internal/controls/view/view-impl.cpp @@ -22,8 +22,7 @@ #include #include #include - -// INTERNAL INCLUDES +#include namespace Dali { @@ -34,7 +33,7 @@ namespace Toolkit namespace Internal { -namespace // to register type +namespace { BaseHandle Create() @@ -42,14 +41,11 @@ BaseHandle Create() return Toolkit::View::New(); } -TypeRegistration typeRegistration( typeid(Toolkit::View), typeid(Toolkit::Control), Create ); +DALI_TYPE_REGISTRATION_BEGIN( Toolkit::View, Toolkit::Control, Create ) -SignalConnectorType signalConnector1( typeRegistration, Toolkit::View::SIGNAL_ORIENTATION_ANIMATION_START , &View::DoConnectSignal ); +DALI_SIGNAL_REGISTRATION( View, "orientation-animation-start", SIGNAL_ORIENTATION_ANIMATION_START ) -} - -namespace -{ +DALI_TYPE_REGISTRATION_END() const float ROTATION_ANIMATION_DURATION = 0.5f; @@ -136,7 +132,7 @@ void View::SetBackground( ImageActor backgroundImage ) mBackgroundLayer = Layer::New(); mBackgroundLayer.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); - mBackgroundLayer.SetSize( mViewSize ); + mBackgroundLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); // Add background layer to custom actor. Self().Add( mBackgroundLayer ); @@ -156,8 +152,10 @@ void View::SetBackground( ImageActor backgroundImage ) } backgroundImage.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); - backgroundImage.SetScale( FillXYKeepAspectRatio( mViewSize, backgroundImage.GetSize() ) ); + backgroundImage.SetRelayoutEnabled( false ); // We will scale its size manually mBackgroundLayer.Add( backgroundImage ); + + RelayoutRequest(); } void View::SetOrientationFunction( Degree portrait, Degree landscale, Degree portraitInverse, Degree landscapeInverse ) @@ -251,7 +249,7 @@ bool View::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* trac bool connected( true ); Toolkit::View view = Toolkit::View::DownCast(handle); - if( Toolkit::View::SIGNAL_ORIENTATION_ANIMATION_START == signalName ) + if( 0 == strcmp( signalName.c_str(), SIGNAL_ORIENTATION_ANIMATION_START ) ) { view.OrientationAnimationStartedSignal().Connect( tracker, functor ); } @@ -294,16 +292,14 @@ void View::OnInitialize() } } -void View::OnControlSizeSet( const Vector3& targetSize ) +void View::OnRelayout( const Vector2& size, RelayoutContainer& container ) { - mViewSize = targetSize; if( mBackgroundLayer ) { - mBackgroundLayer.SetSize( mViewSize ); - if( mBackgroundLayer.GetChildCount() > 0 ) + if( mBackgroundLayer && mBackgroundLayer.GetChildCount() > 0 ) { Actor background = mBackgroundLayer.GetChildAt(0); - background.SetScale( FillXYKeepAspectRatio( mViewSize, background.GetSize() ) ); + background.SetScale( FillXYKeepAspectRatio( Vector3( size.width, size.height, 1.0f ), background.GetTargetSize() ) ); } } }