X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-label-impl.cpp;h=f484bbf35f2980f9d64c41424bd8c1c7225845ea;hb=7cca1061ed3db08d2e7f511a8f6ef707e688703d;hp=5187b25018284c4027cf6d7deadfc049271d9bae;hpb=448bcfa1ab294f28eb9252e2c736c83bc043f9ef;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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 5187b25..f484bbf 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -81,6 +81,13 @@ const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] = }; const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] ); +const Scripting::StringEnum LINE_WRAP_MODE_STRING_TABLE[] = +{ + { "WRAP_MODE_WORD", Toolkit::Text::Layout::LineWrap::WORD }, + { "WRAP_MODE_CHARACTER", Toolkit::Text::Layout::LineWrap::CHARACTER } +}; +const unsigned int LINE_WRAP_MODE_STRING_TABLE_COUNT = sizeof( LINE_WRAP_MODE_STRING_TABLE ) / sizeof( LINE_WRAP_MODE_STRING_TABLE[0] ); + // Type registration BaseHandle Create() { @@ -119,6 +126,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "ellipsis", BOO DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopDelay", FLOAT, AUTO_SCROLL_LOOP_DELAY ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", STRING, AUTO_SCROLL_STOP_MODE ) DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "lineCount", INTEGER, LINE_COUNT ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineWrapMode", STRING, LINE_WRAP_MODE ) DALI_TYPE_REGISTRATION_END() @@ -350,7 +358,7 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr { if( impl.mTextScroller ) { - impl.mTextScroller->SetLoopCount( 0 ); // Causes the current animation to finish playing (0) + impl.mTextScroller->StopScrolling(); } } // If request is enable (true) then start autoscroll as not already running @@ -486,6 +494,21 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::DevelTextLabel::Property::LINE_WRAP_MODE: + { + const std::string& wrapModeStr = value.Get< std::string >(); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p LINE_WRAP_MODE %s\n", impl.mController.Get(), wrapModeStr.c_str() ); + + Layout::LineWrap::Mode lineWrapMode( Layout::LineWrap::WORD ); + if( Scripting::GetEnumeration< Layout::LineWrap::Mode >( wrapModeStr.c_str(), + LINE_WRAP_MODE_STRING_TABLE, + LINE_WRAP_MODE_STRING_TABLE_COUNT, + lineWrapMode ) ) + { + impl.mController->SetLineWrapMode( lineWrapMode ); + } + break; + } } } } @@ -737,6 +760,14 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } break; } + case Toolkit::DevelTextLabel::Property::LINE_WRAP_MODE: + { + if( impl.mController ) + { + value = impl.mController->GetLineWrapMode(); + } + break; + } case Toolkit::DevelTextLabel::Property::LINE_COUNT: { if( impl.mController ) @@ -814,14 +845,21 @@ Vector3 TextLabel::GetNaturalSize() float TextLabel::GetHeightForWidth( float width ) { - return mController->GetHeightForWidth( width ); + Padding padding; + Self().GetPadding( padding ); + return mController->GetHeightForWidth( width ) + padding.top + padding.bottom; } void TextLabel::OnRelayout( const Vector2& size, RelayoutContainer& container ) { DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnRelayout\n" ); - const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size ); + Padding padding; + Self().GetPadding( padding ); + Vector2 contentSize( size.x - ( padding.left + padding.right ), size.y - ( padding.top + padding.bottom ) ); + + + const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize ); if( ( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) ) || !mRenderer ) @@ -861,7 +899,9 @@ void TextLabel::RenderText() if( renderableActor ) { const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition(); - renderableActor.SetPosition( scrollOffset.x + alignmentOffset, scrollOffset.y ); + Padding padding; + self.GetPadding( padding ); + renderableActor.SetPosition( scrollOffset.x + alignmentOffset + padding.left, scrollOffset.y + padding.top ); self.Add( renderableActor ); } @@ -891,7 +931,7 @@ void TextLabel::SetUpAutoScrolling() // If speed, loopCount or gap not set via property system then will need to create a TextScroller with defaults mTextScroller = Text::TextScroller::New( *this ); } - mTextScroller->SetParameters( mRenderableActor, controlSize, offScreenSize, direction, alignmentOffset ); + mTextScroller->SetParameters( mRenderableActor, controlSize, offScreenSize, direction, alignmentOffset, mController->GetHorizontalAlignment() ); Actor self = Self(); self.Add( mTextScroller->GetScrollingText() );