X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-label-impl.cpp;h=60ca46ed67fa393ec85dc299c3a7f6736e82c042;hp=4ff20356f11fe8d26afe137ea0e67cd39ebab273;hb=37998ba8d5d17e637fe80ff29a2622cc964fe82a;hpb=826a077bb3183b5d317bfb22e14ab4e217d26f40 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 4ff2035..60ca46e 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -83,9 +83,11 @@ DALI_PROPERTY_REGISTRATION( TextLabel, "point-size", FLOAT, POINT_SI DALI_PROPERTY_REGISTRATION( TextLabel, "multi-line", BOOLEAN, MULTI_LINE ) DALI_PROPERTY_REGISTRATION( TextLabel, "horizontal-alignment", STRING, HORIZONTAL_ALIGNMENT ) DALI_PROPERTY_REGISTRATION( TextLabel, "vertical-alignment", STRING, VERTICAL_ALIGNMENT ) -DALI_PROPERTY_REGISTRATION( TextLabel, "shadow-offset", VECTOR2, SHADOW_OFFSET ) -DALI_PROPERTY_REGISTRATION( TextLabel, "shadow-color", VECTOR4, SHADOW_COLOR ) - +DALI_PROPERTY_REGISTRATION( TextLabel, "text-color", VECTOR4, TEXT_COLOR ) +DALI_PROPERTY_REGISTRATION( TextLabel, "shadow-offset", VECTOR2, SHADOW_OFFSET ) +DALI_PROPERTY_REGISTRATION( TextLabel, "shadow-color", VECTOR4, SHADOW_COLOR ) +DALI_PROPERTY_REGISTRATION( TextLabel, "underline-enabled", BOOLEAN, UNDERLINE_ENABLED ) +DALI_PROPERTY_REGISTRATION( TextLabel, "underline-color", VECTOR4, UNDERLINE_COLOR ) DALI_TYPE_REGISTRATION_END() } // namespace @@ -169,7 +171,7 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr { float pointSize = value.Get< float >(); - if( impl.mController->GetDefaultPointSize() != pointSize /*TODO - epsilon*/ ) + if( fabsf(impl.mController->GetDefaultPointSize() - pointSize) > Math::MACHINE_EPSILON_1 ) { impl.mController->SetDefaultPointSize( pointSize ); impl.RequestTextRelayout(); @@ -220,7 +222,22 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } - case Toolkit::TextLabel::Property::SHADOW_OFFSET: + + case Toolkit::TextLabel::Property::TEXT_COLOR: + { + if ( impl.mController ) + { + Vector4 textColor = value.Get< Vector4 >(); + if ( impl.mController->GetTextColor() != textColor ) + { + impl.mController->SetTextColor( textColor ); + impl.RequestTextRelayout(); + } + } + break; + } + + case Toolkit::TextLabel::Property::SHADOW_OFFSET: { if( impl.mController ) { @@ -246,6 +263,32 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::TextLabel::Property::UNDERLINE_COLOR: + { + if( impl.mController ) + { + Vector4 color = value.Get< Vector4 >(); + if ( impl.mController->GetUnderlineColor() != color ) + { + impl.mController->SetUnderlineColor( color ); + impl.RequestTextRelayout(); + } + } + break; + } + case Toolkit::TextLabel::Property::UNDERLINE_ENABLED: + { + if( impl.mController ) + { + bool enabled = value.Get< bool >(); + if ( impl.mController->IsUnderlineEnabled() != enabled ) + { + impl.mController->SetUnderlineEnabled( enabled ); + impl.RequestTextRelayout(); + } + } + break; + } } } } @@ -304,7 +347,15 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } break; } - case Toolkit::TextLabel::Property::SHADOW_OFFSET: + case Toolkit::TextLabel::Property::TEXT_COLOR: + { + if ( impl.mController ) + { + value = impl.mController->GetTextColor(); + } + break; + } + case Toolkit::TextLabel::Property::SHADOW_OFFSET: { if ( impl.mController ) { @@ -320,6 +371,22 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } break; } + case Toolkit::TextLabel::Property::UNDERLINE_COLOR: + { + if ( impl.mController ) + { + value = impl.mController->GetUnderlineColor(); + } + break; + } + case Toolkit::TextLabel::Property::UNDERLINE_ENABLED: + { + if ( impl.mController ) + { + value = impl.mController->IsUnderlineEnabled(); + } + break; + } } } @@ -334,7 +401,7 @@ void TextLabel::OnInitialize() // Use height-for-width negotiation by default self.SetResizePolicy( FILL_TO_PARENT, WIDTH ); - self.SetDimensionDependency( HEIGHT, WIDTH ); + self.SetResizePolicy( DIMENSION_DEPENDENCY, HEIGHT ); } void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange change )