Dali-toolkit: Replace constraints with SizeMode 68/35368/3
authorTom Robinson <tom.robinson@samsung.com>
Thu, 12 Feb 2015 15:30:30 +0000 (15:30 +0000)
committerTom Robinson <tom.robinson@samsung.com>
Wed, 18 Feb 2015 10:34:52 +0000 (02:34 -0800)
Change-Id: I8bc67f3b0c781f0f5c30f3576972ff1008c8c16c

dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-handles-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-impl.cpp
dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp
dali-toolkit/internal/focus-manager/focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp

index 098e9ae..d47d9bf 100644 (file)
@@ -180,9 +180,9 @@ void ShadowView::SetShadowPlane(Actor shadowPlane)
 
   ConstrainCamera();
 
 
   ConstrainCamera();
 
-  mShadowPlane.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlaneBg, Actor::SIZE ), EqualToConstraint() ) );
+  mShadowPlane.SetSizeMode( SIZE_EQUAL_TO_PARENT );
 
 
-  mBlurRootActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlane, Actor::SIZE ), EqualToConstraint() ) );
+  mBlurRootActor.SetSizeMode( SIZE_EQUAL_TO_PARENT );
 }
 
 void ShadowView::SetPointLight(Actor pointLight)
 }
 
 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 );
 {
   // 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<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ));
+  mChildrenRoot.SetSizeMode( SIZE_EQUAL_TO_PARENT );
 
   Vector2 stageSize = Stage::GetCurrent().GetSize();
   mCameraActor = CameraActor::New(stageSize);
 
   Vector2 stageSize = Stage::GetCurrent().GetSize();
   mCameraActor = CameraActor::New(stageSize);
index 456659a..aa5ca7d 100644 (file)
@@ -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 );
 
   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<Vector3>( 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;
   handleGrabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
 
   return handleGrabArea;
index 6dd4adf..c9d5b83 100644 (file)
@@ -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 = 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<Vector3>( 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 );
   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 = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
     mHandleOneGrabArea.SetName("SelectionHandleOneGrabArea");
 
-    mHandleOneGrabArea.ApplyConstraint( Constraint::New<Vector3>( 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 );
     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 = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
     mHandleTwoGrabArea.SetName("SelectionHandleTwoGrabArea");
-    mHandleTwoGrabArea.ApplyConstraint( Constraint::New<Vector3>( 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 );
     mHandleTwoGrabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
 
     mTapDetector.Attach( mHandleTwoGrabArea );
index de6cd6f..3ad818f 100644 (file)
@@ -287,7 +287,7 @@ void TextInputPopup::CreateBackground()
     mBackgroundEffect.SetAnchorPoint( AnchorPoint::CENTER );
     mBackgroundEffect.SetParentOrigin( ParentOrigin::CENTER );
     mBackgroundEffect.SetName( "text-input-popup-background-effect" );
     mBackgroundEffect.SetAnchorPoint( AnchorPoint::CENTER );
     mBackgroundEffect.SetParentOrigin( ParentOrigin::CENTER );
     mBackgroundEffect.SetName( "text-input-popup-background-effect" );
-    mBackgroundEffect.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+    mBackgroundEffect.SetSizeMode( SIZE_EQUAL_TO_PARENT );
     mBackgroundEffect.SetZ( 1.0f );
     mBackground.Add( mBackgroundEffect );
 
     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.SetAnchorPoint( AnchorPoint::CENTER);
     mBackgroundLine.SetParentOrigin( ParentOrigin::CENTER );
     mBackgroundLine.SetName( "text-input-popup-background-effect" );
-    mBackgroundLine.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+    mBackgroundLine.SetSizeMode( SIZE_EQUAL_TO_PARENT );
     mBackgroundLine.SetColor( mLineColor );
     mBackgroundLine.SetZ( 0.1f );
     mBackgroundEffect.Add( mBackgroundLine );
     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.SetParentOrigin( ParentOrigin::CENTER );
     mTailEffect.SetAnchorPoint( AnchorPoint::CENTER );
     mTailEffect.SetName( "text-input-popup-tail-effect" );
-    mTailEffect.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+    mTailEffect.SetSizeMode( SIZE_EQUAL_TO_PARENT );
     mTailEffect.SetZ( 0.1f );
     mTail.Add( mTailEffect );
 
     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 = ImageActor::New( tailLine );
     mTailLine.SetParentOrigin( ParentOrigin::CENTER );
     mTailLine.SetAnchorPoint( AnchorPoint::CENTER );
-    mTailLine.ApplyConstraint( Constraint::New<Vector3>( 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 );
     mTailLine.SetName( "text-input-popup-tail-line" );
     mTailLine.SetColor( mLineColor );
     mTailLine.SetZ( 0.1f );
index 7a46f2e..1fcc519 100644 (file)
@@ -668,10 +668,7 @@ void FocusManager::CreateDefaultFocusIndicatorActor()
   focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
 
   // Apply size constraint to the focus indicator
   focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
 
   // Apply size constraint to the focus indicator
-  Constraint constraint = Constraint::New<Vector3>(Actor::SIZE,
-                                                   ParentSource(Actor::SIZE),
-                                                   EqualToConstraint());
-  focusIndicator.ApplyConstraint(constraint);
+  focusIndicator.SetSizeMode( SIZE_EQUAL_TO_PARENT );
 
   SetFocusIndicatorActor(focusIndicator);
 }
 
   SetFocusIndicatorActor(focusIndicator);
 }
index 11644e7..c9a3d98 100644 (file)
@@ -468,10 +468,7 @@ void KeyboardFocusManager::CreateDefaultFocusIndicatorActor()
   focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
 
   // Apply size constraint to the focus indicator
   focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
 
   // Apply size constraint to the focus indicator
-  Constraint constraint = Constraint::New<Vector3>(Actor::SIZE,
-                                                   ParentSource(Actor::SIZE),
-                                                   EqualToConstraint());
-  focusIndicator.ApplyConstraint(constraint);
+  focusIndicator.SetSizeMode( SIZE_EQUAL_TO_PARENT );
 
   SetFocusIndicatorActor(focusIndicator);
 }
 
   SetFocusIndicatorActor(focusIndicator);
 }