text-decorator to use ImageView instead of ImageActors 96/54296/2
authorAgnelo Vaz <agnelo.vaz@samsung.com>
Mon, 14 Dec 2015 20:43:35 +0000 (20:43 +0000)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Tue, 15 Dec 2015 15:51:09 +0000 (15:51 +0000)
* SolidColorActor occurances replaced with CustomActors with background color set
* ImageActor planned to be deprecated
* Testcase expecting an ImageActor updated

Change-Id: Ieb821143f09637c19a0bcc2b55c0485b6b961596
Signed-off-by: Agnelo Vaz <agnelo.vaz@samsung.com>
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp
dali-toolkit/internal/text/decorator/text-decorator.cpp

index b6f5c71d9fb59bbcc1c0f22ee11608f1ea40a457..b0e426959c239562b1fc925f6fe678d83d38c495 100644 (file)
@@ -668,7 +668,7 @@ int utcDaliTextFieldEvent02(void)
   DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
   DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 2u, TEST_LOCATION ); // The camera actor and the renderer
 
-  ImageActor cursor = ImageActor::DownCast( layer.GetChildAt( 0u ) );
+  Control cursor = Control::DownCast( layer.GetChildAt( 0u ) );
   DALI_TEST_CHECK( cursor );
 
   CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) );
index 6c69704b5ffdfc60c24f42c3635dac35e52f4837..6022879fcdcc1582b51829f376b61d630e2f817b 100644 (file)
@@ -736,14 +736,13 @@ std::string TextSelectionPopup::GetPressedImage() const
    {
      const Size size( mOptionDividerSize.width, 0.0f ); // Height FILL_TO_PARENT
 
-     ImageActor divider = Toolkit::CreateSolidColorActor( Color::WHITE );
+     Toolkit::Control divider = Toolkit::Control::New();
 #ifdef DECORATOR_DEBUG
      divider.SetName("Text's popup divider");
 #endif
      divider.SetSize( size );
      divider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
-     divider.SetColor( mDividerColor );
-     divider.SetSortModifier( DECORATION_DEPTH_INDEX );
+     divider.SetBackgroundColor( mDividerColor  );
      mToolbar.AddDivider( divider );
    }
  }
index 9ca5fb75840e3515cc93f242190fbe54522c9d72..0c4976174039baf67e85e9604526365fbf390e8e 100644 (file)
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/images/resource-image.h>
+#include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/math/vector2.h>
 #include <dali/public-api/math/vector4.h>
 #include <dali/public-api/object/property-map.h>
@@ -156,22 +157,6 @@ void TextSelectionToolbar::OnStageConnection( int depth )
   // Call the Control::OnStageConnection() to set the depth of the background.
   Control::OnStageConnection( depth );
 
-  // Traverse the dividers and set the depth.
-  for( unsigned int i = 0; i < mDividerIndexes.Count(); ++i )
-  {
-    Actor divider = mTableOfButtons.GetChildAt( Toolkit::TableView::CellPosition( 0, mDividerIndexes[ i ] ) );
-
-    ImageActor dividerImageActor = ImageActor::DownCast( divider );
-    if( dividerImageActor )
-    {
-      dividerImageActor.SetSortModifier( DECORATION_DEPTH_INDEX + depth );
-    }
-    else
-    {
-      // TODO at the moment divider are image actors.
-    }
-  }
-
   // Texts are controls, they have their own OnStageConnection() implementation.
   // Icons are inside a TableView. It has it's own OnStageConnection() implementation.
 }
@@ -221,7 +206,8 @@ void TextSelectionToolbar::SetUp()
   mStencilLayer.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
   mStencilLayer.SetParentOrigin( ParentOrigin::CENTER );
 
-  ImageActor stencil = CreateSolidColorActor( Color::RED );
+  BufferImage stencilImage = BufferImage::WHITE(); // ImageView needs an Image or does nothing
+  Toolkit::ImageView stencil = Toolkit::ImageView::New(stencilImage);
   stencil.SetDrawMode( DrawMode::STENCIL );
   stencil.SetVisible( true );
   stencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
index 757eb4e6c84124643a51bea9c8726ad3e4ddf1e2..3e6e33d52122b7a9f7d206fd6814588d08fd1234 100644 (file)
@@ -35,6 +35,8 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali-toolkit/internal/controls/image-view/image-view-impl.h>
 
 #ifdef DEBUG_ENABLED
 #define DECORATOR_DEBUG
@@ -220,9 +222,9 @@ struct Decorator::Impl : public ConnectionTracker
     {
     }
 
-    ImageActor actor;
+    ImageView actor;
     Actor grabArea;
-    ImageActor markerActor;
+    ImageView markerActor;
 
     Vector2 position;
     Size    size;
@@ -523,10 +525,10 @@ struct Decorator::Impl : public ConnectionTracker
     DeterminePositionPopup();
   }
 
-  void CreateCursor( ImageActor& cursor, const Vector4& color )
+  void CreateCursor( Control& cursor, const Vector4& color )
   {
-    cursor = CreateSolidColorActor( color );
-    cursor.SetSortModifier( DECORATION_DEPTH_INDEX );
+    cursor = Control::New();
+    cursor.SetBackgroundColor( color );
     cursor.SetParentOrigin( ParentOrigin::TOP_LEFT ); // Need to set the default parent origin as CreateSolidColorActor() sets a different one.
     cursor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
   }
