From: Paul Wisbey Date: Tue, 7 Apr 2015 10:34:34 +0000 (+0100) Subject: Merge remote-tracking branch 'origin/tizen' into new_text X-Git-Tag: dali_1.0.38~11^2~13 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=56d412791a44c2a79135d2293c13fddb135c9d54;hp=2ea37149ec3b54f9f2255cca9eca5429907b5601 Merge remote-tracking branch 'origin/tizen' into new_text Conflicts: automated-tests/src/dali-toolkit-internal/CMakeLists.txt dali-toolkit/internal/controls/buttons/push-button-impl.cpp dali-toolkit/internal/controls/text-input/text-input-handles-impl.cpp dali-toolkit/internal/controls/text-input/text-input-impl.cpp Change-Id: Icb029929ab92e9d4c606f47c50d8d213759f09c5 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Alignment.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Alignment.cpp index 4dcef68..0f62a2a 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Alignment.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Alignment.cpp @@ -935,7 +935,7 @@ int UtcDaliAlignmentOnSizeSet(void) application.SendNotification(); Vector2 size( 100.0f, 200.0f ); - alignment.SetPreferredSize(size); + alignment.SetSize(size); application.Render(); application.SendNotification(); @@ -1010,7 +1010,7 @@ int UtcDaliAlignmentOnSizeAnimation(void) Stage::GetCurrent().Add(alignment); Animation animation = Animation::New(100.0f); - animation.Resize(alignment, Vector3(100.0f, 150.0f, 200.0f)); + animation.AnimateTo( Property( alignment, Actor::Property::SIZE ), Vector3( 100.0f, 150.0f, 200.0f ) ); animation.Play(); application.Render(); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp index 3a6900e..12e85b6 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Button.cpp @@ -144,6 +144,7 @@ int UtcDaliButtonSize(void) // First an image is set, then SetSize is called. pushButton = PushButton::New(); + Stage::GetCurrent().Add( pushButton ); pushButton.SetBackgroundImage( image01 ); pushButton.SetSize( 10.f, 10.f ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp index 32bb9de..d6dc8d4 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-CheckBoxButton.cpp @@ -111,6 +111,7 @@ int UtcDaliCheckBoxButtonSetImages(void) Image image02 = CreateSolidColorImage( Color::RED, 30, 30 ); ImageActor imageActor02 = CreateSolidColorActor( Color::RED ); imageActor02.SetSize( 40, 40 ); + imageActor02.SetName( "imageActor02" ); Image image03 = CreateSolidColorImage( Color::RED, 50, 50 ); ImageActor imageActor03 = CreateSolidColorActor( Color::RED ); @@ -122,6 +123,8 @@ int UtcDaliCheckBoxButtonSetImages(void) Vector3 size; CheckBoxButton checkBoxButton = CheckBoxButton::New(); + checkBoxButton.SetName( "UtcDaliCheckBoxButtonSetImages" ); + Stage::GetCurrent().Add( checkBoxButton ); application.SendNotification(); application.Render(); @@ -133,79 +136,12 @@ int UtcDaliCheckBoxButtonSetImages(void) application.SendNotification(); application.Render(); - size = checkBoxButton.GetBackgroundImage().GetCurrentSize(); + size = checkBoxButton.GetCurrentSize(); DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION ); DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION ); checkBoxButton.SetBackgroundImage( imageActor01 ); - application.SendNotification(); - application.Render(); - - size = checkBoxButton.GetBackgroundImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION ); - - checkBoxButton.SetSelectedImage( image02 ); - - application.SendNotification(); - application.Render(); - - size = checkBoxButton.GetSelectedImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 30.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 30.f, TEST_LOCATION ); - - checkBoxButton.SetSelectedImage( imageActor02 ); - - application.SendNotification(); - application.Render(); - - size = checkBoxButton.GetSelectedImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 40.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 40.f, TEST_LOCATION ); - - checkBoxButton.SetDisabledBackgroundImage( image03 ); - - application.SendNotification(); - application.Render(); - - size = checkBoxButton.GetDisabledBackgroundImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 50.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 50.f, TEST_LOCATION ); - - checkBoxButton.SetDisabledBackgroundImage( imageActor03 ); - - application.SendNotification(); - application.Render(); - - size = checkBoxButton.GetDisabledBackgroundImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 60.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 60.f, TEST_LOCATION ); - - checkBoxButton.SetDisabledSelectedImage( image04 ); - - application.SendNotification(); - application.Render(); - - size = checkBoxButton.GetDisabledSelectedImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 70.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 70.f, TEST_LOCATION ); - - checkBoxButton.SetDisabledSelectedImage( imageActor04 ); - - application.SendNotification(); - application.Render(); - - size = checkBoxButton.GetDisabledSelectedImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 80.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 80.f, TEST_LOCATION ); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp index aa9e46c..beeb619 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp @@ -328,6 +328,12 @@ int UtcDaliControlTestParameters(void) DummyControl test = DummyControl::New(); test.SetSize( 0.7f, 0.7f, 0.7f ); + + Stage::GetCurrent().Add( test ); + + application.SendNotification(); + application.Render(); + float width = 640.0f; float height = test.GetHeightForWidth( width ); DALI_TEST_CHECK( test.GetWidthForHeight( height ) == width ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp index c0cf98c..f7926a5 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp @@ -219,7 +219,7 @@ int UtcDaliControlImplOnGestureMethods(void) { DummyControl dummy = DummyControl::New(true); dummy.SetRelayoutEnabled( true ); - dummy.SetPreferredSize( Vector2(100.0f, 100.0f ) ); + dummy.SetSize( Vector2(100.0f, 100.0f ) ); dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); @@ -280,7 +280,7 @@ int UtcDaliControlImplOnGestureMethods(void) { DummyControl dummy = DummyControl::New(); dummy.SetRelayoutEnabled( true ); - dummy.SetPreferredSize( Vector2( 100.0f, 100.0f ) ); + dummy.SetSize( Vector2( 100.0f, 100.0f ) ); dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); @@ -454,7 +454,7 @@ int UtcDaliControlImplSizeSet(void) DALI_TEST_EQUALS( dummyImpl.sizeSetCalled, true, TEST_LOCATION ); // Called from size negotiation Vector2 size(100.0f, 200.0f); - dummy.SetPreferredSize(size); + dummy.SetSize(size); application.Render(); application.SendNotification(); @@ -479,7 +479,7 @@ int UtcDaliControlImplSizeSet(void) application.Render(); application.SendNotification(); - dummy.SetPreferredSize(size); + dummy.SetSize(size); application.Render(); application.SendNotification(); @@ -505,7 +505,7 @@ int UtcDaliControlImplSizeAnimation(void) DALI_TEST_EQUALS( dummyImpl.sizeAnimationCalled, false, TEST_LOCATION ); Animation animation = Animation::New(1.0f); - animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f)); + animation.AnimateTo( Property( dummy, Actor::Property::SIZE ), Vector3( 100.0f, 150.0f, 200.0f ) ); animation.Play(); application.Render(); @@ -525,7 +525,7 @@ int UtcDaliControlImplSizeAnimation(void) Stage::GetCurrent().Add(dummy); Animation animation = Animation::New(1.0f); - animation.Resize(dummy, Vector3(100.0f, 150.0f, 200.0f)); + animation.AnimateTo( Property( dummy, Actor::Property::SIZE ), Vector3( 100.0f, 150.0f, 200.0f ) ); animation.Play(); application.Render(); @@ -549,7 +549,7 @@ int UtcDaliControlImplTouchEvent(void) dummy.SetRelayoutEnabled( true ); DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); - dummy.SetPreferredSize( Vector2( 100.0f, 100.0f ) ); + dummy.SetSize( Vector2( 100.0f, 100.0f ) ); dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); @@ -573,7 +573,7 @@ int UtcDaliControlImplTouchEvent(void) DummyControl dummy = DummyControl::New(); dummy.SetRelayoutEnabled( true ); - dummy.SetPreferredSize( Vector2( 100.0f, 100.0f ) ); + dummy.SetSize( Vector2( 100.0f, 100.0f ) ); dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); @@ -776,7 +776,7 @@ int UtcDaliControlImplMouseWheelEvent(void) dummy.SetRelayoutEnabled( true ); DummyControlImplOverride& dummyImpl = static_cast(dummy.GetImplementation()); - dummy.SetPreferredSize( Vector2( 100.0f, 100.0f ) ); + dummy.SetSize( Vector2( 100.0f, 100.0f ) ); dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); @@ -803,7 +803,7 @@ int UtcDaliControlImplMouseWheelEvent(void) DummyControl dummy = DummyControl::New(); dummy.SetRelayoutEnabled( true ); - dummy.SetPreferredSize( Vector2( 100.0f, 100.0f ) ); + dummy.SetSize( Vector2( 100.0f, 100.0f ) ); dummy.SetAnchorPoint(AnchorPoint::TOP_LEFT); Stage::GetCurrent().Add(dummy); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp index 443de6f..955f19d 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-PageTurnView.cpp @@ -371,6 +371,7 @@ int UtcDaliPageTurnViewEnterLeaveEditMode(void) factory.EnableOffscreenRendering( ); PageTurnView pageTurnView = PageTurnLandscapeView::New( factory, PAGE_SIZE ); + pageTurnView.SetRelayoutEnabled( false ); pageTurnView.SetPositionInheritanceMode( USE_PARENT_POSITION ); Stage::GetCurrent().Add( pageTurnView ); @@ -422,6 +423,7 @@ int UtcDaliPageTurnViewGetHitActor(void) factory.EnableOffscreenRendering( ); PageTurnView pageTurnView = PageTurnPortraitView::New( factory, PAGE_SIZE ); + pageTurnView.SetRelayoutEnabled( false ); pageTurnView.SetParentOrigin( ParentOrigin::TOP_LEFT ); pageTurnView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); Stage::GetCurrent().Add( pageTurnView ); @@ -458,6 +460,7 @@ int UtcDaliPageTurnViewRefresh(void) TestPageFactory factory(application); factory.EnableOffscreenRendering( ); PageTurnView pageTurnView = PageTurnPortraitView::New( factory, PAGE_SIZE ); + pageTurnView.SetRelayoutEnabled( false ); pageTurnView.SetParentOrigin( ParentOrigin::TOP_LEFT ); pageTurnView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); Stage::GetCurrent().Add( pageTurnView ); @@ -498,6 +501,7 @@ int UtcDaliPageTurnViewSignals(void) TestPageFactory factory(application); Vector2 size = Stage::GetCurrent().GetSize(); PageTurnView portraitView = PageTurnPortraitView::New( factory, size ); + portraitView.SetRelayoutEnabled( false ); portraitView.SetPositionInheritanceMode( USE_PARENT_POSITION ); Stage::GetCurrent().Add( portraitView ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp index 580e2c6..2148042 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Popup.cpp @@ -286,9 +286,9 @@ int UtcDaliPopupShowHide(void) PushButton button1 = PushButton::New(); PushButton button2 = PushButton::New(); - button1.SetPreferredSize(DEFAULT_BUTTON_SIZE.GetVectorXY()); + button1.SetSize(DEFAULT_BUTTON_SIZE.GetVectorXY()); popup.AddButton(button1); - button2.SetPreferredSize(DEFAULT_BUTTON_SIZE.GetVectorXY()); + button2.SetSize(DEFAULT_BUTTON_SIZE.GetVectorXY()); popup.AddButton(button2); // Showing/Hiding popup, results in all child Actors being diff --git a/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp b/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp index 49ed86d..850f6a4 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-PushButton.cpp @@ -279,27 +279,10 @@ int UtcDaliPushButtonSetImages(void) Actor imageActor; Image image01 = CreateSolidColorImage( Color::RED, 10, 10 ); - ImageActor imageActor01 = CreateSolidColorActor( Color::RED ); - imageActor01.SetSize( 20.f, 20.f ); - - Image image02 = CreateSolidColorImage( Color::RED, 30, 30 ); - ImageActor imageActor02 = CreateSolidColorActor( Color::RED ); - imageActor02.SetSize( 40.f, 40.f ); - - Image image03 = CreateSolidColorImage( Color::RED, 50, 50 ); - ImageActor imageActor03 = CreateSolidColorActor( Color::RED ); - imageActor03.SetSize( 60.f, 60.f ); - - Image image04 = CreateSolidColorImage( Color::RED, 70, 70 ); - ImageActor imageActor04 = CreateSolidColorActor( Color::RED ); - imageActor04.SetSize( 80.f, 80.f ); - - Image image05 = CreateSolidColorImage( Color::RED, 90, 90 ); - ImageActor imageActor05 = CreateSolidColorActor( Color::RED ); - imageActor05.SetSize( 100.f, 100.f ); Vector3 size; PushButton pushButton = PushButton::New(); + Stage::GetCurrent().Add( pushButton ); application.SendNotification(); application.Render(); @@ -311,100 +294,11 @@ int UtcDaliPushButtonSetImages(void) application.SendNotification(); application.Render(); - size = pushButton.GetButtonImage().GetCurrentSize(); + size = pushButton.GetCurrentSize(); DALI_TEST_EQUALS( size.width, 10.f, TEST_LOCATION ); DALI_TEST_EQUALS( size.height, 10.f, TEST_LOCATION ); - pushButton.SetButtonImage( imageActor01 ); - - application.SendNotification(); - application.Render(); - - size = pushButton.GetButtonImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 20.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 20.f, TEST_LOCATION ); - - pushButton.SetBackgroundImage( image02 ); - - application.SendNotification(); - application.Render(); - - size = pushButton.GetBackgroundImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 30.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 30.f, TEST_LOCATION ); - - pushButton.SetBackgroundImage( imageActor02 ); - - application.SendNotification(); - application.Render(); - - size = pushButton.GetBackgroundImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 40.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 40.f, TEST_LOCATION ); - - pushButton.SetSelectedImage( image03 ); - - application.SendNotification(); - application.Render(); - - size = pushButton.GetSelectedImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 50.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 50.f, TEST_LOCATION ); - - pushButton.SetSelectedImage( imageActor03 ); - - application.SendNotification(); - application.Render(); - - size = pushButton.GetSelectedImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 60.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 60.f, TEST_LOCATION ); - - pushButton.SetDisabledBackgroundImage( image04 ); - - application.SendNotification(); - application.Render(); - - size = pushButton.GetDisabledBackgroundImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 70.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 70.f, TEST_LOCATION ); - - pushButton.SetDisabledBackgroundImage( imageActor04 ); - - application.SendNotification(); - application.Render(); - - size = pushButton.GetDisabledBackgroundImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 80.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 80.f, TEST_LOCATION ); - - pushButton.SetDisabledImage( image05 ); - - application.SendNotification(); - application.Render(); - - size = pushButton.GetDisabledImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 90.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 90.f, TEST_LOCATION ); - - pushButton.SetDisabledImage( imageActor05 ); - - application.SendNotification(); - application.Render(); - - size = pushButton.GetDisabledImage().GetCurrentSize(); - - DALI_TEST_EQUALS( size.width, 100.f, TEST_LOCATION ); - DALI_TEST_EQUALS( size.height, 100.f, TEST_LOCATION ); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp index 9b9cad1..662502c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp @@ -239,14 +239,11 @@ struct TestSumConstraint */ static float TestOvershootSnapDuration(ToolkitTestApplication &application, ScrollView scrollView) { - Property::Index overshootPropertyX = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME); - Property::Index overshootPropertyY = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME); - int timeToReachOrigin = -1; for(int i = 0;i(overshootPropertyX); - float overshootYValue = scrollView.GetProperty(overshootPropertyY); + float overshootXValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X); + float overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); if(overshootXValue == 0.0f && overshootYValue == 0.0f) { break; @@ -817,9 +814,8 @@ int UtcDaliScrollViewConstraints(void) a.SetPosition( TEST_ACTOR_POSITION ); Wait(application); - Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME); Constraint constraint = Constraint::New( Actor::Property::POSITION, - Source(scrollView, scrollPositionProperty), + Source(scrollView, ScrollView::Property::SCROLL_POSITION), TestSumConstraint( TEST_CONSTRAINT_OFFSET ) ); constraint.SetRemoveAction(Constraint::Discard); scrollView.ApplyConstraintToChildren(constraint); @@ -865,10 +861,9 @@ int UtcDaliScrollViewBind(void) a.SetPosition( TEST_ACTOR_POSITION ); Wait(application); - Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME); // apply this constraint to scrollview Constraint constraint = Constraint::New( Actor::Property::POSITION, - Source(scrollView, scrollPositionProperty), + Source(scrollView, ScrollView::Property::SCROLL_POSITION), TestSumConstraint( TEST_CONSTRAINT_OFFSET ) ); constraint.SetRemoveAction(Constraint::Discard); @@ -1034,12 +1029,9 @@ int UtcDaliScrollViewOvershoot(void) // 1. Scroll page in NW (-500,-500 pixels), then inspect overshoot. (don't release touch) Vector2 currentPos = Vector2(100.0f, 100.0f); currentPos = PerformGestureDiagonalSwipe(application, currentPos, Vector2(5.0f, 5.0f), 100, false); - Property::Index overshootXProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME); - Property::Index overshootYProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME); - Property::Index scrollPositionProperty = scrollView.GetPropertyIndex(ScrollView::SCROLL_POSITION_PROPERTY_NAME); - float overshootXValue = scrollView.GetProperty(overshootXProperty); - float overshootYValue = scrollView.GetProperty(overshootYProperty); - Vector3 positionValue = scrollView.GetProperty(scrollPositionProperty); + float overshootXValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_X); + float overshootYValue = scrollView.GetProperty(ScrollView::Property::OVERSHOOT_Y); + Vector3 positionValue = scrollView.GetProperty(ScrollView::Property::SCROLL_POSITION); DALI_TEST_EQUALS(overshootXValue, 1.0f, TEST_LOCATION); DALI_TEST_EQUALS(overshootYValue, 1.0f, TEST_LOCATION); DALI_TEST_EQUALS(positionValue, Vector3::ZERO, TEST_LOCATION); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Slider.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Slider.cpp index d5d2ef0..89090da 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Slider.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Slider.cpp @@ -125,7 +125,7 @@ int UtcDaliSliderSignals(void) Stage::GetCurrent().Add( slider ); slider.SetParentOrigin(ParentOrigin::TOP_LEFT); slider.SetAnchorPoint(ParentOrigin::TOP_LEFT); - slider.SetPreferredSize( Vector2( Stage::GetCurrent().GetSize().x, 20.0f ) ); + slider.SetSize( Vector2( Stage::GetCurrent().GetSize().x, 20.0f ) ); slider.SetPosition( 0.0f, 0.0f ); const float MIN_BOUND = 0.0f; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-SuperBlurView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-SuperBlurView.cpp index 5fd205c..b7e662e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-SuperBlurView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-SuperBlurView.cpp @@ -197,6 +197,7 @@ int UtcDaliSuperBlurViewGetBlurredImage(void) tet_infoline( "UtcDaliSuperBlurViewGetBlurredImage" ); SuperBlurView blurView = SuperBlurView::New( BLUR_LEVELS ); + blurView.SetRelayoutEnabled( false ); blurView.SetSize( 100.f,100.f ); Image inputImage = CreateSolidColorImage( application, Color::GREEN, 100, 100 ); blurView.SetImage( inputImage ); @@ -207,8 +208,8 @@ int UtcDaliSuperBlurViewGetBlurredImage(void) DALI_TEST_CHECK( image1 ); Image image2 = blurView.GetBlurredImage( 2 ); - DALI_TEST_CHECK( image2.GetWidth() == 25 ); - DALI_TEST_CHECK( image2.GetHeight() == 25 ); + DALI_TEST_EQUALS( image2.GetWidth(), 25, TEST_LOCATION ); + DALI_TEST_EQUALS( image2.GetHeight(), 25, TEST_LOCATION ); Image image3 = blurView.GetBlurredImage( 3 ); DALI_TEST_CHECK( FrameBufferImage::DownCast( image2 ) ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp index 484453c..0e99819 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp @@ -73,18 +73,18 @@ static void SetupTableViewAndActors(TableView& tableView, Actor& actor1, Actor& tableView.SetRelayoutEnabled( true ); Stage::GetCurrent().Add( tableView ); - tableView.SetPreferredSize( Dali::Vector2( 100.0f, 100.0f ) ); + tableView.SetSize( Dali::Vector2( 100.0f, 100.0f ) ); actor1 = Actor::New(); actor2 = Actor::New(); actor3 = Actor::New(); actor1.SetRelayoutEnabled( true ); - actor1.SetPreferredSize( Dali::Vector2( 10, 10 ) ); + actor1.SetSize( Dali::Vector2( 10, 10 ) ); actor2.SetRelayoutEnabled( true ); - actor2.SetPreferredSize( Dali::Vector2( 10, 10 ) ); + actor2.SetSize( Dali::Vector2( 10, 10 ) ); actor3.SetRelayoutEnabled( true ); - actor3.SetPreferredSize( Dali::Vector2( 10, 10 ) ); + actor3.SetSize( Dali::Vector2( 10, 10 ) ); tableView.AddChild( actor1, TableView::CellPosition( 0, 0 ) ); tableView.AddChild( actor2, TableView::CellPosition( 0, 1 ) ); @@ -541,7 +541,7 @@ int UtcDaliTableViewSetGetProperty(void) // Create a 1x1 table-view TableView tableView = TableView::New(1,1); - tableView.SetPreferredSize( Vector2( 100.0f, 100.0f ) ); + tableView.SetSize( Vector2( 100.0f, 100.0f ) ); DALI_TEST_CHECK( tableView ); // Test "rows" property diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ToolBar.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ToolBar.cpp index e1042b2..d359334 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ToolBar.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ToolBar.cpp @@ -114,23 +114,18 @@ int UtcDaliToolBarAddControl01(void) try { ImageActor control1 = CreateSolidColorActor( Color::RED ); - control1.SetPreferredSize( Vector2( 100.f, 100.f ) ); - control1.SetResizePolicy( FIXED, ALL_DIMENSIONS ); + control1.SetSize( Vector2( 100.f, 100.f ) ); ImageActor control2 = CreateSolidColorActor( Color::RED ); - control2.SetPreferredSize( Vector2( 100.f, 100.f ) ); - control2.SetResizePolicy( FIXED, ALL_DIMENSIONS ); + control2.SetSize( Vector2( 100.f, 100.f ) ); ImageActor control3 = CreateSolidColorActor( Color::RED ); - control3.SetPreferredSize( Vector2( 100.f, 100.f ) ); - control3.SetResizePolicy( FIXED, ALL_DIMENSIONS ); + control3.SetSize( Vector2( 100.f, 100.f ) ); ImageActor control4 = CreateSolidColorActor( Color::RED ); - control4.SetPreferredSize( Vector2( 100.f, 100.f ) ); - control4.SetResizePolicy( FIXED, ALL_DIMENSIONS ); + control4.SetSize( Vector2( 100.f, 100.f ) ); ImageActor control5 = CreateSolidColorActor( Color::RED ); - control5.SetPreferredSize( Vector2( 100.f, 100.f ) ); - control5.SetResizePolicy( FIXED, ALL_DIMENSIONS ); + control5.SetSize( Vector2( 100.f, 100.f ) ); ToolBar toolbar = ToolBar::New(); - toolbar.SetPreferredSize( Vector2( 600.f, 100.f ) ); + toolbar.SetSize( Vector2( 600.f, 100.f ) ); application.Render(); application.SendNotification(); @@ -144,14 +139,11 @@ int UtcDaliToolBarAddControl01(void) toolbar.AddControl( control5, 0.1f, Alignment::HorizontalRight, Alignment::Padding( 1.f, 1.f, 1.f, 1.f ) ); ImageActor control6 = CreateSolidColorActor( Color::RED ); - control6.SetPreferredSize( Vector2( 100.f, 100.f ) ); - control6.SetResizePolicy( FIXED, ALL_DIMENSIONS ); + control6.SetSize( Vector2( 100.f, 100.f ) ); ImageActor control7 = CreateSolidColorActor( Color::RED ); - control7.SetPreferredSize( Vector2( 100.f, 100.f ) ); - control7.SetResizePolicy( FIXED, ALL_DIMENSIONS ); + control7.SetSize( Vector2( 100.f, 100.f ) ); ImageActor control8 = CreateSolidColorActor( Color::RED ); - control8.SetPreferredSize( Vector2( 100.f, 100.f ) ); - control8.SetResizePolicy( FIXED, ALL_DIMENSIONS ); + control8.SetSize( Vector2( 100.f, 100.f ) ); application.Render(); application.SendNotification(); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-View.cpp b/automated-tests/src/dali-toolkit/utc-Dali-View.cpp index 2d28fd2..ad124e1 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-View.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-View.cpp @@ -308,7 +308,7 @@ int UtcDaliViewOrientationChanged(void) view.SetRelayoutEnabled( true ); Stage::GetCurrent().Add( view ); - view.SetPreferredSize( Vector2( 480, 800 ) ); + view.SetSize( Vector2( 480, 800 ) ); view.OrientationAnimationStartedSignal().Connect( &StartAnimation ); diff --git a/dali-toolkit/internal/builder/builder-animations.cpp b/dali-toolkit/internal/builder/builder-animations.cpp index c1c8921..bea8368 100644 --- a/dali-toolkit/internal/builder/builder-animations.cpp +++ b/dali-toolkit/internal/builder/builder-animations.cpp @@ -16,6 +16,8 @@ */ // EXTERNAL INCLUDES +#include +#include #include // INTERNAL INCLUDES diff --git a/dali-toolkit/internal/builder/builder-declarations.h b/dali-toolkit/internal/builder/builder-declarations.h index 766e1bf..21c49a1 100644 --- a/dali-toolkit/internal/builder/builder-declarations.h +++ b/dali-toolkit/internal/builder/builder-declarations.h @@ -19,7 +19,12 @@ */ // EXTERNAL INCLUDES -#include +#include +#include +#include +#include +#include +#include // INTERNAL INCLUDES #include diff --git a/dali-toolkit/internal/builder/builder-impl.cpp b/dali-toolkit/internal/builder/builder-impl.cpp index 8ca0281..202e944 100644 --- a/dali-toolkit/internal/builder/builder-impl.cpp +++ b/dali-toolkit/internal/builder/builder-impl.cpp @@ -22,11 +22,16 @@ #include #include #include - +#include +#include +#include +#include +#include +#include +#include #include // INTERNAL INCLUDES - #include #include diff --git a/dali-toolkit/internal/builder/builder-impl.h b/dali-toolkit/internal/builder/builder-impl.h index aeb3ff1..4fb7aba 100644 --- a/dali-toolkit/internal/builder/builder-impl.h +++ b/dali-toolkit/internal/builder/builder-impl.h @@ -22,8 +22,11 @@ #include #include #include +#include #include #include +#include +#include #include // INTERNAL INCLUDES diff --git a/dali-toolkit/internal/builder/builder-set-property.cpp b/dali-toolkit/internal/builder/builder-set-property.cpp index 00d6ec6..184d253 100644 --- a/dali-toolkit/internal/builder/builder-set-property.cpp +++ b/dali-toolkit/internal/builder/builder-set-property.cpp @@ -17,6 +17,7 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include diff --git a/dali-toolkit/internal/builder/builder-signals.cpp b/dali-toolkit/internal/builder/builder-signals.cpp index 0efd85b..f832721 100644 --- a/dali-toolkit/internal/builder/builder-signals.cpp +++ b/dali-toolkit/internal/builder/builder-signals.cpp @@ -16,8 +16,11 @@ */ // EXTERNAL INCLUDES -#include #include +#include +#include +#include +#include // INTERNAL INCLUDES #include diff --git a/dali-toolkit/internal/controls/buttons/button-impl.cpp b/dali-toolkit/internal/controls/buttons/button-impl.cpp index 0f7a0a5..c42531f 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -28,6 +28,30 @@ // INTERNAL INCLUDES #include +/** + * Button states and contents + * (3) mSelectedContent + * (2) mButtonContent (2) mSelectedBackgroundContent + * (1) mBackgroundContent (1) mBackgroundContent + * < unselected > ----------------------- < selected > + * | OnSelect() | + * | OnDisabled() | OnDisabled() + * | | + * < disabled > < disabled-selected > + * (2) mDisabledContent (2) mDisabledSelectedContent + * (1) mDisabledBackgroundContent (1) mDisabledBackgroundContent + * + * The drawing order of child actors is as follows. + * + * Top mLabel + * | mButtonContent / mSelectedContent / mDisabledContent / mDisabledSelectedContent + * | mSelectedBackgroundContent + * Bottom mBackgroundContent / mDisabledBackgroundContent + * + * Some of contents may be missed. + * And 2 images - fade-in image and fade-out image - in the same layer can be shown during the transition animation. Fade-in image should be above fade-out image. + */ + namespace Dali { @@ -85,7 +109,8 @@ Button::Button() mNextAutoRepeatingDelay( NEXT_AUTOREPEATING_DELAY ), mAnimationTime( 0.0f ), mClickActionPerforming( false ), - mState( ButtonUp ) + mState( ButtonUp ), + mPaintState( UnselectedState ) { } @@ -101,9 +126,241 @@ void Button::SetDisabled( bool disabled ) { if( disabled != mDisabled ) { + unsigned int backgroundIndex; + unsigned int buttonIndex; + + bool animationStarted = false; + mDisabled = disabled; - OnDisabled( mDisabled ); + switch( mPaintState ) + { + case UnselectedState: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mDisabledContent ); + + if( mBackgroundContent ) + { + backgroundIndex = 1; + } + else + { + backgroundIndex = 0; + } + + InsertChild( backgroundIndex, mDisabledBackgroundContent ); + + animationStarted = OnDisabled(); + + if( animationStarted ) + { + mPaintState = UnselectedDisabledTransition; + } + else + { + mPaintState = DisabledUnselectedState; + } + break; + } + case SelectedState: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mDisabledSelectedContent ); + + if( mBackgroundContent ) + { + backgroundIndex = 1; + } + else + { + backgroundIndex = 0; + } + + InsertChild( backgroundIndex, mDisabledBackgroundContent ); + + animationStarted = OnDisabled(); + + if( animationStarted ) + { + mPaintState = SelectedDisabledTransition; + } + else + { + mPaintState = DisabledSelectedState; + } + break; + } + case DisabledUnselectedState: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mButtonContent ); + + if( mDisabledBackgroundContent ) + { + backgroundIndex = 1; + } + else + { + backgroundIndex = 0; + } + + InsertChild( backgroundIndex, mBackgroundContent ); + + animationStarted = OnDisabled(); + + if( animationStarted ) + { + mPaintState = DisabledUnselectedTransition; + } + else + { + mPaintState = UnselectedState; + } + break; + } + case DisabledSelectedState: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mSelectedContent ); + + if( mDisabledBackgroundContent ) + { + backgroundIndex = 1; + } + else + { + backgroundIndex = 0; + } + + InsertChild( backgroundIndex, mSelectedBackgroundContent ); + InsertChild( backgroundIndex, mBackgroundContent ); + + animationStarted = OnDisabled(); + + if( animationStarted ) + { + mPaintState = DisabledSelectedTransition; + } + else + { + mPaintState = SelectedState; + } + break; + } + case UnselectedSelectedTransition: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mDisabledSelectedContent ); + + if( mBackgroundContent ) + { + backgroundIndex = 1; + } + else + { + backgroundIndex = 0; + } + + InsertChild( backgroundIndex, mDisabledBackgroundContent ); + + animationStarted = OnDisabled(); + + if( animationStarted ) + { + mPaintState = SelectedDisabledTransition; + } + else + { + mPaintState = DisabledSelectedState; + } + break; + } + case SelectedUnselectedTransition: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mDisabledContent ); + + if( mBackgroundContent ) + { + backgroundIndex = 1; + } + else + { + backgroundIndex = 0; + } + + InsertChild( backgroundIndex, mDisabledBackgroundContent ); + + animationStarted = OnDisabled(); + + if( animationStarted ) + { + mPaintState = UnselectedDisabledTransition; + } + else + { + mPaintState = DisabledUnselectedState; + } + break; + } + case UnselectedDisabledTransition: + { + animationStarted = OnDisabled(); + + if( animationStarted ) + { + mPaintState = DisabledUnselectedTransition; + } + else + { + mPaintState = UnselectedState; + } + break; + } + case DisabledUnselectedTransition: + { + animationStarted = OnDisabled(); + + if( animationStarted ) + { + mPaintState = UnselectedDisabledTransition; + } + else + { + mPaintState = DisabledUnselectedState; + } + break; + } + case SelectedDisabledTransition: + { + animationStarted = OnDisabled(); + + if( animationStarted ) + { + mPaintState = DisabledSelectedTransition; + } + else + { + mPaintState = SelectedState; + } + break; + } + case DisabledSelectedTransition: + { + animationStarted = OnDisabled(); + + if( animationStarted ) + { + mPaintState = SelectedDisabledTransition; + } + else + { + mPaintState = DisabledSelectedState; + } + break; + } + } } } @@ -124,11 +381,7 @@ void Button::SetAutoRepeating( bool autoRepeating ) if( mSelected ) { // Emit a signal is not wanted, only change the appearance. - OnSelected( false ); - - mSelected = false; - - RelayoutRequest(); + SetSelected( false, false ); } } } @@ -180,18 +433,169 @@ void Button::SetSelected( bool selected ) { if( !mDisabled && mTogglableButton && ( selected != mSelected ) ) { - // Notifies the derived class the button has been selected. - OnSelected( selected ); + SetSelected( selected, true ); + } +} - mSelected = selected; +void Button::SetSelected( bool selected, bool emitSignal ) +{ + unsigned int buttonIndex, backgroundIndex; + bool animationStarted = false; + mSelected = selected; + + switch( mPaintState ) + { + case UnselectedState: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mSelectedContent ); + + if( mBackgroundContent ) + { + backgroundIndex = 1; + } + else + { + backgroundIndex = 0; + } + + InsertChild( backgroundIndex, mSelectedBackgroundContent ); + + // Notifies the derived class the button has been selected. + animationStarted = OnSelected(); + + if( animationStarted ) + { + mPaintState = UnselectedSelectedTransition; + } + else + { + mPaintState = SelectedState; + } + break; + } + case SelectedState: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mButtonContent ); + + // Notifies the derived class the button has been selected. + animationStarted = OnSelected(); + + if( animationStarted ) + { + mPaintState = SelectedUnselectedTransition; + } + else + { + mPaintState = UnselectedState; + } + break; + } + case UnselectedSelectedTransition: + { + // Notifies the derived class the button has been selected. + animationStarted = OnSelected(); + + if( animationStarted ) + { + mPaintState = SelectedUnselectedTransition; + } + else + { + mPaintState = UnselectedState; + } + break; + } + case SelectedUnselectedTransition: + { + // Notifies the derived class the button has been selected. + animationStarted = OnSelected(); + + if( animationStarted ) + { + mPaintState = UnselectedSelectedTransition; + } + else + { + mPaintState = SelectedState; + } + break; + } + case DisabledUnselectedTransition: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mSelectedContent ); + + if( mDisabledBackgroundContent ) + { + if( mBackgroundContent ) + { + backgroundIndex = 2; + } + else + { + backgroundIndex = 1; + } + } + else if( mBackgroundContent ) + { + backgroundIndex = 1; + } + else + { + backgroundIndex = 0; + } + + InsertChild( backgroundIndex, mSelectedBackgroundContent ); + + // Notifies the derived class the button has been selected. + animationStarted = OnSelected(); + + if( animationStarted ) + { + mPaintState = UnselectedSelectedTransition; + } + else + { + mPaintState = SelectedState; + } + break; + } + case DisabledSelectedTransition: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mButtonContent ); + + // Notifies the derived class the button has been selected. + animationStarted = OnSelected(); + + if( animationStarted ) + { + mPaintState = SelectedUnselectedTransition; + } + else + { + mPaintState = UnselectedState; + } + break; + } + default: + { + break; + } + } + + if( emitSignal ) + { Toolkit::Button handle( GetOwner() ); // Emit signal. mStateChangedSignal.Emit( handle ); - - RelayoutRequest(); } + + RelayoutRequest(); } bool Button::IsSelected() const @@ -225,6 +629,10 @@ void Button::SetLabel( Actor label ) } mLabel = label; + mLabel.SetPosition( 0.f, 0.f ); + + // label should be the top of the button + Self().Add( mLabel ); OnLabelSet(); @@ -242,6 +650,31 @@ Actor& Button::GetLabel() return mLabel; } +void Button::SetButtonImage( Actor image ) +{ + StopAllAnimations(); + + if( mButtonContent && mButtonContent.GetParent() ) + { + Self().Remove( mButtonContent ); + } + + mButtonContent = image; + + mButtonContent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mButtonContent.SetParentOrigin( ParentOrigin::TOP_LEFT ); + mButtonContent.SetPosition( 0.f, 0.f ); + + if( mPaintState == UnselectedState ) + { + unsigned int index = FindChildIndex( mLabel ); + + Self().Insert( index, mButtonContent ); + } + + OnButtonImageSet(); +} + Actor Button::GetButtonImage() const { return mButtonContent; @@ -252,6 +685,31 @@ Actor& Button::GetButtonImage() return mButtonContent; } +void Button::SetSelectedImage( Actor image ) +{ + StopAllAnimations(); + + if( mSelectedContent && mSelectedContent.GetParent() ) + { + Self().Remove( mSelectedContent ); + } + + mSelectedContent = image; + + mSelectedContent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mSelectedContent.SetParentOrigin( ParentOrigin::TOP_LEFT ); + mSelectedContent.SetPosition( 0.f, 0.f ); + + if( mPaintState == SelectedState ) + { + unsigned int index = FindChildIndex( mLabel ); + + Self().Insert( index, mSelectedContent ); + } + + OnSelectedImageSet(); +} + Actor Button::GetSelectedImage() const { return mSelectedContent; @@ -262,6 +720,29 @@ Actor& Button::GetSelectedImage() return mSelectedContent; } +void Button::SetBackgroundImage( Actor image ) +{ + StopAllAnimations(); + + if( mBackgroundContent && mBackgroundContent.GetParent() ) + { + Self().Remove( mBackgroundContent ); + } + + mBackgroundContent = image; + + mBackgroundContent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mBackgroundContent.SetParentOrigin( ParentOrigin::TOP_LEFT ); + mBackgroundContent.SetPosition( 0.f, 0.f ); + + if( mPaintState == UnselectedState || mPaintState == SelectedState ) + { + Self().Insert( 0, mBackgroundContent ); + } + + OnBackgroundImageSet(); +} + Actor Button::GetBackgroundImage() const { return mBackgroundContent; @@ -272,6 +753,71 @@ Actor& Button::GetBackgroundImage() return mBackgroundContent; } +void Button::SetSelectedBackgroundImage( Actor image ) +{ + StopAllAnimations(); + + if( mSelectedBackgroundContent && mSelectedBackgroundContent.GetParent() ) + { + Self().Remove( mSelectedBackgroundContent ); + } + + mSelectedBackgroundContent = image; + + mSelectedBackgroundContent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mSelectedBackgroundContent.SetParentOrigin( ParentOrigin::TOP_LEFT ); + mSelectedBackgroundContent.SetPosition( 0.f, 0.f ); + + if( mPaintState == SelectedState ) + { + if( mBackgroundContent ) + { + Self().Insert( 1, mSelectedBackgroundContent ); + } + else + { + Self().Insert( 0, mSelectedBackgroundContent ); + } + } + + OnSelectedBackgroundImageSet(); +} + +Actor Button::GetSelectedBackgroundImage() const +{ + return mSelectedBackgroundContent; +} + +Actor& Button::GetSelectedBackgroundImage() +{ + return mSelectedBackgroundContent; +} + +void Button::SetDisabledImage( Actor image ) +{ + StopAllAnimations(); + + if( mDisabledContent && mDisabledContent.GetParent() ) + { + Self().Remove( mDisabledContent ); + } + + mDisabledContent = image; + + mDisabledContent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mDisabledContent.SetParentOrigin( ParentOrigin::TOP_LEFT ); + mDisabledContent.SetPosition( 0.f, 0.f ); + + if( mPaintState == DisabledUnselectedState || mPaintState == DisabledSelectedState ) + { + unsigned int index = FindChildIndex( mLabel ); + + Self().Insert( index, mDisabledContent ); + } + + OnDisabledImageSet(); +} + Actor Button::GetDisabledImage() const { return mDisabledContent; @@ -282,6 +828,31 @@ Actor& Button::GetDisabledImage() return mDisabledContent; } +void Button::SetDisabledSelectedImage( Actor image ) +{ + StopAllAnimations(); + + if( mDisabledSelectedContent && mDisabledSelectedContent.GetParent() ) + { + Self().Remove( mDisabledSelectedContent ); + } + + mDisabledSelectedContent = image; + + mDisabledSelectedContent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mDisabledSelectedContent.SetParentOrigin( ParentOrigin::TOP_LEFT ); + mDisabledSelectedContent.SetPosition( 0.f, 0.f ); + + if( mPaintState == DisabledSelectedState ) + { + unsigned int index = FindChildIndex( mLabel ); + + Self().Insert( index, mDisabledSelectedContent ); + } + + OnDisabledSelectedImageSet(); +} + Actor Button::GetDisabledSelectedImage() const { return mDisabledSelectedContent; @@ -292,6 +863,29 @@ Actor& Button::GetDisabledSelectedImage() return mDisabledSelectedContent; } +void Button::SetDisabledBackgroundImage( Actor image ) +{ + StopAllAnimations(); + + if( mDisabledBackgroundContent && mDisabledBackgroundContent.GetParent() ) + { + Self().Remove( mDisabledBackgroundContent ); + } + + mDisabledBackgroundContent = image; + + mDisabledBackgroundContent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mDisabledBackgroundContent.SetParentOrigin( ParentOrigin::TOP_LEFT ); + mDisabledBackgroundContent.SetPosition( 0.f, 0.f ); + + if( mPaintState == DisabledUnselectedState || mPaintState == DisabledSelectedState ) + { + Self().Insert( 0, mDisabledBackgroundContent ); + } + + OnDisabledBackgroundImageSet(); +} + Actor Button::GetDisabledBackgroundImage() const { return mDisabledBackgroundContent; @@ -335,16 +929,66 @@ void Button::DoClickAction( const PropertyValueContainer& attributes ) } } +void Button::UpdatePaintTransitionState() +{ + switch( mPaintState ) + { + case UnselectedSelectedTransition: + { + RemoveChild( mButtonContent ); + mPaintState = SelectedState; + break; + } + case SelectedUnselectedTransition: + { + RemoveChild( mSelectedBackgroundContent ); + RemoveChild( mSelectedContent ); + mPaintState = UnselectedState; + break; + } + case UnselectedDisabledTransition: + { + RemoveChild( mBackgroundContent ); + RemoveChild( mButtonContent ); + mPaintState = DisabledUnselectedState; + break; + } + case DisabledUnselectedTransition: + { + RemoveChild( mDisabledBackgroundContent ); + RemoveChild( mDisabledContent ); + mPaintState = UnselectedState; + break; + } + case SelectedDisabledTransition: + { + RemoveChild( mBackgroundContent ); + RemoveChild( mSelectedBackgroundContent ); + RemoveChild( mSelectedContent ); + mPaintState = DisabledSelectedState; + break; + } + case DisabledSelectedTransition: + { + RemoveChild( mDisabledBackgroundContent ); + RemoveChild( mDisabledSelectedContent ); + mPaintState = SelectedState; + break; + } + default: + { + break; + } + } +} + void Button::OnButtonStageDisconnection() { if( ButtonDown == mState ) { if( !mTogglableButton ) { - Toolkit::Button handle( GetOwner() ); - - // Notifies the derived class the button has been released. - OnReleased(); + Released(); if( mAutoRepeating ) { @@ -360,8 +1004,7 @@ void Button::OnButtonDown() { Toolkit::Button handle( GetOwner() ); - // Notifies the derived class the button has been pressed. - OnPressed(); + Pressed(); if( mAutoRepeating ) { @@ -383,9 +1026,7 @@ void Button::OnButtonUp() } else { - // Notifies the derived class the button has been clicked. - OnReleased(); - OnClicked(); + Released(); if( mAutoRepeating ) { @@ -409,8 +1050,7 @@ void Button::OnTouchPointLeave() { Toolkit::Button handle( GetOwner() ); - // Notifies the derived class the button has been released. - OnReleased(); + Released(); if( mAutoRepeating ) { @@ -554,6 +1194,7 @@ void Button::OnInitialize() OnButtonInitialize(); + self.SetDrawMode( DrawMode::OVERLAY ); self.SetKeyboardFocusable( true ); } @@ -564,6 +1205,12 @@ void Button::OnActivated() DoClickAction( attributes ); } +void Button::OnControlStageDisconnection() +{ + OnButtonStageDisconnection(); // Notification for derived classes. + mState = ButtonUp; +} + void Button::OnTap(Actor actor, const TapGesture& tap) { // Do nothing. @@ -584,10 +1231,9 @@ bool Button::AutoRepeatingSlot() // Restart the autorepeat timer. SetUpTimer( mNextAutoRepeatingDelay ); - Toolkit::Button handle( GetOwner() ); + Pressed(); - // Notifies the derived class the button has been pressed. - OnPressed(); + Toolkit::Button handle( GetOwner() ); //Emit signal. consumed = mReleasedSignal.Emit( handle ); @@ -598,10 +1244,165 @@ bool Button::AutoRepeatingSlot() return consumed; } -void Button::OnControlStageDisconnection() +void Button::Pressed() { - OnButtonStageDisconnection(); // Notification for derived classes. - mState = ButtonUp; + unsigned int buttonIndex, backgroundIndex; + bool animationStarted = false; + + switch( mPaintState ) + { + case UnselectedState: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mSelectedContent ); + + if( mBackgroundContent ) + { + backgroundIndex = 1; + } + else + { + backgroundIndex = 0; + } + + InsertChild( backgroundIndex, mSelectedBackgroundContent ); + + // Notifies the derived class the button has been pressed. + animationStarted = OnPressed(); + + if( animationStarted ) + { + mPaintState = UnselectedSelectedTransition; + } + else + { + mPaintState = SelectedState; + } + break; + } + case SelectedUnselectedTransition: + { + // Notifies the derived class the button has been pressed. + animationStarted = OnPressed(); + + if( animationStarted ) + { + mPaintState = UnselectedSelectedTransition; + } + else + { + mPaintState = SelectedState; + } + break; + } + case DisabledUnselectedTransition: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mSelectedContent ); + + if( mDisabledBackgroundContent ) + { + if( mBackgroundContent ) + { + backgroundIndex = 2; + } + else + { + backgroundIndex = 1; + } + } + else if( mBackgroundContent ) + { + backgroundIndex = 1; + } + else + { + backgroundIndex = 0; + } + + InsertChild( backgroundIndex, mSelectedBackgroundContent ); + + // Notifies the derived class the button has been pressed. + animationStarted = OnPressed(); + + if( animationStarted ) + { + mPaintState = UnselectedSelectedTransition; + } + else + { + mPaintState = SelectedState; + } + break; + } + default: + break; + } +} + +void Button::Released() +{ + unsigned int buttonIndex; + bool animationStarted = false; + + switch( mPaintState ) + { + case SelectedState: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mButtonContent ); + + // Notifies the derived class the button has been released. + animationStarted = OnReleased(); + + if( animationStarted ) + { + mPaintState = SelectedUnselectedTransition; + } + else + { + mPaintState = UnselectedState; + } + break; + } + case UnselectedSelectedTransition: + { + // Notifies the derived class the button has been released. + animationStarted = OnReleased(); + + if( animationStarted ) + { + mPaintState = SelectedUnselectedTransition; + } + else + { + mPaintState = UnselectedState; + } + break; + } + case DisabledSelectedTransition: + { + buttonIndex = FindChildIndex( mLabel ); + InsertChild( buttonIndex, mButtonContent ); + + // Notifies the derived class the button has been released. + animationStarted = OnReleased(); + + if( animationStarted ) + { + mPaintState = SelectedUnselectedTransition; + } + else + { + mPaintState = UnselectedState; + } + break; + } + default: + { + break; + } + } } Button::ButtonState Button::GetState() @@ -609,6 +1410,44 @@ Button::ButtonState Button::GetState() return mState; } +Button::PaintState Button::GetPaintState() +{ + return mPaintState; +} + +void Button::InsertChild( unsigned int index, Actor& actor ) +{ + if( actor ) + { + Self().Insert( index, actor); + } +} + +void Button::RemoveChild( Actor& actor ) +{ + if( actor && actor.GetParent() ) + { + Self().Remove( actor ); + } +} + +unsigned int Button::FindChildIndex( Actor& actor ) +{ + Actor self = Self(); + unsigned int childrenNum = self.GetChildCount(); + + for( unsigned int i = 0; i < childrenNum; i++ ) + { + Actor child = self.GetChildAt( i ); + if( child == actor ) + { + return i; + } + } + + return childrenNum; +} + void Button::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value ) { Toolkit::Button button = Toolkit::Button::DownCast( Dali::BaseHandle( object ) ); diff --git a/dali-toolkit/internal/controls/buttons/button-impl.h b/dali-toolkit/internal/controls/buttons/button-impl.h index f9dee5a..5197aca 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.h +++ b/dali-toolkit/internal/controls/buttons/button-impl.h @@ -142,6 +142,11 @@ public: Actor GetLabel() const; /** + * @copydoc Dali::Toolkit::PushButton::SetButtonImage( Actor image ) + */ + void SetButtonImage( Actor image ); + + /** * @copydoc Dali::Toolkit::PushButton::GetButtonImage() */ Actor GetButtonImage() const; @@ -153,6 +158,11 @@ public: Actor& GetButtonImage(); /** + * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( Actor image ) + */ + void SetSelectedImage( Actor image ); + + /** * @copydoc Dali::Toolkit::PushButton::GetSelectedImage() */ Actor GetSelectedImage() const; @@ -164,6 +174,11 @@ public: Actor& GetSelectedImage(); /** + * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( Actor image ) + */ + void SetBackgroundImage( Actor image ); + + /** * @copydoc Dali::Toolkit::PushButton::GetBackgroundImage() */ Actor GetBackgroundImage() const; @@ -175,6 +190,27 @@ public: Actor& GetBackgroundImage(); /** + * @copydoc Dali::Toolkit::PushButton::SetSelectedBackgroundImage( Actor image ) + */ + void SetSelectedBackgroundImage( Actor image ); + + /** + * @copydoc Dali::Toolkit::PushButton::GetSelectedBackgroundImage() + */ + Actor GetSelectedBackgroundImage() const; + + /** + * Internal use only. + * @return A reference to the selected background image. + */ + Actor& GetSelectedBackgroundImage(); + + /** + * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Actor image ) + */ + void SetDisabledImage( Actor image ); + + /** * @copydoc Dali::Toolkit::PushButton::GetDisabledImage() */ Actor GetDisabledImage() const; @@ -186,6 +222,11 @@ public: Actor& GetDisabledImage(); /** + * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledSelectedImage( Actor image ) + */ + void SetDisabledSelectedImage( Actor image ); + + /** * @copydoc Dali::Toolkit::CheckBoxButton::GetDisabledSelectedImage() */ Actor GetDisabledSelectedImage() const; @@ -197,6 +238,11 @@ public: Actor& GetDisabledSelectedImage(); /** + * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Actor image ) + */ + void SetDisabledBackgroundImage( Actor image ); + + /** * @copydoc Dali::Toolkit::PushButton::GetDisabledBackgroundImage() */ Actor GetDisabledBackgroundImage() const; @@ -216,57 +262,71 @@ public: */ static bool DoAction( BaseObject* object, const std::string& actionName, const PropertyValueContainer& attributes ); +protected: + /** - * @copydoc Dali::Toolkit::PushButton::SetButtonImage( Actor image ) + * @return A reference to the label actor. */ - virtual void SetButtonImage( Actor image ) {} + Actor& GetLabel(); /** - * @copydoc Dali::Toolkit::PushButton::SetSelectedImage( Actor image ) + * It changes the transition state of the push button. */ - virtual void SetSelectedImage( Actor image ) {} + void UpdatePaintTransitionState(); + +private: /** - * @copydoc Dali::Toolkit::PushButton::SetBackgroundImage( Actor image ) + * Perform the click action to click the button. + * @param[in] attributes The attributes to perfrom this action. */ - virtual void SetBackgroundImage( Actor image ) {} + void DoClickAction( const PropertyValueContainer& attributes ); /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledImage( Actor image ) + * This method is called after the button initialization. + * Could be reimplemented in subclasses to provide specific behaviour. */ - virtual void SetDisabledImage( Actor image ) {} + virtual void OnButtonInitialize() { } /** - * @copydoc Dali::Toolkit::CheckBoxButton::SetDisabledSelectedImage( Actor image ) + * This method is called when the label is set. */ - virtual void SetDisabledSelectedImage( Actor image ) {} + virtual void OnLabelSet() {} /** - * @copydoc Dali::Toolkit::PushButton::SetDisabledBackgroundImage( Actor image ) + * This method is called when the button image is set */ - virtual void SetDisabledBackgroundImage( Actor image ) {} + virtual void OnButtonImageSet() {} -protected: + /** + * This method is called when the selected image is set + */ + virtual void OnSelectedImageSet() {} /** - * Internal use only. - * @return A reference to the label actor. + * This method is called when the background image is set */ - Actor& GetLabel(); + virtual void OnBackgroundImageSet() {} -private: + /** + * This method is called when the selected background image is set + */ + virtual void OnSelectedBackgroundImageSet() {} /** - * Perform the click action to click the button. - * @param[in] attributes The attributes to perfrom this action. + * This method is called when the disabled button image is set */ - void DoClickAction( const PropertyValueContainer& attributes ); + virtual void OnDisabledImageSet() {} /** - * This method is called after the button initialization. - * Could be reimplemented in subclasses to provide specific behaviour. + * This method is called when the disabled selected image is set */ - virtual void OnButtonInitialize() { } + virtual void OnDisabledSelectedImageSet() {} + + /** + * This method is called when the disabled background image is set + */ + virtual void OnDisabledBackgroundImageSet() {} /** * This method is called from the OnTouchEvent method when the button is down. @@ -300,34 +360,33 @@ private: virtual void OnButtonStageDisconnection(); /** - * This method is called when the label is set. - */ - virtual void OnLabelSet() {} - - /** * This method is called when the \e selected property is changed. + * @return true if the transition animation is started. */ - virtual void OnSelected( bool selected ) {} + virtual bool OnSelected() { return false; } /** * This method is called when the \e disabled property is changed. + * @return true if the transition animation is started. */ - virtual void OnDisabled( bool disabled ) {} + virtual bool OnDisabled() { return false; } /** * This method is called when the button is pressed. + * @return true if the transition animation is started. */ - virtual void OnPressed() {} + virtual bool OnPressed() { return false; } /** * This method is called when the button is released. + * @return true if the transition animation is started. */ - virtual void OnReleased() {} + virtual bool OnReleased() { return false; } /** - * This method is called when the button is clicked + * This method stops all animations */ - virtual void OnClicked() {} + virtual void StopAllAnimations() {} public: @@ -428,6 +487,23 @@ private: */ bool AutoRepeatingSlot(); + /** + * Sets the button as selected or unselected. + * @param[in] selected \e selected property value. + * @param[in] emitSignal Emit a signal if this value is \e true. + */ + void SetSelected( bool selected, bool emitSignal ); + + /** + * This method is called when the button is pressed. + */ + void Pressed(); + + /** + * This method is called when the button is released. + */ + void Released(); + protected: enum ButtonState @@ -446,7 +522,7 @@ protected: DisabledUnselectedState, ///< The button is disabled and unselected. DisabledSelectedState, ///< The button is disabled and selected. UnselectedSelectedTransition, ///< The button is in transition from unselected to selected. - SelectedUnselectedTransition, ///< The push button is in transition from selected to unselected. + SelectedUnselectedTransition, ///< The button is in transition from selected to unselected. UnselectedDisabledTransition, ///< The button is in transition from unselected to disabled. DisabledUnselectedTransition, ///< The button is in transition from disabled to unselected. SelectedDisabledTransition, ///< The button is in transition from selected to disabled. @@ -454,6 +530,23 @@ protected: }; ButtonState GetState(); + PaintState GetPaintState(); + + /** + * Inserts the actor to the button. + */ + void InsertChild( unsigned int index, Actor& actor ); + + /** + * Removes the actor from the button. + */ + void RemoveChild( Actor& actor ); + + /** + * Finds the index of the actor. + * If the actor doesn't exist, return the last index + 1. + */ + unsigned int FindChildIndex( Actor& actor ); private: @@ -478,6 +571,7 @@ private: Actor mButtonContent; ///< Stores the unselected content. Actor mSelectedContent; ///< Stores the selected content. Actor mBackgroundContent; ///< Stores the background content. + Actor mSelectedBackgroundContent; ///< Stores the selected background content. Actor mDisabledContent; ///< Stores the disabled content. Actor mDisabledSelectedContent; ///< Stores the disabled selected content. Actor mDisabledBackgroundContent; ///< Stores the disabled background content. @@ -496,6 +590,7 @@ private: bool mClickActionPerforming; ButtonState mState; ///< Stores the button state. + PaintState mPaintState; ///< Stores the paint state. }; } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp b/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp index 0da7949..cc90db8 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp @@ -34,13 +34,9 @@ namespace Internal namespace { -const float FOREGROUND_DEPTH( 0.5f ); -const float BACKGROUND_DEPTH( 0.25f ); - +const float DISTANCE_BETWEEN_IMAGE_AND_LABEL( 5.0f ); const float ANIMATION_TIME( 0.26f ); // EFL checkbox tick time -const Vector3 DISTANCE_BETWEEN_IMAGE_AND_LABEL(5.0f, 0.0f, 0.0f); - BaseHandle Create() { return Toolkit::CheckBoxButton::New(); @@ -66,8 +62,7 @@ Dali::Toolkit::CheckBoxButton CheckBoxButton::New() } CheckBoxButton::CheckBoxButton() -: Button(), - mPaintState( UnselectedState ) +: Button() { SetTogglableButton( true ); @@ -76,9 +71,9 @@ CheckBoxButton::CheckBoxButton() CheckBoxButton::~CheckBoxButton() { - if( mCheckInAnimation ) + if( mTransitionAnimation ) { - mCheckInAnimation.Clear(); + mTransitionAnimation.Clear(); } } @@ -88,323 +83,147 @@ void CheckBoxButton::OnButtonInitialize() Self().SetResizePolicy( FIT_TO_CHILDREN, ALL_DIMENSIONS ); } -void CheckBoxButton::SetSelectedImage( Actor image ) -{ - Actor& selectedImage = GetSelectedImage(); - - switch( mPaintState ) - { - case SelectedState: - { - if( selectedImage && selectedImage.GetParent() ) - { - Self().Remove( selectedImage ); - } - - selectedImage = image; - Self().Add( selectedImage ); - break; - } - case UnselectedSelectedTransition: - { - StopCheckInAnimation(); - Self().Remove( selectedImage ); - - selectedImage = image; - Self().Add( selectedImage ); - - mPaintState = SelectedState; - break; - } - default: - { - selectedImage = image; - break; - } - } - - selectedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - selectedImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - selectedImage.SetZ( FOREGROUND_DEPTH ); -} - -void CheckBoxButton::SetBackgroundImage( Actor image ) -{ - Actor& backgroundImage = GetBackgroundImage(); - - switch( mPaintState ) - { - case UnselectedState: // FALLTHROUGH - case SelectedState: - case UnselectedSelectedTransition: - { - if( backgroundImage && backgroundImage.GetParent() ) - { - Self().Remove( backgroundImage ); - - Actor& label = GetLabel(); - - if( label ) - { - backgroundImage.Remove( label ); - image.Add( label ); - } - } - - backgroundImage = image; - Self().Add( backgroundImage ); - break; - } - default: - { - backgroundImage = image; - break; - } - } - - backgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - backgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - backgroundImage.SetZ( BACKGROUND_DEPTH ); -} - -void CheckBoxButton::SetDisabledSelectedImage( Actor image ) -{ - Actor& disabledSelectedImage = GetDisabledSelectedImage(); - - switch( mPaintState ) - { - case DisabledSelectedState: - { - if( disabledSelectedImage && disabledSelectedImage.GetParent() ) - { - Self().Remove( disabledSelectedImage ); - } - - disabledSelectedImage = image; - Self().Add( disabledSelectedImage ); - break; - } - default: - { - disabledSelectedImage = image; - break; - } - } - - disabledSelectedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - disabledSelectedImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - disabledSelectedImage.SetZ( FOREGROUND_DEPTH ); -} - -void CheckBoxButton::SetDisabledBackgroundImage( Actor image ) -{ - Actor& disabledBackgroundImage = GetDisabledBackgroundImage(); - - switch( mPaintState ) - { - case DisabledSelectedState: - case DisabledUnselectedState: - { - if( disabledBackgroundImage && disabledBackgroundImage.GetParent() ) - { - Self().Remove( disabledBackgroundImage ); - - Actor& label = GetLabel(); - - if( label ) - { - disabledBackgroundImage.Remove( label ); - image.Add( label ); - } - } - - disabledBackgroundImage = image; - Self().Add( disabledBackgroundImage ); - break; - } - default: - { - disabledBackgroundImage = image; - break; - } - } - - disabledBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - disabledBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - disabledBackgroundImage.SetZ( BACKGROUND_DEPTH ); -} - void CheckBoxButton::OnLabelSet() { Actor& label = GetLabel(); if( label ) { - label.SetParentOrigin( ParentOrigin::CENTER_RIGHT ); + label.SetParentOrigin( ParentOrigin::CENTER_LEFT ); label.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - label.TranslateBy( DISTANCE_BETWEEN_IMAGE_AND_LABEL ); if( IsDisabled() && GetDisabledBackgroundImage() ) { - GetDisabledBackgroundImage().Add( label ); + label.SetX( GetDisabledBackgroundImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); } else if ( GetBackgroundImage() ) { - GetBackgroundImage().Add( label ); + label.SetX( GetBackgroundImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); } else { - Self().Add( label ); + label.SetX( DISTANCE_BETWEEN_IMAGE_AND_LABEL ); } } } -void CheckBoxButton::OnSelected( bool selected ) +bool CheckBoxButton::OnSelected() { Actor& selectedImage = GetSelectedImage(); - switch( mPaintState ) + PaintState paintState = GetPaintState(); + + switch( paintState ) { case UnselectedState: { - AddChild( selectedImage ); - StartCheckInAnimation( selectedImage ); // Animate in the check actor - - mPaintState = UnselectedSelectedTransition; + StartTransitionAnimation( selectedImage ); break; } case SelectedState: { RemoveChild( selectedImage ); - - mPaintState = UnselectedState; break; } case UnselectedSelectedTransition: { - StopCheckInAnimation(); + StopTransitionAnimation( false ); RemoveChild( selectedImage ); - - mPaintState = UnselectedState; break; } default: + { break; + } } + + if( mTransitionAnimation ) + { + return true; + } + + return false; } -void CheckBoxButton::OnDisabled( bool disabled ) +bool CheckBoxButton::OnDisabled() { Actor& backgroundImage = GetBackgroundImage(); Actor& selectedImage = GetSelectedImage(); Actor& disabledBackgroundImage = GetDisabledBackgroundImage(); Actor& disabledSelectedImage = GetDisabledSelectedImage(); - switch( mPaintState ) + PaintState paintState = GetPaintState(); + + switch( paintState ) { case UnselectedState: { - if( disabled ) - { - RemoveChild( backgroundImage ); - AddChild( disabledBackgroundImage ); - mPaintState = DisabledUnselectedState; - } + RemoveChild( backgroundImage ); break; } case SelectedState: { - if( disabled ) - { - RemoveChild( backgroundImage ); - RemoveChild( selectedImage ); - AddChild( disabledBackgroundImage ); - AddChild( disabledSelectedImage ); - - mPaintState = DisabledSelectedState; - } + RemoveChild( backgroundImage ); + RemoveChild( selectedImage ); break; } case DisabledUnselectedState: { - if( !disabled ) - { - RemoveChild( disabledBackgroundImage ); - AddChild( backgroundImage ); - - mPaintState = UnselectedState; - } + RemoveChild( disabledBackgroundImage ); break; } case DisabledSelectedState: { - if( !disabled ) - { - RemoveChild( disabledBackgroundImage ); - RemoveChild( disabledSelectedImage ); - AddChild( backgroundImage ); - AddChild( selectedImage ); - - mPaintState = SelectedState; - } + RemoveChild( disabledBackgroundImage ); + RemoveChild( disabledSelectedImage ); break; } case UnselectedSelectedTransition: { - if( disabled ) - { - StopCheckInAnimation(); - - RemoveChild( backgroundImage ); - RemoveChild( selectedImage ); - AddChild( disabledBackgroundImage ); - AddChild( disabledSelectedImage ); + StopTransitionAnimation(); - mPaintState = DisabledSelectedState; - } + RemoveChild( backgroundImage ); + RemoveChild( selectedImage ); break; } default: + { break; + } } Actor& label = GetLabel(); if( label ) { - if( label.GetParent() ) + if( IsDisabled() && disabledBackgroundImage) { - label.GetParent().Remove( label ); + label.SetX( disabledBackgroundImage.GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); } - - if( disabled && disabledBackgroundImage) + else if( backgroundImage ) { - disabledBackgroundImage.Add( label ); + label.SetX( backgroundImage.GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); } - else if( backgroundImage ) + else { - backgroundImage.Add( label ); + label.SetX( DISTANCE_BETWEEN_IMAGE_AND_LABEL ); } } -} -void CheckBoxButton::AddChild( Actor& actor ) -{ - if( actor ) + if( mTransitionAnimation ) { - Self().Add( actor); + return true; } + + return false; } -void CheckBoxButton::RemoveChild( Actor& actor ) +void CheckBoxButton::StopAllAnimations() { - if( actor ) - { - Self().Remove( actor ); - } + StopTransitionAnimation(); } -void CheckBoxButton::StartCheckInAnimation( Actor& actor ) +void CheckBoxButton::StartTransitionAnimation( Actor& actor ) { if( actor ) { @@ -419,47 +238,39 @@ void CheckBoxButton::StartCheckInAnimation( Actor& actor ) mTickUVEffect.SetBottomRight( Vector2( 0.0f, 1.0f ) ); - if( !mCheckInAnimation ) + if( !mTransitionAnimation ) { - mCheckInAnimation = Dali::Animation::New( GetAnimationTime() ); + mTransitionAnimation = Dali::Animation::New( GetAnimationTime() ); } // UV anim - mCheckInAnimation.AnimateTo( Property( mTickUVEffect, mTickUVEffect.GetBottomRightPropertyName() ), Vector2( 1.0f, 1.0f ) ); + mTransitionAnimation.AnimateTo( Property( mTickUVEffect, mTickUVEffect.GetBottomRightPropertyName() ), Vector2( 1.0f, 1.0f ) ); // Actor size anim - mCheckInAnimation.AnimateTo( Property( actor, Actor::Property::SCALE_X ), 1.0f ); + mTransitionAnimation.AnimateTo( Property( actor, Actor::Property::SCALE_X ), 1.0f ); - mCheckInAnimation.FinishedSignal().Connect( this, &CheckBoxButton::CheckInAnimationFinished ); - mCheckInAnimation.Play(); + mTransitionAnimation.FinishedSignal().Connect( this, &CheckBoxButton::TransitionAnimationFinished ); + mTransitionAnimation.Play(); } } -void CheckBoxButton::StopCheckInAnimation() +void CheckBoxButton::StopTransitionAnimation( bool remove ) { - if( mCheckInAnimation ) + if( mTransitionAnimation ) { - mCheckInAnimation.Clear(); - mCheckInAnimation.Reset(); + mTransitionAnimation.Clear(); + mTransitionAnimation.Reset(); } -} -void CheckBoxButton::CheckInAnimationFinished( Dali::Animation& source ) -{ - switch( mPaintState ) + if( remove ) { - case UnselectedSelectedTransition: - { - mPaintState = SelectedState; - break; - } - default: - { - break; - } + UpdatePaintTransitionState(); } +} - StopCheckInAnimation(); +void CheckBoxButton::TransitionAnimationFinished( Dali::Animation& source ) +{ + StopTransitionAnimation(); } } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-impl.h b/dali-toolkit/internal/controls/buttons/check-box-button-impl.h index 47b91ae..7f55610 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/check-box-button-impl.h @@ -52,27 +52,17 @@ public: */ static Dali::Toolkit::CheckBoxButton New(); -public: // From Button - - /** - * @copydoc Toolkit::Internal::Button::SetSelectedImage( Actor image ) - */ - virtual void SetSelectedImage( Actor image ); - - /** - * @copydoc Toolkit::Internal::Button::SetBackgroundImage( Actor image ) - */ - virtual void SetBackgroundImage( Actor image ); +private: /** - * @copydoc Toolkit::Internal::Button::SetDisabledSelectedImage( Actor image ) + * Construct a new CheckBoxButton. */ - virtual void SetDisabledSelectedImage( Actor image ); + CheckBoxButton(); /** - * @copydoc Toolkit::Internal::Button::SetDisabledBackgroundImage( Actor image ) + * A reference counted object may only be deleted by calling Unreference() */ - virtual void SetDisabledBackgroundImage( Actor image ); + virtual ~CheckBoxButton(); private: // From Button @@ -90,56 +80,39 @@ private: // From Button /** * @copydoc Toolkit::Internal::Button::OnSelected() */ - virtual void OnSelected( bool selected ); + virtual bool OnSelected(); /** - * @copydoc Toolkit::Internal::Button::OnDisabled( bool disabled ) + * @copydoc Toolkit::Internal::Button::OnDisabled() */ - virtual void OnDisabled( bool disabled ); - -private: + virtual bool OnDisabled(); /** - * Construct a new CheckBoxButton. + * @copydoc Toolkit::Internal::Button::StopAllAnimations() */ - CheckBoxButton(); - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~CheckBoxButton(); + virtual void StopAllAnimations(); private: /** - * Adds the actor to the button. - */ - void AddChild( Actor& actor ); - - /** - * Removes the actor from the button. - */ - void RemoveChild( Actor& actor ); - - /** - * Adds the actor to the check in animation. - * It creates a check in animation if needed and starts the check in animation. + * Adds the actor to the transition animation. + * It creates a transition animation if needed and starts the animation. * @param[in] actor The actor. */ - void StartCheckInAnimation( Actor& actor ); + void StartTransitionAnimation( Actor& actor ); /** - * Stops the check in animation. + * Stops the transition animation. + * @param[in] remove If true, removes the fadeout actor from root. */ - void StopCheckInAnimation(); + void StopTransitionAnimation( bool remove = true ); // slots /** - * Called when the check in animation finishes. - * It changes the check button paint state. + * Called when the transition animation finishes. */ - void CheckInAnimationFinished( Dali::Animation& source ); + void TransitionAnimationFinished( Dali::Animation& source ); private: @@ -150,10 +123,8 @@ private: CheckBoxButton& operator=( const CheckBoxButton& ); private: - Animation mCheckInAnimation; ///< Animation used in the state transitions. - ImageRegionEffect mTickUVEffect; ///< ImageRegionEffect to expand the tick across - - PaintState mPaintState; ///< The paint state. + Animation mTransitionAnimation; ///< Animation used in the state transitions. + ImageRegionEffect mTickUVEffect; ///< ImageRegionEffect to expand the tick across }; } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp index 1a5c3a4..24fa230 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp @@ -38,11 +38,6 @@ namespace { const float TEXT_PADDING = 12.0f; - -const float LABEL_DEPTH( 0.75f ); -const float FOREGROUND_DEPTH( 0.5f ); -const float BACKGROUND_DEPTH( 0.25f ); - const float ANIMATION_TIME( 0.2f ); BaseHandle Create() @@ -97,8 +92,7 @@ Dali::Toolkit::PushButton PushButton::New() PushButton::PushButton() : Button(), - mSize(), - mPaintState( UnselectedState ) + mSize() { SetAnimationTime( ANIMATION_TIME ); } @@ -107,481 +101,162 @@ PushButton::~PushButton() { } -void PushButton::SetButtonImage( Actor image ) +void PushButton::OnButtonInitialize() { - Actor& buttonImage = GetButtonImage(); - Actor& fadeOutButtonImage = GetFadeOutButtonImage(); - - switch( mPaintState ) - { - case UnselectedState: - { - if( buttonImage && buttonImage.GetParent() ) - { - StopFadeOutAnimation(); - FadeOutImage( Foreground, buttonImage ); - - buttonImage = image; - - FadeInImage( buttonImage, 0.0f, 0 ); - - StartFadeOutAnimation(); - StartFadeInAnimation(); - } - else - { - buttonImage = image; - Self().Insert( 0, buttonImage ); - } - break; - } - case UnselectedSelectedTransition: // FALLTHROUGH - case UnselectedDisabledTransition: - { - float opacity = 1.f; - if( fadeOutButtonImage ) - { - opacity = fadeOutButtonImage.GetCurrentOpacity(); - } - StopFadeOutAnimation(); - - // Replaces the button image. - buttonImage = image; - - Self().Insert( 0, buttonImage ); - FadeOutImage( Foreground, buttonImage, opacity ); - - StartFadeOutAnimation(); - break; - } - case SelectedUnselectedTransition: // FALLTHROUGH - case DisabledUnselectedTransition: - { - StopFadeInAnimation(); - Self().Remove( buttonImage ); - - buttonImage = image; - - FadeInImage( buttonImage, 0.0f, 0 ); - StartFadeInAnimation(); - break; - } - default: - buttonImage = image; - break; - } + // Push button requires the Leave event. + Actor self = Self(); + self.SetLeaveRequired( true ); - buttonImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - buttonImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - buttonImage.SetPosition( 0.f, 0.f, FOREGROUND_DEPTH ); - buttonImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - buttonImage.SetName( "BUTTON_IMAGE" ); + // Set resize policy to natural size so that buttons will resize to background images + self.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); } -void PushButton::SetSelectedImage( Actor image ) +void PushButton::OnLabelSet() { - Actor& selectedImage = GetSelectedImage(); - Actor& fadeOutButtonImage = GetFadeOutButtonImage(); + Actor& label = GetLabel(); - switch( mPaintState ) + if( label ) { - case SelectedState: - { - if( selectedImage && selectedImage.GetParent() ) - { - StopFadeOutAnimation(); - FadeOutImage( Foreground, selectedImage ); - - selectedImage = image; + label.SetAnchorPoint( AnchorPoint::CENTER ); + label.SetParentOrigin( ParentOrigin::CENTER ); + label.SetSize( mSize ); + } +} - FadeInImage( selectedImage, 0.0f, 0 ); +void PushButton::OnButtonImageSet() +{ + Actor& buttonImage = GetButtonImage(); - StartFadeOutAnimation(); - StartFadeInAnimation(); - } - else - { - selectedImage = image; - Self().Insert( 0, selectedImage ); - } - break; - } - case SelectedUnselectedTransition: // FALLTHROUGH - case SelectedDisabledTransition: - { - float opacity = 1.f; - if( fadeOutButtonImage ) - { - opacity = fadeOutButtonImage.GetCurrentOpacity(); - } - StopFadeOutAnimation(); + buttonImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - // Replaces the button image. - selectedImage = image; + buttonImage.RelayoutRequestTree(); - Self().Insert( 0, selectedImage ); - FadeOutImage( Foreground, selectedImage, opacity ); + RelayoutRequest(); +} - StartFadeOutAnimation(); - break; - } - case UnselectedSelectedTransition: // FALLTHROUGH - case DisabledSelectedTransition: - { - StopFadeInAnimation(); - Self().Remove( selectedImage ); +void PushButton::OnSelectedImageSet() +{ + Actor& selectedImage = GetSelectedImage(); - selectedImage = image; + selectedImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - FadeInImage( selectedImage, 0.0f, 0 ); - StartFadeInAnimation(); - break; - } - default: - selectedImage = image; - break; - } + selectedImage.RelayoutRequestTree(); - selectedImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - selectedImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - selectedImage.SetPosition( 0.f, 0.f, FOREGROUND_DEPTH ); - selectedImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + RelayoutRequest(); } -void PushButton::SetBackgroundImage( Actor image ) +void PushButton::OnBackgroundImageSet() { Actor& backgroundImage = GetBackgroundImage(); - Actor& fadeOutBackgroundImage = GetFadeOutBackgroundImage(); - switch( mPaintState ) - { - case UnselectedState: // FALLTHROUGH - case SelectedState: - case UnselectedSelectedTransition: - case SelectedUnselectedTransition: - { - if( backgroundImage && backgroundImage.GetParent() ) - { - StopFadeOutAnimation(); - FadeOutImage( Background, backgroundImage ); - - backgroundImage = image; - - FadeInImage( backgroundImage, 0.0f, 0 ); - - StartFadeOutAnimation(); - StartFadeInAnimation(); - } - else - { - backgroundImage = image; - Self().Insert( 0, backgroundImage ); - } - break; - } - case UnselectedDisabledTransition: // FALLTHROUGH - case SelectedDisabledTransition: - { - float opacity = 1.f; - if( fadeOutBackgroundImage ) - { - opacity = fadeOutBackgroundImage.GetCurrentOpacity(); - } - StopFadeOutAnimation(); - - // Replaces the button image. - backgroundImage = image; - - Self().Insert( 0, backgroundImage ); - FadeOutImage( Background, backgroundImage, opacity ); + backgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - StartFadeOutAnimation(); - break; - } - case DisabledUnselectedTransition: // FALLTHROUGH - case DisabledSelectedTransition: - { - StopFadeInAnimation(); - Self().Remove( backgroundImage ); + backgroundImage.RelayoutRequestTree(); - backgroundImage = image; + RelayoutRequest(); +} - FadeInImage( backgroundImage, 0.0f, 0 ); - StartFadeInAnimation(); - break; - } - default: - backgroundImage = image; - break; - } +void PushButton::OnSelectedBackgroundImageSet() +{ + Actor& selectedBackgroundImage = GetSelectedBackgroundImage(); - backgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - backgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - backgroundImage.SetPosition( 0.f, 0.f, BACKGROUND_DEPTH ); - backgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + selectedBackgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); } -void PushButton::SetDisabledImage( Actor image ) +void PushButton::OnDisabledImageSet() { Actor& disabledImage = GetDisabledImage(); - Actor& fadeOutButtonImage = GetFadeOutButtonImage(); - - switch( mPaintState ) - { - case DisabledUnselectedState: // FALLTHROUGH - case DisabledSelectedState: - { - if( disabledImage && disabledImage.GetParent() ) - { - StopFadeOutAnimation(); - FadeOutImage( Foreground, disabledImage ); - - disabledImage = image; - - FadeInImage( disabledImage, 0.0f, 0 ); - - StartFadeOutAnimation(); - StartFadeInAnimation(); - } - else - { - disabledImage = image; - Self().Add( disabledImage ); - } - break; - } - case UnselectedDisabledTransition: // FALLTHROUGH - case SelectedDisabledTransition: - { - StopFadeInAnimation(); - Self().Remove( disabledImage ); - - disabledImage = image; - - FadeInImage( disabledImage, 0.0f, 0 ); - StartFadeInAnimation(); - break; - } - case DisabledUnselectedTransition: // FALLTHROUGH - case DisabledSelectedTransition: - { - float opacity = 1.f; - if( fadeOutButtonImage ) - { - opacity = fadeOutButtonImage.GetCurrentOpacity(); - } - StopFadeOutAnimation(); - - // Replaces the button image. - disabledImage = image; - Self().Add( disabledImage ); - FadeOutImage( Foreground, disabledImage, opacity ); + disabledImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - StartFadeOutAnimation(); - break; - } - default: - disabledImage = image; - break; - } + disabledImage.RelayoutRequestTree(); - disabledImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - disabledImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - disabledImage.SetPosition( 0.f, 0.f, FOREGROUND_DEPTH ); - disabledImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + RelayoutRequest(); } -void PushButton::SetDisabledBackgroundImage( Actor image ) +void PushButton::OnDisabledBackgroundImageSet() { Actor& disabledBackgroundImage = GetDisabledBackgroundImage(); - Actor& fadeOutBackgroundImage = GetFadeOutBackgroundImage(); - - switch( mPaintState ) - { - case DisabledUnselectedState: // FALLTHROUGH - case DisabledSelectedState: - { - if( disabledBackgroundImage && disabledBackgroundImage.GetParent() ) - { - StopFadeOutAnimation(); - FadeOutImage( Background, disabledBackgroundImage ); - disabledBackgroundImage = image; - - FadeInImage( disabledBackgroundImage, 0.0f, 0 ); - - StartFadeOutAnimation(); - StartFadeInAnimation(); - } - else - { - disabledBackgroundImage = image; - Self().Add( disabledBackgroundImage ); - } - break; - } - case UnselectedDisabledTransition: // FALLTHROUGH - case SelectedDisabledTransition: - { - StopFadeInAnimation(); - Self().Remove( disabledBackgroundImage ); - - disabledBackgroundImage = image; - - FadeInImage( disabledBackgroundImage, 0.0f, 0 ); - StartFadeInAnimation(); - break; - } - case DisabledUnselectedTransition: // FALLTHROUGH - case DisabledSelectedTransition: - { - float opacity = 1.f; - if( fadeOutBackgroundImage ) - { - opacity = fadeOutBackgroundImage.GetCurrentOpacity(); - } - StopFadeOutAnimation(); - - // Replaces the button image. - disabledBackgroundImage = image; - - Self().Add( disabledBackgroundImage ); - FadeOutImage( Background, disabledBackgroundImage, opacity ); - - StartFadeOutAnimation(); - break; - } - default: - disabledBackgroundImage = image; - break; - } - - disabledBackgroundImage.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - disabledBackgroundImage.SetParentOrigin( ParentOrigin::TOP_LEFT ); - disabledBackgroundImage.SetPosition( 0.f, 0.f, BACKGROUND_DEPTH ); disabledBackgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); -} - -void PushButton::OnButtonInitialize() -{ - // Push button requires the Leave event. - Actor root = Self(); - root.SetLeaveRequired( true ); - - // Set resize policy to natural size so that buttons will resize to background images - root.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); -} - -void PushButton::OnLabelSet() -{ - Actor& label = GetLabel(); - if( label ) - { - label.SetAnchorPoint( AnchorPoint::CENTER ); - label.SetParentOrigin( ParentOrigin::CENTER ); - label.SetPosition( 0.f, 0.f, LABEL_DEPTH ); - label.SetSize( mSize ); + disabledBackgroundImage.RelayoutRequestTree(); - Self().Add( label ); - } + RelayoutRequest(); } -void PushButton::OnSelected( bool selected ) +bool PushButton::OnSelected() { - Actor& selectedImage = GetSelectedImage(); Actor& buttonImage = GetButtonImage(); - Actor& fadeOutButtonImage = GetFadeOutButtonImage(); + Actor& selectedImage = GetSelectedImage(); + Actor& selectedBackgroundImage = GetSelectedBackgroundImage(); - switch( mPaintState ) + PaintState paintState = GetPaintState(); + + switch( paintState ) { case UnselectedState: { - StopFadeOutAnimation(); - FadeOutImage( Foreground, buttonImage ); - FadeInImage( selectedImage, 0.0f, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || selectedImage ) - { - mPaintState = UnselectedSelectedTransition; - } - else - { - mPaintState = SelectedState; - } + FadeOutImage( buttonImage ); + FadeInImage( selectedBackgroundImage ); + FadeInImage( selectedImage ); + StartTransitionAnimation(); break; } case SelectedState: { - StopFadeOutAnimation(); - FadeOutImage( Foreground, selectedImage ); - FadeInImage( buttonImage, 0.0f, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || selectedImage ) - { - mPaintState = SelectedUnselectedTransition; - } - else - { - mPaintState = UnselectedState; - } + FadeOutImage( selectedBackgroundImage ); + FadeOutImage( selectedImage ); + FadeInImage( buttonImage ); + StartTransitionAnimation(); break; } case UnselectedSelectedTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( selectedImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = selectedImage.GetCurrentOpacity(); } - StopFadeOutAnimation( false ); - StopFadeInAnimation(); - - FadeOutImage( Foreground, selectedImage, 1.f - opacity ); - FadeInImage( buttonImage, opacity, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || selectedImage ) - { - mPaintState = SelectedUnselectedTransition; - } - else - { - mPaintState = UnselectedState; - } + StopTransitionAnimation( false ); + FadeOutImage( selectedBackgroundImage, opacity ); + FadeOutImage( selectedImage, opacity ); + FadeInImage( buttonImage, 1.f - opacity ); + StartTransitionAnimation(); break; } case SelectedUnselectedTransition: { float opacity = 0.f; - if( fadeOutButtonImage ) + if( selectedImage ) { - opacity = 1.f - fadeOutButtonImage.GetCurrentOpacity(); + opacity = selectedImage.GetCurrentOpacity(); } - StopFadeOutAnimation( false ); - StopFadeInAnimation(); - - FadeOutImage( Foreground, buttonImage, 1.f - opacity ); - FadeInImage( selectedImage, opacity, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || selectedImage ) - { - mPaintState = UnselectedSelectedTransition; - } - else - { - mPaintState = SelectedState; - } + StopTransitionAnimation( false ); + FadeOutImage( buttonImage, 1.f - opacity ); + FadeInImage( selectedBackgroundImage, opacity ); + FadeInImage( selectedImage, opacity ); + StartTransitionAnimation(); + break; + } + case DisabledUnselectedTransition: + { + StopTransitionAnimation(); + FadeOutImage( buttonImage ); + FadeInImage( selectedBackgroundImage ); + FadeInImage( selectedImage ); + StartTransitionAnimation(); + break; + } + case DisabledSelectedTransition: + { + StopTransitionAnimation(); + FadeOutImage( selectedBackgroundImage ); + FadeOutImage( selectedImage ); + FadeInImage( buttonImage ); + StartTransitionAnimation(); break; } default: @@ -589,419 +264,282 @@ void PushButton::OnSelected( bool selected ) break; } } + + if( mTransitionAnimation ) + { + return true; + } + + return false; } -void PushButton::OnDisabled( bool disabled ) +bool PushButton::OnDisabled() { Actor& buttonImage = GetButtonImage(); Actor& selectedImage = GetSelectedImage(); + Actor& selectedBackgroundImage = GetSelectedBackgroundImage(); Actor& backgroundImage = GetBackgroundImage(); Actor& disabledImage = GetDisabledImage(); + Actor& disabledSelectedImage = GetDisabledSelectedImage(); Actor& disabledBackgroundImage = GetDisabledBackgroundImage(); - Actor& fadeOutButtonImage = GetFadeOutButtonImage(); - switch( mPaintState ) - { - case UnselectedState: + PaintState paintState = GetPaintState(); + + switch( paintState ) { - if( disabled ) + case UnselectedState: { - StopFadeOutAnimation(); - FadeOutImage( Background, backgroundImage ); - FadeOutImage( Foreground, buttonImage ); - FadeInImage( disabledBackgroundImage, 0.0f, 0 ); - FadeInImage( disabledImage, 0.0f, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = UnselectedDisabledTransition; - } - else - { - mPaintState = DisabledUnselectedState; - } + FadeOutImage( backgroundImage ); + FadeOutImage( buttonImage ); + FadeInImage( disabledBackgroundImage ); + FadeInImage( disabledImage ); + StartTransitionAnimation(); + break; } - break; - } - case SelectedState: - { - if( disabled ) + case SelectedState: { - StopFadeOutAnimation(); - FadeOutImage( Background, backgroundImage ); - FadeOutImage( Foreground, selectedImage ); - FadeInImage( disabledBackgroundImage, 0.0f, 0 ); - FadeInImage( disabledImage, 0.0f, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = SelectedDisabledTransition; - } - else - { - mPaintState = DisabledSelectedState; - } + FadeOutImage( backgroundImage ); + FadeOutImage( selectedBackgroundImage ); + FadeOutImage( selectedImage ); + FadeInImage( disabledBackgroundImage ); + FadeInImage( disabledSelectedImage ); + StartTransitionAnimation(); + break; } - break; - } - case DisabledUnselectedState: - { - if( !disabled ) + case DisabledUnselectedState: { - StopFadeOutAnimation(); - FadeOutImage( Background, disabledBackgroundImage ); - FadeOutImage( Foreground, disabledImage ); - FadeInImage( backgroundImage, 0.0f, 0 ); - FadeInImage( buttonImage, 0.0f, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = DisabledUnselectedTransition; - } - else - { - mPaintState = UnselectedState; - } + FadeOutImage( disabledBackgroundImage ); + FadeOutImage( disabledImage ); + FadeInImage( backgroundImage ); + FadeInImage( buttonImage ); + StartTransitionAnimation(); + break; } - break; - } - case DisabledSelectedState: - { - if( !disabled ) + case DisabledSelectedState: { - StopFadeOutAnimation(); - FadeOutImage( Background, disabledBackgroundImage ); - FadeOutImage( Foreground, disabledImage ); - FadeInImage( backgroundImage, 0.0f, 0 ); - FadeInImage( selectedImage, 0.0f, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = DisabledSelectedTransition; - } - else - { - mPaintState = SelectedState; - } + FadeOutImage( disabledBackgroundImage ); + FadeOutImage( disabledSelectedImage ); + FadeInImage( backgroundImage ); + FadeInImage( selectedBackgroundImage ); + FadeInImage( selectedImage ); + StartTransitionAnimation(); + break; } - break; - } - case UnselectedSelectedTransition: - { - if( disabled ) + case UnselectedSelectedTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( selectedImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = selectedImage.GetCurrentOpacity(); } - StopFadeOutAnimation(); - StopFadeInAnimation(); - - FadeOutImage( Foreground, selectedImage, 1.f - opacity ); - FadeOutImage( Background, backgroundImage ); - - FadeInImage( disabledImage, 0.0f, 0 ); - FadeInImage( disabledBackgroundImage, 0.0f, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = SelectedDisabledTransition; - } - else - { - mPaintState = DisabledSelectedState; - } + StopTransitionAnimation(); + FadeOutImage( backgroundImage ); + FadeOutImage( selectedBackgroundImage, opacity ); + FadeOutImage( selectedImage, opacity ); + FadeInImage( disabledBackgroundImage ); + FadeInImage( disabledSelectedImage ); + StartTransitionAnimation(); + break; } - break; - } - case SelectedUnselectedTransition: - { - if( disabled ) + case SelectedUnselectedTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( buttonImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = buttonImage.GetCurrentOpacity(); } - StopFadeOutAnimation(); - StopFadeInAnimation(); - - FadeOutImage( Foreground, buttonImage, 1.f - opacity ); - FadeOutImage( Background, backgroundImage ); - - FadeInImage( disabledImage, 0.0f, 0); - FadeInImage( disabledBackgroundImage, 0.0f, 0 ); - - StartFadeOutAnimation(); - StartFadeInAnimation(); - if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = UnselectedDisabledTransition; - } - else - { - mPaintState = DisabledUnselectedState; - } + StopTransitionAnimation(); + FadeOutImage( backgroundImage ); + FadeOutImage( buttonImage, opacity ); + FadeInImage( disabledBackgroundImage ); + FadeInImage( disabledImage ); + StartTransitionAnimation(); + break; } - break; - } - case UnselectedDisabledTransition: - { - if( !disabled ) + case UnselectedDisabledTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( disabledImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = disabledImage.GetCurrentOpacity(); } - StopFadeOutAnimation( false ); - StopFadeInAnimation(); - FadeOutImage( Foreground, disabledImage, 1.f - opacity ); - FadeOutImage( Background, disabledBackgroundImage, 1.f - opacity ); - FadeInImage( buttonImage, opacity, 0 ); - FadeInImage( backgroundImage, opacity, 0 ); - - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = DisabledUnselectedTransition; - } - else - { - mPaintState = UnselectedState; - } + StopTransitionAnimation( false ); + FadeOutImage( disabledBackgroundImage, opacity ); + FadeOutImage( disabledImage, opacity ); + FadeInImage( backgroundImage, 1.f - opacity ); + FadeInImage( buttonImage, 1.f - opacity ); + StartTransitionAnimation(); + break; } - break; - } - case DisabledUnselectedTransition: - { - if( disabled ) + case DisabledUnselectedTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( buttonImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = buttonImage.GetCurrentOpacity(); } - StopFadeOutAnimation( false ); - StopFadeInAnimation(); - - FadeOutImage( Foreground, buttonImage, 1.f - opacity ); - FadeOutImage( Background, backgroundImage, 1.f - opacity ); - FadeInImage( disabledImage, opacity, 0 ); - FadeInImage( disabledBackgroundImage, opacity, 0 ); - - StartFadeOutAnimation(); - StartFadeInAnimation(); - if( buttonImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = UnselectedDisabledTransition; - } - else - { - mPaintState = DisabledUnselectedState; - } + StopTransitionAnimation( false ); + FadeOutImage( backgroundImage, opacity ); + FadeOutImage( buttonImage, opacity ); + FadeInImage( disabledBackgroundImage, 1.f - opacity ); + FadeInImage( disabledImage, 1.f - opacity ); + StartTransitionAnimation(); + break; } - break; - } - case SelectedDisabledTransition: - { - if( !disabled ) + case SelectedDisabledTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( disabledSelectedImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = disabledSelectedImage.GetCurrentOpacity(); } - StopFadeOutAnimation( false ); - StopFadeInAnimation(); - FadeOutImage( Foreground, disabledImage, 1.f - opacity ); - FadeOutImage( Background, disabledBackgroundImage, 1.f - opacity ); - FadeInImage( selectedImage, opacity, 0 ); - FadeInImage( backgroundImage, opacity, 0 ); - - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = DisabledSelectedTransition; - } - else - { - mPaintState = SelectedState; - } + StopTransitionAnimation( false ); + FadeOutImage( disabledBackgroundImage, opacity ); + FadeOutImage( disabledSelectedImage, opacity ); + FadeInImage( backgroundImage, 1.f - opacity ); + FadeInImage( selectedBackgroundImage, 1.f - opacity ); + FadeInImage( selectedImage, 1.f - opacity ); + StartTransitionAnimation(); + break; } - break; - } - case DisabledSelectedTransition: - { - if( disabled ) + case DisabledSelectedTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( selectedImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = selectedImage.GetCurrentOpacity(); } - StopFadeOutAnimation( false ); - StopFadeInAnimation(); - - FadeOutImage( Foreground, selectedImage, 1.f - opacity ); - FadeOutImage( Background, backgroundImage, 1.f - opacity ); - FadeInImage( disabledImage, opacity, 0 ); - FadeInImage( disabledBackgroundImage, opacity, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( selectedImage || disabledImage || backgroundImage || disabledBackgroundImage ) - { - mPaintState = SelectedDisabledTransition; - } - else - { - mPaintState = DisabledSelectedState; - } + StopTransitionAnimation( false ); + FadeOutImage( backgroundImage, opacity ); + FadeOutImage( selectedBackgroundImage, opacity ); + FadeOutImage( selectedImage, opacity ); + FadeInImage( disabledBackgroundImage, 1.f - opacity ); + FadeInImage( disabledSelectedImage, 1.f - opacity ); + StartTransitionAnimation(); + break; } - break; } - default: - break; + + if( mTransitionAnimation ) + { + return true; } + + return false; } -void PushButton::OnPressed() +bool PushButton::OnPressed() { - Actor& selectedImage = GetSelectedImage(); Actor& buttonImage = GetButtonImage(); - Actor& fadeOutButtonImage = GetFadeOutButtonImage(); + Actor& selectedImage = GetSelectedImage(); + Actor& selectedBackgroundImage = GetSelectedBackgroundImage(); + + PaintState paintState = GetPaintState(); - switch( mPaintState ) + switch( paintState ) { case UnselectedState: { - StopFadeOutAnimation(); - FadeOutImage( Foreground, buttonImage ); - FadeInImage( selectedImage, 0.0f, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || selectedImage ) - { - mPaintState = UnselectedSelectedTransition; - } - else - { - mPaintState = SelectedState; - } + FadeOutImage( buttonImage ); + FadeInImage( selectedBackgroundImage ); + FadeInImage( selectedImage ); + StartTransitionAnimation(); break; } - case UnselectedSelectedTransition: + case SelectedUnselectedTransition: { - if( !IsAutoRepeating() ) + float opacity = 1.f; + if( buttonImage ) { - mPaintState = SelectedUnselectedTransition; + opacity = buttonImage.GetCurrentOpacity(); } + + StopTransitionAnimation( false ); + FadeOutImage( buttonImage, opacity ); + FadeInImage( selectedBackgroundImage, 1.f - opacity ); + FadeInImage( selectedImage, 1.f - opacity ); + StartTransitionAnimation(); break; } - case SelectedUnselectedTransition: + case DisabledUnselectedTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( buttonImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = buttonImage.GetCurrentOpacity(); } - StopFadeOutAnimation( false ); - StopFadeInAnimation(); - - FadeOutImage( Foreground, buttonImage, 1.f - opacity ); - FadeInImage( selectedImage, opacity, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || selectedImage ) - { - mPaintState = UnselectedSelectedTransition; - } - else - { - mPaintState = SelectedState; - } + StopTransitionAnimation(); + FadeOutImage( buttonImage, opacity ); + FadeInImage( selectedBackgroundImage ); + FadeInImage( selectedImage ); + StartTransitionAnimation(); break; } default: break; } + + if( mTransitionAnimation ) + { + return true; + } + + return false; } -void PushButton::OnReleased() +bool PushButton::OnReleased() { - Actor& selectedImage = GetSelectedImage(); Actor& buttonImage = GetButtonImage(); - Actor& fadeOutButtonImage = GetFadeOutButtonImage(); + Actor& selectedImage = GetSelectedImage(); + Actor& selectedBackgroundImage = GetSelectedBackgroundImage(); + + PaintState paintState = GetPaintState(); - switch( mPaintState ) + switch( paintState ) { case SelectedState: { - StopFadeOutAnimation(); - FadeOutImage( Foreground, selectedImage ); - FadeInImage( buttonImage, 0.0f, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || selectedImage ) - { - mPaintState = SelectedUnselectedTransition; - } - else - { - mPaintState = UnselectedState; - } + FadeOutImage( selectedBackgroundImage ); + FadeOutImage( selectedImage ); + FadeInImage( buttonImage ); + StartTransitionAnimation(); break; } case UnselectedSelectedTransition: { float opacity = 1.f; - if( fadeOutButtonImage ) + if( selectedImage ) { - opacity = fadeOutButtonImage.GetCurrentOpacity(); + opacity = selectedImage.GetCurrentOpacity(); } - StopFadeOutAnimation( false ); - StopFadeInAnimation(); - - FadeOutImage( Foreground, selectedImage, 1.f - opacity ); - FadeInImage( buttonImage, opacity, 0 ); - StartFadeOutAnimation(); - StartFadeInAnimation(); - - if( buttonImage || selectedImage ) - { - mPaintState = SelectedUnselectedTransition; - } - else + StopTransitionAnimation( false ); + FadeOutImage( selectedBackgroundImage, opacity ); + FadeOutImage( selectedImage, opacity ); + FadeInImage( buttonImage, 1.f - opacity ); + StartTransitionAnimation(); + break; + } + case DisabledSelectedTransition: + { + float opacity = 1.f; + if( selectedImage ) { - mPaintState = UnselectedState; + opacity = selectedImage.GetCurrentOpacity(); } + + StopTransitionAnimation(); + FadeOutImage( selectedBackgroundImage, opacity ); + FadeOutImage( selectedImage, opacity ); + FadeInImage( buttonImage ); + StartTransitionAnimation(); break; } default: @@ -1009,11 +547,18 @@ void PushButton::OnReleased() break; } } + + if( mTransitionAnimation ) + { + return true; + } + + return false; } -void PushButton::OnClicked() +void PushButton::StopAllAnimations() { - OnReleased(); + StopTransitionAnimation(); } void PushButton::OnControlSizeSet( const Vector3& targetSize ) @@ -1033,273 +578,94 @@ void PushButton::OnControlSizeSet( const Vector3& targetSize ) Vector3 PushButton::GetNaturalSize() { - Vector3 size = Control::GetNaturalSize(); - - const bool widthIsZero = EqualsZero( size.width ); - const bool heightIsZero = EqualsZero( size.height ); - - if( widthIsZero || heightIsZero ) - { - // If background and background not scale9 try get size from that - ImageActor imageActor = FindImageActor( GetButtonImage() ); - if( imageActor && imageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH ) - { - Vector3 imageSize = imageActor.GetNaturalSize(); - - if( widthIsZero ) - { - size.width = imageSize.width; - } - - if( heightIsZero ) - { - size.height = imageSize.height; - } - } - - ImageActor backgroundImageActor = FindImageActor( GetBackgroundImage() ); - if( backgroundImageActor && backgroundImageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH ) - { - Vector3 imageSize = backgroundImageActor.GetNaturalSize(); - - if( widthIsZero ) - { - size.width = std::max( size.width, imageSize.width ); - } - - if( heightIsZero ) - { - size.height = std::max( size.height, imageSize.height ); - } - } - - // If label, test against it's size - Toolkit::TextLabel textLabel = Toolkit::TextLabel::DownCast( GetLabel() ); - if( textLabel ) - { - Vector3 textLabelSize = textLabel.GetNaturalSize(); - - if( widthIsZero ) - { - size.width = std::max( size.width, textLabelSize.width + TEXT_PADDING * 2.0f ); - } - - if( heightIsZero ) - { - size.height = std::max( size.height, textLabelSize.height + TEXT_PADDING * 2.0f ); - } - } - } - - return size; -} - -Actor& PushButton::GetFadeOutButtonImage() -{ - return mFadeOutButtonContent; -} + Vector3 size; -Actor& PushButton::GetFadeOutBackgroundImage() -{ - return mFadeOutBackgroundContent; -} - -void PushButton::AddToFadeInAnimation( const Actor& actor ) -{ - if( !mFadeInAnimation ) + // If background and background not scale9 try get size from that + ImageActor imageActor = FindImageActor( GetButtonImage() ); + if( imageActor && imageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH ) { - mFadeInAnimation = Dali::Animation::New( GetAnimationTime() ); + size.width = imageActor.GetRelayoutSize( WIDTH ); + size.height = imageActor.GetRelayoutSize( HEIGHT ); } - mFadeInAnimation.OpacityTo( actor, 1.f ); -} - -void PushButton::StartFadeInAnimation() -{ - if( mFadeInAnimation ) + ImageActor backgroundImageActor = FindImageActor( GetBackgroundImage() ); + if( backgroundImageActor && backgroundImageActor.GetStyle() != ImageActor::STYLE_NINE_PATCH ) { - mFadeInAnimation.FinishedSignal().Connect( this, &PushButton::FadeInAnimationFinished ); - mFadeInAnimation.Play(); + size.width = std::max( size.width, backgroundImageActor.GetRelayoutSize( WIDTH ) ); + size.height = std::max( size.height, backgroundImageActor.GetRelayoutSize( HEIGHT ) ); } -} -void PushButton::StopFadeInAnimation() -{ - if( mFadeInAnimation ) + // If label, test against it's size + Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( GetLabel() ); + if( label ) { - mFadeInAnimation.Clear(); - mFadeInAnimation.Reset(); - } -} + Vector3 labelSize = label.GetNaturalSize(); -void PushButton::AddToFadeOutAnimation( const Actor& actor ) -{ - if( !mFadeOutAnimation ) - { - mFadeOutAnimation = Dali::Animation::New( GetAnimationTime() ); + size.width = std::max( size.width, labelSize.width + TEXT_PADDING * 2.0f ); + size.height = std::max( size.height, labelSize.height + TEXT_PADDING * 2.0f ); } - mFadeOutAnimation.OpacityTo( actor, 0.f ); + return size; } -void PushButton::StartFadeOutAnimation() +void PushButton::StartTransitionAnimation() { - if( mFadeOutAnimation ) + if( mTransitionAnimation ) { - mFadeOutAnimation.FinishedSignal().Connect( this, &PushButton::FadeOutAnimationFinished ); - mFadeOutAnimation.Play(); + mTransitionAnimation.FinishedSignal().Connect( this, &PushButton::TransitionAnimationFinished ); + mTransitionAnimation.Play(); } } -void PushButton::StopFadeOutAnimation( bool remove ) +void PushButton::StopTransitionAnimation( bool remove ) { - if( mFadeOutAnimation ) + if( mTransitionAnimation ) { - mFadeOutAnimation.Clear(); - mFadeOutAnimation.Reset(); + mTransitionAnimation.Clear(); + mTransitionAnimation.Reset(); } if( remove ) { - Actor& fadeOutButtonImage = GetFadeOutButtonImage(); - Actor& fadeOutBackgroundImage = GetFadeOutBackgroundImage(); - - if( fadeOutButtonImage && fadeOutButtonImage.GetParent() ) - { - fadeOutButtonImage.GetParent().Remove( fadeOutButtonImage ); - } - - if( fadeOutBackgroundImage && fadeOutBackgroundImage.GetParent() ) - { - fadeOutBackgroundImage.GetParent().Remove( fadeOutBackgroundImage ); - } - - fadeOutButtonImage.Reset(); - fadeOutBackgroundImage.Reset(); + UpdatePaintTransitionState(); } } -void PushButton::FadeInImage( Actor& image, float opacity, int priority ) +void PushButton::FadeInImage( Actor& image, float opacity, Vector3 scale ) { if( image ) { image.SetOpacity( opacity ); - if( !image.GetParent() ) + image.SetScale( scale ); + + if( !mTransitionAnimation ) { - if( priority > -1 ) - { - Self().Insert( priority, image ); - } - else - { - Self().Add( image ); - } + mTransitionAnimation = Dali::Animation::New( GetAnimationTime() ); } - AddToFadeInAnimation( image ); + mTransitionAnimation.AnimateTo( Property( image, Actor::Property::COLOR_ALPHA ), 1.f ); } } -void PushButton::FadeOutImage( ImageLayer layer, Actor& image, float opacity ) +void PushButton::FadeOutImage( Actor& image, float opacity, Vector3 scale ) { if( image ) { - Actor& fadeOutButtonImage = GetFadeOutButtonImage(); - Actor& fadeOutBackgroundImage = GetFadeOutBackgroundImage(); - - Actor& actorLayer = ( ( Background == layer ) ? fadeOutBackgroundImage : fadeOutButtonImage ); - - actorLayer = image; - actorLayer.SetOpacity( opacity ); - - AddToFadeOutAnimation( actorLayer ); - } -} + image.SetOpacity( opacity ); + image.SetScale( scale ); -void PushButton::FadeOutAnimationFinished( Dali::Animation& source ) -{ - switch( mPaintState ) - { - case UnselectedSelectedTransition: - { - mPaintState = SelectedState; - break; - } - case SelectedUnselectedTransition: - { - mPaintState = UnselectedState; - break; - } - case UnselectedDisabledTransition: - { - mPaintState = DisabledUnselectedState; - break; - } - case DisabledUnselectedTransition: - { - mPaintState = UnselectedState; - break; - } - case SelectedDisabledTransition: - { - mPaintState = DisabledSelectedState; - break; - } - case DisabledSelectedTransition: - { - mPaintState = SelectedState; - break; - } - default: + if( !mTransitionAnimation ) { - break; + mTransitionAnimation = Dali::Animation::New( GetAnimationTime() ); } - } - StopFadeOutAnimation(); + mTransitionAnimation.AnimateTo( Property( image, Actor::Property::COLOR_ALPHA ), 0.f ); + } } -void PushButton::FadeInAnimationFinished( Dali::Animation& source ) +void PushButton::TransitionAnimationFinished( Dali::Animation& source ) { - switch( mPaintState ) - { - case UnselectedSelectedTransition: - { - mPaintState = SelectedState; - break; - } - case SelectedUnselectedTransition: - { - mPaintState = UnselectedState; - break; - } - case UnselectedDisabledTransition: - { - mPaintState = DisabledUnselectedState; - break; - } - case DisabledUnselectedTransition: - { - mPaintState = UnselectedState; - break; - } - case SelectedDisabledTransition: - { - mPaintState = DisabledSelectedState; - break; - } - case DisabledSelectedTransition: - { - mPaintState = SelectedState; - break; - } - default: - { - break; - } - } - - StopFadeInAnimation(); + StopTransitionAnimation(); } } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.h b/dali-toolkit/internal/controls/buttons/push-button-impl.h index 89bce4b..3eddddc 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.h @@ -62,69 +62,72 @@ protected: */ virtual ~PushButton(); -public: // From Button +private: // From Button /** - * @copydoc Toolkit::Internal::Button::SetButtonImage( Actor image ) + * @copydoc Toolkit::Internal::Button::OnButtonInitialize() */ - virtual void SetButtonImage( Actor image ); + virtual void OnButtonInitialize(); /** - * @copydoc Toolkit::Internal::Button::SetSelectedImage( Actor image ) + * @copydoc Toolkit::Internal::Button::OnLabelSet() */ - virtual void SetSelectedImage( Actor image ); + virtual void OnLabelSet(); /** - * @copydoc Toolkit::Internal::Button::SetBackgroundImage( Actor image ) + * @copydoc Toolkit::Internal::Button::OnButtonImageSet() */ - virtual void SetBackgroundImage( Actor image ); + virtual void OnButtonImageSet(); /** - * @copydoc Toolkit::Internal::Button::SetDisabledImage( Actor image ) + * @copydoc Toolkit::Internal::Button::OnSelectedImageSet() */ - virtual void SetDisabledImage( Actor image ); + virtual void OnSelectedImageSet(); /** - * @copydoc Toolkit::Internal::Button::SetDisabledBackgroundImage( Actor image ) + * @copydoc Toolkit::Internal::Button::OnBackgroundImage() */ - virtual void SetDisabledBackgroundImage( Actor image ); + virtual void OnBackgroundImageSet(); -private: // From Button + /** + * @copydoc Toolkit::Internal::Button::OnSelectedBackgroundImageSet() + */ + virtual void OnSelectedBackgroundImageSet(); /** - * @copydoc Toolkit::Internal::Button::OnButtonInitialize() + * @copydoc Toolkit::Internal::Button::OnDisabledImageSet() */ - virtual void OnButtonInitialize(); + virtual void OnDisabledImageSet(); /** - * @copydoc Toolkit::Internal::Button::OnLabelSet() + * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet() */ - virtual void OnLabelSet(); + virtual void OnDisabledBackgroundImageSet(); /** * @copydoc Toolkit::Internal::Button::OnSelected() */ - virtual void OnSelected( bool selected ); + virtual bool OnSelected(); /** - * @copydoc Toolkit::Internal::Button::OnDisabled( bool disabled ) + * @copydoc Toolkit::Internal::Button::OnDisabled() */ - virtual void OnDisabled( bool disabled ); + virtual bool OnDisabled(); /** * @copydoc Toolkit::Internal::Button::OnPressed() */ - virtual void OnPressed(); + virtual bool OnPressed(); /** * @copydoc Toolkit::Internal::Button::OnReleased() */ - virtual void OnReleased(); + virtual bool OnReleased(); /** - * @copydoc Toolkit::Internal::Button::OnClicked() + * @copydoc Toolkit::Internal::Button::StopAllAnimations() */ - virtual void OnClicked(); + virtual void StopAllAnimations(); private: // From Control @@ -141,89 +144,40 @@ private: // From Control private: /** - * Used in the FadeOut functions. - */ - enum ImageLayer - { - Background, ///< Fade out the background. - Foreground ///< Fade out the foreground. - }; - - /** - * Gets the button image that is fading out. - * @return A reference to the button image that is fading out. + * Starts the transition animation. + * PushButton::TransitionAnimationFinished slot is called when the animation finishes. */ - Actor& GetFadeOutButtonImage(); + void StartTransitionAnimation(); /** - * Gets the background image that is fading out. - * @return A reference to the background image that is fading out. - */ - Actor& GetFadeOutBackgroundImage(); - - /** - * Adds the actor to the fade in animation. It creates a fade in animation if needed. - * @param[in] actor The actor. - */ - void AddToFadeInAnimation( const Actor& actor ); - - /** - * Starts the fade in animation. - * PushButton::FadeInAnimationFinished slot is called when the animation finishes. - */ - void StartFadeInAnimation(); - - /** - * Stops the fade in animation. - */ - void StopFadeInAnimation(); - - /** - * Adds the actor to the fade out animation. It creates a fade out animation if needed. - */ - void AddToFadeOutAnimation( const Actor& actor ); - - /** - * Starts the fade out animation. - * PushButton::FadeOutAnimationFinished slot is called when the animation finishes. - */ - void StartFadeOutAnimation(); - - /** - * Stops the fade out animation. - * It removes the actor stored in PushButton::mFadeOutBackgroundImage and PushButton::mFadeOutCheckedImage. + * Stops the transition animation. * @param[in] remove If true, removes the fadeout actor from root. */ - void StopFadeOutAnimation( bool remove = true ); + void StopTransitionAnimation( bool remove = true ); /** * It adds the actor to the root actor and to the fade in animation. * @param[inout] image The actor. * @param[in] opacity The initial opacity. + * @param[in] scale The initial scale. */ - void FadeInImage( Actor& image, float opacity = 0.f, int priority = -1 ); + void FadeInImage( Actor& image, float opacity = 0.f, Vector3 scale = Vector3( 1.f, 1.f, 1.f ) ); /** * It adds the actor fade out animation and stores it to be removed when the animation finishes. * @param[in] layer Defines if the actor is going to be stored in the mFadeOutBackgroundImage or mFadeOutCheckedImage member. * @param[inout] image The actor. * @param[in] opacity The initial opacity. + * @param[in] scale The initial scale. */ - void FadeOutImage( ImageLayer layer, Actor& image, float opacity = 1.f ); + void FadeOutImage( Actor& image, float opacity = 1.f, Vector3 scale = Vector3( 1.f, 1.f, 1.f ) ); // slots /** - * Called when the fade out animation finishes. - * It changes the check button paint state and removes actors from the root. + * Called when the transition animation finishes. */ - void FadeOutAnimationFinished( Dali::Animation& source ); - - /** - * Called when the fade in animation finishes. - * It changes the check button paint state. - */ - void FadeInAnimationFinished( Dali::Animation& source ); + void TransitionAnimationFinished( Dali::Animation& source ); private: @@ -235,15 +189,8 @@ private: private: - Animation mFadeInAnimation; ///< Animation used in the state transitions. - Animation mFadeOutAnimation; ///< Animation used in the state transitions. - - Actor mFadeOutButtonContent; ///< Stores a foreground content, which is in a fade out animation, to be removed when the animation finishes. - Actor mFadeOutBackgroundContent; ///< Stores a background content, which is in a fade out animation, to be removed when the animation finishes. - + Animation mTransitionAnimation; ///< Animation used in the state transitions. Vector3 mSize; ///< The button's size. - - PaintState mPaintState; ///< The paint state. }; } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp b/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp index 05dba27..96b588c 100644 --- a/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp @@ -45,7 +45,7 @@ TypeRegistration typeRegistration( typeid( Toolkit::RadioButton ), typeid( Toolk const char* const UNSELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-unselected.png"; const char* const SELECTED_BUTTON_IMAGE_DIR = DALI_IMAGE_DIR "radio-button-selected.png"; -const float DISTANCE_BETWEEN_IMAGE_AND_LABEL = 5.0f; +const float DISTANCE_BETWEEN_IMAGE_AND_LABEL( 5.0f ); } Dali::Toolkit::RadioButton RadioButton::New() @@ -72,26 +72,6 @@ RadioButton::~RadioButton() { } -void RadioButton::SetImage( Actor image ) -{ - mLayoutContainer.RemoveChildAt( Toolkit::TableView::CellPosition( 0, 0 ) ); - mLayoutContainer.AddChild( image, Toolkit::TableView::CellPosition( 0, 0 ) ); - - RelayoutRequest(); -} - -void RadioButton::SetButtonImage( Actor image ) -{ - Actor& buttonImage = GetButtonImage(); - buttonImage = image; -} - -void RadioButton::SetSelectedImage( Actor image ) -{ - Actor& selectedImage = GetSelectedImage(); - selectedImage = image; -} - void RadioButton::OnButtonInitialize() { Actor self = Self(); @@ -99,21 +79,12 @@ void RadioButton::OnButtonInitialize() // Wrap size of radio button around all its children self.SetResizePolicy( FIT_TO_CHILDREN, ALL_DIMENSIONS ); - // Create the layout container empty at first - mLayoutContainer = Toolkit::TableView::New( 0, 0 ); - mLayoutContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - mLayoutContainer.SetParentOrigin( ParentOrigin::TOP_LEFT ); - mLayoutContainer.SetResizePolicy( FIT_TO_CHILDREN, ALL_DIMENSIONS ); - self.Add( mLayoutContainer ); - Image buttonImage = Dali::ResourceImage::New( UNSELECTED_BUTTON_IMAGE_DIR ); Image selectedImage = Dali::ResourceImage::New( SELECTED_BUTTON_IMAGE_DIR ); SetButtonImage( ImageActor::New( buttonImage ) ); SetSelectedImage( ImageActor::New( selectedImage ) ); - SetImage( GetButtonImage() ); - RelayoutRequest(); } @@ -135,37 +106,71 @@ void RadioButton::OnLabelSet() if( label ) { - // Add padding to the left of the label to create distance from the image - label.SetPadding( Padding( DISTANCE_BETWEEN_IMAGE_AND_LABEL, 0.0f, 0.0f, 0.0f ) ); + label.SetParentOrigin( ParentOrigin::CENTER_LEFT ); + label.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); - mLayoutContainer.RemoveChildAt( Toolkit::TableView::CellPosition( 0, 1 ) ); - mLayoutContainer.AddChild( label, Toolkit::TableView::CellPosition( 0, 1 ) ); + if( IsSelected() ) + { + label.SetX( GetSelectedImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); + } + else + { + label.SetX( GetButtonImage().GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); + } } } -void RadioButton::OnSelected( bool selected ) +bool RadioButton::OnSelected() { - if( selected ) + Actor& buttonImage = GetButtonImage(); + Actor& selectedImage = GetSelectedImage(); + Actor& label = GetLabel(); + + PaintState paintState = GetPaintState(); + + switch( paintState ) { - Actor parent = Self().GetParent(); - if( parent ) + case UnselectedState: { - for( unsigned int i = 0; i < parent.GetChildCount(); ++i ) + Actor parent = Self().GetParent(); + if( parent ) { - Dali::Toolkit::RadioButton radioButtonChild = Dali::Toolkit::RadioButton::DownCast( parent.GetChildAt( i ) ); - if( radioButtonChild ) + for( unsigned int i = 0; i < parent.GetChildCount(); ++i ) { - radioButtonChild.SetSelected( false ); + Dali::Toolkit::RadioButton radioButtonChild = Dali::Toolkit::RadioButton::DownCast( parent.GetChildAt( i ) ); + if( radioButtonChild && radioButtonChild != Self() ) + { + radioButtonChild.SetSelected( false ); + } } } + + RemoveChild( buttonImage ); + + if( label ) + { + label.SetX( selectedImage.GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); + } + break; } + case SelectedState: + { + RemoveChild( selectedImage ); - SetImage( GetSelectedImage() ); - } - else - { - SetImage( GetButtonImage() ); + if( label ) + { + label.SetX( buttonImage.GetNaturalSize().width + DISTANCE_BETWEEN_IMAGE_AND_LABEL ); + } + break; + } + default: + { + break; + } } + + // there is no animation + return false; } } // namespace Internal diff --git a/dali-toolkit/internal/controls/buttons/radio-button-impl.h b/dali-toolkit/internal/controls/buttons/radio-button-impl.h index 43a3c62..d525a43 100644 --- a/dali-toolkit/internal/controls/buttons/radio-button-impl.h +++ b/dali-toolkit/internal/controls/buttons/radio-button-impl.h @@ -46,42 +46,22 @@ public: /** * Create a new RadioButton. * - * @return A smart-pointer to the newly allocated PushButton. + * @return A smart-pointer to the newly allocated RadioButton. */ static Dali::Toolkit::RadioButton New(); - /** - * Construct a new PushButton. - */ - RadioButton(); - - /** - * Construct a new PushButton with label. - */ - RadioButton( const std::string& label ); +private: /** - * Construct a new PushButton with label. + * Construct a new RadioButton. */ - RadioButton( Actor label ); + RadioButton(); /** * A reference counted object may only be deleted by calling Unreference() */ virtual ~RadioButton(); -public: // From Button - - /** - * @copydoc Toolkit::Internal::Button::SetButtonImage( Actor image ) - */ - virtual void SetButtonImage( Actor image ); - - /** - * @copydoc Toolkit::Internal::Button::SetSelectedImage( Actor image ) - */ - virtual void SetSelectedImage( Actor image ); - private: // From Button /** @@ -97,7 +77,7 @@ private: // From Button /** * @copydoc Toolkit::Internal::Button::OnSelected() */ - virtual void OnSelected( bool selected ); + virtual bool OnSelected(); /** * @copydoc Toolkit::Internal::Button::OnLabelSet() @@ -106,25 +86,11 @@ private: // From Button private: - /** - * @brief Set the image to display - * - * @param[in] image The image to set - */ - void SetImage( Actor image ); - -private: - // Undefined RadioButton( const RadioButton& origin ); // Undefined RadioButton& operator=( const RadioButton& origin ); - -private: - - Toolkit::TableView mLayoutContainer; ///< Container to position button images and labels - }; } // namespace Internal diff --git a/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp b/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp index 1084302..4974ce1 100644 --- a/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp +++ b/dali-toolkit/internal/controls/cluster/cluster-style-impl.cpp @@ -295,8 +295,8 @@ void ClusterStyle::Apply( Actor actor, if( animationDuration > 0.f ) { Animation animation = Animation::New(animationDuration); - animation.MoveTo( actor, position, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds ); - animation.Resize( actor, size, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION ), position, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); + animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); animation.Play(); } else @@ -318,10 +318,10 @@ void ClusterStyle::Apply( Actor actor, if( animationDuration > 0.f ) { Animation animation = Animation::New(animationDuration); - animation.MoveTo( actor, position, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds ); - animation.Resize( actor, size, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds ); - animation.RotateTo( actor, rotation, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds ); - animation.ScaleTo( actor, scale, alpha, durationSeconds.delaySeconds, durationSeconds.durationSeconds ); + animation.AnimateTo( Property( actor, Actor::Property::POSITION ), position, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); + animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); + animation.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), rotation, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); + animation.AnimateTo( Property( actor, Actor::Property::SCALE ), scale, alpha, TimePeriod( durationSeconds.delaySeconds, durationSeconds.durationSeconds ) ); animation.Play(); } else diff --git a/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp b/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp index 91fb19f..84eb4e4 100644 --- a/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp +++ b/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp @@ -264,11 +264,12 @@ void NavigationControl::OrientationChanged( int angle ) } } + Actor self = Self(); Animation animation = Animation::New( mOrientationAnimationDuration ); - animation.RotateTo( Self(), Degree( -angle ), Vector3::ZAXIS, mOrientationAnimationAlphaFunc ); + animation.AnimateTo( Property( self, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -angle ) ), Vector3::ZAXIS ), mOrientationAnimationAlphaFunc ); animation.Play(); - Self().SetSize( targetSize ); + self.SetSize( targetSize ); RelayoutRequest(); } diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index 1bb4853..42981a3 100755 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -223,11 +223,10 @@ void Popup::SetBackgroundImage( Actor image ) // OnDialogTouched only consume the event. It prevents the touch event to be caught by the backing. mBackgroundImage.TouchedSignal().Connect( this, &Popup::OnDialogTouched ); - mBackgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + mBackgroundImage.SetResizePolicy( SIZE_FIXED_OFFSET_FROM_PARENT, ALL_DIMENSIONS ); mBackgroundImage.SetAnchorPoint( AnchorPoint::CENTER ); mBackgroundImage.SetParentOrigin( ParentOrigin::CENTER ); - mBackgroundImage.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT ); Vector3 border( mPopupStyle->backgroundOuterBorder.x, mPopupStyle->backgroundOuterBorder.z, 0.0f ); mBackgroundImage.SetSizeModeFactor( border ); @@ -278,7 +277,7 @@ void Popup::SetTitle( const std::string& text ) { mTitle.SetPadding( Padding( 0.0f, 0.0f, mPopupStyle->margin, mPopupStyle->margin ) ); mTitle.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - mTitle.SetDimensionDependency( HEIGHT, WIDTH ); // HeightForWidth + mTitle.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); mPopupLayout.AddChild( mTitle, Toolkit::TableView::CellPosition( 0, 0 ) ); } diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp index bae2b78..cd3a764 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -250,6 +250,8 @@ void ScrollBar::OnScrollPositionNotified(PropertyNotification& source) void ScrollBar::Show() { + Actor self = Self(); + // Cancel any animation if(mAnimation) { @@ -260,17 +262,19 @@ void ScrollBar::Show() if(mIndicatorShowDuration > 0.0f) { mAnimation = Animation::New( mIndicatorShowDuration ); - mAnimation.OpacityTo( Self(), 1.0f, AlphaFunctions::EaseIn ); + mAnimation.AnimateTo( Property( self, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn ); mAnimation.Play(); } else { - Self().SetOpacity(1.0f); + self.SetOpacity(1.0f); } } void ScrollBar::Hide() { + Actor self = Self(); + // Cancel any animation if(mAnimation) { @@ -281,12 +285,12 @@ void ScrollBar::Hide() if(mIndicatorHideDuration > 0.0f) { mAnimation = Animation::New( mIndicatorHideDuration ); - mAnimation.OpacityTo( Self(), 0.0f, AlphaFunctions::EaseIn ); + mAnimation.AnimateTo( Property( self, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunctions::EaseIn ); mAnimation.Play(); } else { - Self().SetOpacity(0.0f); + self.SetOpacity(0.0f); } } diff --git a/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp b/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp index 1dfced0..b01505b 100755 --- a/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-component/scroll-bar-internal-impl.cpp @@ -393,32 +393,32 @@ ScrollBarInternal::ScrollBarInternal(Toolkit::Scrollable& container, bool vertic // target the container to observe for scrolling Actor target = mContainer.Self(); Constraint constraint = Constraint::New( Actor::Property::VISIBLE, - Source( target, vertical ? target.GetPropertyIndex(Scrollable::SCROLLABLE_CAN_SCROLL_VERTICAL) : target.GetPropertyIndex(Scrollable::SCROLLABLE_CAN_SCROLL_HORIZONTAL)), + Source( target, vertical ? Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL : Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL), ScrollBarInternalVisibilityConstraint ); mSlider.ApplyConstraint( constraint ); mSliderWrap.ApplyConstraint( constraint ); constraint = Constraint::New( Actor::Property::SIZE, - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), + Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( target, Actor::Property::SIZE ), ScrollBarInternalSizeConstraint( vertical ) ); mSlider.ApplyConstraint( constraint ); mSliderWrap.ApplyConstraint( constraint ); constraint = Constraint::New( Actor::Property::ORIENTATION, - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), + Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ), ScrollBarInternalRotationConstraint( vertical ) ); mSlider.ApplyConstraint( constraint ); mSliderWrap.ApplyConstraint( constraint ); constraint = Constraint::New( Actor::Property::POSITION, Source( mSlider, Actor::Property::SIZE), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_RELATIVE_POSITION_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), + Source( target, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), + Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( target, Actor::Property::SIZE ), ScrollBarInternalPositionConstraint(vertical) ); @@ -426,10 +426,10 @@ ScrollBarInternal::ScrollBarInternal(Toolkit::Scrollable& container, bool vertic constraint = Constraint::New( Actor::Property::POSITION, Source( mSlider, Actor::Property::SIZE), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_RELATIVE_POSITION_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), + Source( target, Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source( target, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), + Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( target, Actor::Property::SIZE ), ScrollBarInternalPositionConstraint(vertical, true) ); mSliderWrap.ApplyConstraint( constraint ); @@ -447,7 +447,7 @@ ScrollBarInternal::ScrollBarInternal(Toolkit::Scrollable& container, bool vertic mContainer.AddOverlay( mHitArea ); constraint = Constraint::New( Actor::Property::SIZE, - Source( target, target.GetPropertyIndex( Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME ) ), + Source( target, Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( target, Actor::Property::SIZE ), ScrollBarInternalHitSizeConstraint(vertical, BAR_TAB_SIZE.width) ); mHitArea.ApplyConstraint( constraint ); @@ -558,8 +558,8 @@ void ScrollBarInternal::Show() } mAnimation = Animation::New( BAR_SHOW_TIME ); - mAnimation.OpacityTo( mSlider, 1.0f, AlphaFunctions::EaseIn ); - mAnimation.OpacityTo( mSliderWrap, 1.0f, AlphaFunctions::EaseIn ); + mAnimation.AnimateTo( Property( mSlider, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn ); + mAnimation.AnimateTo( Property( mSliderWrap, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunctions::EaseIn ); mAnimation.Play(); DestructTimer(); @@ -575,8 +575,8 @@ void ScrollBarInternal::Hide() } mAnimation = Animation::New( BAR_HIDE_TIME ); - mAnimation.OpacityTo( mSlider, 0.0f, AlphaFunctions::EaseIn ); - mAnimation.OpacityTo( mSliderWrap, 0.0f, AlphaFunctions::EaseIn ); + mAnimation.AnimateTo( Property( mSlider, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunctions::EaseIn ); + mAnimation.AnimateTo( Property( mSliderWrap, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunctions::EaseIn ); mAnimation.Play(); } diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index f9b3281..43f134d 100644 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -362,8 +362,6 @@ ItemView::ItemView(ItemFactory& factory) void ItemView::OnInitialize() { - RegisterCommonProperties(); - Actor self = Self(); // Disable size negotiation for item views @@ -379,10 +377,10 @@ void ItemView::OnInitialize() EnableScrollComponent(Toolkit::Scrollable::OvershootIndicator); - Constraint constraint = Constraint::New(mPropertyRelativePosition, + Constraint constraint = Constraint::New(Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION, LocalSource(mPropertyPosition), - LocalSource(mPropertyPositionMin), - LocalSource(mPropertyPositionMax), + LocalSource(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN), + LocalSource(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX), LocalSource(Actor::Property::SIZE), RelativePositionConstraint); self.ApplyConstraint(constraint); @@ -473,8 +471,7 @@ void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSiz if(mActiveLayout->GetItemSize(itemId, targetSize, size)) { // resize immediately - actor.SetResizePolicy( FIXED, ALL_DIMENSIONS ); - actor.SetPreferredSize( size.GetVectorXY() ); + actor.SetSize( size.GetVectorXY() ); } mActiveLayout->ApplyConstraints(actor, itemId, durationSeconds, mScrollPositionObject, Self() ); @@ -520,7 +517,7 @@ void ItemView::ActivateLayout(unsigned int layoutIndex, const Vector3& targetSiz Radian scrollDirection(mActiveLayout->GetScrollDirection()); float orientation = static_cast(mActiveLayout->GetOrientation()); - self.SetProperty(mPropertyScrollDirection, Vector3(sinf(scrollDirection), cosf(scrollDirection), orientation)); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_DIRECTION, Vector3(sinf(scrollDirection), cosf(scrollDirection), orientation)); self.SetProperty(mPropertyScrollSpeed, mScrollSpeed); @@ -996,8 +993,7 @@ void ItemView::SetupActor( Item item, float durationSeconds ) Vector3 size; if( mActiveLayout->GetItemSize( item.first, mActiveLayoutTargetSize, size ) ) { - item.second.SetResizePolicy( FIXED, ALL_DIMENSIONS ); - item.second.SetPreferredSize( size.GetVectorXY() ); + item.second.SetSize( size.GetVectorXY() ); } mActiveLayout->ApplyConstraints( item.second, item.first, durationSeconds, mScrollPositionObject, Self() ); @@ -1455,22 +1451,22 @@ void ItemView::CalculateDomainSize(const Vector3& layoutSize) if(IsHorizontal(mActiveLayout->GetOrientation())) { - self.SetProperty(mPropertyPositionMin, Vector3(0.0f, firstItemPosition.x, 0.0f)); - self.SetProperty(mPropertyPositionMax, Vector3(0.0f, lastItemPosition.x, 0.0f)); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN, Vector3(0.0f, firstItemPosition.x, 0.0f)); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, Vector3(0.0f, lastItemPosition.x, 0.0f)); domainSize = fabs(firstItemPosition.x - lastItemPosition.x); } else { - self.SetProperty(mPropertyPositionMin, Vector3(0.0f, firstItemPosition.y, 0.0f)); - self.SetProperty(mPropertyPositionMax, Vector3(0.0f, lastItemPosition.y, 0.0f)); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN, Vector3(0.0f, firstItemPosition.y, 0.0f)); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, Vector3(0.0f, lastItemPosition.y, 0.0f)); domainSize = fabs(firstItemPosition.y - lastItemPosition.y); } mScrollConnector.SetScrollDomain(minLayoutPosition, 0.0f, domainSize); bool isLayoutScrollable = IsLayoutScrollable(layoutSize); - self.SetProperty(mPropertyCanScrollVertical, isLayoutScrollable); - self.SetProperty(mPropertyCanScrollHorizontal, false); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL, isLayoutScrollable); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL, false); } } @@ -1478,8 +1474,8 @@ Vector3 ItemView::GetDomainSize() const { Actor self = Self(); - float minScrollPosition = self.GetProperty(mPropertyPositionMin); - float maxScrollPosition = self.GetProperty(mPropertyPositionMax); + float minScrollPosition = self.GetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN); + float maxScrollPosition = self.GetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX); return Vector3(0.0f, fabs(maxScrollPosition - minScrollPosition), 0.0f); } @@ -1566,7 +1562,7 @@ void ItemView::SetOvershootEnabled( bool enable ) self.Add(mOvershootOverlay); Constraint constraint = Constraint::New( Actor::Property::SIZE, - ParentSource( mPropertyScrollDirection ), + ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ), ParentSource( Actor::Property::SIZE ), OvershootOverlaySizeConstraint() ); @@ -1574,20 +1570,20 @@ void ItemView::SetOvershootEnabled( bool enable ) mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height); constraint = Constraint::New( Actor::Property::ORIENTATION, - ParentSource( mPropertyScrollDirection ), + ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ), OvershootOverlayRotationConstraint() ); mOvershootOverlay.ApplyConstraint(constraint); constraint = Constraint::New( Actor::Property::POSITION, ParentSource( Actor::Property::SIZE ), - ParentSource( mPropertyScrollDirection ), + ParentSource( Toolkit::Scrollable::Property::SCROLL_DIRECTION ), Source( mScrollPositionObject, ScrollConnector::OVERSHOOT ), OvershootOverlayPositionConstraint() ); mOvershootOverlay.ApplyConstraint(constraint); constraint = Constraint::New( Actor::Property::VISIBLE, - ParentSource( mPropertyCanScrollVertical ), + ParentSource( Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL ), OvershootOverlayVisibilityConstraint() ); mOvershootOverlay.ApplyConstraint(constraint); @@ -1642,7 +1638,12 @@ void ItemView::AnimateScrollOvershoot(float overshootAmount, bool animateBack) if(mOvershootAnimationSpeed > Math::MACHINE_EPSILON_0) { float currentOvershoot = mScrollPositionObject.GetProperty(ScrollConnector::OVERSHOOT); - float duration = mOvershootOverlay.GetCurrentSize().height * (animatingOn ? (1.0f - fabsf(currentOvershoot)) : fabsf(currentOvershoot)) / mOvershootAnimationSpeed; + float duration = 0.0f; + + if (mOvershootOverlay) + { + duration = mOvershootOverlay.GetCurrentSize().height * (animatingOn ? (1.0f - fabsf(currentOvershoot)) : fabsf(currentOvershoot)) / mOvershootAnimationSpeed; + } RemoveAnimation(mScrollOvershootAnimation); mScrollOvershootAnimation = Animation::New(duration); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp index 60cb127..44ceade 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp @@ -33,23 +33,9 @@ namespace Internal // ScrollBase /////////////////////////////////////////////////////////////////////////////////////////////////// -const char* const ScrollBase::SCROLL_DOMAIN_OFFSET_PROPERTY_NAME = "domain-offset"; - ScrollBase::ScrollBase() : Scrollable(), mParent(NULL), - mPropertyTime(Property::INVALID_INDEX), - mPropertyPrePosition(Property::INVALID_INDEX), - mPropertyPosition(Property::INVALID_INDEX), - mPropertyOvershootX(Property::INVALID_INDEX), - mPropertyOvershootY(Property::INVALID_INDEX), - mPropertyWrap(Property::INVALID_INDEX), - mPropertyPanning(Property::INVALID_INDEX), - mPropertyScrolling(Property::INVALID_INDEX), - mPropertyFinal(Property::INVALID_INDEX), - mPropertyDomainOffset(Property::INVALID_INDEX), - mPropertyPositionDelta(Property::INVALID_INDEX), - mPropertyScrollStartPagePosition(Property::INVALID_INDEX), mDelay(0.0f) { } @@ -59,28 +45,6 @@ void ScrollBase::SetParent(ScrollBase *parent) mParent = parent; } -void ScrollBase::RegisterProperties() -{ - Actor self = Self(); - - // Register common properties - RegisterCommonProperties(); - - // Register Scroll Properties. - mPropertyTime = self.RegisterProperty(Toolkit::ScrollView::SCROLL_TIME_PROPERTY_NAME, 0.0f); - mPropertyPrePosition = self.RegisterProperty(Toolkit::ScrollView::SCROLL_PRE_POSITION_PROPERTY_NAME, Vector3::ZERO); - mPropertyPosition = self.RegisterProperty(Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME, Vector3::ZERO); - mPropertyOvershootX = self.RegisterProperty(Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME, 0.0f); - mPropertyOvershootY = self.RegisterProperty(Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME, 0.0f); - mPropertyFinal = self.RegisterProperty(Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME, Vector3::ZERO); - mPropertyWrap = self.RegisterProperty(Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME, false); - mPropertyPanning = self.RegisterProperty(Toolkit::ScrollView::SCROLL_PANNING_PROPERTY_NAME, false); - mPropertyScrolling = self.RegisterProperty(Toolkit::ScrollView::SCROLL_SCROLLING_PROPERTY_NAME, false); - mPropertyDomainOffset = self.RegisterProperty(SCROLL_DOMAIN_OFFSET_PROPERTY_NAME, Vector3::ZERO); - mPropertyPositionDelta = self.RegisterProperty(Toolkit::ScrollView::SCROLL_POSITION_DELTA_PROPERTY_NAME, Vector3::ZERO); - mPropertyScrollStartPagePosition = self.RegisterProperty(Toolkit::ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME, Vector3::ZERO); -} - void ScrollBase::BindActor(Actor child) { FindAndUnbindActor(child); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h index 968e3ab..a4b955c 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h @@ -191,26 +191,9 @@ protected: */ ScrollBase(); - /** - * 2nd-phase initialization. - */ - void RegisterProperties(); - protected: ScrollBase *mParent; ///< Pointer to ScrollBase parent, if exists. - Property::Index mPropertyTime; ///< Scroll Time (0 to animationDuration while animating, otherwise 0) - Property::Index mPropertyPrePosition; ///< Scroll Position ("scroll-position") [function of scroll-x, scroll-y] - Property::Index mPropertyPosition; ///< Scroll Position ("scroll-position") [function of scroll-pre-position] - Property::Index mPropertyOvershootX; ///< Scroll Overshoot ("scroll-overshoot-x") [function of scroll-pre-position, scroll-position] - Property::Index mPropertyOvershootY; ///< Scroll Overshoot ("scroll-overshoot-y") [function of scroll-pre-position, scroll-position] - Property::Index mPropertyWrap; ///< Scroll Wrap ("scroll-wrap") - Property::Index mPropertyPanning; ///< Whether we are panning - Property::Index mPropertyScrolling; ///< Whether we are scrolling - Property::Index mPropertyFinal; ///< Scroll Final Position ("scroll-final") [scroll-position + f(scroll-overshoot)] - Property::Index mPropertyDomainOffset; ///< Scroll Domain Offset ("scroll-domain-offset") keeps track of scroll position as it wraps domains - Property::Index mPropertyPositionDelta; ///< Scroll Position Delta ("scroll-position-delta") - Property::Index mPropertyScrollStartPagePosition; ///< Scroll Start Page Position ("scroll-start-page-position") private: diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp index b02d3fc..c3a900e 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp @@ -158,7 +158,7 @@ ScrollOvershootEffectRipple::ScrollOvershootEffectRipple( bool vertical, Scrolla void ScrollOvershootEffectRipple::Apply() { Actor self = mAttachedScrollView.Self(); - mOvershootProperty = self.GetPropertyIndex(IsVertical() ? Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME : Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME); + mOvershootProperty = IsVertical() ? Toolkit::ScrollView::Property::OVERSHOOT_Y : Toolkit::ScrollView::Property::OVERSHOOT_X; // make sure height is set, since we only create a constraint for image width mOvershootOverlay.SetSize(OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.width, OVERSHOOT_BOUNCE_ACTOR_DEFAULT_SIZE.height); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp index ea529ff..6eb200b 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp @@ -83,7 +83,7 @@ public: * @param[in] positionProperty The Actor's Position. * @param[in] scaleProperty The Actor's Scale. * @param[in] sizeProperty The Actor's Size - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) * @param[in] scrollSizeProperty The size of the scroll-view (scrollView SIZE) * @return The new visibility of this Actor. */ @@ -114,7 +114,7 @@ public: * @param[in] positionProperty The Actor's Position. * @param[in] scaleProperty The Actor's Scale. * @param[in] sizeProperty The Actor's Size - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) * @param[in] scrollSizeProperty The size of the scroll-view (scrollView SIZE) * @param[in] activateProperty Activation value (0 - normal, 1.0 - full effect) * @return The new orientation of this Actor. @@ -164,7 +164,7 @@ public: * @param[in] current The current position of this Actor * @param[in] scaleProperty The Actor's Scale. * @param[in] sizeProperty The Actor's Size - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) * @param[in] scrollSizeProperty The size of the scroll-view (scrollView SIZE) * @param[in] activateProperty Activation value (0 - normal, 1.0 - full effect) * @return The new position of this Actor. @@ -234,7 +234,7 @@ void ApplyScrollCarouselConstraints(Toolkit::ScrollView scrollView, LocalSource( Actor::Property::POSITION ), LocalSource( Actor::Property::SCALE ), LocalSource( Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ), Source(scrollView, Actor::Property::SIZE ), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ), boost::bind( &ScrollCarouselEffectInfo::VisibilityConstraint, info, _1, _2, _3, _4, _5, _6) ); @@ -245,7 +245,7 @@ void ApplyScrollCarouselConstraints(Toolkit::ScrollView scrollView, LocalSource( Actor::Property::POSITION ), LocalSource( Actor::Property::SCALE ), LocalSource( Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ), Source(scrollView, Actor::Property::SIZE ), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ), boost::bind( &ScrollCarouselEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); @@ -255,7 +255,7 @@ void ApplyScrollCarouselConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::POSITION, LocalSource( Actor::Property::SCALE ), LocalSource( Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ), Source(scrollView, Actor::Property::SIZE ), Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollViewCarouselEffect::EFFECT_ACTIVATE ) ), boost::bind( &ScrollCarouselEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6) ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp index 938ba1c..dfc980d 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp @@ -64,11 +64,11 @@ public: /** * @param[in] current The current orientation of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new orientation of this Actor. */ Quaternion RotationConstraint(const Quaternion& current, @@ -134,11 +134,11 @@ public: /** * @param[in] current The current color of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new color of this Actor. */ Vector4 ColorConstraint(const Vector4& current, @@ -208,11 +208,11 @@ public: /** * @param[in] current The current position * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new position of this Actor. */ Vector3 PositionConstraint(const Vector3& current, @@ -305,11 +305,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Constraint constraint; constraint = Constraint::New( Actor::Property::ORIENTATION, Source(parentPage, Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollCubeEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -317,11 +317,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::COLOR, Source(parentPage, Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollCubeEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -329,11 +329,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::POSITION, Source(parentPage, Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollCubeEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp index 8b6003f..0f21d0c 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp @@ -93,11 +93,11 @@ struct ScrollDepthScaleConstraint /** * @param[in] current The current scale * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new scale of this Actor. */ Vector3 operator()(const Vector3& currentScale, @@ -218,11 +218,11 @@ struct ScrollDepthPositionConstraint /** * @param[in] current The current position * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new position of this Actor. */ Vector3 operator()(const Vector3& currentPosition, @@ -339,9 +339,9 @@ void ApplyScrollDepthConstraints(Toolkit::ScrollView scrollView, Constraint constraint = Constraint::New( Actor::Property::SCALE, LocalSource(Actor::Property::POSITION), ParentSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), ScrollDepthScaleConstraint( positionExtent, offsetExtent, positionScale, scaleExtent ) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -350,11 +350,11 @@ void ApplyScrollDepthConstraints(Toolkit::ScrollView scrollView, // Position Constraint (apply last as other constraints use Actor::POSITION as a function input) constraint = Constraint::New( Actor::Property::POSITION, ParentSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_POSITION ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), ScrollDepthPositionConstraint( positionExtent, offsetExtent, positionScale ) ); constraint.SetRemoveAction( Constraint::Discard ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 5111cec..ee5163c 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -29,6 +29,7 @@ // INTERNAL INCLUDES #include +#include #include #include #include @@ -213,6 +214,18 @@ BaseHandle Create() // Setup properties, signals and actions using the type-registry. DALI_TYPE_REGISTRATION_BEGIN( Toolkit::ScrollView, Toolkit::Scrollable, Create ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scroll-position", VECTOR3, SCROLL_POSITION) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scroll-pre-position", VECTOR3, SCROLL_PRE_POSITION) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "overshoot-x", FLOAT, OVERSHOOT_X) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "overshoot-y", FLOAT, OVERSHOOT_Y) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scroll-final", VECTOR3, SCROLL_FINAL) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "wrap", BOOLEAN, WRAP) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "panning", BOOLEAN, PANNING) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scrolling", BOOLEAN, SCROLLING) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scroll-domain-offset", VECTOR3, SCROLL_DOMAIN_OFFSET) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "scroll-position-delta", VECTOR3, SCROLL_POSITION_DELTA) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( ScrollView, "start-page-position", VECTOR3, START_PAGE_POSITION) + DALI_SIGNAL_REGISTRATION( ScrollView, "value-changed", SIGNAL_SNAP_STARTED ) DALI_TYPE_REGISTRATION_END() @@ -420,7 +433,7 @@ struct InternalPositionConstraint /** * This constraint updates the X overshoot property using the difference - * mPropertyPrePosition.x and mPropertyPosition.x, returning a relative value between 0.0f and 1.0f + * SCROLL_PRE_POSITION.x and SCROLL_POSITION.x, returning a relative value between 0.0f and 1.0f */ struct OvershootXConstraint { @@ -446,7 +459,7 @@ struct OvershootXConstraint /** * This constraint updates the Y overshoot property using the difference - * mPropertyPrePosition.y and mPropertyPosition.y, returning a relative value between 0.0f and 1.0f + * SCROLL_PRE_POSITION.y and SCROLL_POSITION.y, returning a relative value between 0.0f and 1.0f */ struct OvershootYConstraint { @@ -596,9 +609,6 @@ void ScrollView::OnInitialize() mAlterChild = true; - // Register Scroll Properties. - RegisterProperties(); - mScrollPostPosition = mScrollPrePosition = Vector3::ZERO; mMouseWheelScrollDistanceStep = Stage::GetCurrent().GetSize() * DEFAULT_MOUSE_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION; @@ -617,6 +627,9 @@ void ScrollView::OnInitialize() EnableScrollComponent(Toolkit::Scrollable::OvershootIndicator); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL, mCanScrollVertical); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL, mCanScrollHorizontal); + Vector3 size = GetControlSize(); UpdatePropertyDomain(size); SetInternalConstraints(); @@ -871,24 +884,24 @@ void ScrollView::UpdatePropertyDomain(const Vector3& size) if( mCanScrollVertical != canScrollVertical ) { mCanScrollVertical = canScrollVertical; - self.SetProperty(mPropertyCanScrollVertical, canScrollVertical); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL, canScrollVertical); } if( mCanScrollHorizontal != canScrollHorizontal ) { mCanScrollHorizontal = canScrollHorizontal; - self.SetProperty(mPropertyCanScrollHorizontal, canScrollHorizontal); + self.SetProperty(Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL, canScrollHorizontal); } if( scrollPositionChanged ) { - DALI_LOG_SCROLL_STATE("[0x%X] Domain Changed, setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Domain Changed, setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); } if( domainChanged ) { mMinScroll = min; mMaxScroll = max; - self.SetProperty(mPropertyPositionMin, mMinScroll ); - self.SetProperty(mPropertyPositionMax, mMaxScroll ); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MIN, mMinScroll ); + self.SetProperty(Toolkit::Scrollable::Property::SCROLL_POSITION_MAX, mMaxScroll ); } } @@ -961,7 +974,7 @@ bool ScrollView::GetWrapMode() const void ScrollView::SetWrapMode(bool enable) { mWrapMode = enable; - Self().SetProperty(mPropertyWrap, enable); + Self().SetProperty(Toolkit::ScrollView::Property::WRAP, enable); } int ScrollView::GetScrollUpdateDistance() const @@ -1119,7 +1132,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct this, position.x, position.y, duration, int(horizontalBias), int(verticalBias)); Vector3 currentScrollPosition = GetCurrentScrollPosition(); - self.SetProperty( mPropertyScrollStartPagePosition, currentScrollPosition ); + self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, currentScrollPosition ); if( mScrolling ) // are we interrupting a current scroll? { @@ -1134,7 +1147,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct DALI_LOG_SCROLL_STATE("[0x%X] Interrupting Pan, set to false", this ); mPanning = false; mGestureStackDepth = 0; - self.SetProperty( mPropertyPanning, false ); + self.SetProperty( Toolkit::ScrollView::Property::PANNING, false ); if( mScrollMainInternalPrePositionConstraint ) { @@ -1142,7 +1155,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct } } - self.SetProperty(mPropertyScrolling, true); + self.SetProperty(Toolkit::ScrollView::Property::SCROLLING, true); mScrolling = true; DALI_LOG_SCROLL_STATE("[0x%X] mScrollStartedSignal 1 [%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y); @@ -1158,7 +1171,7 @@ void ScrollView::TransformTo(const Vector3& position, float duration, AlphaFunct if(!animating) { // if not animating, then this pan has completed right now. - self.SetProperty(mPropertyScrolling, false); + self.SetProperty(Toolkit::ScrollView::Property::SCROLLING, false); mScrolling = false; // If we have no duration, then in the next update frame, we will be at the position specified as we just set. @@ -1450,7 +1463,7 @@ bool ScrollView::SnapWithVelocity(Vector2 velocity) if(child) { - Vector3 position = Self().GetProperty(mPropertyPosition); + Vector3 position = Self().GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION); // Get center-point of the Actor. Vector3 childPosition = GetPositionOfAnchor(child, AnchorPoint::CENTER); @@ -1639,15 +1652,15 @@ bool ScrollView::AnimateTo(const Vector3& position, const Vector3& positionDurat if( !(mScrollStateFlags & SCROLL_ANIMATION_FLAGS) ) { - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollTargetPosition.x, mScrollTargetPosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollTargetPosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollTargetPosition.x, mScrollTargetPosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollTargetPosition); mScrollPrePosition = mScrollTargetPosition; mScrollPostPosition = mScrollTargetPosition; WrapPosition(mScrollPostPosition); } DALI_LOG_SCROLL_STATE("[0x%X] position-changed, mScrollTargetPosition[%.2f, %.2f], mScrollPrePosition[%.2f, %.2f], mScrollPostPosition[%.2f, %.2f]", this, mScrollTargetPosition.x, mScrollTargetPosition.y, mScrollPrePosition.x, mScrollPrePosition.y, mScrollPostPosition.x, mScrollPostPosition.y ); - DALI_LOG_SCROLL_STATE("[0x%X] mPropertyPrePosition[%.2f, %.2f], mPropertyPosition[%.2f, %.2f]", this, self.GetProperty( mPropertyPrePosition ).Get().x, self.GetProperty( mPropertyPrePosition ).Get().y, self.GetProperty( mPropertyPosition ).Get().x, self.GetProperty( mPropertyPosition ).Get().y ); + DALI_LOG_SCROLL_STATE("[0x%X] SCROLL_PRE_POSITION[%.2f, %.2f], SCROLL_POSITION[%.2f, %.2f]", this, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ).Get().x, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ).Get().y, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_POSITION ).Get().x, self.GetProperty( Toolkit::ScrollView::Property::SCROLL_POSITION ).Get().y ); } SetScrollUpdateNotification(true); @@ -1728,14 +1741,14 @@ void ScrollView::FindAndUnbindActor(Actor child) Vector3 ScrollView::GetPropertyPrePosition() const { - Vector3 position = Self().GetProperty(mPropertyPrePosition); + Vector3 position = Self().GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION); WrapPosition(position); return position; } Vector3 ScrollView::GetPropertyPosition() const { - Vector3 position = Self().GetProperty(mPropertyPosition); + Vector3 position = Self().GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION); WrapPosition(position); return position; @@ -1751,21 +1764,21 @@ void ScrollView::HandleSnapAnimationFinished() // Emit Signal that scrolling has completed. mScrolling = false; Actor self = Self(); - self.SetProperty(mPropertyScrolling, false); + self.SetProperty(Toolkit::ScrollView::Property::SCROLLING, false); Vector3 deltaPosition(mScrollPrePosition); UpdateLocalScrollProperties(); WrapPosition(mScrollPrePosition); - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); Vector3 currentScrollPosition = GetCurrentScrollPosition(); DALI_LOG_SCROLL_STATE("[0x%X] mScrollCompletedSignal 3 current[%.2f, %.2f], mScrollTargetPosition[%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y, -mScrollTargetPosition.x, -mScrollTargetPosition.y ); mScrollCompletedSignal.Emit( currentScrollPosition ); mDomainOffset += deltaPosition - mScrollPostPosition; - self.SetProperty(mPropertyDomainOffset, mDomainOffset); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET, mDomainOffset); HandleStoppedAnimation(); } @@ -1782,7 +1795,7 @@ void ScrollView::SetScrollUpdateNotification( bool enabled ) if( enabled && !mScrollUpdatedSignal.Empty()) { // Only set up the notification when the application has connected to the updated signal - mScrollXUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 0, StepCondition(mScrollUpdateDistance, 0.0f)); + mScrollXUpdateNotification = self.AddPropertyNotification(Toolkit::ScrollView::Property::SCROLL_POSITION, 0, StepCondition(mScrollUpdateDistance, 0.0f)); mScrollXUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification ); } if( mScrollYUpdateNotification ) @@ -1795,7 +1808,7 @@ void ScrollView::SetScrollUpdateNotification( bool enabled ) if( enabled && !mScrollUpdatedSignal.Empty()) { // Only set up the notification when the application has connected to the updated signal - mScrollYUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 1, StepCondition(mScrollUpdateDistance, 0.0f)); + mScrollYUpdateNotification = self.AddPropertyNotification(Toolkit::ScrollView::Property::SCROLL_POSITION, 1, StepCondition(mScrollUpdateDistance, 0.0f)); mScrollYUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification ); } } @@ -1869,16 +1882,6 @@ void ScrollView::OnChildRemove(Actor& child) UnbindActor(child); } -void ScrollView::OnPropertySet( Property::Index index, Property::Value propertyValue ) -{ - Actor self = Self(); - if( index == mPropertyPrePosition ) - { - DALI_LOG_SCROLL_STATE("[0x%X]: mPropertyPrePosition[%.2f, %.2f]", this, propertyValue.Get().x, propertyValue.Get().y); - propertyValue.Get(mScrollPrePosition); - } -} - void ScrollView::StartTouchDownTimer() { if ( !mTouchDownTimer ) @@ -1917,7 +1920,7 @@ bool ScrollView::OnTouchDownTimeout() mScrollInterrupted = true; // reset domain offset as scrolling from original plane. mDomainOffset = Vector3::ZERO; - Self().SetProperty(mPropertyDomainOffset, Vector3::ZERO); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET, Vector3::ZERO); UpdateLocalScrollProperties(); Vector3 currentScrollPosition = GetCurrentScrollPosition(); @@ -2047,32 +2050,32 @@ bool ScrollView::OnMouseWheelEvent(const MouseWheelEvent& event) void ScrollView::ResetScrolling() { Actor self = Self(); - self.GetProperty(mPropertyPosition).Get(mScrollPostPosition); + self.GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION).Get(mScrollPostPosition); mScrollPrePosition = mScrollPostPosition; - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPostPosition.x, mScrollPostPosition.y ); - self.SetProperty(mPropertyPrePosition, mScrollPostPosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPostPosition.x, mScrollPostPosition.y ); + self.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPostPosition); } void ScrollView::UpdateLocalScrollProperties() { Actor self = Self(); - self.GetProperty(mPropertyPrePosition).Get(mScrollPrePosition); - self.GetProperty(mPropertyPosition).Get(mScrollPostPosition); + self.GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION).Get(mScrollPrePosition); + self.GetProperty(Toolkit::ScrollView::Property::SCROLL_POSITION).Get(mScrollPostPosition); } // private functions void ScrollView::PreAnimatedScrollSetup() { - // mPropertyPrePosition is our unclamped property with wrapping - // mPropertyPosition is our final scroll position after clamping + // SCROLL_PRE_POSITION is our unclamped property with wrapping + // SCROLL_POSITION is our final scroll position after clamping Actor self = Self(); Vector3 deltaPosition(mScrollPostPosition); WrapPosition(mScrollPostPosition); mDomainOffset += deltaPosition - mScrollPostPosition; - Self().SetProperty(mPropertyDomainOffset, mDomainOffset); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET, mDomainOffset); if( mScrollStateFlags & SCROLL_X_STATE_MASK ) { @@ -2103,11 +2106,11 @@ void ScrollView::AnimateInternalXTo( float position, float duration, AlphaFuncti if( duration > Math::MACHINE_EPSILON_10 ) { Actor self = Self(); - DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(mPropertyPrePosition).Get().x, position ); + DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION).Get().x, position ); mInternalXAnimation = Animation::New(duration); DALI_LOG_SCROLL_STATE("[0x%X], mInternalXAnimation[0x%X]", this, mInternalXAnimation.GetObjectPtr() ); mInternalXAnimation.FinishedSignal().Connect(this, &ScrollView::OnScrollAnimationFinished); - mInternalXAnimation.AnimateTo( Property(self, mPropertyPrePosition, 0), position, alpha, duration); + mInternalXAnimation.AnimateTo( Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 0), position, alpha, duration); mInternalXAnimation.Play(); // erase current state flags @@ -2124,11 +2127,11 @@ void ScrollView::AnimateInternalYTo( float position, float duration, AlphaFuncti if( duration > Math::MACHINE_EPSILON_10 ) { Actor self = Self(); - DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(mPropertyPrePosition).Get().y, position ); + DALI_LOG_SCROLL_STATE("[0x%X], Animating from[%.2f] to[%.2f]", this, self.GetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION).Get().y, position ); mInternalYAnimation = Animation::New(duration); DALI_LOG_SCROLL_STATE("[0x%X], mInternalYAnimation[0x%X]", this, mInternalYAnimation.GetObjectPtr() ); mInternalYAnimation.FinishedSignal().Connect(this, &ScrollView::OnScrollAnimationFinished); - mInternalYAnimation.AnimateTo( Property(self, mPropertyPrePosition, 1), position, alpha, TimePeriod(duration)); + mInternalYAnimation.AnimateTo( Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 1), position, alpha, TimePeriod(duration)); mInternalYAnimation.Play(); // erase current state flags @@ -2151,7 +2154,7 @@ void ScrollView::OnScrollAnimationFinished( Animation& source ) if( source == mInternalXAnimation ) { - DALI_LOG_SCROLL_STATE("[0x%X] mInternalXAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalXAnimation.GetObjectPtr(), mScrollTargetPosition.x, Self().GetProperty(mPropertyPrePosition).Get().x, mScrollPostPosition.x ); + DALI_LOG_SCROLL_STATE("[0x%X] mInternalXAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalXAnimation.GetObjectPtr(), mScrollTargetPosition.x, Self().GetProperty(SCROLL_PRE_POSITION).Get().x, mScrollPostPosition.x ); if( !(mScrollStateFlags & AnimatingInternalY) ) { @@ -2163,15 +2166,15 @@ void ScrollView::OnScrollAnimationFinished( Animation& source ) { const RulerDomain rulerDomain = mRulerX->GetDomain(); mScrollPrePosition.x = -WrapInDomain(-mScrollPrePosition.x, rulerDomain.min, rulerDomain.max); - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - handle.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + handle.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); } SnapInternalXTo(mScrollPostPosition.x); } if( source == mInternalYAnimation ) { - DALI_LOG_SCROLL_STATE("[0x%X] mInternalYAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalYAnimation.GetObjectPtr(), mScrollTargetPosition.y, Self().GetProperty(mPropertyPrePosition).Get().y, mScrollPostPosition.y ); + DALI_LOG_SCROLL_STATE("[0x%X] mInternalYAnimation[0x%X], expected[%.2f], actual[%.2f], post[%.2f]", this, mInternalYAnimation.GetObjectPtr(), mScrollTargetPosition.y, Self().GetProperty(SCROLL_PRE_POSITION).Get().y, mScrollPostPosition.y ); if( !(mScrollStateFlags & AnimatingInternalX) ) { @@ -2183,8 +2186,8 @@ void ScrollView::OnScrollAnimationFinished( Animation& source ) // wrap pre scroll y position and set it const RulerDomain rulerDomain = mRulerY->GetDomain(); mScrollPrePosition.y = -WrapInDomain(-mScrollPrePosition.y, rulerDomain.min, rulerDomain.max); - DALI_LOG_SCROLL_STATE("[0x%X] Setting mPropertyPrePosition To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); - handle.SetProperty(mPropertyPrePosition, mScrollPrePosition); + DALI_LOG_SCROLL_STATE("[0x%X] Setting SCROLL_PRE_POSITION To[%.2f, %.2f]", this, mScrollPrePosition.x, mScrollPrePosition.y ); + handle.SetProperty(Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, mScrollPrePosition); } SnapInternalYTo(mScrollPostPosition.y); } @@ -2238,7 +2241,7 @@ void ScrollView::SnapInternalXTo(float position) mInternalXAnimation = Animation::New(duration); mInternalXAnimation.FinishedSignal().Connect(this, &ScrollView::OnSnapInternalPositionFinished); - mInternalXAnimation.AnimateTo(Property(self, mPropertyPrePosition, 0), position); + mInternalXAnimation.AnimateTo(Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 0), position); mInternalXAnimation.Play(); // add internal animation state flag @@ -2264,7 +2267,7 @@ void ScrollView::SnapInternalYTo(float position) mInternalYAnimation = Animation::New(duration); mInternalYAnimation.FinishedSignal().Connect(this, &ScrollView::OnSnapInternalPositionFinished); - mInternalYAnimation.AnimateTo(Property(self, mPropertyPrePosition, 1), position); + mInternalYAnimation.AnimateTo(Property(self, Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, 1), position); mInternalYAnimation.Play(); // add internal animation state flag @@ -2357,8 +2360,8 @@ void ScrollView::OnPan( const PanGesture& gesture ) UpdateLocalScrollProperties(); GestureStarted(); mPanning = true; - self.SetProperty( mPropertyPanning, true ); - self.SetProperty( mPropertyScrollStartPagePosition, Vector3(gesture.position.x, gesture.position.y, 0.0f) ); + self.SetProperty( Toolkit::ScrollView::Property::PANNING, true ); + self.SetProperty( Toolkit::ScrollView::Property::START_PAGE_POSITION, Vector3(gesture.position.x, gesture.position.y, 0.0f) ); UpdateMainInternalConstraint(); break; @@ -2389,7 +2392,7 @@ void ScrollView::OnPan( const PanGesture& gesture ) UpdateLocalScrollProperties(); mLastVelocity = gesture.velocity; mPanning = false; - self.SetProperty( mPropertyPanning, false ); + self.SetProperty( Toolkit::ScrollView::Property::PANNING, false ); if( mScrollMainInternalPrePositionConstraint ) { @@ -2428,7 +2431,7 @@ void ScrollView::OnGestureEx(Gesture::State state) if(state == Gesture::Started) { Vector3 currentScrollPosition = GetCurrentScrollPosition(); - Self().SetProperty(mPropertyScrolling, true); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLLING, true); mScrolling = true; DALI_LOG_SCROLL_STATE("[0x%X] mScrollStartedSignal 2 [%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y); mScrollStartedSignal.Emit( currentScrollPosition ); @@ -2474,7 +2477,7 @@ void ScrollView::FinishTransform() // if not animating, then this pan has completed right now. SetScrollUpdateNotification(false); mScrolling = false; - Self().SetProperty(mPropertyScrolling, false); + Self().SetProperty(Toolkit::ScrollView::Property::SCROLLING, false); if( fabs(mScrollPrePosition.x - mScrollTargetPosition.x) > Math::MACHINE_EPSILON_10 ) { @@ -2611,7 +2614,7 @@ void ScrollView::UpdateMainInternalConstraint() if( mPanning ) { - constraint = Constraint::New( mPropertyPrePosition, + constraint = Constraint::New( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION, Source( detector, PanGestureDetector::Property::LOCAL_POSITION ), Source( self, Actor::Property::SIZE ), InternalPrePositionConstraint( mPanStartPosition, initialPanMask, mAxisAutoLock, mAxisAutoLockGradient, mLockAxis, mMaxOvershoot, mRulerX->GetDomain(), mRulerY->GetDomain() ) ); @@ -2619,33 +2622,33 @@ void ScrollView::UpdateMainInternalConstraint() } // 2. Second calculate the clamped position (actual position) - constraint = Constraint::New( mPropertyPosition, - LocalSource( mPropertyPrePosition ), - LocalSource( mPropertyPositionMin ), - LocalSource( mPropertyPositionMax ), + constraint = Constraint::New( Toolkit::ScrollView::Property::SCROLL_POSITION, + LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ), + LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source( self, Actor::Property::SIZE ), InternalPositionConstraint( mRulerX->GetDomain(), mRulerY->GetDomain(), mWrapMode ) ); mScrollMainInternalPositionConstraint = self.ApplyConstraint( constraint ); - constraint = Constraint::New( mPropertyPositionDelta, - LocalSource( mPropertyPosition ), - LocalSource( mPropertyDomainOffset ), + constraint = Constraint::New( Toolkit::ScrollView::Property::SCROLL_POSITION_DELTA, + LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ), + LocalSource( Toolkit::ScrollView::Property::SCROLL_DOMAIN_OFFSET ), InternalPositionDeltaConstraint ); mScrollMainInternalDeltaConstraint = self.ApplyConstraint( constraint ); - constraint = Constraint::New( mPropertyFinal, - LocalSource( mPropertyPosition ), - LocalSource( mPropertyOvershootX ), - LocalSource( mPropertyOvershootY ), + constraint = Constraint::New( Toolkit::ScrollView::Property::SCROLL_FINAL, + LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ), + LocalSource( Toolkit::ScrollView::Property::OVERSHOOT_X ), + LocalSource( Toolkit::ScrollView::Property::OVERSHOOT_Y ), InternalFinalConstraint( FinalDefaultAlphaFunction, FinalDefaultAlphaFunction ) ); mScrollMainInternalFinalConstraint = self.ApplyConstraint( constraint ); - constraint = Constraint::New( mPropertyRelativePosition, - LocalSource( mPropertyPosition ), - LocalSource( mPropertyPositionMin ), - LocalSource( mPropertyPositionMax ), + constraint = Constraint::New( Toolkit::Scrollable::Property::SCROLL_RELATIVE_POSITION, + LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ), + LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + LocalSource( Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), LocalSource( Actor::Property::SIZE ), InternalRelativePositionConstraint ); mScrollMainInternalRelativeConstraint = self.ApplyConstraint( constraint ); @@ -2667,24 +2670,24 @@ void ScrollView::SetOvershootConstraintsEnabled(bool enabled) } if( enabled ) { - Constraint constraint = Constraint::New( mPropertyOvershootX, - LocalSource( mPropertyPrePosition ), - LocalSource( mPropertyPosition ), - LocalSource( mPropertyCanScrollHorizontal ), + Constraint constraint = Constraint::New( Toolkit::ScrollView::Property::OVERSHOOT_X, + LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ), + LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ), + LocalSource( Toolkit::Scrollable::Property::CAN_SCROLL_HORIZONTAL ), OvershootXConstraint(mMaxOvershoot.x) ); mScrollMainInternalOvershootXConstraint = self.ApplyConstraint( constraint ); - constraint = Constraint::New( mPropertyOvershootY, - LocalSource( mPropertyPrePosition ), - LocalSource( mPropertyPosition ), - LocalSource( mPropertyCanScrollVertical ), + constraint = Constraint::New( Toolkit::ScrollView::Property::OVERSHOOT_Y, + LocalSource( Toolkit::ScrollView::Property::SCROLL_PRE_POSITION ), + LocalSource( Toolkit::ScrollView::Property::SCROLL_POSITION ), + LocalSource( Toolkit::Scrollable::Property::CAN_SCROLL_VERTICAL ), OvershootYConstraint(mMaxOvershoot.y) ); mScrollMainInternalOvershootYConstraint = self.ApplyConstraint( constraint ); } else { - self.SetProperty(mPropertyOvershootX, 0.0f); - self.SetProperty(mPropertyOvershootY, 0.0f); + self.SetProperty(Toolkit::ScrollView::Property::OVERSHOOT_X, 0.0f); + self.SetProperty(Toolkit::ScrollView::Property::OVERSHOOT_Y, 0.0f); } } @@ -2703,7 +2706,7 @@ void ScrollView::SetInternalConstraints() // MoveActor (scrolling) constraint = Constraint::New( Actor::Property::POSITION, - Source( self, mPropertyPosition ), + Source( self, Toolkit::ScrollView::Property::SCROLL_POSITION ), MoveActorConstraint ); constraint.SetRemoveAction(Constraint::Discard); ApplyConstraintToBoundActors(constraint); @@ -2713,9 +2716,9 @@ void ScrollView::SetInternalConstraints() LocalSource( Actor::Property::SCALE ), LocalSource( Actor::Property::ANCHOR_POINT ), LocalSource( Actor::Property::SIZE ), - Source( self, mPropertyPositionMin ), - Source( self, mPropertyPositionMax ), - Source( self, mPropertyWrap ), + Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source( self, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), + Source( self, Toolkit::ScrollView::Property::WRAP ), WrapActorConstraint ); constraint.SetRemoveAction(Constraint::Discard); ApplyConstraintToBoundActors(constraint); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h index 8f9abc7..da194f9 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h @@ -525,11 +525,6 @@ private: // private overriden functions from CustomActorImpl and Controls virtual void OnChildRemove(Actor& child); /** - * @copydoc Dali::CustomActorImpl::OnPropertySet( Property::Index index, Property::Value propertyValue ) - */ - virtual void OnPropertySet( Property::Index index, Property::Value propertyValue ); - - /** * From CustomActorImpl; called after a touch-signal is received by the owning actor. * * We don't listen to these events as content within the contain may consume events. @@ -591,7 +586,7 @@ private: /** * Called whenever a snap animation has completed * @param[in] source the Animation instance that has completed. - * Resets all scrolling animations and states, leaving current scroll position at mPropertyPosition + * Resets all scrolling animations and states, leaving current scroll position at SCROLL_POSITION */ void ResetScrolling(); @@ -636,7 +631,7 @@ private: void OnScrollAnimationFinished( Animation& source ); /** - * Called when either the X or Y internal scroll positions have finished snapping back to mPropertyPrePosition + * Called when either the X or Y internal scroll positions have finished snapping back to SCROLL_PRE_POSITION * * @param[in] source the Animation instance that has completed. */ diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp index fb4578e..704cdaf 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-carousel-effect-impl.cpp @@ -68,11 +68,11 @@ public: /** * @param[in] current The current color of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new color of this Actor. */ Vector4 ColorConstraint(const Vector4& current, @@ -120,11 +120,11 @@ public: /** * @param[in] current The current position * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new position of this Actor. */ Vector3 PositionConstraint(const Vector3& current, @@ -192,11 +192,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Constraint constraint; constraint = Constraint::New( Actor::Property::COLOR, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollPageCarouselEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -204,11 +204,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::POSITION, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollPageCarouselEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp index 27e43e1..c65d4f3 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-cube-effect-impl.cpp @@ -71,11 +71,11 @@ public: /** * @param[in] current The current orientation of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new orientation of this Actor. */ Quaternion RotationConstraint(const Quaternion& current, @@ -125,11 +125,11 @@ public: /** * @param[in] current The current color of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new color of this Actor. */ Vector4 ColorConstraint(const Vector4& current, @@ -185,11 +185,11 @@ public: /** * @param[in] current The current position * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollWrap Whether scroll wrap has been enabled or not (SCROLL_WRAP_PROPERTY_NAME) + * @param[in] scrollWrap Whether scroll wrap has been enabled or not (WRAP) * @return The new position of this Actor. */ Vector3 PositionConstraint(const Vector3& current, @@ -261,11 +261,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Constraint constraint; constraint = Constraint::New( Actor::Property::ORIENTATION, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollPageCubeEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -273,11 +273,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::COLOR, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollPageCubeEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -285,11 +285,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::POSITION, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::WRAP ), boost::bind( &ScrollPageCubeEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp index b414458..27db48f 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-page-spiral-effect-impl.cpp @@ -82,11 +82,11 @@ public: /** * @param[in] current The current orientation of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (SCROLL_START_PAGE_POSITION_PROPERTY_NAME) + * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (START_PAGE_POSITION) * @return The new orientation of this Actor. */ Quaternion RotationConstraint(const Quaternion& current, @@ -163,11 +163,11 @@ public: /** * @param[in] current The current color of this Actor * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (SCROLL_START_PAGE_POSITION_PROPERTY_NAME) + * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (START_PAGE_POSITION) * @return The new color of this Actor. */ Vector4 ColorConstraint(const Vector4& current, @@ -251,11 +251,11 @@ public: /** * @param[in] current The current position * @param[in] pagePositionProperty The page's position. - * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) - * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MIN_PROPERTY_NAME) + * @param[in] scrollPositionProperty The scroll-view's position property (SCROLL_POSITION) + * @param[in] scrollPositionMin The minimum extent of this scroll domain. (SCROLL_POSITION_MIN) + * @param[in] scrollPositionMax The maximum extent of this scroll domain. (SCROLL_POSITION_MAX) * @param[in] pageSizeProperty The size of the page. (scrollView SIZE) - * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (SCROLL_START_PAGE_POSITION_PROPERTY_NAME) + * @param[in] scrollPageStartPositionProperty The position of the page where scrolling started. (START_PAGE_POSITION) * @return The new position of this Actor. */ Vector3 PositionConstraint(const Vector3& current, @@ -351,11 +351,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, Constraint constraint; constraint = Constraint::New( Actor::Property::ORIENTATION, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ), boost::bind( &ScrollPageSpiralEffectInfo::RotationConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -363,11 +363,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::COLOR, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ), boost::bind( &ScrollPageSpiralEffectInfo::ColorConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); @@ -375,11 +375,11 @@ void ApplyScrollCubeConstraints(Toolkit::ScrollView scrollView, constraint = Constraint::New( Actor::Property::POSITION, LocalSource(Actor::Property::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::SCROLL_FINAL ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ), + Source(scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ), Source(scrollView, Actor::Property::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME ) ), + Source(scrollView, Toolkit::ScrollView::Property::START_PAGE_POSITION ), boost::bind( &ScrollPageSpiralEffectInfo::PositionConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); constraint.SetRemoveAction( Constraint::Discard ); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp index e21ef87..c8c669b 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-wobble-effect-impl.cpp @@ -231,10 +231,6 @@ void ScrollViewWobbleEffect::OnDetach(Toolkit::ScrollView& scrollView) void ScrollViewWobbleEffect::AttachActor(Actor actor) { - Property::Index propertyPosition = actor.GetPropertyIndex(Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME); - Property::Index propertyOvershootX = actor.GetPropertyIndex(Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME); - Property::Index propertyOvershootY = actor.GetPropertyIndex(Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME); - // Create effect-overshoot property if not already created. Property::Index propertyEffectOvershoot = actor.GetPropertyIndex(Toolkit::ScrollViewWobbleEffect::EFFECT_OVERSHOOT); if(propertyEffectOvershoot == Property::INVALID_INDEX) @@ -246,9 +242,9 @@ void ScrollViewWobbleEffect::AttachActor(Actor actor) Constraint constraint = Constraint::New( propertyEffectOvershoot, Source(scrollView, mPropertyTime), - Source(actor, propertyPosition), - Source(actor, propertyOvershootX), - Source(actor, propertyOvershootY), + Source(actor, Toolkit::ScrollView::Property::SCROLL_POSITION), + Source(actor, Toolkit::ScrollView::Property::OVERSHOOT_X), + Source(actor, Toolkit::ScrollView::Property::OVERSHOOT_Y), ScrollViewWobbleEffectConstraint(*this) ); actor.ApplyConstraint(constraint); } diff --git a/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp b/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp index 0c73cd4..3db2f3e 100644 --- a/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp @@ -49,6 +49,13 @@ DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Scrollable, Toolkit::Control, Create ); DALI_PROPERTY_REGISTRATION( Scrollable, "overshoot-effect-color", VECTOR4, OVERSHOOT_EFFECT_COLOR ) DALI_PROPERTY_REGISTRATION( Scrollable, "overshoot-animation-speed", FLOAT, OVERSHOOT_ANIMATION_SPEED ) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "scroll-relative-position", VECTOR3, SCROLL_RELATIVE_POSITION) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "scroll-position-min", VECTOR3, SCROLL_POSITION_MIN) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "scroll-position-max", VECTOR3, SCROLL_POSITION_MAX) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "scroll-direction", VECTOR3, SCROLL_DIRECTION) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "can-scroll-vertical", BOOLEAN, CAN_SCROLL_VERTICAL) +DALI_ANIMATABLE_PROPERTY_REGISTRATION( Scrollable, "can-scroll-horizontal", BOOLEAN, CAN_SCROLL_HORIZONTAL) + DALI_SIGNAL_REGISTRATION( Scrollable, "scroll-started", SIGNAL_SCROLL_STARTED ) DALI_SIGNAL_REGISTRATION( Scrollable, "scroll-completed", SIGNAL_SCROLL_COMPLETED ) DALI_SIGNAL_REGISTRATION( Scrollable, "scroll-updated", SIGNAL_SCROLL_UPDATED ) @@ -60,9 +67,6 @@ const float DEFAULT_OVERSHOOT_ANIMATION_SPEED(120.0f); // 120 pixels per second } -const char* const Scrollable::SCROLLABLE_CAN_SCROLL_VERTICAL = "scrollable-can-scroll-vertical"; -const char* const Scrollable::SCROLLABLE_CAN_SCROLL_HORIZONTAL = "scrollable-can-scroll-horizontal"; - /////////////////////////////////////////////////////////////////////////////////////////////////// // Scrollable /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -73,12 +77,6 @@ Scrollable::Scrollable() : Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS | NO_SIZE_NEGOTIATION ) ), mOvershootEffectColor( DEFAULT_OVERSHOOT_COLOUR ), mOvershootAnimationSpeed ( DEFAULT_OVERSHOOT_ANIMATION_SPEED ), - mPropertyRelativePosition(Property::INVALID_INDEX), - mPropertyPositionMin(Property::INVALID_INDEX), - mPropertyPositionMax(Property::INVALID_INDEX), - mPropertyScrollDirection(Property::INVALID_INDEX), - mPropertyCanScrollVertical(Property::INVALID_INDEX), - mPropertyCanScrollHorizontal(Property::INVALID_INDEX), mOvershootEnabled(false) { } @@ -89,19 +87,6 @@ Scrollable::~Scrollable() mComponents.clear(); } -void Scrollable::RegisterCommonProperties() -{ - Actor self = Self(); - - // Register properties. - mPropertyRelativePosition = self.RegisterProperty(Toolkit::Scrollable::SCROLL_RELATIVE_POSITION_PROPERTY_NAME, Vector3::ZERO); - mPropertyPositionMin = self.RegisterProperty(Toolkit::Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME, Vector3::ZERO); - mPropertyPositionMax = self.RegisterProperty(Toolkit::Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME, Vector3::ZERO); - mPropertyScrollDirection = self.RegisterProperty(Toolkit::Scrollable::SCROLL_DIRECTION_PROPERTY_NAME, Vector3::ZERO); - mPropertyCanScrollVertical = self.RegisterProperty(SCROLLABLE_CAN_SCROLL_VERTICAL, true); - mPropertyCanScrollHorizontal = self.RegisterProperty(SCROLLABLE_CAN_SCROLL_HORIZONTAL, true); -} - bool Scrollable::IsScrollComponentEnabled(Toolkit::Scrollable::ScrollComponentType type) const { if(type == Toolkit::Scrollable::OvershootIndicator) diff --git a/dali-toolkit/internal/controls/scrollable/scrollable-impl.h b/dali-toolkit/internal/controls/scrollable/scrollable-impl.h index 799ed62..eb9f377 100644 --- a/dali-toolkit/internal/controls/scrollable/scrollable-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scrollable-impl.h @@ -44,16 +44,6 @@ typedef IntrusivePtr ScrollablePtr; class Scrollable : public Control { public: - static const char* const SCROLLABLE_CAN_SCROLL_VERTICAL; - static const char* const SCROLLABLE_CAN_SCROLL_HORIZONTAL; - - /** - * Create a new Scrollable. - * @return A public handle to the newly allocated Scrollable. - */ -// static Dali::Toolkit::Scrollable New(); - -public: /** * @copydoc Dali::Toolkit::Scrollable::IsScrollComponentEnabled(Scrollable::ScrollComponentType type) @@ -196,11 +186,6 @@ protected: */ virtual ~Scrollable(); - /** - * Register common properties - */ - void RegisterCommonProperties(); - private: /** @@ -231,13 +216,6 @@ protected: Vector4 mOvershootEffectColor; /// mComponent; ///< ScrollComponent (such as a scrollbar/page indicator/status) Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal; diff --git a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp index 5ce5e22..a1ad3b6 100644 --- a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp +++ b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp @@ -168,6 +168,7 @@ void ShadowView::SetShadowPlane(Actor shadowPlane) mShadowPlaneBg = shadowPlane; mShadowPlane = ImageActor::New(); + mShadowPlane.SetName( "SHADOW_PLANE" ); mShadowPlane.SetParentOrigin(ParentOrigin::CENTER); mShadowPlane.SetAnchorPoint(AnchorPoint::CENTER); @@ -275,8 +276,9 @@ void ShadowView::OnInitialize() mBlurFilter.SetPixelFormat(Pixel::RGBA8888); mBlurRootActor = Actor::New(); - + mBlurRootActor.SetName( "BLUR_ROOT_ACTOR" ); mBlurRootActor.SetRelayoutEnabled( true ); + // Turn off inheritance to ensure filter renders properly mBlurRootActor.SetPositionInheritanceMode(USE_PARENT_POSITION); mBlurRootActor.SetInheritOrientation(false); diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 6149e29..73f40e9 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -401,7 +401,7 @@ void TextLabel::OnInitialize() // Use height-for-width negotiation by default self.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - self.SetDimensionDependency( HEIGHT, WIDTH ); + self.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); } void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change ) diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index 6f3f565..6db6845 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -503,8 +503,8 @@ Dali::Image TextSelectionPopup::GetPopupImage( PopupParts part ) textSize.width = std::min( textSize.width, OPTION_MAX_WIDTH - 2.f * OPTION_MARGIN_WIDTH ); // Set the size to the text. Text will be ellipsized if exceeds the max width. - captionTextLabel.SetPreferredSize( textSize.GetVectorXY() ); - pressedCaptionTextLabel.SetPreferredSize( textSize.GetVectorXY() ); + captionTextLabel.SetSize( textSize.GetVectorXY() ); + pressedCaptionTextLabel.SetSize( textSize.GetVectorXY() ); // 4. Calculate the size of option. @@ -513,13 +513,13 @@ Dali::Image TextSelectionPopup::GetPopupImage( PopupParts part ) const Vector2 optionSize( std::min( OPTION_MAX_WIDTH, std::max( OPTION_MIN_WIDTH, std::max( textSize.width, OPTION_ICON_SIZE.width ) + 2.f * OPTION_MARGIN_WIDTH ) ), DEFAULT_POPUP_MAX_SIZE.height - mNinePatchMargins.z - mNinePatchMargins.w ); - optionContainer.SetPreferredSize( optionSize ); - optionPressedContainer.SetPreferredSize( optionSize ); + optionContainer.SetSize( optionSize ); + optionPressedContainer.SetSize( optionSize ); // 5. Create a option. Toolkit::PushButton option = Toolkit::PushButton::New(); option.SetResizePolicy( FIXED, ALL_DIMENSIONS ); - option.SetPreferredSize( optionSize ); + option.SetSize( optionSize ); option.SetAnchorPoint( AnchorPoint::TOP_LEFT ); option.SetX( mContentSize.width ); option.SetName( name ); @@ -545,7 +545,7 @@ Dali::Image TextSelectionPopup::GetPopupImage( PopupParts part ) ImageActor divider = Toolkit::CreateSolidColorActor( Color::WHITE ); divider.SetResizePolicy( FIXED, ALL_DIMENSIONS ); - divider.SetPreferredSize( size ); + divider.SetSize( size ); divider.SetParentOrigin( ParentOrigin::TOP_LEFT ); divider.SetAnchorPoint( AnchorPoint::TOP_LEFT ); divider.SetPosition( mContentSize.width - POPUP_DIVIDER_WIDTH, 0.0f ); @@ -566,10 +566,10 @@ Dali::Image TextSelectionPopup::GetPopupImage( PopupParts part ) stencil.SetRelayoutEnabled( true ); self.SetResizePolicy( FIXED, ALL_DIMENSIONS ); - self.SetPreferredSize( mRequiredPopUpSize ); // control matches stencil size + self.SetSize( mRequiredPopUpSize ); // control matches stencil size mStencilLayer.SetResizePolicy( FIXED, ALL_DIMENSIONS ); - mStencilLayer.SetPreferredSize( size ); // matches stencil size + mStencilLayer.SetSize( size ); // matches stencil size stencil.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); scrollview.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); diff --git a/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp b/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp index 73654a4..274ca56 100644 --- a/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp +++ b/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp @@ -74,7 +74,7 @@ void ToolBar::SetBackground( Actor background ) // ToolBar image background.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); background.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); - background.SetPreferredSize( Vector2( mToolBarSize.width, mToolBarSize.height ) ); + background.SetSize( Vector2( mToolBarSize.width, mToolBarSize.height ) ); RenderableActor renderableActor = RenderableActor::DownCast( background ); if ( renderableActor ) @@ -359,7 +359,7 @@ void ToolBar::OnControlChildAdd(Actor& child) void ToolBar::OnControlSizeSet( const Vector3& targetSize ) { mToolBarSize = targetSize; - mBackground.SetPreferredSize( Vector2( mToolBarSize.width, mToolBarSize.height ) ); + mBackground.SetSize( Vector2( mToolBarSize.width, mToolBarSize.height ) ); } } // namespace Internal diff --git a/dali-toolkit/internal/controls/view/view-impl.cpp b/dali-toolkit/internal/controls/view/view-impl.cpp index a1d0c09..3cb58ac 100644 --- a/dali-toolkit/internal/controls/view/view-impl.cpp +++ b/dali-toolkit/internal/controls/view/view-impl.cpp @@ -168,6 +168,8 @@ void View::SetOrientationFunction( Degree portrait, Degree landscale, Degree por void View::OrientationChanged( Dali::Orientation orientation ) { + Actor self = Self(); + // Nothing to do if orientation doesn't really change. if ( orientation.GetDegrees() == mOrientation || !mAutoRotateEnabled ) { @@ -178,13 +180,13 @@ void View::OrientationChanged( Dali::Orientation orientation ) // has parent so we expect it to be on stage mRotateAnimation = Animation::New( ROTATION_ANIMATION_DURATION ); - mRotateAnimation.RotateTo( Self(), Degree( -orientation.GetDegrees() ), Vector3::ZAXIS, AlphaFunctions::EaseOut ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::ORIENTATION ), Quaternion( -orientation.GetRadians(), Vector3::ZAXIS ), AlphaFunctions::EaseOut ); // Resize the view if( mFullScreen ) { const Vector2& stageSize( Stage::GetCurrent().GetSize() ); - const Vector3& currentSize( Self().GetCurrentSize() ); + const Vector3& currentSize( self.GetCurrentSize() ); float minSize = std::min( stageSize.width, stageSize.height ); float maxSize = std::max( stageSize.width, stageSize.height ); @@ -214,15 +216,15 @@ void View::OrientationChanged( Dali::Orientation orientation ) { // width grows, shrink height faster Vector3 shrink( currentSize );shrink.height = targetSize.height; - mRotateAnimation.Resize( Self(), shrink, AlphaFunctions::EaseOut, 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ); - mRotateAnimation.Resize( Self(), targetSize, AlphaFunctions::EaseIn, 0.0f, ROTATION_ANIMATION_DURATION ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), shrink, AlphaFunctions::EaseOut, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ) ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), targetSize, AlphaFunctions::EaseIn, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION ) ); } else { // height grows, shrink width faster Vector3 shrink( currentSize );shrink.width = targetSize.width; - mRotateAnimation.Resize( Self(), shrink, AlphaFunctions::EaseOut, 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ); - mRotateAnimation.Resize( Self(), targetSize, AlphaFunctions::EaseIn, 0.0f, ROTATION_ANIMATION_DURATION ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), shrink, AlphaFunctions::EaseOut, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ) ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), targetSize, AlphaFunctions::EaseIn, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION ) ); } } diff --git a/dali-toolkit/internal/filters/blur-two-pass-filter.cpp b/dali-toolkit/internal/filters/blur-two-pass-filter.cpp index ee152de..af62fb3 100644 --- a/dali-toolkit/internal/filters/blur-two-pass-filter.cpp +++ b/dali-toolkit/internal/filters/blur-two-pass-filter.cpp @@ -142,7 +142,7 @@ void BlurTwoPassFilter::Enable() // create actor to render input with applied emboss effect mActorForInput = ImageActor::New( mInputImage ); mActorForInput.SetParentOrigin( ParentOrigin::CENTER ); - mActorForInput.SetSize(mTargetSize); + mActorForInput.SetSize( mTargetSize ); mActorForInput.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // create internal offscreen for result of horizontal pass @@ -151,7 +151,7 @@ void BlurTwoPassFilter::Enable() // create an actor to render mImageForHorz for vertical blur pass mActorForHorz = ImageActor::New( mImageForHorz ); mActorForHorz.SetParentOrigin( ParentOrigin::CENTER ); - mActorForHorz.SetSize(mTargetSize); + mActorForHorz.SetSize( mTargetSize ); mActorForHorz.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // create internal offscreen for result of the two pass blurred image @@ -160,7 +160,7 @@ void BlurTwoPassFilter::Enable() // create an actor to blend the blurred image and the input image with the given blur strength mActorForBlending = ImageActor::New( mBlurredImage ); mActorForBlending.SetParentOrigin( ParentOrigin::CENTER ); - mActorForBlending.SetSize(mTargetSize); + mActorForBlending.SetSize( mTargetSize ); mActorForBlending.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); mRootActor.Add( mActorForInput ); diff --git a/dali-toolkit/internal/scripting/script-impl.h b/dali-toolkit/internal/scripting/script-impl.h index ba4094e..bda3721 100644 --- a/dali-toolkit/internal/scripting/script-impl.h +++ b/dali-toolkit/internal/scripting/script-impl.h @@ -17,6 +17,8 @@ * limitations under the License. * */ +// EXTERNAL INCLUDES +#include // INTERNAL INCLUDES #include diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index 97aa0c8..b4a0705 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -373,8 +373,7 @@ struct Decorator::Impl : public ConnectionTracker #endif mGrabArea.SetParentOrigin( ParentOrigin::TOP_CENTER ); mGrabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - mGrabArea.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); - mGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + mGrabArea.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE ); mGrabHandle.Add( mGrabArea ); @@ -408,7 +407,7 @@ struct Decorator::Impl : public ConnectionTracker #ifdef DECORATOR_DEBUG primary.grabArea.SetName("SelectionHandleOneGrabArea"); #endif - primary.grabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + primary.grabArea.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); primary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ); primary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); @@ -441,7 +440,7 @@ struct Decorator::Impl : public ConnectionTracker #ifdef DECORATOR_DEBUG secondary.grabArea.SetName("SelectionHandleTwoGrabArea"); #endif - secondary.grabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + secondary.grabArea.SetResizePolicy( SIZE_RELATIVE_TO_PARENT, ALL_DIMENSIONS ); secondary.grabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ); secondary.grabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); diff --git a/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp index 975889d..5a0188a 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-cross-effect-impl.cpp @@ -127,11 +127,11 @@ void CubeTransitionCrossEffect::SetupAnimation(unsigned int actorIndex, float an mTiles[mContainerIndex][actorIndex].TranslateBy( resetTranslation ); mTiles[mContainerIndex][actorIndex].SetOrientation( Radian( angle), axis ); } - mAnimation.RotateTo( mBoxes[actorIndex], Radian( -angle ), axis, AlphaFunctions::EaseInOutSine ); + mAnimation.AnimateTo( Property( mBoxes[actorIndex], Actor::Property::ORIENTATION ), Quaternion( Radian( -angle ), axis ), AlphaFunctions::EaseInOutSine ); Vector3 position(mBoxes[actorIndex].GetCurrentPosition()); - mAnimation.MoveTo(mBoxes[actorIndex], position*mDisplacementRatio+Vector3(0.f,0.f,mCubeDisplacement), AlphaFunctions::Bounce); - mAnimation.ColorTo( mTiles[mContainerIndex^1][actorIndex], HALF_BRIGHTNESS, AlphaFunctions::EaseOut ); - mAnimation.ColorTo( mTiles[mContainerIndex][actorIndex], FULL_BRIGHTNESS, AlphaFunctions::EaseIn ); + mAnimation.AnimateTo( Property( mBoxes[actorIndex], Actor::Property::POSITION ), position * mDisplacementRatio + Vector3( 0.f, 0.f, mCubeDisplacement ), AlphaFunctions::Bounce ); + mAnimation.AnimateTo( Property( mTiles[mContainerIndex^1][actorIndex], Actor::Property::COLOR ), HALF_BRIGHTNESS, AlphaFunctions::EaseOut ); + mAnimation.AnimateTo( Property( mTiles[mContainerIndex][actorIndex], Actor::Property::COLOR ), FULL_BRIGHTNESS, AlphaFunctions::EaseIn ); } } // namespace Internal diff --git a/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp index 2872ffa..1a58f8d 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-effect-impl.cpp @@ -116,10 +116,10 @@ void CubeTransitionEffect::Initialize() // helper actor to create a off-screen image using shader effect mEmptyImage = ImageActor::New( placeHolder ); + mEmptyImage.SetRelayoutEnabled( false ); mEmptyImage.SetSize(Stage::GetCurrent().GetSize()); mEmptyImage.SetParentOrigin( ParentOrigin::CENTER ); mEmptyImage.SetAnchorPoint( AnchorPoint::CENTER ); - mEmptyImage.SetRelayoutEnabled( false ); mFullImageCreator = FullAreaImageCreator::New(); mEmptyImage.SetShaderEffect( mFullImageCreator ); Stage::GetCurrent().Add(mEmptyImage); @@ -140,9 +140,9 @@ void CubeTransitionEffect::Initialize() ImageActor CubeTransitionEffect::CreateTile( Image image, const Vector4& color ) { ImageActor tile = ImageActor::New( image ); + tile.SetRelayoutEnabled( false ); tile.SetParentOrigin( ParentOrigin::CENTER ); tile.SetAnchorPoint( AnchorPoint::CENTER ); - tile.SetRelayoutEnabled( false ); tile.SetSize( mTileSize ); tile.SetColorMode( Dali::USE_OWN_COLOR ); tile.SetColor( color ); diff --git a/dali-toolkit/internal/transition-effects/cube-transition-fold-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-fold-effect-impl.cpp index abffa6a..37a3a06 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-fold-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-fold-effect-impl.cpp @@ -125,11 +125,11 @@ void CubeTransitionFoldEffect::SetupAnimation(unsigned int actorIndex, float ang sideTile.TranslateBy( resetTranslation ); sideTile.SetOrientation( Radian( angle), Vector3::YAXIS ); } - mAnimation.RotateTo( currentCube, Radian( -angle ), Vector3::YAXIS, AlphaFunctions::Linear ); + mAnimation.AnimateTo( Property( currentCube, Actor::Property::ORIENTATION ), Quaternion( Radian( -angle ), Vector3::YAXIS ), AlphaFunctions::Linear ); Vector3 position(currentCube.GetCurrentPosition()); - mAnimation.MoveTo(currentCube, Vector3( position.x*mDisplacementRatio, position.y, position.z ), AlphaFunctions::Bounce); - mAnimation.ColorTo( frontTile, HALF_BRIGHTNESS, AlphaFunctions::EaseOut ); - mAnimation.ColorTo( sideTile, FULL_BRIGHTNESS, AlphaFunctions::EaseIn ); + mAnimation.AnimateTo( Property( currentCube, Actor::Property::POSITION ), Vector3( position.x*mDisplacementRatio, position.y, position.z ), AlphaFunctions::Bounce ); + mAnimation.AnimateTo( Property( frontTile, Actor::Property::COLOR ), HALF_BRIGHTNESS, AlphaFunctions::EaseOut ); + mAnimation.AnimateTo( Property( sideTile, Actor::Property::COLOR ), FULL_BRIGHTNESS, AlphaFunctions::EaseIn ); } } // namespace Internal diff --git a/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp b/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp index 1f8ca0f..1b0063d 100644 --- a/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp +++ b/dali-toolkit/internal/transition-effects/cube-transition-wave-effect-impl.cpp @@ -97,14 +97,14 @@ void CubeTransitionWaveEffect::OnStartTransition( Vector2 panPosition, Vector2 p // the delay value is within 0.f ~ 2.f*thirdAnimationDuration float delay = thirdAnimationDuration * CalculateDelay(x*mTileSize.width,y*mTileSize.height); - mAnimation.RotateTo( mBoxes[idx], Degree( -angle ), Vector3::YAXIS, - AlphaFunctions::EaseOutSine, delay, thirdAnimationDuration ); - mAnimation.MoveBy( mBoxes[idx], Vector3(0.f,0.f,-mCubeDisplacement), - AlphaFunctions::Bounce, delay, thirdAnimationDuration ); - mAnimation.ColorTo( mTiles[anotherIndex][idx], HALF_BRIGHTNESS, - AlphaFunctions::EaseOut, delay, thirdAnimationDuration ); - mAnimation.ColorTo( mTiles[mContainerIndex][idx], FULL_BRIGHTNESS, - AlphaFunctions::EaseIn, delay, thirdAnimationDuration ); + mAnimation.AnimateTo( Property( mBoxes[idx], Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( -angle ) ), Vector3::YAXIS ), + AlphaFunctions::EaseOutSine, TimePeriod( delay, thirdAnimationDuration ) ); + mAnimation.AnimateBy( Property( mBoxes[idx], Actor::Property::POSITION ), Vector3( 0.f, 0.f, -mCubeDisplacement ), + AlphaFunctions::Bounce, TimePeriod( delay, thirdAnimationDuration ) ); + mAnimation.AnimateTo( Property( mTiles[anotherIndex][idx], Actor::Property::COLOR ), HALF_BRIGHTNESS, + AlphaFunctions::EaseOut, TimePeriod( delay, thirdAnimationDuration ) ); + mAnimation.AnimateTo( Property( mTiles[mContainerIndex][idx], Actor::Property::COLOR ), FULL_BRIGHTNESS, + AlphaFunctions::EaseIn, TimePeriod( delay, thirdAnimationDuration ) ); } } diff --git a/dali-toolkit/public-api/controls/buttons/push-button.cpp b/dali-toolkit/public-api/controls/buttons/push-button.cpp index d2ae939..f128778 100644 --- a/dali-toolkit/public-api/controls/buttons/push-button.cpp +++ b/dali-toolkit/public-api/controls/buttons/push-button.cpp @@ -76,7 +76,9 @@ PushButton PushButton::DownCast( BaseHandle handle ) void PushButton::SetButtonImage( Image image ) { - Dali::Toolkit::GetImplementation( *this ).SetButtonImage( ImageActor::New( image ) ); + Actor imageActor = ImageActor::New( image ); + imageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); + Dali::Toolkit::GetImplementation( *this ).SetButtonImage( imageActor ); } void PushButton::SetButtonImage( Actor image ) @@ -91,7 +93,9 @@ Actor PushButton::GetButtonImage() const void PushButton::SetBackgroundImage( Image image ) { - Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( ImageActor::New( image ) ); + Actor imageActor = ImageActor::New( image ); + imageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); + Dali::Toolkit::GetImplementation( *this ).SetBackgroundImage( imageActor ); } void PushButton::SetBackgroundImage( Actor image ) @@ -106,7 +110,9 @@ Actor PushButton::GetBackgroundImage() const void PushButton::SetSelectedImage( Image image ) { - Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( ImageActor::New( image ) ); + Actor imageActor = ImageActor::New( image ); + imageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); + Dali::Toolkit::GetImplementation( *this ).SetSelectedImage( imageActor ); } void PushButton::SetSelectedImage( Actor image ) @@ -119,9 +125,26 @@ Actor PushButton::GetSelectedImage() const return Dali::Toolkit::GetImplementation( *this ).GetSelectedImage(); } +void PushButton::SetSelectedBackgroundImage( Image image ) +{ + Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( ImageActor::New( image ) ); +} + +void PushButton::SetSelectedBackgroundImage( Actor image ) +{ + Dali::Toolkit::GetImplementation( *this ).SetSelectedBackgroundImage( image ); +} + +Actor PushButton::GetSelectedBackgroundImage() const +{ + return Dali::Toolkit::GetImplementation( *this ).GetSelectedBackgroundImage(); +} + void PushButton::SetDisabledBackgroundImage( Image image ) { - Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( ImageActor::New( image ) ); + Actor imageActor = ImageActor::New( image ); + imageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); + Dali::Toolkit::GetImplementation( *this ).SetDisabledBackgroundImage( imageActor ); } void PushButton::SetDisabledBackgroundImage( Actor image ) @@ -136,7 +159,9 @@ Actor PushButton::GetDisabledBackgroundImage() const void PushButton::SetDisabledImage( Image image ) { - Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( ImageActor::New( image ) ); + Actor imageActor = ImageActor::New( image ); + imageActor.SetResizePolicy( USE_NATURAL_SIZE, ALL_DIMENSIONS ); + Dali::Toolkit::GetImplementation( *this ).SetDisabledImage( imageActor ); } void PushButton::SetDisabledImage( Actor image ) diff --git a/dali-toolkit/public-api/controls/buttons/push-button.h b/dali-toolkit/public-api/controls/buttons/push-button.h index dfc3409..4a1974f 100644 --- a/dali-toolkit/public-api/controls/buttons/push-button.h +++ b/dali-toolkit/public-api/controls/buttons/push-button.h @@ -179,6 +179,25 @@ public: Actor GetSelectedImage() const; /** + * @brief Sets the selected background image. + * + * @param[in] image The selected background image. + */ + void SetSelectedBackgroundImage( Image image ); + + /** + * @copydoc SetSelectedBackgroundImage( Image image ) + */ + void SetSelectedBackgroundImage( Actor image ); + + /** + * @brief Gets the selected background image. + * + * @return An actor with the selected background image. + */ + Actor GetSelectedBackgroundImage() const; + + /** * @brief Sets the disabled background image. * * @param[in] image The disabled background image. diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index b495d1f..216491b 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -138,8 +138,12 @@ void SetupBackgroundActor( Actor actor, Property::Index constrainingIndex, const actor.SetPositionInheritanceMode( USE_PARENT_POSITION_PLUS_LOCAL_POSITION ); actor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); actor.SetZ( BACKGROUND_ACTOR_Z_POSITION ); - actor.SetRelayoutEnabled( true ); - actor.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + actor.SetRelayoutEnabled( false ); + + Constraint constraint = Constraint::New( constrainingIndex, + ParentSource( Actor::Property::SIZE ), + EqualToConstraint() ); + actor.ApplyConstraint( constraint ); } } // unnamed namespace diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.cpp b/dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.cpp index cce79c0..564235c 100644 --- a/dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.cpp +++ b/dali-toolkit/public-api/controls/scrollable/item-view/depth-layout.cpp @@ -575,7 +575,7 @@ void DepthLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 { if(animation) { - animation.Resize(actor, size); + animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size ); } } diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.cpp b/dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.cpp index efb16e2..93e9956 100644 --- a/dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.cpp +++ b/dali-toolkit/public-api/controls/scrollable/item-view/grid-layout.cpp @@ -624,8 +624,8 @@ void GridLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 s // Do a nonlinear size animation to shrink the actor first when the actor size changes, // so that we can avoid the actors overlapping during orientation change. - animation.Resize( actor, shrink, AlphaFunctions::EaseOut, 0.0f, durationSeconds * 0.5f ); - animation.Resize( actor, size, AlphaFunctions::EaseIn, 0.0f, durationSeconds ); + animation.AnimateTo( Property( actor, Actor::Property::SIZE ), shrink, AlphaFunctions::EaseOut, TimePeriod( 0.0f, durationSeconds * 0.5f ) ); + animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size, AlphaFunctions::EaseIn, TimePeriod( 0.0f, durationSeconds ) ); } } diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.cpp b/dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.cpp index 471574c..07b5a78 100644 --- a/dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.cpp +++ b/dali-toolkit/public-api/controls/scrollable/item-view/spiral-layout.cpp @@ -489,7 +489,7 @@ void SpiralLayout::GetResizeAnimation(Animation& animation, Actor actor, Vector3 { if(animation) { - animation.Resize(actor, size); + animation.AnimateTo( Property( actor, Actor::Property::SIZE ), size ); } } diff --git a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp index 9e8a9c7..be7a991 100644 --- a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp +++ b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp @@ -283,18 +283,6 @@ unsigned int FixedRuler::GetTotalPages() const // ScrollView /////////////////////////////////////////////////////////////////////////////////////////////////// -const std::string ScrollView::SCROLL_TIME_PROPERTY_NAME( "scroll-time" ); -const std::string ScrollView::SCROLL_POSITION_PROPERTY_NAME( "scroll-position" ); -const std::string ScrollView::SCROLL_PRE_POSITION_PROPERTY_NAME( "scroll-pre-position" ); -const std::string ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME( "scroll-overshoot-x" ); -const std::string ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME( "scroll-overshoot-y" ); -const std::string ScrollView::SCROLL_FINAL_PROPERTY_NAME( "scroll-final" ); -const std::string ScrollView::SCROLL_WRAP_PROPERTY_NAME( "scroll-wrap" ); -const std::string ScrollView::SCROLL_PANNING_PROPERTY_NAME( "scroll-panning" ); -const std::string ScrollView::SCROLL_SCROLLING_PROPERTY_NAME( "scroll-scrolling" ); -const std::string ScrollView::SCROLL_POSITION_DELTA_PROPERTY_NAME( "scroll-position-delta" ); -const std::string ScrollView::SCROLL_START_PAGE_POSITION_PROPERTY_NAME( "scroll-start-page-position" ); - const float ScrollView::DEFAULT_SLOW_SNAP_ANIMATION_DURATION(0.5f); const float ScrollView::DEFAULT_FAST_SNAP_ANIMATION_DURATION(0.25f); const float ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION(0.5f); diff --git a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h index 6cf6331..3ba77ed 100644 --- a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h +++ b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h @@ -409,20 +409,6 @@ class DALI_IMPORT_API ScrollView : public Scrollable { public: - // Custom properties - - static const std::string SCROLL_TIME_PROPERTY_NAME; ///< Property, name "scroll-time", type float - static const std::string SCROLL_POSITION_PROPERTY_NAME; ///< Property, name "scroll-position", type Vector3 - static const std::string SCROLL_PRE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-pre-position", type Vector3 - static const std::string SCROLL_OVERSHOOT_X_PROPERTY_NAME; ///< Property, name "scroll-overshoot-x", type float - static const std::string SCROLL_OVERSHOOT_Y_PROPERTY_NAME; ///< Property, name "scroll-overshoot-y", type float - static const std::string SCROLL_FINAL_PROPERTY_NAME; ///< Property, name "scroll-final", type Vector3 - static const std::string SCROLL_WRAP_PROPERTY_NAME; ///< Property, name "scroll-wrap", type bool - static const std::string SCROLL_PANNING_PROPERTY_NAME; ///< Property, name "scroll-panning", type bool - static const std::string SCROLL_SCROLLING_PROPERTY_NAME; ///< Property, name "scroll-scrolling", type bool - static const std::string SCROLL_POSITION_DELTA_PROPERTY_NAME; ///< Property, name "scroll-position-delta" type Vector3 - static const std::string SCROLL_START_PAGE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-start-page-position" type Vector3 - // Default settings static const float DEFAULT_SLOW_SNAP_ANIMATION_DURATION; ///< Default Drag-Release animation time. @@ -457,6 +443,36 @@ public: float duration; ///< Duration of snap animation. }; + /** + * @brief The start and end property ranges for this control. + */ + enum PropertyRange + { + ANIMATABLE_PROPERTY_START_INDEX = Toolkit::Scrollable::ANIMATABLE_PROPERTY_END_INDEX + 1, + ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX + 1000 ///< Reserve animatable property indices + }; + + /** + * @brief An enumeration of properties belonging to the ScrollView class. + */ + struct Property + { + enum + { + SCROLL_POSITION = ANIMATABLE_PROPERTY_START_INDEX, ///< Property, name "scroll-position", type Vector3 + SCROLL_PRE_POSITION, ///< Property, name "scroll-pre-position", type Vector3 + OVERSHOOT_X, ///< Property, name "overshoot-x", type float + OVERSHOOT_Y, ///< Property, name "overshoot-y", type float + SCROLL_FINAL, ///< Property, name "scroll-final", type Vector3 + WRAP, ///< Property, name "wrap", type bool + PANNING, ///< Property, name "panning", type bool + SCROLLING, ///< Property, name "scrolling", type bool + SCROLL_DOMAIN_OFFSET, ///< Property, name "scroll-domain-offset" type Vector3 + SCROLL_POSITION_DELTA, ///< Property, name "scroll-position-delta" type Vector3 + START_PAGE_POSITION ///< Property, name "start-page-position" type Vector3 + }; + }; + typedef Signal< void ( const SnapEvent& ) > SnapStartedSignalType; ///< SnapStarted signal type /** diff --git a/dali-toolkit/public-api/controls/scrollable/scrollable.cpp b/dali-toolkit/public-api/controls/scrollable/scrollable.cpp index 1ce8314..ff955ff 100644 --- a/dali-toolkit/public-api/controls/scrollable/scrollable.cpp +++ b/dali-toolkit/public-api/controls/scrollable/scrollable.cpp @@ -26,11 +26,6 @@ namespace Dali namespace Toolkit { -const std::string Scrollable::SCROLL_RELATIVE_POSITION_PROPERTY_NAME( "scroll-relative-position" ); -const std::string Scrollable::SCROLL_POSITION_MIN_PROPERTY_NAME( "scroll-position-min" ); -const std::string Scrollable::SCROLL_POSITION_MAX_PROPERTY_NAME( "scroll-position-max" ); -const std::string Scrollable::SCROLL_DIRECTION_PROPERTY_NAME( "scroll-direction" ); - Scrollable::Scrollable() { } diff --git a/dali-toolkit/public-api/controls/scrollable/scrollable.h b/dali-toolkit/public-api/controls/scrollable/scrollable.h index 0b315f3..62f6100 100644 --- a/dali-toolkit/public-api/controls/scrollable/scrollable.h +++ b/dali-toolkit/public-api/controls/scrollable/scrollable.h @@ -59,20 +59,16 @@ public: OvershootIndicator, }; - // Custom properties - - static const std::string SCROLL_RELATIVE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-relative-position", type Vector3 - static const std::string SCROLL_POSITION_MIN_PROPERTY_NAME; ///< Property, name "scroll-position-min", type Vector3 - static const std::string SCROLL_POSITION_MAX_PROPERTY_NAME; ///< Property, name "scroll-position-max", type Vector3 - static const std::string SCROLL_DIRECTION_PROPERTY_NAME; ///< Property, name "scroll-direction", type Vector2 - /** * @brief The start and end property ranges for this control. */ enum PropertyRange { PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, - PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices + PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000, ///< Reserve property indices + + ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, + ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve animatable property indices }; /** @@ -82,8 +78,17 @@ public: { enum { + // Event side properties OVERSHOOT_EFFECT_COLOR = PROPERTY_START_INDEX, ///< Property, name "overshoot-effect-color", @see SetOvershootEffectColor(), type Vector4 OVERSHOOT_ANIMATION_SPEED, ///< Property, name "overshoot-animation-speed", @see SetOvershootAnimationSpeed(), type float + + // Animatable properties + SCROLL_RELATIVE_POSITION = ANIMATABLE_PROPERTY_START_INDEX, ///< Property, name "scroll-relative-position", type Vector3 + SCROLL_POSITION_MIN, ///< Property, name "scroll-position-min", type Vector3 + SCROLL_POSITION_MAX, ///< Property, name "scroll-position-max", type Vector3 + SCROLL_DIRECTION, ///< Property, name "scroll-direction", type Vector2 + CAN_SCROLL_VERTICAL, ///< Property, name "can-scroll-vertical", type bool + CAN_SCROLL_HORIZONTAL ///< Property, name "can-scroll-horizontal", type bool }; }; diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index 5487676..898eac4 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -31,7 +31,7 @@ namespace Toolkit const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 0; -const unsigned int TOOLKIT_MICRO_VERSION = 35; +const unsigned int TOOLKIT_MICRO_VERSION = 36; const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/dali-toolkit/public-api/scripting/script.h b/dali-toolkit/public-api/scripting/script.h index 53c82aa..a3dd4bc 100644 --- a/dali-toolkit/public-api/scripting/script.h +++ b/dali-toolkit/public-api/scripting/script.h @@ -18,9 +18,9 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include -#include +#include namespace Dali { diff --git a/docs/content/programming-guide/animation-example.h b/docs/content/programming-guide/animation-example.h index 577dcfe..d133614 100644 --- a/docs/content/programming-guide/animation-example.h +++ b/docs/content/programming-guide/animation-example.h @@ -20,8 +20,8 @@ Here we add the animators, these are the building blocks (functions) of the animation and define what we want to see @code - myAnimation.OpacityTo(actor, 1.0f); - myAnimation.MoveTo(actor, x, y, z); + myAnimation.AnimateTo(Property(actor, Actor::Property::OPACITY), 1.0f); + myAnimation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(x, y, z)); @endcode start animation, when this is called we want the animation to start playing so here the actor will move whilst the opacity changes. @@ -30,15 +30,13 @@ @endcode \section advanced-anims Adding more advanced animators, if simply moving the actor is not enough we have further animations methods. - For actor there exists a range of methods ranging from Move, Rotate, Scale, Opacity, Color to Resize. The API explains in detail what each does and the parameters to these methods but there are some points worth noting; - - xxxxBy and xxxxTo, method names are appended by 'By' or 'To' either animate to a supplied value or animate by a supplied value. For example an actor at (10,10,10) calling MoveBy(actor, 50,0,0) would mean its location is (60,0,0) whilst MoveTo(actor, 50,0,0) would result in a location (50,0,0). + AnimateBy and AnimateTo, method names are appended by 'By' or 'To' either animate to a supplied value or animate by a supplied value. For example an actor at (10,10,10) calling AnimateBy(Property(actor, Actor::Property::POSITION), 50,0,0) would mean its location is (60,0,0) whilst AnimateTo(Property(actor, Actor::Property::POSITION), 50,0,0) would result in a location (50,0,0). Dali::AlphaFunctions can be used to give interesting effects to the animation, for example the MOVEment of an actor on screen can speed up and slow down following a sine curve by using the Dali::AlphaFunctions::EaseInOutSine instead of AlphaFunctions::Linear. @code - myAnimation.MoveTo(actor, Vector3(x, y, z), AlphaFunctions::Linear, delay, ANIMATOR_DURATION); - myAnimation.Resize(actor, actorSize, AlphaFunctions::EaseIn, delay, ANIMATOR_DURATION); + myAnimation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(x, y, z), AlphaFunctions::Linear, delay, ANIMATOR_DURATION); + myAnimation.AnimateTo(Property(actor, Actor::Property::SIZE), actorSize, AlphaFunctions::EaseIn, delay, ANIMATOR_DURATION); @endcode \section playback-control Controlling a playing animation diff --git a/docs/content/programming-guide/animation-rotation.h b/docs/content/programming-guide/animation-rotation.h index 2e01044..0351ec9 100644 --- a/docs/content/programming-guide/animation-rotation.h +++ b/docs/content/programming-guide/animation-rotation.h @@ -15,19 +15,15 @@ * actor.RotateBy(q); * @endcode * - * The Dali::Animation class provides several RotateTo methods that - * use \ref Dali::Quaternion "Quaternions" directly. The other - * RotateTo methods are specified using Axis+Angle, and these convert - * to Quaternion internally. You will only need to use the quaternion - * based methods when you are doing something more complex than - * initialising with Axis+Angle, such as applying several rotations - * together. + * The Dali::Animation class provides several AnimateTo methods that + * use \ref Dali::Quaternion "Quaternions" directly to change the orientation. + * * @code * mAnimation = Animation::New(5.0f); // 5 seconds * Quaternion q(Radian(Degree(45.0f)).value, Vector3::YAXIS); * Quaternion r(Radian(Degree(30.0f)).value, Vector3::ZAXIS); * q *= r; - * mAnimation.RotateTo(mActor, q, AlphaFunctions::EaseInOut); + * mAnimation.AnimateTo(Property(mActor, Actor::Property::ORIENTATION), q, AlphaFunctions::EaseInOut); * mAnimation.Play(); * @endcode */ diff --git a/docs/content/programming-guide/dynamics-bodies.h b/docs/content/programming-guide/dynamics-bodies.h index a8a9200..a6761d5 100644 --- a/docs/content/programming-guide/dynamics-bodies.h +++ b/docs/content/programming-guide/dynamics-bodies.h @@ -125,7 +125,7 @@ * body.SetKinematic( true ); * // create a second animation to move the actor 100 units to the right * Animation animation( Animation::New( 1 ) ); - * animation.MoveBy( actor, Vector3( 100, 0, 0 ), AlphaFunctions::Linear ); + * animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Vector3( 100, 0, 0 ), AlphaFunctions::Linear ); * animation.Play(); * \endcode *
diff --git a/docs/content/programming-guide/size-negotiation-controls.h b/docs/content/programming-guide/size-negotiation-controls.h index 641da16..1663e79 100644 --- a/docs/content/programming-guide/size-negotiation-controls.h +++ b/docs/content/programming-guide/size-negotiation-controls.h @@ -65,8 +65,7 @@ mBacking.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); @endcode The popup control is added to the layer and a background image is specified to fill the size of the popup and add a border by the following. @code -mBackgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); -mBackgroundImage.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT ); +mBackgroundImage.SetResizePolicy( SIZE_FIXED_OFFSET_FROM_PARENT, ALL_DIMENSIONS ); Vector3 border( mPopupStyle->backgroundOuterBorder.x, mPopupStyle->backgroundOuterBorder.z, 0.0f ); mBackgroundImage.SetSizeModeFactor( border ); @endcode diff --git a/docs/content/programming-guide/size-negotiation.h b/docs/content/programming-guide/size-negotiation.h index 536a8f8..c8bcb89 100644 --- a/docs/content/programming-guide/size-negotiation.h +++ b/docs/content/programming-guide/size-negotiation.h @@ -29,9 +29,11 @@ If a method can process width and height at the same time then the ALL_DIMENSION The ResizePolicy enum specifies a range of options for controlling the way actors resize. These are powerful rules that enable much automatic resizing behaviour. They are as following: -- FIXED: This is the option to use when you want the specific definite size as set by SetPreferredSize +- FIXED: This is the option to use when you want the specific definite size as set by SetSize (This is the default for all actors) - USE_NATURAL_SIZE: Use this option for objects such as images or text to get their natural size e.g. The dimensions of the image, or the size of the text without wrapping. Also use this on TableViews when the size of the table is dependent on its children. - FILL_TO_PARENT: Size will fill up to the size of its parent's size, taking a size factor into account to allow proportionate filling +- SIZE_RELATIVE_TO_PARENT: Fill up the parent with a relative scale. Use SetSizeModeFactor to specify the ratio to fill up to the parent. +- SIZE_FIXED_OFFSET_FROM_PARENT: Fill up the parent and add a fixed offset using SetSizeModeFactor. - FIT_TO_CHILDREN: Size will scale around the size of the actor's children. E.g. A popup's height may resize itself around it's contents. - DIMENSION_DEPENDENCY: This covers rules such as width-for-height and height-for-width. You specify that one dimension depends on another. @@ -44,13 +46,17 @@ This section details how an actor may be used with size negotiation.

