From: Agnelo Vaz Date: Mon, 14 Dec 2015 20:43:35 +0000 (+0000) Subject: text-decorator to use ImageView instead of ImageActors X-Git-Tag: dali_1.1.15~4^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=f270df9bc75b84c58a31d0735b5513530389a82f text-decorator to use ImageView instead of ImageActors * 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 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index b6f5c71..b0e4269 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -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 ) ); diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index 6c69704..6022879 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -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 ); } } diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp index 9ca5fb7..0c49761 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp @@ -21,9 +21,10 @@ // INTERNAL INCLUDES #include #include +#include // EXTERNAL INCLUDES -#include +#include #include #include #include @@ -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 ); diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index 757eb4e..3e6e33d 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -35,6 +35,8 @@ // INTERNAL INCLUDES #include #include +#include +#include #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 ); } }