Changes after Stage moved to Devel API
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / popup / popup-impl.cpp
index 4d0e156..1b4c3ab 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.
@@ -26,7 +26,7 @@
 #include <dali/integration-api/debug.h>
 #include <dali/public-api/adaptor-framework/key.h>
 #include <dali/public-api/animation/constraints.h>
-#include <dali/public-api/common/stage.h>
+#include <dali/devel-api/common/stage.h>
 #include <dali/public-api/events/key-event.h>
 #include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/object/type-registry.h>
@@ -39,7 +39,7 @@
 #include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
+#include <dali-toolkit/devel-api/accessibility-manager/accessibility-manager.h>
 #include <dali-toolkit/public-api/visuals/color-visual-properties.h>
 #include <dali-toolkit/public-api/visuals/visual-properties.h>
 #include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
@@ -325,7 +325,7 @@ void Popup::OnInitialize()
 
   mPopupLayout.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::WIDTH );
   mPopupLayout.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
-  mPopupLayout.SetSize( Stage::GetCurrent().GetSize().x * DEFAULT_RELATIVE_PARENT_WIDTH, 0.0f );
+  mPopupLayout.SetProperty( Actor::Property::SIZE, Vector2( Stage::GetCurrent().GetSize().x * DEFAULT_RELATIVE_PARENT_WIDTH, 0.0f ) );
 
   mPopupLayout.SetFitHeight( 0 ); // Set row to fit.
   mPopupLayout.SetFitHeight( 1 ); // Set row to fit.
@@ -354,14 +354,14 @@ void Popup::LayoutAnimation()
     case Toolkit::Popup::ZOOM:
     {
       // Zoom animations start fully zoomed out.
-      mPopupContainer.SetScale( Vector3::ZERO );
+      mPopupContainer.SetProperty( Actor::Property::SCALE, Vector3::ZERO );
       break;
     }
 
     case Toolkit::Popup::FADE:
     {
       // Fade animations start transparent.
-      mPopupContainer.SetProperty( DevelActor::Property::OPACITY, 0.0f );
+      mPopupContainer.SetProperty( Actor::Property::OPACITY, 0.0f );
       break;
     }
 
