Removing unused variables
[platform/core/uifw/dali-demo.git] / examples / property-notification / property-notification-example.cpp
index 3d3b6d6..c54e239 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
 
 #include <dali/devel-api/actors/actor-devel.h>
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -57,10 +56,10 @@ public:
    */
   void Create( Application& application )
   {
-    // Set the stage background color and connect to the stage's key signal to allow Back and Escape to exit.
-    Stage stage = Stage::GetCurrent();
-    stage.SetBackgroundColor( Color::WHITE );
-    stage.KeyEventSignal().Connect( this, &PropertyNotificationController::OnKeyEvent );
+    // Set the window background color and connect to the window's key signal to allow Back and Escape to exit.
+    Window window = application.GetWindow();
+    window.SetBackgroundColor( Color::WHITE );
+    window.KeyEventSignal().Connect( this, &PropertyNotificationController::OnKeyEvent );
 
     // Create a text label and set the text color to black
     mTextLabel = TextLabel::New( "Black to Red Animation\nNew opacity animation at 50% Red" );
@@ -68,16 +67,16 @@ public:
     mTextLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
     mTextLabel.SetProperty( TextLabel::Property::MULTI_LINE, true );
     mTextLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
-    mTextLabel.SetProperty( DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE, Color::BLACK );
-    stage.Add( mTextLabel );
+    mTextLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK );
+    window.Add( mTextLabel );
 
     // Create an animation and animate the text color to red
     Animation animation = Animation::New( COLOR_ANIMATION_DURATION );
-    animation.AnimateTo( Property( mTextLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::RED );
+    animation.AnimateTo( Property( mTextLabel, TextLabel::Property::TEXT_COLOR ), Color::RED );
     animation.Play();
 
     // Set up a property notification so we are notified when the red component of the text-color reaches 50%
-    PropertyNotification notification = mTextLabel.AddPropertyNotification( DevelTextLabel::Property::TEXT_COLOR_RED, GreaterThanCondition( 0.5f ) );
+    PropertyNotification notification = mTextLabel.AddPropertyNotification( TextLabel::Property::TEXT_COLOR_RED, GreaterThanCondition( 0.5f ) );
     notification.NotifySignal().Connect( this, &PropertyNotificationController::RedComponentNotification );
   }
 
@@ -89,7 +88,7 @@ public:
    */
   void OnKeyEvent( const KeyEvent& event )
   {
-    if( event.state == KeyEvent::Down )
+    if( event.GetState() == KeyEvent::Down )
     {
       if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
       {
@@ -107,7 +106,7 @@ public:
   void RedComponentNotification( PropertyNotification& /* source */ )
   {
     Animation animation = Animation::New( OPACITY_ANIMATION_DURATION );
-    animation.AnimateTo( Property( mTextLabel, DevelActor::Property::OPACITY ), 0.0f );
+    animation.AnimateTo( Property( mTextLabel, Actor::Property::OPACITY ), 0.0f );
     animation.Play();
   }