- TextField& impl( GetImpl( textField ) );
-
- switch( index )
- {
- case Toolkit::TextField::Property::RENDERING_BACKEND:
- {
- int backend = value.Get< int >();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p RENDERING_BACKEND %d\n", impl.mController.Get(), backend );
-
-#ifndef ENABLE_VECTOR_BASED_TEXT_RENDERING
- if( Text::RENDERING_VECTOR_BASED == backend )
- {
- backend = TextAbstraction::BITMAP_GLYPH; // Fallback to bitmap-based rendering
- }
-#endif
- if( impl.mRenderingBackend != backend )
- {
- 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 = (Text::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() );
-
- 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() );
-
- 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() );
-
- 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 );
- }
- break;
- }
- case Toolkit::TextField::Property::FONT_STYLE:
- {
- SetFontStyleProperty( impl.mController, value, Text::FontStyle::DEFAULT );
- break;
- }
- 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 );
-
- 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 );
-
- impl.mController->SetMaximumNumberOfCharacters( max );
- }
- break;
- }
- case Toolkit::TextField::Property::EXCEED_POLICY:
- {
- impl.mExceedPolicy = value.Get<int>();
-
- if( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == impl.mExceedPolicy )
- {
- impl.EnableClipping();
- }
- else
- {
- UnparentAndReset( impl.mStencil );
- }
- impl.RequestTextRelayout();
- break;
- }
- 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 ) )
- {
- 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 ) )
- {
- 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 )
- {
- 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 )
- {
- impl.mController->SetPlaceholderTextColor( textColor );
- impl.mRenderer.Reset();
- }
- }
- break;
- }
- case Toolkit::TextField::Property::SHADOW_OFFSET:
- {
- if( impl.mController )
- {
- const Vector2& shadowOffset = value.Get< Vector2 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SHADOW_OFFSET %f,%f\n", impl.mController.Get(), shadowOffset.x, shadowOffset.y );
-
- if ( impl.mController->GetShadowOffset() != shadowOffset )
- {
- impl.mController->SetShadowOffset( shadowOffset );
- impl.mRenderer.Reset();
- }
- }
- break;
- }
- case Toolkit::TextField::Property::SHADOW_COLOR:
- {
- if( impl.mController )
- {
- const Vector4& shadowColor = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SHADOW_COLOR %f,%f,%f,%f\n", impl.mController.Get(), shadowColor.r, shadowColor.g, shadowColor.b, shadowColor.a );
-
- if ( impl.mController->GetShadowColor() != shadowColor )
- {
- impl.mController->SetShadowColor( shadowColor );
- 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 );
-
- 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 );
-
- 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 );
-
- 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 );
-
- 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 );
-
- 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 );
-
- impl.mDecorator->SetCursorWidth( width );
- impl.mController->GetLayoutEngine().SetCursorWidth( width );
- }
- break;
- }
- case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE:
- {
- const ResourceImage image = ResourceImage::New( value.Get< std::string >() );
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), image.GetUrl().c_str() );
-
- if( impl.mDecorator )
- {
- impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, image );
- impl.RequestTextRelayout();
- }
- break;
- }
- case Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE:
- {
- const ResourceImage image = ResourceImage::New( value.Get< std::string >() );
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), image.GetUrl().c_str() );
-
- if( impl.mDecorator )
- {
- impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED, image );
- impl.RequestTextRelayout();
- }
- break;
- }
- case Toolkit::TextField::Property::SCROLL_THRESHOLD:
- {
- 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 );
- }
- break;
- }
- case Toolkit::TextField::Property::SCROLL_SPEED:
- {
- 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 );
- }
- break;
- }
- case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT:
- {
- const Image image = Scripting::NewImage( value );
-
- if( impl.mDecorator && image )
- {
- impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, image );
- impl.RequestTextRelayout();
- }
- break;
- }
- case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT:
- {
- const Image image = Scripting::NewImage( value );
-
- if( impl.mDecorator && image )
- {
- impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, image );
- impl.RequestTextRelayout();
- }
- break;
- }
- case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT:
- {
- const Image image = Scripting::NewImage( value );
-
- if( impl.mDecorator && image )
- {
- impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, image );
- impl.RequestTextRelayout();
- }
- break;
- }
- case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT:
- {
- const Image image = Scripting::NewImage( value );
-
- if( impl.mDecorator && image )
- {
- impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, image );
- impl.RequestTextRelayout();
- }
- break;
- }
- case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT:
- {
- const Image image = Scripting::NewImage( value );
-
- if( impl.mDecorator && image )
- {
- impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, image );
- impl.RequestTextRelayout();
- }
- break;
- }
- case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT:
- {
- const Image image = Scripting::NewImage( value );
-
- if( impl.mDecorator && image )
- {
- impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, image );
- impl.RequestTextRelayout();
- }
- break;
- }
- case Toolkit::TextField::Property::SELECTION_HIGHLIGHT_COLOR:
- {
- 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();
- }
- break;
- }
- case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX:
- {
- if( impl.mDecorator )
- {
- const Rect<int> box = value.Get< Rect<int> >();
- 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();
- }
- break;
- }
- case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
- {
- const Property::Map* map = value.GetMap();
- if (map)
- {
- impl.mInputMethodOptions.ApplyProperty( *map );
- }
- impl.mController->SetInputModePassword( impl.mInputMethodOptions.IsPassword() );
-
- Toolkit::Control control = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
- if (control == textField)
- {
- impl.mInputMethodContext.ApplyOptions( impl.mInputMethodOptions );
- }
- break;
- }
- 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 );
-
- impl.mController->SetInputColor( inputColor );
- }
- break;
- }
- case Toolkit::TextField::Property::ENABLE_MARKUP:
- {
- if( impl.mController )
- {
- const bool enableMarkup = value.Get<bool>();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_MARKUP %d\n", impl.mController.Get(), 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 );
- }
- break;
- }
- case Toolkit::TextField::Property::INPUT_FONT_STYLE:
- {
- SetFontStyleProperty( impl.mController, value, Text::FontStyle::INPUT );
- break;
- }
- 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 );
- }
- break;
- }
- case Toolkit::TextField::Property::UNDERLINE:
- {
- const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
- if( update )
- {
- impl.mRenderer.Reset();
- }
- break;
- }
- case Toolkit::TextField::Property::INPUT_UNDERLINE:
- {
- const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
- if( update )
- {
- impl.mRenderer.Reset();
- }
- break;
- }
- case Toolkit::TextField::Property::SHADOW:
- {
- const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
- if( update )
- {
- impl.mRenderer.Reset();
- }
- break;
- }
- case Toolkit::TextField::Property::INPUT_SHADOW:
- {
- const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
- if( update )
- {
- impl.mRenderer.Reset();
- }
- break;
- }
- case Toolkit::TextField::Property::EMBOSS:
- {
- const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
- if( update )
- {
- impl.mRenderer.Reset();
- }
- break;
- }
- case Toolkit::TextField::Property::INPUT_EMBOSS:
- {
- const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
- if( update )
- {
- impl.mRenderer.Reset();
- }
- break;
- }
- case Toolkit::TextField::Property::OUTLINE:
- {
- const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
- if( update )
- {
- impl.mRenderer.Reset();
- }
- break;
- }
- case Toolkit::TextField::Property::INPUT_OUTLINE:
- {
- const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
- if( update )
- {
- impl.mRenderer.Reset();
- }
- break;
- }
- case Toolkit::TextField::Property::HIDDEN_INPUT_SETTINGS:
- {
- const Property::Map* map = value.GetMap();
- if (map)
- {
- impl.mController->SetHiddenInputOption(*map);
- }
- break;
- }
- 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 );