@@ -435,7 +435,7 @@ void Popup::StartTransitionAnimation( bool transitionIn, bool instantaneous /* f
       }
       else
       {
-        mPopupContainer.SetScale( transitionIn ? Vector3::ONE : Vector3::ZERO );
+        mPopupContainer.SetProperty( Actor::Property::SCALE, transitionIn ? Vector3::ONE : Vector3::ZERO );
       }
       break;
     }
@@ -456,7 +456,7 @@ void Popup::StartTransitionAnimation( bool transitionIn, bool instantaneous /* f
       }
       else
       {
-        mPopupContainer.SetProperty( DevelActor::Property::OPACITY, transitionIn ? 1.0f : 0.0f );
+        mPopupContainer.SetProperty( Actor::Property::OPACITY, transitionIn ? 1.0f : 0.0f );
       }
       break;
     }
@@ -747,16 +747,16 @@ void Popup::SetDisplayState( Toolkit::Popup::DisplayState displayState )
     {
       mPreviousFocusedActor = keyboardFocusManager.GetCurrentFocusActor();
 
-      if( Self().IsKeyboardFocusable() )
+      if( Self().GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) )
       {
         // Setup the actgor to start focus from.
         Actor focusActor;
-        if( mContent && mContent.IsKeyboardFocusable() )
+        if( mContent && mContent.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) )
         {
           // If the content is focusable, move the focus to the content.
           focusActor = mContent;
         }
-        else if( mFooter && mFooter.IsKeyboardFocusable() )
+        else if( mFooter && mFooter.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) )
         {
           // If the footer is focusable, move the focus to the footer.
           focusActor = mFooter;
@@ -779,7 +779,7 @@ void Popup::SetDisplayState( Toolkit::Popup::DisplayState displayState )
     ClearKeyInputFocus();
 
     // Restore the keyboard focus when popup is hidden.
-    if( mPreviousFocusedActor && mPreviousFocusedActor.IsKeyboardFocusable() )
+    if( mPreviousFocusedActor && mPreviousFocusedActor.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) )
     {
       Dali::Toolkit::KeyboardFocusManager keyboardFocusManager = Dali::Toolkit::KeyboardFocusManager::Get();
       if( keyboardFocusManager )
@@ -898,7 +898,7 @@ void Popup::LayoutTail()
     mTailImage.SetProperty( Dali::Actor::Property::NAME, "tailImage" );
     mTailImage.SetProperty( Actor::Property::PARENT_ORIGIN, parentOrigin );
     mTailImage.SetProperty( Actor::Property::ANCHOR_POINT, anchorPoint );
-    mTailImage.SetPosition( position );
+    mTailImage.SetProperty( Actor::Property::POSITION, position );
 
     if( mPopupBackgroundImage )
     {
@@ -931,7 +931,7 @@ Toolkit::Control Popup::CreateBacking()
 
   // Always the full size of the stage.
   backing.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
-  backing.SetSize( Stage::GetCurrent().GetSize() );
+  backing.SetProperty( Actor::Property::SIZE, Stage::GetCurrent().GetSize() );
 
   // Catch events.
   backing.SetProperty( Actor::Property::SENSITIVE, true );
@@ -1032,7 +1032,7 @@ void Popup::UpdateBackgroundPositionAndSize()
     mPopupBackgroundImage.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( mBackgroundBorder.left + mBackgroundBorder.right, mBackgroundBorder.top + mBackgroundBorder.bottom, 0.0f ) );
 
     // Adjust the position of the background so the transparent areas are set appropriately
-    mPopupBackgroundImage.SetPosition( ( mBackgroundBorder.right - mBackgroundBorder.left ) * 0.5f, ( mBackgroundBorder.bottom - mBackgroundBorder.top ) * 0.5f );
+    mPopupBackgroundImage.SetProperty( Actor::Property::POSITION, Vector2( ( mBackgroundBorder.right - mBackgroundBorder.left ) * 0.5f, ( mBackgroundBorder.bottom - mBackgroundBorder.top ) * 0.5f ));
   }
 }
 
@@ -1552,7 +1552,7 @@ bool Popup::OnBackingTouched( Actor actor, const TouchData& touch )
   }
 
   // Block anything behind backing becoming touched.
-  mLayer.SetTouchConsumed( true );
+  mLayer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
   return true;
 }
 
@@ -1565,7 +1565,7 @@ bool Popup::OnBackingWheelEvent( Actor actor, const WheelEvent& event )
   }
 
   // Consume wheel event in dimmed backing actor.
-  mLayer.SetTouchConsumed( true );
+  mLayer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
   return true;
 }
 
@@ -1578,7 +1578,7 @@ bool Popup::OnDialogTouched( Actor actor, const TouchData& touch )
   }
 
   // Consume event (stops backing actor receiving touch events)
-  mLayer.SetTouchConsumed( true );
+  mLayer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
   return true;
 }
 
@@ -1687,7 +1687,7 @@ void Popup::LayoutContext( const Vector2& size )
   }
 
   // Set the final position.
-  mPopupContainer.SetPosition( newPosition );
+  mPopupContainer.SetProperty( Actor::Property::POSITION, newPosition );
 }
 
 void Popup::OnRelayout( const Vector2& size, RelayoutContainer& container )
@@ -1831,7 +1831,7 @@ void Popup::AddFocusableChildrenRecursive( Actor parent, std::vector< Actor >& f
     Toolkit::Control control = Toolkit::Control::DownCast( parent );
     bool layoutControl = control && GetImplementation( control ).IsKeyboardNavigationSupported();
 
-    if( parent.IsKeyboardFocusable() || layoutControl )
+    if( parent.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) || layoutControl )
     {
       focusableActors.push_back( parent );
 
@@ -1889,12 +1889,12 @@ Actor Popup::GetNextKeyboardFocusableActor( Actor currentFocusedActor, Toolkit::
     ( currentFocusedActor && ( ( !mContent || ( currentFocusGroup != mContent ) ) && ( !mFooter || ( currentFocusGroup != mFooter ) ) ) ) )
   {
     // The current focused actor is not within popup.
-    if( mContent && mContent.IsKeyboardFocusable() )
+    if( mContent && mContent.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) )
     {
       // If the content is focusable, move the focus to the content.
       nextFocusableActor = mContent;
     }
-    else if( mFooter && mFooter.IsKeyboardFocusable() )
+    else if( mFooter && mFooter.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) )
     {
       // If the footer is focusable, move the focus to the footer.
       nextFocusableActor = mFooter;