From 9f8c97ef6070093c3529a9d4368e18307eebf007 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Thu, 12 Feb 2015 15:30:30 +0000 Subject: [PATCH] Dali-toolkit: Replace constraints with SizeMode Change-Id: I8bc67f3b0c781f0f5c30f3576972ff1008c8c16c --- dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp | 6 +++--- .../internal/controls/text-input/text-input-handles-impl.cpp | 3 ++- dali-toolkit/internal/controls/text-input/text-input-impl.cpp | 9 ++++++--- .../internal/controls/text-input/text-input-popup-impl.cpp | 8 ++++---- dali-toolkit/internal/focus-manager/focus-manager-impl.cpp | 5 +---- .../internal/focus-manager/keyboard-focus-manager-impl.cpp | 5 +---- 6 files changed, 17 insertions(+), 19 deletions(-) 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 098e9ae..d47d9bf 100644 --- a/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp +++ b/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp @@ -180,9 +180,9 @@ void ShadowView::SetShadowPlane(Actor shadowPlane) ConstrainCamera(); - mShadowPlane.ApplyConstraint( Constraint::New( Actor::SIZE, Source( mShadowPlaneBg, Actor::SIZE ), EqualToConstraint() ) ); + mShadowPlane.SetSizeMode( SIZE_EQUAL_TO_PARENT ); - mBlurRootActor.ApplyConstraint( Constraint::New( Actor::SIZE, Source( mShadowPlane, Actor::SIZE ), EqualToConstraint() ) ); + mBlurRootActor.SetSizeMode( SIZE_EQUAL_TO_PARENT ); } void ShadowView::SetPointLight(Actor pointLight) @@ -237,7 +237,7 @@ void ShadowView::OnInitialize() { // root actor to parent all user added actors. Used as source actor for shadow render task. mChildrenRoot.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); - mChildrenRoot.ApplyConstraint(Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() )); + mChildrenRoot.SetSizeMode( SIZE_EQUAL_TO_PARENT ); Vector2 stageSize = Stage::GetCurrent().GetSize(); mCameraActor = CameraActor::New(stageSize); diff --git a/dali-toolkit/internal/controls/text-input/text-input-handles-impl.cpp b/dali-toolkit/internal/controls/text-input/text-input-handles-impl.cpp index 456659a..aa5ca7d 100644 --- a/dali-toolkit/internal/controls/text-input/text-input-handles-impl.cpp +++ b/dali-toolkit/internal/controls/text-input/text-input-handles-impl.cpp @@ -62,7 +62,8 @@ Actor CreateGrabArea( const std::string& name, const Vector3& relativeScale ) Actor handleGrabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move handleGrabArea.SetName( name ); - handleGrabArea.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( relativeScale ) ) ); // grab area to be larger than text actor + handleGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + handleGrabArea.SetSizeModeFactor( relativeScale ); handleGrabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); return handleGrabArea; diff --git a/dali-toolkit/internal/controls/text-input/text-input-impl.cpp b/dali-toolkit/internal/controls/text-input/text-input-impl.cpp index 6dd4adf..c9d5b83 100644 --- a/dali-toolkit/internal/controls/text-input/text-input-impl.cpp +++ b/dali-toolkit/internal/controls/text-input/text-input-impl.cpp @@ -3048,7 +3048,8 @@ void TextInput::CreateGrabArea( Actor& parent ) mGrabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move mGrabArea.SetName( "GrabArea" ); mGrabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); - mGrabArea.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE ) ) ); // grab area to be larger than text actor + mGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE ); mGrabArea.TouchedSignal().Connect(this,&TextInput::OnPressDown); mTapDetector.Attach( mGrabArea ); mPanGestureDetector.Attach( mGrabArea ); @@ -3284,7 +3285,8 @@ void TextInput::CreateSelectionHandles( std::size_t start, std::size_t end, Dali mHandleOneGrabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move mHandleOneGrabArea.SetName("SelectionHandleOneGrabArea"); - mHandleOneGrabArea.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ) ) ); // grab area to be larger than text actor + mHandleOneGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + mHandleOneGrabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ); mHandleOneGrabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); mTapDetector.Attach( mHandleOneGrabArea ); @@ -3311,7 +3313,8 @@ void TextInput::CreateSelectionHandles( std::size_t start, std::size_t end, Dali mHandleTwoGrabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move mHandleTwoGrabArea.SetName("SelectionHandleTwoGrabArea"); - mHandleTwoGrabArea.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ) ) ); // grab area to be larger than text actor + mHandleTwoGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT ); + mHandleTwoGrabArea.SetSizeModeFactor( DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE ); mHandleTwoGrabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); mTapDetector.Attach( mHandleTwoGrabArea ); diff --git a/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp b/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp index de6cd6f..3ad818f 100644 --- a/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp @@ -287,7 +287,7 @@ void TextInputPopup::CreateBackground() mBackgroundEffect.SetAnchorPoint( AnchorPoint::CENTER ); mBackgroundEffect.SetParentOrigin( ParentOrigin::CENTER ); mBackgroundEffect.SetName( "text-input-popup-background-effect" ); - mBackgroundEffect.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mBackgroundEffect.SetSizeMode( SIZE_EQUAL_TO_PARENT ); mBackgroundEffect.SetZ( 1.0f ); mBackground.Add( mBackgroundEffect ); @@ -296,7 +296,7 @@ void TextInputPopup::CreateBackground() mBackgroundLine.SetAnchorPoint( AnchorPoint::CENTER); mBackgroundLine.SetParentOrigin( ParentOrigin::CENTER ); mBackgroundLine.SetName( "text-input-popup-background-effect" ); - mBackgroundLine.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mBackgroundLine.SetSizeMode( SIZE_EQUAL_TO_PARENT ); mBackgroundLine.SetColor( mLineColor ); mBackgroundLine.SetZ( 0.1f ); mBackgroundEffect.Add( mBackgroundLine ); @@ -322,7 +322,7 @@ void TextInputPopup::CreateTail() mTailEffect.SetParentOrigin( ParentOrigin::CENTER ); mTailEffect.SetAnchorPoint( AnchorPoint::CENTER ); mTailEffect.SetName( "text-input-popup-tail-effect" ); - mTailEffect.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mTailEffect.SetSizeMode( SIZE_EQUAL_TO_PARENT ); mTailEffect.SetZ( 0.1f ); mTail.Add( mTailEffect ); @@ -330,7 +330,7 @@ void TextInputPopup::CreateTail() mTailLine = ImageActor::New( tailLine ); mTailLine.SetParentOrigin( ParentOrigin::CENTER ); mTailLine.SetAnchorPoint( AnchorPoint::CENTER ); - mTailLine.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mTailLine.SetSizeMode( SIZE_EQUAL_TO_PARENT ); mTailLine.SetName( "text-input-popup-tail-line" ); mTailLine.SetColor( mLineColor ); mTailLine.SetZ( 0.1f ); diff --git a/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp index 7a46f2e..1fcc519c 100644 --- a/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/focus-manager-impl.cpp @@ -668,10 +668,7 @@ void FocusManager::CreateDefaultFocusIndicatorActor() focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f)); // Apply size constraint to the focus indicator - Constraint constraint = Constraint::New(Actor::SIZE, - ParentSource(Actor::SIZE), - EqualToConstraint()); - focusIndicator.ApplyConstraint(constraint); + focusIndicator.SetSizeMode( SIZE_EQUAL_TO_PARENT ); SetFocusIndicatorActor(focusIndicator); } diff --git a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index 11644e7..c9a3d98 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -468,10 +468,7 @@ void KeyboardFocusManager::CreateDefaultFocusIndicatorActor() focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f)); // Apply size constraint to the focus indicator - Constraint constraint = Constraint::New(Actor::SIZE, - ParentSource(Actor::SIZE), - EqualToConstraint()); - focusIndicator.ApplyConstraint(constraint); + focusIndicator.SetSizeMode( SIZE_EQUAL_TO_PARENT ); SetFocusIndicatorActor(focusIndicator); } -- 2.7.4