Move more public-api headers to devel-api. PART 3
[platform/core/uifw/dali-demo.git] / examples / magnifier / magnifier-example.cpp
index 68e3036..d20cd6b 100644 (file)
@@ -21,7 +21,7 @@
 #include "shared/view.h"
 
 #include <dali-toolkit/dali-toolkit.h>
-
+#include <dali-toolkit/devel-api/controls/magnifier/magnifier.h>
 using namespace Dali;
 
 namespace
@@ -193,6 +193,8 @@ public:
    */
   void Create( Application& application )
   {
+    DemoHelper::RequestThemeChange();
+
     Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
 
     mStageSize = Stage::GetCurrent().GetSize();
@@ -217,22 +219,20 @@ public:
 
     // Create magnifier (controlled by human touch)
     Layer overlay = Layer::New();
-    overlay.SetRelayoutEnabled( false );
     overlay.SetSensitive(false);
     overlay.SetParentOrigin( ParentOrigin::CENTER );
     overlay.SetSize(mStageSize);
     Stage::GetCurrent().Add(overlay);
 
     mMagnifier = Toolkit::Magnifier::New();
-    mMagnifier.SetRelayoutEnabled( false );
-    mMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
+    mMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
     mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width );  // Size of magnifier is in relation to stage width
     mMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
     mMagnifier.SetScale(Vector3::ZERO);
     overlay.Add( mMagnifier );
 
     // Apply constraint to animate the position of the magnifier.
-    Constraint constraint = Constraint::New<Vector3>( mMagnifier, Actor::Property::POSITION, ConfinementConstraint(ParentOrigin::CENTER, Vector2::ONE * MAGNIFIER_INDENT, Vector2::ONE * MAGNIFIER_INDENT) );
+    Constraint constraint = Constraint::New<Vector3>( mMagnifier, Actor::Property::POSITION, ConfinementConstraint(Vector3( 0.5f, 0.5f, 0.0f ), Vector2::ONE * MAGNIFIER_INDENT, Vector2::ONE * MAGNIFIER_INDENT) );
     constraint.AddSource( LocalSource(Actor::Property::SIZE) );
     constraint.AddSource( LocalSource(Actor::Property::PARENT_ORIGIN) );
     constraint.AddSource( LocalSource(Actor::Property::ANCHOR_POINT) );
@@ -242,8 +242,7 @@ public:
 
     // Create bouncing magnifier automatically bounces around screen.
     mBouncingMagnifier = Toolkit::Magnifier::New();
-    mBouncingMagnifier.SetRelayoutEnabled( false );
-    mBouncingMagnifier.SetSourceActor( mView.GetBackgroundLayer() );
+    mBouncingMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
     mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
     mBouncingMagnifier.SetMagnificationFactor( MAGNIFICATION_FACTOR );
     overlay.Add( mBouncingMagnifier );
@@ -345,7 +344,7 @@ public:
     if(!mMagnifierShown)
     {
       Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
-      animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ONE, AlphaFunctions::EaseIn);
+      animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ONE, AlphaFunction::EASE_IN);
       animation.Play();
       mMagnifierShown = true;
     }
@@ -359,7 +358,7 @@ public:
     if(mMagnifierShown)
     {
       Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION);
-      animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut);
+      animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ZERO, AlphaFunction::EASE_OUT);
       animation.Play();
       mMagnifierShown = false;
     }
@@ -394,7 +393,7 @@ public:
 private:
 
   Application&  mApplication;                             ///< Application instance
-  Toolkit::View mView;                                    ///< The view
+  Toolkit::Control mView;                                 ///< The view
   Layer mContent;                                         ///< The content layer
   Toolkit::Magnifier mMagnifier;                          ///< The manually controlled magnifier
   Toolkit::Magnifier mBouncingMagnifier;                  ///< The animating magnifier (swirly animation)