Enabling Size Negotiation

The first thing to do is to specify whether you want an actor to be included or excluded from the relayout process. The following method is used to enable or disable the relayout -for an individual actor. +for an individual actor. Make sure this is the first thing that is called after the actor is created otherwise the actor may still be negotiated. @code void SetRelayoutEnabled( bool enabled ) @endcode Text and image actors have relayout enabled by default, while a plain Actor is disabled. Be aware that if desiring to use an Actor in relayout then relayout needs to be explicitly enabled first.

Specifying Size Policies

+Actors have different size policies by default. For example ImageActor is set to USE_NATURAL_SIZE. This ensures that when an image actor is +placed on the stage it will use its natural size by default. However if the user calls SetSize with non-zero sizes on the image actor then the current +size policy is overridden by the FIXED size policy and the actor will take on the size specified. + The next step is to specify how an actor will be size negotiated. The resize policies for an actor may be specified by the following method: @code void SetResizePolicy( ResizePolicy policy, Dimension dimension ) @endcode It is common to specifiy different policies for the different dimensions of width and height to achive different layouts. Different actors have @@ -81,24 +87,20 @@ After: This example shows an actor rootActor set to expand to its parent's width and contract/expand around its child's height. The child image actor is set to natural size which means it will display at the acutal size of the image. -To specify that a dimension has a dependency on another dimension use the following method. Calling this method will automatically set the resize policy to be DIMENSION_DEPENDENCY -for the given dimension. -@code void SetDimensionDependency( Dimension dimension, Dimension dependency ) @endcode -For example if dimension is HEIGHT and dependency is WIDTH then there is a height-for-width dependency in effect. The classic use case for this +To specify that a dimension has a dependency on another dimension use DIMENSION_DEPENDENCY. For example if dimension is HEIGHT and dependency is +WIDTH then there is a height-for-width dependency in effect. The classic use case for this is a text view that wraps its text. The following example snippet shows a text view that expands its width to the size of its parent, wraps its contents and then determines its height based on the width. @code TextView text = TextView::New( "Example" ); text.SetMultilinePolicy( SplitByWord ); text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); -text.SetDimensionDependency( HEIGHT, WIDTH ); +text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); @endcode

