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=fa9c6c01d465d40ffb973a4ab55b104dccedd799;hp=8fec200ee64f00b82f7606ab146eb5af9351428e;hb=e54ea0676d3bbe53d40309a41b1b415f8f6a64d4;hpb=0231146907c21e934102222180a1a94b36ba0e65 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 8fec200..fa9c6c0 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -138,6 +138,9 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "renderingBackend DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "fontSizeScale", FLOAT, FONT_SIZE_SCALE ) DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "enableFontSizeScale", BOOLEAN, ENABLE_FONT_SIZE_SCALE ) DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION ) +DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "strikethrough", MAP, STRIKETHROUGH ) +DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "characterSpacing", FLOAT, CHARACTER_SPACING ) +DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "relativeLineSize", FLOAT, RELATIVE_LINE_SIZE ) DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR ) DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(Toolkit, TextLabel, "textColorRed", TEXT_COLOR_RED, TEXT_COLOR, 0) @@ -220,10 +223,10 @@ void ParseTextFitProperty(Text::ControllerPtr& controller, const Property::Map* } // namespace -Toolkit::TextLabel TextLabel::New() +Toolkit::TextLabel TextLabel::New(ControlBehaviour additionalBehaviour) { // Create the implementation, temporarily owned by this handle on stack - IntrusivePtr impl = new TextLabel(); + IntrusivePtr impl = new TextLabel(additionalBehaviour); // Pass ownership to CustomActor handle Toolkit::TextLabel handle(*impl); @@ -528,6 +531,25 @@ void TextLabel::SetProperty(BaseObject* object, Property::Index index, const Pro } break; } + case Toolkit::DevelTextLabel::Property::STRIKETHROUGH: + { + impl.mTextUpdateNeeded = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT) || impl.mTextUpdateNeeded; + break; + } + case Toolkit::DevelTextLabel::Property::CHARACTER_SPACING: + { + const float characterSpacing = value.Get(); + impl.mController->SetCharacterSpacing(characterSpacing); + break; + } + case Toolkit::DevelTextLabel::Property::RELATIVE_LINE_SIZE: + { + const float relativeLineSize = value.Get(); + DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextLabel %p RELATIVE_LINE_SIZE %f\n", impl.mController.Get(), relativeLineSize); + + impl.mController->SetRelativeLineSize(relativeLineSize); + break; + } } // Request relayout when text update is needed. It's necessary to call it @@ -776,6 +798,21 @@ Property::Value TextLabel::GetProperty(BaseObject* object, Property::Index index value = impl.mController->GetEllipsisPosition(); break; } + case Toolkit::DevelTextLabel::Property::STRIKETHROUGH: + { + GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT); + break; + } + case Toolkit::DevelTextLabel::Property::CHARACTER_SPACING: + { + value = impl.mController->GetCharacterSpacing(); + break; + } + case Toolkit::DevelTextLabel::Property::RELATIVE_LINE_SIZE: + { + value = impl.mController->GetRelativeLineSize(); + break; + } } } @@ -1140,8 +1177,8 @@ void TextLabel::OnAccessibilityStatusChanged() CommonTextUtils::SynchronizeTextAnchorsInParent(Self(), mController, mAnchorActors); } -TextLabel::TextLabel() -: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)), +TextLabel::TextLabel(ControlBehaviour additionalBehavior) +: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehavior)), mRenderingBackend(DEFAULT_RENDERING_BACKEND), mTextUpdateNeeded(false) { @@ -1342,6 +1379,24 @@ bool TextLabel::AccessibleImpl::SetRangeOfSelection(size_t selectionIndex, size_ return true; } +Rect<> TextLabel::AccessibleImpl::GetRangeExtents(size_t startOffset, size_t endOffset, Accessibility::CoordinateType type) +{ + if (endOffset <= startOffset || endOffset <= 0) + { + return {0, 0, 0, 0}; + } + + auto self = Toolkit::TextLabel::DownCast(Self()); + auto rect = Dali::Toolkit::GetImpl(self).GetTextController()->GetTextBoundingRectangle(startOffset, endOffset - 1); + + auto componentExtents = this->GetExtents(type); + + rect.x += componentExtents.x; + rect.y += componentExtents.y; + + return rect; +} + int32_t TextLabel::AccessibleImpl::GetLinkCount() const { auto self = Toolkit::TextLabel::DownCast(Self());