From 02e561a57ec4fc1af26eddfba4eb4b71a79b13b3 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Fri, 18 Sep 2020 00:00:21 +0100 Subject: [PATCH] Reduce Cyclomatic Complexity of Text classes Change-Id: I055f3fd585a9709ab99d23887f7ff02fcf454975 --- .../controls/text-controls/text-editor-impl.cpp | 508 ++++++------------- .../controls/text-controls/text-field-impl.cpp | 545 +++++++-------------- .../controls/text-controls/text-label-impl.cpp | 280 ++++------- 3 files changed, 429 insertions(+), 904 deletions(-) diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index 7576bc1..7b85236 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -191,6 +192,8 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P if( textEditor ) { TextEditor& impl( GetImpl( textEditor ) ); + DALI_ASSERT_DEBUG( impl.mController && "No text contoller" ); + DALI_ASSERT_DEBUG( impl.mDecorator && "No text decorator" ); switch( index ) { @@ -209,39 +212,30 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P } case Toolkit::TextEditor::Property::TEXT: { - if( impl.mController ) - { - const std::string& text = value.Get< std::string >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p TEXT %s\n", impl.mController.Get(), text.c_str() ); + const std::string& text = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p TEXT %s\n", impl.mController.Get(), text.c_str() ); - impl.mController->SetText( text ); - } + impl.mController->SetText( text ); break; } case Toolkit::TextEditor::Property::TEXT_COLOR: { - if( impl.mController ) + const Vector4& textColor = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a ); + + if( impl.mController->GetDefaultColor() != textColor ) { - const Vector4& textColor = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a ); - - if( impl.mController->GetDefaultColor() != textColor ) - { - impl.mController->SetDefaultColor( textColor ); - impl.mController->SetInputColor( textColor ); - impl.mRenderer.Reset(); - } + impl.mController->SetDefaultColor( textColor ); + impl.mController->SetInputColor( textColor ); + impl.mRenderer.Reset(); } break; } case Toolkit::TextEditor::Property::FONT_FAMILY: { - if( impl.mController ) - { - const std::string& fontFamily = value.Get< std::string >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() ); - impl.mController->SetDefaultFontFamily( fontFamily ); - } + const std::string& fontFamily = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() ); + impl.mController->SetDefaultFontFamily( fontFamily ); break; } case Toolkit::TextEditor::Property::FONT_STYLE: @@ -251,28 +245,22 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P } case Toolkit::TextEditor::Property::POINT_SIZE: { - if( impl.mController ) - { - const float pointSize = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p POINT_SIZE %f\n", impl.mController.Get(), pointSize ); + const float pointSize = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p POINT_SIZE %f\n", impl.mController.Get(), pointSize ); - if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) ) - { - impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE ); - } + if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) ) + { + impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE ); } break; } case Toolkit::TextEditor::Property::HORIZONTAL_ALIGNMENT: { - if( impl.mController ) + Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set + if( Text::GetHorizontalAlignmentEnumeration( value, alignment ) ) { - Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set - if( Text::GetHorizontalAlignmentEnumeration( value, alignment ) ) - { - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p HORIZONTAL_ALIGNMENT %d\n", impl.mController.Get(), alignment ); - impl.mController->SetHorizontalAlignment( alignment ); - } + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p HORIZONTAL_ALIGNMENT %d\n", impl.mController.Get(), alignment ); + impl.mController->SetHorizontalAlignment( alignment ); } break; } @@ -281,10 +269,7 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P const float threshold = value.Get< float >(); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p SCROLL_THRESHOLD %f\n", impl.mController.Get(), threshold ); - if( impl.mDecorator ) - { - impl.mDecorator->SetScrollThreshold( threshold ); - } + impl.mDecorator->SetScrollThreshold( threshold ); break; } case Toolkit::TextEditor::Property::SCROLL_SPEED: @@ -292,80 +277,59 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P const float speed = value.Get< float >(); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p SCROLL_SPEED %f\n", impl.mController.Get(), speed ); - if( impl.mDecorator ) - { - impl.mDecorator->SetScrollSpeed( speed ); - } + impl.mDecorator->SetScrollSpeed( speed ); break; } case Toolkit::TextEditor::Property::PRIMARY_CURSOR_COLOR: { - if( impl.mDecorator ) - { - const Vector4& color = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a ); + const Vector4& color = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a ); - impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color ); - impl.RequestTextRelayout(); - } + impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color ); + impl.RequestTextRelayout(); break; } case Toolkit::TextEditor::Property::SECONDARY_CURSOR_COLOR: { - if( impl.mDecorator ) - { - const Vector4& color = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a ); + const Vector4& color = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a ); - impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color ); - impl.RequestTextRelayout(); - } + impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color ); + impl.RequestTextRelayout(); break; } case Toolkit::TextEditor::Property::ENABLE_CURSOR_BLINK: { - if( impl.mController ) - { - const bool enable = value.Get< bool >(); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable ); + const bool enable = value.Get< bool >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable ); - impl.mController->SetEnableCursorBlink( enable ); - impl.RequestTextRelayout(); - } + impl.mController->SetEnableCursorBlink( enable ); + impl.RequestTextRelayout(); break; } case Toolkit::TextEditor::Property::CURSOR_BLINK_INTERVAL: { - if( impl.mDecorator ) - { - const float interval = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval ); + const float interval = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval ); - impl.mDecorator->SetCursorBlinkInterval( interval ); - } + impl.mDecorator->SetCursorBlinkInterval( interval ); break; } case Toolkit::TextEditor::Property::CURSOR_BLINK_DURATION: { - if( impl.mDecorator ) - { - const float duration = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_BLINK_DURATION %f\n", impl.mController.Get(), duration ); + const float duration = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_BLINK_DURATION %f\n", impl.mController.Get(), duration ); - impl.mDecorator->SetCursorBlinkDuration( duration ); - } + impl.mDecorator->SetCursorBlinkDuration( duration ); break; } case Toolkit::TextEditor::Property::CURSOR_WIDTH: { - if( impl.mDecorator ) - { - const int width = value.Get< int >(); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_WIDTH %d\n", impl.mController.Get(), width ); + const int width = value.Get< int >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_WIDTH %d\n", impl.mController.Get(), width ); - impl.mDecorator->SetCursorWidth( width ); - impl.mController->GetLayoutEngine().SetCursorWidth( width ); - } + impl.mDecorator->SetCursorWidth( width ); + impl.mController->GetLayoutEngine().SetCursorWidth( width ); break; } case Toolkit::TextEditor::Property::GRAB_HANDLE_IMAGE: @@ -373,7 +337,7 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P const std::string imageFileName = value.Get< std::string >(); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), imageFileName.c_str() ); - if( impl.mDecorator && imageFileName.size() ) + if( imageFileName.size() ) { impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, imageFileName ); impl.RequestTextRelayout(); @@ -385,7 +349,7 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P const std::string imageFileName = value.Get< std::string >(); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), imageFileName.c_str() ); - if( impl.mDecorator && imageFileName.size() ) + if( imageFileName.size() ) { impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED, imageFileName ); impl.RequestTextRelayout(); @@ -396,7 +360,7 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); @@ -407,7 +371,7 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); @@ -418,7 +382,7 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename ); impl.RequestTextRelayout(); @@ -429,7 +393,7 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename ); impl.RequestTextRelayout(); @@ -440,7 +404,7 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); @@ -451,7 +415,7 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); @@ -463,55 +427,40 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P const Vector4 color = value.Get< Vector4 >(); DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p SELECTION_HIGHLIGHT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a ); - if( impl.mDecorator ) - { - impl.mDecorator->SetHighlightColor( color ); - impl.RequestTextRelayout(); - } + impl.mDecorator->SetHighlightColor( color ); + impl.RequestTextRelayout(); break; } case Toolkit::TextEditor::Property::DECORATION_BOUNDING_BOX: { - if( impl.mDecorator ) - { - const Rect& box = value.Get< Rect >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height ); + const Rect& box = value.Get< Rect >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height ); - impl.mDecorator->SetBoundingBox( box ); - impl.RequestTextRelayout(); - } + impl.mDecorator->SetBoundingBox( box ); + impl.RequestTextRelayout(); break; } case Toolkit::TextEditor::Property::ENABLE_MARKUP: { - if( impl.mController ) - { - const bool enableMarkup = value.Get(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_MARKUP %d\n", impl.mController.Get(), enableMarkup ); + const bool enableMarkup = value.Get(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_MARKUP %d\n", impl.mController.Get(), enableMarkup ); - impl.mController->SetMarkupProcessorEnabled( enableMarkup ); - } + impl.mController->SetMarkupProcessorEnabled( enableMarkup ); break; } case Toolkit::TextEditor::Property::INPUT_COLOR: { - if( impl.mController ) - { - const Vector4& inputColor = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a ); + const Vector4& inputColor = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a ); - impl.mController->SetInputColor( inputColor ); - } + impl.mController->SetInputColor( inputColor ); break; } case Toolkit::TextEditor::Property::INPUT_FONT_FAMILY: { - if( impl.mController ) - { - const std::string& fontFamily = value.Get< std::string >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() ); - impl.mController->SetInputFontFamily( fontFamily ); - } + const std::string& fontFamily = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() ); + impl.mController->SetInputFontFamily( fontFamily ); break; } case Toolkit::TextEditor::Property::INPUT_FONT_STYLE: @@ -521,38 +470,28 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P } case Toolkit::TextEditor::Property::INPUT_POINT_SIZE: { - if( impl.mController ) - { - const float pointSize = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_POINT_SIZE %f\n", impl.mController.Get(), pointSize ); - impl.mController->SetInputFontPointSize( pointSize ); - } + const float pointSize = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_POINT_SIZE %f\n", impl.mController.Get(), pointSize ); + impl.mController->SetInputFontPointSize( pointSize ); break; } case Toolkit::TextEditor::Property::LINE_SPACING: { - if( impl.mController ) - { - - // The line spacing isn't supported by the TextEditor. Since it's supported - // by the TextLabel for now it must be ignored. The property is being shadowed - // locally so its value isn't affected. - const float lineSpacing = value.Get(); - impl.mLineSpacing = lineSpacing; - // set it to 0.0 due to missing implementation - impl.mController->SetDefaultLineSpacing( 0.0f ); - impl.mRenderer.Reset(); - } + // The line spacing isn't supported by the TextEditor. Since it's supported + // by the TextLabel for now it must be ignored. The property is being shadowed + // locally so its value isn't affected. + const float lineSpacing = value.Get(); + impl.mLineSpacing = lineSpacing; + // set it to 0.0 due to missing implementation + impl.mController->SetDefaultLineSpacing( 0.0f ); + impl.mRenderer.Reset(); break; } case Toolkit::TextEditor::Property::INPUT_LINE_SPACING: { - if( impl.mController ) - { - const float lineSpacing = value.Get(); - impl.mController->SetInputLineSpacing( lineSpacing ); - impl.mRenderer.Reset(); - } + const float lineSpacing = value.Get(); + impl.mController->SetInputLineSpacing( lineSpacing ); + impl.mRenderer.Reset(); break; } case Toolkit::TextEditor::Property::UNDERLINE: @@ -673,52 +612,40 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P } case Toolkit::TextEditor::Property::PIXEL_SIZE: { - if( impl.mController ) - { - const float pixelSize = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize ); + const float pixelSize = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize ); - if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) ) - { - impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE ); - } + if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) ) + { + impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE ); } break; } case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT: { - if( impl.mController ) - { - const std::string& text = value.Get< std::string >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor::OnPropertySet %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() ); + const std::string& text = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor::OnPropertySet %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() ); - impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text ); - } + impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text ); break; } case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR: { - if( impl.mController ) + const Vector4& textColor = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a ); + + if( impl.mController->GetPlaceholderTextColor() != textColor ) { - const Vector4& textColor = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a ); - - if( impl.mController->GetPlaceholderTextColor() != textColor ) - { - impl.mController->SetPlaceholderTextColor( textColor ); - impl.mRenderer.Reset(); - } + impl.mController->SetPlaceholderTextColor( textColor ); + impl.mRenderer.Reset(); } break; } case Toolkit::TextEditor::Property::ENABLE_SELECTION: { - if( impl.mController ) - { - const bool enableSelection = value.Get< bool >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection ); - impl.mController->SetSelectionEnabled( enableSelection ); - } + const bool enableSelection = value.Get< bool >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection ); + impl.mController->SetSelectionEnabled( enableSelection ); break; } case Toolkit::TextEditor::Property::PLACEHOLDER: @@ -732,56 +659,41 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P } case Toolkit::TextEditor::Property::LINE_WRAP_MODE: { - if( impl.mController ) + Text::LineWrap::Mode lineWrapMode( static_cast< Text::LineWrap::Mode >( -1 ) ); // Set to invalid value to ensure a valid mode does get set + if( GetLineWrapModeEnumeration( value, lineWrapMode ) ) { - Text::LineWrap::Mode lineWrapMode( static_cast< Text::LineWrap::Mode >( -1 ) ); // Set to invalid value to ensure a valid mode does get set - if( GetLineWrapModeEnumeration( value, lineWrapMode ) ) - { - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p LineWrap::MODE %d\n", impl.mController.Get(), lineWrapMode ); - impl.mController->SetLineWrapMode( lineWrapMode ); - } + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p LineWrap::MODE %d\n", impl.mController.Get(), lineWrapMode ); + impl.mController->SetLineWrapMode( lineWrapMode ); } break; } case Toolkit::DevelTextEditor::Property::ENABLE_SHIFT_SELECTION: { - if( impl.mController ) - { - const bool shiftSelection = value.Get(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection ); + const bool shiftSelection = value.Get(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection ); - impl.mController->SetShiftSelectionEnabled( shiftSelection ); - } + impl.mController->SetShiftSelectionEnabled( shiftSelection ); break; } case Toolkit::DevelTextEditor::Property::ENABLE_GRAB_HANDLE: { - if( impl.mController ) - { - const bool grabHandleEnabled = value.Get(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_GRAB_HANDLE %d\n", impl.mController.Get(), grabHandleEnabled ); + const bool grabHandleEnabled = value.Get(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_GRAB_HANDLE %d\n", impl.mController.Get(), grabHandleEnabled ); - impl.mController->SetGrabHandleEnabled( grabHandleEnabled ); - } + impl.mController->SetGrabHandleEnabled( grabHandleEnabled ); break; } case Toolkit::DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: { - if( impl.mController ) - { - impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >()); - } + impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >()); break; } case Toolkit::DevelTextEditor::Property::MAX_LENGTH: { - if( impl.mController ) - { - const int max = value.Get< int >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p MAX_LENGTH %d\n", impl.mController.Get(), max ); + const int max = value.Get< int >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p MAX_LENGTH %d\n", impl.mController.Get(), max ); - impl.mController->SetMaximumNumberOfCharacters( max ); - } + impl.mController->SetMaximumNumberOfCharacters( max ); break; } } // switch @@ -797,6 +709,8 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind if( textEditor ) { TextEditor& impl( GetImpl( textEditor ) ); + DALI_ASSERT_DEBUG( impl.mController && "No text contoller" ); + DALI_ASSERT_DEBUG( impl.mDecorator && "No text decorator" ); switch( index ) { @@ -807,29 +721,20 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind } case Toolkit::TextEditor::Property::TEXT: { - if( impl.mController ) - { - std::string text; - impl.mController->GetText( text ); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p returning text: %s\n", impl.mController.Get(), text.c_str() ); - value = text; - } + std::string text; + impl.mController->GetText( text ); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p returning text: %s\n", impl.mController.Get(), text.c_str() ); + value = text; break; } case Toolkit::TextEditor::Property::TEXT_COLOR: { - if ( impl.mController ) - { - value = impl.mController->GetDefaultColor(); - } + value = impl.mController->GetDefaultColor(); break; } case Toolkit::TextEditor::Property::FONT_FAMILY: { - if( impl.mController ) - { - value = impl.mController->GetDefaultFontFamily(); - } + value = impl.mController->GetDefaultFontFamily(); break; } case Toolkit::TextEditor::Property::FONT_STYLE: @@ -839,54 +744,36 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind } case Toolkit::TextEditor::Property::POINT_SIZE: { - if( impl.mController ) - { - value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ); - } + value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ); break; } case Toolkit::TextEditor::Property::HORIZONTAL_ALIGNMENT: { - if( impl.mController ) + const char* name = GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() ); + if( name ) { - const char* name = GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() ); - if( name ) - { - value = std::string( name ); - } + value = std::string( name ); } break; } case Toolkit::TextEditor::Property::SCROLL_THRESHOLD: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetScrollThreshold(); - } + value = impl.mDecorator->GetScrollThreshold(); break; } case Toolkit::TextEditor::Property::SCROLL_SPEED: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetScrollSpeed(); - } + value = impl.mDecorator->GetScrollSpeed(); break; } case Toolkit::TextEditor::Property::PRIMARY_CURSOR_COLOR: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetColor( PRIMARY_CURSOR ); - } + value = impl.mDecorator->GetColor( PRIMARY_CURSOR ); break; } case Toolkit::TextEditor::Property::SECONDARY_CURSOR_COLOR: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetColor( SECONDARY_CURSOR ); - } + value = impl.mDecorator->GetColor( SECONDARY_CURSOR ); break; } case Toolkit::TextEditor::Property::ENABLE_CURSOR_BLINK: @@ -896,42 +783,27 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind } case Toolkit::TextEditor::Property::CURSOR_BLINK_INTERVAL: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetCursorBlinkInterval(); - } + value = impl.mDecorator->GetCursorBlinkInterval(); break; } case Toolkit::TextEditor::Property::CURSOR_BLINK_DURATION: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetCursorBlinkDuration(); - } + value = impl.mDecorator->GetCursorBlinkDuration(); break; } case Toolkit::TextEditor::Property::CURSOR_WIDTH: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetCursorWidth(); - } + value = impl.mDecorator->GetCursorWidth(); break; } case Toolkit::TextEditor::Property::GRAB_HANDLE_IMAGE: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED ); - } + value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED ); break; } case Toolkit::TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED ); - } + value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED ); break; } case Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT: @@ -966,44 +838,29 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind } case Toolkit::TextEditor::Property::SELECTION_HIGHLIGHT_COLOR: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetHighlightColor(); - } + value = impl.mDecorator->GetHighlightColor(); break; } case Toolkit::TextEditor::Property::DECORATION_BOUNDING_BOX: { - if( impl.mDecorator ) - { - Rect boundingBox; - impl.mDecorator->GetBoundingBox( boundingBox ); - value = boundingBox; - } + Rect boundingBox; + impl.mDecorator->GetBoundingBox( boundingBox ); + value = boundingBox; break; } case Toolkit::TextEditor::Property::ENABLE_MARKUP: { - if( impl.mController ) - { - value = impl.mController->IsMarkupProcessorEnabled(); - } + value = impl.mController->IsMarkupProcessorEnabled(); break; } case Toolkit::TextEditor::Property::INPUT_COLOR: { - if( impl.mController ) - { - value = impl.mController->GetInputColor(); - } + value = impl.mController->GetInputColor(); break; } case Toolkit::TextEditor::Property::INPUT_FONT_FAMILY: { - if( impl.mController ) - { - value = impl.mController->GetInputFontFamily(); - } + value = impl.mController->GetInputFontFamily(); break; } case Toolkit::TextEditor::Property::INPUT_FONT_STYLE: @@ -1013,28 +870,19 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind } case Toolkit::TextEditor::Property::INPUT_POINT_SIZE: { - if( impl.mController ) - { - value = impl.mController->GetInputFontPointSize(); - } + value = impl.mController->GetInputFontPointSize(); break; } case Toolkit::TextEditor::Property::LINE_SPACING: { - if( impl.mController ) - { - // LINE_SPACING isn't implemented for the TextEditor. Returning - // only shadowed value, not the real one. - value = impl.mLineSpacing; - } + // LINE_SPACING isn't implemented for the TextEditor. Returning + // only shadowed value, not the real one. + value = impl.mLineSpacing; break; } case Toolkit::TextEditor::Property::INPUT_LINE_SPACING: { - if( impl.mController ) - { - value = impl.mController->GetInputLineSpacing(); - } + value = impl.mController->GetInputLineSpacing(); break; } case Toolkit::TextEditor::Property::UNDERLINE: @@ -1104,45 +952,30 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind } case Toolkit::TextEditor::Property::PIXEL_SIZE: { - if( impl.mController ) - { - value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ); - } + value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ); break; } case Toolkit::TextEditor::Property::LINE_COUNT: { - if( impl.mController ) - { - float width = textEditor.GetProperty( Actor::Property::SIZE_WIDTH ).Get(); - value = impl.mController->GetLineCount( width ); - } + float width = textEditor.GetProperty( Actor::Property::SIZE_WIDTH ).Get(); + value = impl.mController->GetLineCount( width ); break; } case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT: { - if( impl.mController ) - { - std::string text; - impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text ); - value = text; - } + std::string text; + impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text ); + value = text; break; } case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR: { - if( impl.mController ) - { - value = impl.mController->GetPlaceholderTextColor(); - } + value = impl.mController->GetPlaceholderTextColor(); break; } case Toolkit::TextEditor::Property::ENABLE_SELECTION: { - if( impl.mController ) - { - value = impl.mController->IsSelectionEnabled(); - } + value = impl.mController->IsSelectionEnabled(); break; } case Toolkit::TextEditor::Property::PLACEHOLDER: @@ -1154,42 +987,27 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind } case Toolkit::TextEditor::Property::LINE_WRAP_MODE: { - if( impl.mController ) - { - value = impl.mController->GetLineWrapMode(); - } + value = impl.mController->GetLineWrapMode(); break; } case Toolkit::DevelTextEditor::Property::ENABLE_SHIFT_SELECTION: { - if( impl.mController ) - { - value = impl.mController->IsShiftSelectionEnabled(); - } + value = impl.mController->IsShiftSelectionEnabled(); break; } case Toolkit::DevelTextEditor::Property::ENABLE_GRAB_HANDLE: { - if( impl.mController ) - { - value = impl.mController->IsGrabHandleEnabled(); - } + value = impl.mController->IsGrabHandleEnabled(); break; } case Toolkit::DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: { - if( impl.mController ) - { - value = impl.mController->IsMatchSystemLanguageDirection(); - } + value = impl.mController->IsMatchSystemLanguageDirection(); break; } case Toolkit::DevelTextEditor::Property::MAX_LENGTH: { - if( impl.mController ) - { - value = impl.mController->GetMaximumNumberOfCharacters(); - } + value = impl.mController->GetMaximumNumberOfCharacters(); break; } } //switch diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index dfe68d1..bf4f766 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include #include #include @@ -182,10 +183,11 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField SetProperty\n"); - if( textField ) { TextField& impl( GetImpl( textField ) ); + DALI_ASSERT_DEBUG( impl.mController && "No text contoller" ); + DALI_ASSERT_DEBUG( impl.mDecorator && "No text decorator" ); switch( index ) { @@ -205,56 +207,41 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr impl.mRenderingBackend = backend; impl.mRenderer.Reset(); - if( impl.mController ) - { - // When using the vector-based rendering, the size of the GLyphs are different - TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH; - impl.mController->SetGlyphType( glyphType ); - } + // When using the vector-based rendering, the size of the GLyphs are different + TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH; + impl.mController->SetGlyphType( glyphType ); } break; } case Toolkit::TextField::Property::TEXT: { - if( impl.mController ) - { - const std::string& text = value.Get< std::string >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT %s\n", impl.mController.Get(), text.c_str() ); + const std::string& text = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT %s\n", impl.mController.Get(), text.c_str() ); - impl.mController->SetText( text ); - } + impl.mController->SetText( text ); break; } case Toolkit::TextField::Property::PLACEHOLDER_TEXT: { - if( impl.mController ) - { - const std::string& text = value.Get< std::string >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() ); + const std::string& text = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() ); - impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text ); - } + impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text ); break; } case Toolkit::TextField::Property::PLACEHOLDER_TEXT_FOCUSED: { - if( impl.mController ) - { - const std::string& text = value.Get< std::string >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_FOCUSED %s\n", impl.mController.Get(), text.c_str() ); + const std::string& text = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_FOCUSED %s\n", impl.mController.Get(), text.c_str() ); - impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text ); - } + impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text ); break; } case Toolkit::TextField::Property::FONT_FAMILY: { - if( impl.mController ) - { - const std::string& fontFamily = value.Get< std::string >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() ); - impl.mController->SetDefaultFontFamily( fontFamily ); - } + const std::string& fontFamily = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() ); + impl.mController->SetDefaultFontFamily( fontFamily ); break; } case Toolkit::TextField::Property::FONT_STYLE: @@ -264,27 +251,21 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextField::Property::POINT_SIZE: { - if( impl.mController ) - { - const float pointSize = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p POINT_SIZE %f\n", impl.mController.Get(), pointSize ); + const float pointSize = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p POINT_SIZE %f\n", impl.mController.Get(), pointSize ); - if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) ) - { - impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE ); - } + if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) ) + { + impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE ); } break; } case Toolkit::TextField::Property::MAX_LENGTH: { - if( impl.mController ) - { - const int max = value.Get< int >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p MAX_LENGTH %d\n", impl.mController.Get(), max ); + const int max = value.Get< int >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p MAX_LENGTH %d\n", impl.mController.Get(), max ); - impl.mController->SetMaximumNumberOfCharacters( max ); - } + impl.mController->SetMaximumNumberOfCharacters( max ); break; } case Toolkit::TextField::Property::EXCEED_POLICY: @@ -304,129 +285,99 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT: { - if( impl.mController ) + Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set + if( GetHorizontalAlignmentEnumeration( value, alignment ) ) { - Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set - if( GetHorizontalAlignmentEnumeration( value, alignment ) ) - { - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p HORIZONTAL_ALIGNMENT %d\n", impl.mController.Get(), alignment ); - impl.mController->SetHorizontalAlignment( alignment ); - } + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p HORIZONTAL_ALIGNMENT %d\n", impl.mController.Get(), alignment ); + impl.mController->SetHorizontalAlignment( alignment ); } break; } case Toolkit::TextField::Property::VERTICAL_ALIGNMENT: { - if( impl.mController ) + Toolkit::Text::VerticalAlignment::Type alignment( static_cast< Text::VerticalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set + if( GetVerticalAlignmentEnumeration( value, alignment ) ) { - Toolkit::Text::VerticalAlignment::Type alignment( static_cast< Text::VerticalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set - if( GetVerticalAlignmentEnumeration( value, alignment ) ) - { - impl.mController->SetVerticalAlignment( alignment ); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p VERTICAL_ALIGNMENT %d\n", impl.mController.Get(), alignment ); - } + impl.mController->SetVerticalAlignment( alignment ); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p VERTICAL_ALIGNMENT %d\n", impl.mController.Get(), alignment ); } break; } case Toolkit::TextField::Property::TEXT_COLOR: { - if( impl.mController ) + const Vector4& textColor = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a ); + + if( impl.mController->GetDefaultColor() != textColor ) { - const Vector4& textColor = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a ); - - if( impl.mController->GetDefaultColor() != textColor ) - { - impl.mController->SetDefaultColor( textColor ); - impl.mController->SetInputColor( textColor ); - impl.mRenderer.Reset(); - } + impl.mController->SetDefaultColor( textColor ); + impl.mController->SetInputColor( textColor ); + impl.mRenderer.Reset(); } break; } case Toolkit::TextField::Property::PLACEHOLDER_TEXT_COLOR: { - if( impl.mController ) + const Vector4& textColor = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a ); + + if( impl.mController->GetPlaceholderTextColor() != textColor ) { - const Vector4& textColor = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a ); - - if( impl.mController->GetPlaceholderTextColor() != textColor ) - { - impl.mController->SetPlaceholderTextColor( textColor ); - impl.mRenderer.Reset(); - } + impl.mController->SetPlaceholderTextColor( textColor ); + impl.mRenderer.Reset(); } break; } case Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR: { - if( impl.mDecorator ) - { - const Vector4& color = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a ); + const Vector4& color = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a ); - impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color ); - impl.RequestTextRelayout(); - } + impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color ); + impl.RequestTextRelayout(); break; } case Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR: { - if( impl.mDecorator ) - { - const Vector4& color = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a ); + const Vector4& color = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a ); - impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color ); - impl.RequestTextRelayout(); - } + impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color ); + impl.RequestTextRelayout(); break; } case Toolkit::TextField::Property::ENABLE_CURSOR_BLINK: { - if( impl.mController ) - { - const bool enable = value.Get< bool >(); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable ); + const bool enable = value.Get< bool >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable ); - impl.mController->SetEnableCursorBlink( enable ); - impl.RequestTextRelayout(); - } + impl.mController->SetEnableCursorBlink( enable ); + impl.RequestTextRelayout(); break; } case Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL: { - if( impl.mDecorator ) - { - const float interval = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval ); + const float interval = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval ); - impl.mDecorator->SetCursorBlinkInterval( interval ); - } + impl.mDecorator->SetCursorBlinkInterval( interval ); break; } case Toolkit::TextField::Property::CURSOR_BLINK_DURATION: { - if( impl.mDecorator ) - { - const float duration = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_DURATION %f\n", impl.mController.Get(), duration ); + const float duration = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_DURATION %f\n", impl.mController.Get(), duration ); - impl.mDecorator->SetCursorBlinkDuration( duration ); - } + impl.mDecorator->SetCursorBlinkDuration( duration ); break; } case Toolkit::TextField::Property::CURSOR_WIDTH: { - if( impl.mDecorator ) - { - const int width = value.Get< int >(); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_WIDTH %d\n", impl.mController.Get(), width ); + const int width = value.Get< int >(); + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_WIDTH %d\n", impl.mController.Get(), width ); - impl.mDecorator->SetCursorWidth( width ); - impl.mController->GetLayoutEngine().SetCursorWidth( width ); - } + impl.mDecorator->SetCursorWidth( width ); + impl.mController->GetLayoutEngine().SetCursorWidth( width ); break; } case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE: @@ -434,7 +385,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr const std::string imageFileName = value.Get< std::string >(); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), imageFileName.c_str() ); - if( impl.mDecorator && imageFileName.size() ) + if( imageFileName.size() ) { impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, imageFileName ); impl.RequestTextRelayout(); @@ -446,7 +397,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr const std::string imageFileName = value.Get< std::string >(); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), imageFileName.c_str() ); - if( impl.mDecorator && imageFileName.size() ) + if( imageFileName.size() ) { impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED, imageFileName ); impl.RequestTextRelayout(); @@ -458,10 +409,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr const float threshold = value.Get< float >(); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SCROLL_THRESHOLD %f\n", impl.mController.Get(), threshold ); - if( impl.mDecorator ) - { - impl.mDecorator->SetScrollThreshold( threshold ); - } + impl.mDecorator->SetScrollThreshold( threshold ); break; } case Toolkit::TextField::Property::SCROLL_SPEED: @@ -469,17 +417,14 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr const float speed = value.Get< float >(); DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SCROLL_SPEED %f\n", impl.mController.Get(), speed ); - if( impl.mDecorator ) - { - impl.mDecorator->SetScrollSpeed( speed ); - } + impl.mDecorator->SetScrollSpeed( speed ); break; } case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT: { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); @@ -490,7 +435,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); @@ -501,7 +446,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename ); impl.RequestTextRelayout(); @@ -512,7 +457,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename ); impl.RequestTextRelayout(); @@ -523,7 +468,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); @@ -534,7 +479,7 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr { const std::string filename = GetImageFileNameFromPropertyValue( value ); - if( impl.mDecorator && filename.size() ) + if( filename.size() ) { impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename ); impl.RequestTextRelayout(); @@ -546,23 +491,17 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr const Vector4 color = value.Get< Vector4 >(); DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SELECTION_HIGHLIGHT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a ); - if( impl.mDecorator ) - { - impl.mDecorator->SetHighlightColor( color ); - impl.RequestTextRelayout(); - } + impl.mDecorator->SetHighlightColor( color ); + impl.RequestTextRelayout(); break; } case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX: { - if( impl.mDecorator ) - { - const Rect box = value.Get< Rect >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height ); + const Rect box = value.Get< Rect >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height ); - impl.mDecorator->SetBoundingBox( box ); - impl.RequestTextRelayout(); - } + impl.mDecorator->SetBoundingBox( box ); + impl.RequestTextRelayout(); break; } case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS: @@ -583,34 +522,25 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextField::Property::INPUT_COLOR: { - if( impl.mController ) - { - const Vector4 inputColor = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a ); + const Vector4 inputColor = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a ); - impl.mController->SetInputColor( inputColor ); - } + impl.mController->SetInputColor( inputColor ); break; } case Toolkit::TextField::Property::ENABLE_MARKUP: { - if( impl.mController ) - { - const bool enableMarkup = value.Get(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_MARKUP %d\n", impl.mController.Get(), enableMarkup ); + const bool enableMarkup = value.Get(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_MARKUP %d\n", impl.mController.Get(), enableMarkup ); - impl.mController->SetMarkupProcessorEnabled( enableMarkup ); - } + impl.mController->SetMarkupProcessorEnabled( enableMarkup ); break; } case Toolkit::TextField::Property::INPUT_FONT_FAMILY: { - if( impl.mController ) - { - const std::string& fontFamily = value.Get< std::string >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() ); - impl.mController->SetInputFontFamily( fontFamily ); - } + const std::string& fontFamily = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() ); + impl.mController->SetInputFontFamily( fontFamily ); break; } case Toolkit::TextField::Property::INPUT_FONT_STYLE: @@ -620,12 +550,9 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextField::Property::INPUT_POINT_SIZE: { - if( impl.mController ) - { - const float pointSize = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_POINT_SIZE %f\n", impl.mController.Get(), pointSize ); - impl.mController->SetInputFontPointSize( pointSize ); - } + const float pointSize = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_POINT_SIZE %f\n", impl.mController.Get(), pointSize ); + impl.mController->SetInputFontPointSize( pointSize ); break; } case Toolkit::TextField::Property::UNDERLINE: @@ -711,26 +638,20 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextField::Property::PIXEL_SIZE: { - if( impl.mController ) - { - const float pixelSize = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize ); + const float pixelSize = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize ); - if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) ) - { - impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE ); - } + if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) ) + { + impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE ); } break; } case Toolkit::TextField::Property::ENABLE_SELECTION: { - if( impl.mController ) - { - const bool enableSelection = value.Get< bool >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection ); - impl.mController->SetSelectionEnabled( enableSelection ); - } + const bool enableSelection = value.Get< bool >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection ); + impl.mController->SetSelectionEnabled( enableSelection ); break; } case Toolkit::TextField::Property::PLACEHOLDER: @@ -744,66 +665,48 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextField::Property::ELLIPSIS: { - if( impl.mController ) - { - const bool ellipsis = value.Get(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis ); + const bool ellipsis = value.Get(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis ); - impl.mController->SetTextElideEnabled( ellipsis ); - } + impl.mController->SetTextElideEnabled( ellipsis ); break; } case Toolkit::DevelTextField::Property::ENABLE_SHIFT_SELECTION: { - if( impl.mController ) - { - const bool shiftSelection = value.Get(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection ); + const bool shiftSelection = value.Get(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection ); - impl.mController->SetShiftSelectionEnabled( shiftSelection ); - } + impl.mController->SetShiftSelectionEnabled( shiftSelection ); break; } case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE: { - if( impl.mController ) - { - const bool grabHandleEnabled = value.Get(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE %d\n", impl.mController.Get(), grabHandleEnabled ); + const bool grabHandleEnabled = value.Get(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE %d\n", impl.mController.Get(), grabHandleEnabled ); - impl.mController->SetGrabHandleEnabled( grabHandleEnabled ); - } + impl.mController->SetGrabHandleEnabled( grabHandleEnabled ); break; } case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: { - if( impl.mController ) - { - impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >()); - } + impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >()); break; } case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP: { - if( impl.mController ) - { - const bool grabHandlePopupEnabled = value.Get(); - DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE_POPUP %d\n", impl.mController.Get(), grabHandlePopupEnabled); + const bool grabHandlePopupEnabled = value.Get(); + DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE_POPUP %d\n", impl.mController.Get(), grabHandlePopupEnabled); - impl.mController->SetGrabHandlePopupEnabled(grabHandlePopupEnabled); - break; - } + impl.mController->SetGrabHandlePopupEnabled(grabHandlePopupEnabled); + break; } case Toolkit::DevelTextField::Property::BACKGROUND: { - if( impl.mController ) - { - const Vector4 backgroundColor = value.Get< Vector4 >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p BACKGROUND %f,%f,%f,%f\n", impl.mController.Get(), backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a ); + const Vector4 backgroundColor = value.Get< Vector4 >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p BACKGROUND %f,%f,%f,%f\n", impl.mController.Get(), backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a ); - impl.mController->SetBackgroundEnabled( true ); - impl.mController->SetBackgroundColor( backgroundColor ); - } + impl.mController->SetBackgroundEnabled( true ); + impl.mController->SetBackgroundColor( backgroundColor ); break; } } // switch @@ -819,6 +722,8 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde if( textField ) { TextField& impl( GetImpl( textField ) ); + DALI_ASSERT_DEBUG( impl.mController && "No text contoller" ); + DALI_ASSERT_DEBUG( impl.mDecorator && "No text decorator" ); switch( index ) { @@ -829,41 +734,29 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextField::Property::TEXT: { - if( impl.mController ) - { - std::string text; - impl.mController->GetText( text ); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p returning text: %s\n", impl.mController.Get(), text.c_str() ); - value = text; - } + std::string text; + impl.mController->GetText( text ); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p returning text: %s\n", impl.mController.Get(), text.c_str() ); + value = text; break; } case Toolkit::TextField::Property::PLACEHOLDER_TEXT: { - if( impl.mController ) - { - std::string text; - impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text ); - value = text; - } + std::string text; + impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text ); + value = text; break; } case Toolkit::TextField::Property::PLACEHOLDER_TEXT_FOCUSED: { - if( impl.mController ) - { - std::string text; - impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text ); - value = text; - } + std::string text; + impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text ); + value = text; break; } case Toolkit::TextField::Property::FONT_FAMILY: { - if( impl.mController ) - { - value = impl.mController->GetDefaultFontFamily(); - } + value = impl.mController->GetDefaultFontFamily(); break; } case Toolkit::TextField::Property::FONT_STYLE: @@ -873,18 +766,12 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextField::Property::POINT_SIZE: { - if( impl.mController ) - { - value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ); - } + value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ); break; } case Toolkit::TextField::Property::MAX_LENGTH: { - if( impl.mController ) - { - value = impl.mController->GetMaximumNumberOfCharacters(); - } + value = impl.mController->GetMaximumNumberOfCharacters(); break; } case Toolkit::TextField::Property::EXCEED_POLICY: @@ -894,60 +781,42 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT: { - if( impl.mController ) - { - const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() ); + const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() ); - if ( name ) - { - value = std::string( name ); - } + if ( name ) + { + value = std::string( name ); } break; } case Toolkit::TextField::Property::VERTICAL_ALIGNMENT: { - if( impl.mController ) - { - const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() ); + const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() ); - if( name ) - { - value = std::string( name ); - } + if( name ) + { + value = std::string( name ); } break; } case Toolkit::TextField::Property::TEXT_COLOR: { - if ( impl.mController ) - { - value = impl.mController->GetDefaultColor(); - } + value = impl.mController->GetDefaultColor(); break; } case Toolkit::TextField::Property::PLACEHOLDER_TEXT_COLOR: { - if ( impl.mController ) - { - value = impl.mController->GetPlaceholderTextColor(); - } + value = impl.mController->GetPlaceholderTextColor(); break; } case Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetColor( PRIMARY_CURSOR ); - } + value = impl.mDecorator->GetColor( PRIMARY_CURSOR ); break; } case Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetColor( SECONDARY_CURSOR ); - } + value = impl.mDecorator->GetColor( SECONDARY_CURSOR ); break; } case Toolkit::TextField::Property::ENABLE_CURSOR_BLINK: @@ -957,58 +826,37 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetCursorBlinkInterval(); - } + value = impl.mDecorator->GetCursorBlinkInterval(); break; } case Toolkit::TextField::Property::CURSOR_BLINK_DURATION: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetCursorBlinkDuration(); - } + value = impl.mDecorator->GetCursorBlinkDuration(); break; } case Toolkit::TextField::Property::CURSOR_WIDTH: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetCursorWidth(); - } + value = impl.mDecorator->GetCursorWidth(); break; } case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED ); - } + value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED ); break; } case Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED ); - } + value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED ); break; } case Toolkit::TextField::Property::SCROLL_THRESHOLD: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetScrollThreshold(); - } + value = impl.mDecorator->GetScrollThreshold(); break; } case Toolkit::TextField::Property::SCROLL_SPEED: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetScrollSpeed(); - } + value = impl.mDecorator->GetScrollSpeed(); break; } case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT: @@ -1043,20 +891,14 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextField::Property::SELECTION_HIGHLIGHT_COLOR: { - if( impl.mDecorator ) - { - value = impl.mDecorator->GetHighlightColor(); - } + value = impl.mDecorator->GetHighlightColor(); break; } case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX: { - if( impl.mDecorator ) - { - Rect boundingBox; - impl.mDecorator->GetBoundingBox( boundingBox ); - value = boundingBox; - } + Rect boundingBox; + impl.mDecorator->GetBoundingBox( boundingBox ); + value = boundingBox; break; } case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS: @@ -1068,26 +910,17 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextField::Property::INPUT_COLOR: { - if( impl.mController ) - { - value = impl.mController->GetInputColor(); - } + value = impl.mController->GetInputColor(); break; } case Toolkit::TextField::Property::ENABLE_MARKUP: { - if( impl.mController ) - { - value = impl.mController->IsMarkupProcessorEnabled(); - } + value = impl.mController->IsMarkupProcessorEnabled(); break; } case Toolkit::TextField::Property::INPUT_FONT_FAMILY: { - if( impl.mController ) - { - value = impl.mController->GetInputFontFamily(); - } + value = impl.mController->GetInputFontFamily(); break; } case Toolkit::TextField::Property::INPUT_FONT_STYLE: @@ -1097,10 +930,7 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextField::Property::INPUT_POINT_SIZE: { - if( impl.mController ) - { - value = impl.mController->GetInputFontPointSize(); - } + value = impl.mController->GetInputFontPointSize(); break; } case Toolkit::TextField::Property::UNDERLINE: @@ -1152,18 +982,12 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextField::Property::PIXEL_SIZE: { - if( impl.mController ) - { - value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ); - } + value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ); break; } case Toolkit::TextField::Property::ENABLE_SELECTION: { - if( impl.mController ) - { - value = impl.mController->IsSelectionEnabled(); - } + value = impl.mController->IsSelectionEnabled(); break; } case Toolkit::TextField::Property::PLACEHOLDER: @@ -1175,58 +999,37 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextField::Property::ELLIPSIS: { - if( impl.mController ) - { - value = impl.mController->IsTextElideEnabled(); - } + value = impl.mController->IsTextElideEnabled(); break; } case Toolkit::DevelTextField::Property::ENABLE_SHIFT_SELECTION: { - if( impl.mController ) - { - value = impl.mController->IsShiftSelectionEnabled(); - } + value = impl.mController->IsShiftSelectionEnabled(); break; } case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE: { - if( impl.mController ) - { - value = impl.mController->IsGrabHandleEnabled(); - } + value = impl.mController->IsGrabHandleEnabled(); break; } case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: { - if( impl.mController ) - { - value = impl.mController->IsMatchSystemLanguageDirection(); - } + value = impl.mController->IsMatchSystemLanguageDirection(); break; } case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP: { - if( impl.mController ) - { - value = impl.mController->IsGrabHandlePopupEnabled(); - } + value = impl.mController->IsGrabHandlePopupEnabled(); break; } case Toolkit::DevelTextField::Property::BACKGROUND: { - if( impl.mController ) - { - value = impl.mController->GetBackgroundColor(); - } + value = impl.mController->GetBackgroundColor(); break; } case Toolkit::DevelTextField::Property::SELECTED_TEXT: { - if( impl.mController ) - { - value = impl.mController->GetSelectedText( ); - } + value = impl.mController->GetSelectedText( ); break; } } //switch diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index d40cd76..1cdb0f8 100755 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -19,6 +19,7 @@ #include // EXTERNAL INCLUDES +#include #include #include #include @@ -168,6 +169,8 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr if( label ) { TextLabel& impl( GetImpl( label ) ); + DALI_ASSERT_ALWAYS( impl.mController && "No text contoller" ); + switch( index ) { case Toolkit::DevelTextLabel::Property::RENDERING_BACKEND: @@ -185,32 +188,23 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr impl.mRenderingBackend = backend; impl.mTextUpdateNeeded = true; - if( impl.mController ) - { - // When using the vector-based rendering, the size of the GLyphs are different - TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH; - impl.mController->SetGlyphType( glyphType ); - } + // When using the vector-based rendering, the size of the GLyphs are different + TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH; + impl.mController->SetGlyphType( glyphType ); } break; } case Toolkit::TextLabel::Property::TEXT: { - if( impl.mController ) - { - impl.mController->SetText( value.Get< std::string >() ); - } + impl.mController->SetText( value.Get< std::string >() ); break; } case Toolkit::TextLabel::Property::FONT_FAMILY: { - if( impl.mController ) - { - const std::string& fontFamily = value.Get< std::string >(); + const std::string& fontFamily = value.Get< std::string >(); - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::SetProperty Property::FONT_FAMILY newFont(%s)\n", fontFamily.c_str() ); - impl.mController->SetDefaultFontFamily( fontFamily ); - } + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::SetProperty Property::FONT_FAMILY newFont(%s)\n", fontFamily.c_str() ); + impl.mController->SetDefaultFontFamily( fontFamily ); break; } case Toolkit::TextLabel::Property::FONT_STYLE: @@ -220,80 +214,62 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextLabel::Property::POINT_SIZE: { - if( impl.mController ) - { - const float pointSize = value.Get< float >(); + const float pointSize = value.Get< float >(); - if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) ) - { - impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE ); - } + if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) ) + { + impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE ); } break; } case Toolkit::TextLabel::Property::MULTI_LINE: { - if( impl.mController ) - { - impl.mController->SetMultiLineEnabled( value.Get< bool >() ); - } + impl.mController->SetMultiLineEnabled( value.Get< bool >() ); break; } case Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT: { - if( impl.mController ) + Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set + if( Text::GetHorizontalAlignmentEnumeration( value, alignment ) ) { - Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set - if( Text::GetHorizontalAlignmentEnumeration( value, alignment ) ) - { - impl.mController->SetHorizontalAlignment( alignment ); - } + impl.mController->SetHorizontalAlignment( alignment ); } break; } case Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT: { - if( impl.mController ) + Toolkit::Text::VerticalAlignment::Type alignment( static_cast< Text::VerticalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set + if( Text::GetVerticalAlignmentEnumeration( value, alignment ) ) { - Toolkit::Text::VerticalAlignment::Type alignment( static_cast< Text::VerticalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set - if( Text::GetVerticalAlignmentEnumeration( value, alignment ) ) - { - impl.mController->SetVerticalAlignment( alignment ); - } + impl.mController->SetVerticalAlignment( alignment ); } break; } case Toolkit::TextLabel::Property::ENABLE_MARKUP: { - if( impl.mController ) - { - const bool enableMarkup = value.Get(); - impl.mController->SetMarkupProcessorEnabled( enableMarkup ); - } + const bool enableMarkup = value.Get(); + impl.mController->SetMarkupProcessorEnabled( enableMarkup ); break; } case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL: { - if( impl.mController ) + const bool enableAutoScroll = value.Get(); + // If request to auto scroll is the same as current state then do nothing. + if ( enableAutoScroll != impl.mController->IsAutoScrollEnabled() ) { - const bool enableAutoScroll = value.Get(); - // If request to auto scroll is the same as current state then do nothing. - if ( enableAutoScroll != impl.mController->IsAutoScrollEnabled() ) - { - // If request is disable (false) and auto scrolling is enabled then need to stop it - if ( enableAutoScroll == false ) - { - if( impl.mTextScroller ) - { - impl.mTextScroller->StopScrolling(); - } - } - // If request is enable (true) then start autoscroll as not already running - else + // If request is disable (false) and auto scrolling is enabled then need to stop it + if ( enableAutoScroll == false ) + { + if( impl.mTextScroller ) { - impl.mController->SetAutoScrollEnabled( enableAutoScroll ); + impl.mTextScroller->StopScrolling(); } - } + } + // If request is enable (true) then start autoscroll as not already running + else + { + impl.mController->SetAutoScrollEnabled( enableAutoScroll ); + } } break; } @@ -351,15 +327,12 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextLabel::Property::LINE_SPACING: { - if( impl.mController ) - { - const float lineSpacing = value.Get(); + const float lineSpacing = value.Get(); - // Don't trigger anything if the line spacing didn't change - if( impl.mController->SetDefaultLineSpacing( lineSpacing ) ) - { - impl.mTextUpdateNeeded = true; - } + // Don't trigger anything if the line spacing didn't change + if( impl.mController->SetDefaultLineSpacing( lineSpacing ) ) + { + impl.mTextUpdateNeeded = true; } break; } @@ -401,45 +374,36 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::TextLabel::Property::PIXEL_SIZE: { - if( impl.mController ) - { - const float pixelSize = value.Get< float >(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize ); + const float pixelSize = value.Get< float >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize ); - if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) ) - { - impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE ); - } + if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) ) + { + impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE ); } break; } case Toolkit::TextLabel::Property::ELLIPSIS: { - if( impl.mController ) - { - const bool ellipsis = value.Get(); - DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis ); + const bool ellipsis = value.Get(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis ); - impl.mController->SetTextElideEnabled( ellipsis ); - } + impl.mController->SetTextElideEnabled( ellipsis ); break; } case Toolkit::TextLabel::Property::LINE_WRAP_MODE: { - if( impl.mController ) + Text::LineWrap::Mode lineWrapMode( static_cast< Text::LineWrap::Mode >( -1 ) ); // Set to invalid value to ensure a valid mode does get set + if( GetLineWrapModeEnumeration( value, lineWrapMode ) ) { - Text::LineWrap::Mode lineWrapMode( static_cast< Text::LineWrap::Mode >( -1 ) ); // Set to invalid value to ensure a valid mode does get set - if( GetLineWrapModeEnumeration( value, lineWrapMode ) ) - { - DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p LineWrap::MODE %d\n", impl.mController.Get(), lineWrapMode ); - impl.mController->SetLineWrapMode( lineWrapMode ); - } + DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p LineWrap::MODE %d\n", impl.mController.Get(), lineWrapMode ); + impl.mController->SetLineWrapMode( lineWrapMode ); } break; } case Toolkit::DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT: { - if( impl.mController && impl.mController->GetTextModel() ) + if( impl.mController->GetTextModel() ) { DevelText::VerticalLineAlignment::Type alignment = static_cast( value.Get() ); @@ -542,14 +506,11 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } case Toolkit::DevelTextLabel::Property::MIN_LINE_SIZE: { - if( impl.mController ) - { - const float lineSize = value.Get(); + const float lineSize = value.Get(); - if( impl.mController->SetDefaultLineSize( lineSize ) ) - { - impl.mTextUpdateNeeded = true; - } + if( impl.mController->SetDefaultLineSize( lineSize ) ) + { + impl.mTextUpdateNeeded = true; } break; } @@ -575,6 +536,8 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde if( label ) { TextLabel& impl( GetImpl( label ) ); + DALI_ASSERT_DEBUG( impl.mController && "No text contoller" ); + switch( index ) { case Toolkit::DevelTextLabel::Property::RENDERING_BACKEND: @@ -584,20 +547,14 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextLabel::Property::TEXT: { - if( impl.mController ) - { - std::string text; - impl.mController->GetText( text ); - value = text; - } + std::string text; + impl.mController->GetText( text ); + value = text; break; } case Toolkit::TextLabel::Property::FONT_FAMILY: { - if( impl.mController ) - { - value = impl.mController->GetDefaultFontFamily(); - } + value = impl.mController->GetDefaultFontFamily(); break; } case Toolkit::TextLabel::Property::FONT_STYLE: @@ -607,59 +564,41 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextLabel::Property::POINT_SIZE: { - if( impl.mController ) - { - value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ); - } + value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ); break; } case Toolkit::TextLabel::Property::MULTI_LINE: { - if( impl.mController ) - { - value = impl.mController->IsMultiLineEnabled(); - } + value = impl.mController->IsMultiLineEnabled(); break; } case Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT: { - if( impl.mController ) - { - const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() ); + const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() ); - if ( name ) - { - value = std::string( name ); - } + if ( name ) + { + value = std::string( name ); } break; } case Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT: { - if( impl.mController ) + const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() ); + if( name ) { - const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() ); - if( name ) - { - value = std::string( name ); - } + value = std::string( name ); } break; } case Toolkit::TextLabel::Property::ENABLE_MARKUP: { - if( impl.mController ) - { - value = impl.mController->IsMarkupProcessorEnabled(); - } + value = impl.mController->IsMarkupProcessorEnabled(); break; } case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL: { - if( impl.mController ) - { - value = impl.mController->IsAutoScrollEnabled(); - } + value = impl.mController->IsAutoScrollEnabled(); break; } case Toolkit::TextLabel::Property::AUTO_SCROLL_STOP_MODE: @@ -678,7 +617,6 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextLabel::Property::AUTO_SCROLL_SPEED: { - TextLabel& impl( GetImpl( label ) ); if ( impl.mTextScroller ) { value = impl.mTextScroller->GetSpeed(); @@ -687,31 +625,22 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_COUNT: { - if( impl.mController ) + if ( impl.mTextScroller ) { - TextLabel& impl( GetImpl( label ) ); - if ( impl.mTextScroller ) - { - value = impl.mTextScroller->GetLoopCount(); - } + value = impl.mTextScroller->GetLoopCount(); } break; } case Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_DELAY: { - if( impl.mController ) + if ( impl.mTextScroller ) { - TextLabel& impl( GetImpl( label ) ); - if ( impl.mTextScroller ) - { - value = impl.mTextScroller->GetLoopDelay(); - } + value = impl.mTextScroller->GetLoopDelay(); } break; } case Toolkit::TextLabel::Property::AUTO_SCROLL_GAP: { - TextLabel& impl( GetImpl( label ) ); if ( impl.mTextScroller ) { value = impl.mTextScroller->GetGap(); @@ -720,10 +649,7 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextLabel::Property::LINE_SPACING: { - if( impl.mController ) - { - value = impl.mController->GetDefaultLineSpacing(); - } + value = impl.mController->GetDefaultLineSpacing(); break; } case Toolkit::TextLabel::Property::UNDERLINE: @@ -748,51 +674,33 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::TextLabel::Property::PIXEL_SIZE: { - if( impl.mController ) - { - value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ); - } + value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ); break; } case Toolkit::TextLabel::Property::ELLIPSIS: { - if( impl.mController ) - { - value = impl.mController->IsTextElideEnabled(); - } + value = impl.mController->IsTextElideEnabled(); break; } case Toolkit::TextLabel::Property::LINE_WRAP_MODE: { - if( impl.mController ) - { - value = impl.mController->GetLineWrapMode(); - } + value = impl.mController->GetLineWrapMode(); break; } case Toolkit::TextLabel::Property::LINE_COUNT: { - if( impl.mController ) - { - float width = label.GetProperty( Actor::Property::SIZE_WIDTH ).Get(); - value = impl.mController->GetLineCount( width ); - } + float width = label.GetProperty( Actor::Property::SIZE_WIDTH ).Get(); + value = impl.mController->GetLineCount( width ); break; } case Toolkit::DevelTextLabel::Property::TEXT_DIRECTION: { - if( impl.mController ) - { - value = impl.mController->GetTextDirection(); - } + value = impl.mController->GetTextDirection(); break; } case Toolkit::DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT: { - if( impl.mController ) - { - value = impl.mController->GetVerticalLineAlignment(); - } + value = impl.mController->GetVerticalLineAlignment(); break; } case Toolkit::DevelTextLabel::Property::BACKGROUND: @@ -829,10 +737,7 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } case Toolkit::DevelTextLabel::Property::MIN_LINE_SIZE: { - if( impl.mController ) - { - value = impl.mController->GetDefaultLineSize(); - } + value = impl.mController->GetDefaultLineSize(); break; } } @@ -854,10 +759,9 @@ void TextLabel::OnInitialize() TextVisual::SetAnimatableTextColorProperty( mVisual, Toolkit::TextLabel::Property::TEXT_COLOR ); mController = TextVisual::GetController(mVisual); - if( mController ) - { - mController->SetControlInterface(this); - } + DALI_ASSERT_DEBUG( mController && "Invalid Text Controller") + + mController->SetControlInterface(this); // Use height-for-width negotiation by default self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); -- 2.7.4