@@ -657,15 +659,17 @@ struct Decorator::Impl : public ConnectionTracker
     HandleImpl& grabHandle = mHandle[GRAB_HANDLE];
     if( !grabHandle.actor )
     {
-      grabHandle.actor = ImageActor::New( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] );
-      grabHandle.actor.SetSortModifier( DECORATION_DEPTH_INDEX );
+      grabHandle.actor = ImageView::New( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] );
+      GetImpl( grabHandle.actor).SetDepthIndex( DECORATION_DEPTH_INDEX );
       grabHandle.actor.SetAnchorPoint( AnchorPoint::TOP_CENTER );
       // Area that Grab handle responds to, larger than actual handle so easier to move
 #ifdef DECORATOR_DEBUG
       grabHandle.actor.SetName( "GrabHandleActor" );
       if ( Dali::Internal::gLogFilter->IsEnabledFor( Debug::Verbose ) )
       {
-        grabHandle.grabArea = Toolkit::CreateSolidColorActor( Vector4(0.0f, 0.0f, 0.0f, 0.0f), true, Color::RED, 1 );
+        grabHandle.grabArea = Control::New();
+        Toolkit::Control control = Toolkit::Control::DownCast( grabHandle.grabArea );
+        control.SetBackgroundColor( Vector4( 1.0f, 1.0f, 1.0f, 0.5f ) );
         grabHandle.grabArea.SetName( "GrabArea" );
       }
       else
@@ -701,7 +705,7 @@ struct Decorator::Impl : public ConnectionTracker
   {
     if( image )
     {
-      handle.markerActor = ImageActor::New( image );
+      handle.markerActor = ImageView::New( image );
       handle.markerActor.SetColor( mHandleColor );
       handle.actor.Add( handle.markerActor );
 
@@ -725,12 +729,12 @@ struct Decorator::Impl : public ConnectionTracker
     HandleImpl& primary = mHandle[ LEFT_SELECTION_HANDLE ];
     if( !primary.actor )
     {
-      primary.actor = ImageActor::New( mHandleImages[LEFT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED] );
+      primary.actor = ImageView::New( mHandleImages[LEFT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED] );
 #ifdef DECORATOR_DEBUG
       primary.actor.SetName("SelectionHandleOne");
 #endif
       primary.actor.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); // Change to BOTTOM_RIGHT if Look'n'Feel requires handle above text.
-      primary.actor.SetSortModifier( DECORATION_DEPTH_INDEX );
+      GetImpl( primary.actor ).SetDepthIndex( DECORATION_DEPTH_INDEX );
       primary.actor.SetColor( mHandleColor );
 
       primary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
@@ -759,12 +763,12 @@ struct Decorator::Impl : public ConnectionTracker
     HandleImpl& secondary = mHandle[ RIGHT_SELECTION_HANDLE ];
     if( !secondary.actor )
     {
-      secondary.actor = ImageActor::New( mHandleImages[RIGHT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED] );
+      secondary.actor = ImageView::New( mHandleImages[RIGHT_SELECTION_HANDLE][HANDLE_IMAGE_RELEASED] );
 #ifdef DECORATOR_DEBUG
       secondary.actor.SetName("SelectionHandleTwo");
 #endif
       secondary.actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // Change to BOTTOM_LEFT if Look'n'Feel requires handle above text.
-      secondary.actor.SetSortModifier( DECORATION_DEPTH_INDEX );
+      GetImpl( secondary.actor ).SetDepthIndex( DECORATION_DEPTH_INDEX );
       secondary.actor.SetColor( mHandleColor );
 
       secondary.grabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
@@ -1635,8 +1639,8 @@ struct Decorator::Impl : public ConnectionTracker
   PropertyNotification mVerticalGreaterThanNotification;   ///< Notifies when the 'y' coord of the active layer is grater than a given value.
   PropertyNotification mHorizontalLessThanNotification;    ///< Notifies when the 'x' coord of the active layer is less than a given value.
   PropertyNotification mHorizontalGreaterThanNotification; ///< Notifies when the 'x' coord of the active layer is grater than a given value.
-  ImageActor           mPrimaryCursor;
-  ImageActor           mSecondaryCursor;
+  Control              mPrimaryCursor;
+  Control              mSecondaryCursor;
 
   Actor               mHighlightActor;            ///< Actor to display highlight
   Renderer            mHighlightRenderer;
@@ -1837,10 +1841,10 @@ void Decorator::SetHandleActive( HandleType handleType, bool active )
     // state when the power button is pressed and the application goes to background.
     mImpl->mHandle[handleType].pressed = false;
     Image imageReleased = mImpl->mHandleImages[handleType][HANDLE_IMAGE_RELEASED];
-    ImageActor imageActor = mImpl->mHandle[handleType].actor;
-    if( imageReleased && imageActor )
+    ImageView imageView = mImpl->mHandle[handleType].actor;
+    if( imageReleased && imageView )
     {
-       imageActor.SetImage( imageReleased );
+      imageView.SetImage( imageReleased );
     }
   }