application.SendNotification();
application.Render();
- // Check there are the expected number of children ( active layer, offscreen root actor, and the offscreen image view
- DALI_TEST_EQUALS( editor.GetChildCount(), 3u, TEST_LOCATION );
+ // Check there are the expected number of children ( offscreen root actor, and the offscreen image view
+ DALI_TEST_EQUALS( editor.GetChildCount(), 2u, TEST_LOCATION );
- Actor layer = editor.GetChildAt( 0u );
- DALI_TEST_CHECK( layer.IsLayer() );
-
- Actor offscreenRoot = editor.GetChildAt( 1u );
+ Actor offscreenRoot = editor.GetChildAt( 0u );
DALI_TEST_CHECK( offscreenRoot.IsLayer() );
DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor.
- Actor offscreenImage = editor.GetChildAt( 2u );
+ Actor offscreenImage = editor.GetChildAt( 1u );
DALI_TEST_CHECK( offscreenImage );
// Create a tap event to touch the text editor.
application.SendNotification();
application.Render();
+ Actor layer = editor.GetChildAt( 2u );
+ DALI_TEST_CHECK( layer.IsLayer() );
+
DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor.
application.Render();
// The offscreen root actor should have three actors: the camera, a renderer and the highlight actor.
- Actor offscreenRoot = editor.GetChildAt( 1u );
+ Actor offscreenRoot = editor.GetChildAt( 0u );
DALI_TEST_CHECK( offscreenRoot.IsLayer() );
CameraActor camera = CameraActor::DownCast( offscreenRoot.GetChildAt( 0u ) );
application.SendNotification();
application.Render();
- // Check there are the expected number of children ( active layer, offscreen root actor, and the offscreen image view
- DALI_TEST_EQUALS( field.GetChildCount(), 3u, TEST_LOCATION );
+ // Check there are the expected number of children ( offscreen root actor, and the offscreen image view
+ DALI_TEST_EQUALS( field.GetChildCount(), 2u, TEST_LOCATION );
- Actor layer = field.GetChildAt( 0u );
- DALI_TEST_CHECK( layer.IsLayer() );
-
- Actor offscreenRoot = field.GetChildAt( 1u );
+ Actor offscreenRoot = field.GetChildAt( 0u );
DALI_TEST_CHECK( offscreenRoot.IsLayer() );
DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor.
- Actor offscreenImage = field.GetChildAt( 2u );
+ Actor offscreenImage = field.GetChildAt( 1u );
DALI_TEST_CHECK( offscreenImage );
// Create a tap event to touch the text field.
application.SendNotification();
application.Render();
+ Actor layer = field.GetChildAt( 2u );
+ DALI_TEST_CHECK( layer.IsLayer() );
+
DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor.
DALI_TEST_EQUALS( offscreenRoot.GetChildCount(), 1u, TEST_LOCATION ); // The camera actor.
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor OnRelayout\n");
- if( mController->Relayout( size ) ||
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size );
+
+ if( ( Text::Controller::NONE_UPDATED != updateTextType ) ||
!mRenderer )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnRelayout %p Displaying new contents\n", mController.Get() );
- if( mDecorator )
+ if( mDecorator &&
+ ( Text::Controller::NONE_UPDATED != ( Text::Controller::DECORATOR_UPDATED & updateTextType ) ) )
{
mDecorator->Relayout( size );
}
}
EnableClipping( true, size );
- RenderText();
+ RenderText( updateTextType );
}
}
-void TextEditor::RenderText()
+void TextEditor::RenderText( Text::Controller::UpdateTextType updateTextType )
{
Actor self = Self();
Actor renderableActor;
- if( mRenderer )
- {
- renderableActor = mRenderer->Render( mController->GetView(), DepthIndex::TEXT );
- }
- if( renderableActor != mRenderableActor )
+ if( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) )
{
- UnparentAndReset( mRenderableActor );
- mRenderableActor = renderableActor;
+ if( mRenderer )
+ {
+ renderableActor = mRenderer->Render( mController->GetView(), DepthIndex::TEXT );
+ }
+
+ if( renderableActor != mRenderableActor )
+ {
+ UnparentAndReset( mRenderableActor );
+ mRenderableActor = renderableActor;
+ }
}
if( mRenderableActor )
{
if ( mHasBeenStaged )
{
- RenderText();
+ RenderText( static_cast<Text::Controller::UpdateTextType>( Text::Controller::MODEL_UPDATED | Text::Controller::DECORATOR_UPDATED ) );
}
else
{
/**
* @brief Render view, create and attach actor(s) to this text editor.
*/
- void RenderText();
+ void RenderText( Text::Controller::UpdateTextType updateTextType );
// Connection needed to re-render text, when a text editor returns to the stage.
void OnStageConnect( Dali::Actor actor );
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField OnRelayout\n");
- if( mController->Relayout( size ) ||
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size );
+
+ if( ( Text::Controller::NONE_UPDATED != updateTextType ) ||
!mRenderer )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnRelayout %p Displaying new contents\n", mController.Get() );
- if( mDecorator )
+ if( mDecorator &&
+ ( Text::Controller::NONE_UPDATED != ( Text::Controller::DECORATOR_UPDATED & updateTextType ) ) )
{
mDecorator->Relayout( size );
}
mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
}
- EnableClipping( (Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == mExceedPolicy), size );
- RenderText();
+ EnableClipping( ( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == mExceedPolicy ), size );
+ RenderText( updateTextType );
}
}
-void TextField::RenderText()
+void TextField::RenderText( Text::Controller::UpdateTextType updateTextType )
{
Actor self = Self();
Actor renderableActor;
- if( mRenderer )
- {
- renderableActor = mRenderer->Render( mController->GetView(), DepthIndex::TEXT );
- }
- if( renderableActor != mRenderableActor )
+ if( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) )
{
- UnparentAndReset( mRenderableActor );
- mRenderableActor = renderableActor;
+ if( mRenderer )
+ {
+ renderableActor = mRenderer->Render( mController->GetView(), DepthIndex::TEXT );
+ }
+
+ if( renderableActor != mRenderableActor )
+ {
+ UnparentAndReset( mRenderableActor );
+ mRenderableActor = renderableActor;
+ }
}
if( mRenderableActor )
{
if ( mHasBeenStaged )
{
- RenderText();
+ RenderText( static_cast<Text::Controller::UpdateTextType>( Text::Controller::MODEL_UPDATED | Text::Controller::DECORATOR_UPDATED ) );
}
else
{
/**
* @brief Render view, create and attach actor(s) to this Text Field.
*/
- void RenderText();
+ void RenderText( Text::Controller::UpdateTextType updateTextType );
// Connection needed to re-render text, when a Text Field returns to the stage.
void OnStageConnect( Dali::Actor actor );
{
DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnRelayout\n" );
- if( mController->Relayout( size ) ||
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size );
+
+ if( ( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) ) ||
!mRenderer )
{
if( !mRenderer )
return layoutSize.height;
}
-bool Controller::Relayout( const Size& size )
+Controller::UpdateTextType Controller::Relayout( const Size& size )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::Relayout %p size %f,%f, autoScroll[%s]\n", this, size.width, size.height, (mImpl->mAutoScrollEnabled)?"true":"false" );
+ UpdateTextType updateTextType = NONE_UPDATED;
+
if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) )
{
- bool glyphsRemoved( false );
if( 0u != mImpl->mVisualModel->mGlyphPositions.Count() )
{
mImpl->mVisualModel->mGlyphPositions.Clear();
- glyphsRemoved = true;
+ updateTextType = MODEL_UPDATED;
}
// Clear the update info. This info will be set the next time the text is updated.
// Not worth to relayout if width or height is equal to zero.
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::Relayout (skipped)\n" );
- return glyphsRemoved;
+ return updateTextType;
}
// Whether a new size has been set.
mImpl->mOperationsPending,
layoutSize ) || updated;
+ if( updated )
+ {
+ updateTextType = MODEL_UPDATED;
+ }
+
// Do not re-do any operation until something changes.
mImpl->mOperationsPending = NO_OPERATION;
}
// Move the cursor, grab handle etc.
- updated = mImpl->ProcessInputEvents() || updated;
+ if( mImpl->ProcessInputEvents() )
+ {
+ updateTextType = static_cast<UpdateTextType>( updateTextType | DECORATOR_UPDATED );
+ }
}
// Clear the update info. This info will be set the next time the text is updated.
mImpl->mTextUpdateInfo.Clear();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::Relayout\n" );
- return updated;
+ return updateTextType;
}
void Controller::ProcessModifyEvents()
DONT_UPDATE_INPUT_STYLE
};
+ enum UpdateTextType
+ {
+ NONE_UPDATED = 0x0,
+ MODEL_UPDATED = 0x1,
+ DECORATOR_UPDATED = 0x2
+ };
+
/**
* @brief Create a new instance of a Controller.
*
*
* @note UI Controls are expected to minimize calls to this method e.g. call once after size negotiation.
* @param[in] size A the size of a bounding box to layout text within.
- * @return True if the text model or decorations were updated.
+ *
+ * @return Whether the text model or decorations were updated.
*/
- bool Relayout( const Size& size );
+ UpdateTextType Relayout( const Size& size );
/**
* @brief Process queued events which modify the model.