Specifying Sizes and Size Limits

-When wanting a specific fixed size for an actor then specify the resize policy to be FIXED and set the desired, or preferred size using the following method. -This method is to be used instead of SetSize when wishing to specify a size for an actor being size negotiated. -@code void SetPreferredSize( const Vector2& size ) @endcode +When wanting a specific fixed size for an actor then specify the resize policy to be FIXED and set the desired, or preferred size using SetSize. If only one dimension is FIXED then the other value in the size parameter will be ignored, so it is safe to set it to zero. To constrain the final negotiated size of an actor, set the following for minimum and maximum sizes respectively. @@ -109,14 +111,6 @@ void SetMaximumSize( const Vector2& size )

Altering Negotiated Size

-The following method specifies a size mode to use. Use one of: USE_OWN_SIZE, SIZE_RELATIVE_TO_PARENT or SIZE_FIXED_OFFSET_FROM_PARENT. SIZE_RELATIVE_TO_PARENT will -scale the image relative to it's parent size when the resize policy of FILL_TO_PARENT is in effect. While SIZE_FIXED_OFFSET_FROM_PARENT will -add an offset to this parent size, for example when wanting an image to act as a border around its parent. -@code void SetSizeMode( const SizeMode mode ) @endcode - -Use the following with SetSizeMode to specify either the size relative to parent or the fixed offset to apply. -@code void SetSizeModeFactor( const Vector3& factor ) @endcode - When an actor is required to maintain the aspect ratio of its natural size the following method can be used. This is useful for size negotiating images to ensure they maintain their aspect ratio while still fitting within the bounds they have been allocated. This can be one of USE_SIZE_SET, FIT_WITH_ASPECT_RATIO or FILL_WITH_ASPECT_RATIO. The first is the default. The second will fit the actor within the bounds it has been allocated while maintaining aspect ratio. The @@ -152,14 +146,14 @@ text.SetMultilinePolicy( Toolkit::TextView::SplitByWord ); text.SetWidthExceedPolicy( Toolkit::TextView::Split ); text.SetLineJustification( Toolkit::TextView::Left ); text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); -text.SetDimensionDependency( HEIGHT, WIDTH ); +text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); content.AddChild( text, Toolkit::TableView::CellPosition( 0, 0 ) ); // Image ImageActor image = ImageActor::New( ResourceImage::New( IMAGE1 ) ); image.SetResizePolicy( FILL_TO_PARENT, WIDTH ); -image.SetDimensionDependency( HEIGHT, WIDTH ); +image.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) ); content.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) ); @@ -176,8 +170,7 @@ Dali::Image checked = Dali::ResourceImage::New( CHECKBOX_CHECKED_IMAGE ); Toolkit::CheckBoxButton checkBox = Toolkit::CheckBoxButton::New(); checkBox.SetBackgroundImage( unchecked ); checkBox.SetSelectedImage( checked ); -checkBox.SetPreferredSize( Vector2( 48, 48 ) ); -checkBox.SetResizePolicy( FIXED, ALL_DIMENSIONS ); +checkBox.SetSize( Vector2( 48, 48 ) ); root.AddChild( checkBox, Toolkit::TableView::CellPosition( 0, 0 ) ); @@ -213,13 +206,13 @@ will result in a text view that fills up its width to available space in the tab height based on its new width. The table view will then fit its height taking the height of the text view into account. @code text.SetResizePolicy( FILL_TO_PARENT, WIDTH ); -text.SetDimensionDependency( HEIGHT, WIDTH ); +text.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); @endcode The image view performs a similar relayout. It fits its width to the size of the cell and calculates its height based on the new width. Some padding is added to the left of it as well to center it more. @code image.SetResizePolicy( FILL_TO_PARENT, WIDTH ); -image.SetDimensionDependency( HEIGHT, WIDTH ); +image.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); image.SetPadding( Padding( 20.0f, 0.0f, 0.0f, 0.0f ) ); @endcode The sub table view is similar as well in that it expands its width to the size of its cell. When it is added to the table view it diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index 8b2c7c7..b0e9668 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali-toolkit Summary: The OpenGLES Canvas Core Library Toolkit -Version: 1.0.35 +Version: 1.0.36 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/plugins/dali-script-v8/src/constants/constants-wrapper.cpp b/plugins/dali-script-v8/src/constants/constants-wrapper.cpp index 938e485..9815aa7 100644 --- a/plugins/dali-script-v8/src/constants/constants-wrapper.cpp +++ b/plugins/dali-script-v8/src/constants/constants-wrapper.cpp @@ -201,10 +201,6 @@ const IntegerPair EnumTable[] = { "CULL_BACK_FACE", CullBack }, { "CULL_FRONT_AND_BACK_FACE", CullFrontAndBack }, - { "USE_OWN_SIZE", USE_OWN_SIZE }, - { "SIZE_RELATIVE_TO_PARENT", SIZE_RELATIVE_TO_PARENT }, - { "SIZE_FIXED_OFFSET_FROM_PARENT", SIZE_FIXED_OFFSET_FROM_PARENT }, - { "CAMERA_FREE_LOOK" , Camera::FREE_LOOK }, { "CAMERA_LOOK_AT_TARGET" , Camera::LOOK_AT_TARGET }, { "CAMERA_PERSPECTIVE_PROJECTION" , Camera::PERSPECTIVE_PROJECTION },