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-editor-impl.cpp;h=02594712039ddedb370e7bfb3810171f5eeda9cb;hp=b07da0460a8f2a25aec99972a69567bbd793b698;hb=refs%2Fchanges%2F46%2F265846%2F1;hpb=760285a850a7bf256a799cfb23ff2283520dc02a 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 b07da04..0259471 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -31,11 +32,11 @@ #include // INTERNAL INCLUDES -#include #include #include #include #include +#include #include #include #include @@ -166,6 +167,57 @@ DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "selectionCleared", SIGNAL_SE DALI_TYPE_REGISTRATION_END() // clang-format on +Toolkit::TextEditor::InputStyle::Mask ConvertInputStyle(Text::InputStyle::Mask inputStyleMask) +{ + Toolkit::TextEditor::InputStyle::Mask editorInputStyleMask = Toolkit::TextEditor::InputStyle::NONE; + + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_COLOR)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::COLOR); + } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_FONT_FAMILY)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_FAMILY); + } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_POINT_SIZE)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::POINT_SIZE); + } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_FONT_WEIGHT)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_STYLE); + } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_FONT_WIDTH)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_STYLE); + } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_FONT_SLANT)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_STYLE); + } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_LINE_SPACING)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::LINE_SPACING); + } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_UNDERLINE)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::UNDERLINE); + } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_SHADOW)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::SHADOW); + } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_EMBOSS)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::EMBOSS); + } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_OUTLINE)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::OUTLINE); + } + return editorInputStyleMask; +} + } // namespace Toolkit::TextEditor TextEditor::New() @@ -672,100 +724,9 @@ void TextEditor::OnRelayout(const Vector2& size, RelayoutContainer& container) void TextEditor::RenderText(Text::Controller::UpdateTextType updateTextType) { - Actor renderableActor; - - if(Text::Controller::NONE_UPDATED != (Text::Controller::MODEL_UPDATED & updateTextType)) - { - if(mRenderer) - { - Dali::Toolkit::TextEditor handle = Dali::Toolkit::TextEditor(GetOwner()); - - renderableActor = mRenderer->Render(mController->GetView(), - handle, - Property::INVALID_INDEX, // Animatable property not supported - mAlignmentOffset, - DepthIndex::CONTENT); - } - - if(renderableActor != mRenderableActor) - { - UnparentAndReset(mBackgroundActor); - UnparentAndReset(mRenderableActor); - mRenderableActor = renderableActor; - - if(mRenderableActor) - { - mBackgroundActor = mController->CreateBackgroundActor(); - } - } - } - + CommonTextUtils::RenderText(Self(), mRenderer, mController, mDecorator, mAlignmentOffset, mRenderableActor, mBackgroundActor, mStencil, mClippingDecorationActors, updateTextType); if(mRenderableActor) { - const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition(); - - float renderableActorPositionX, renderableActorPositionY; - - if(mStencil) - { - renderableActorPositionX = scrollOffset.x + mAlignmentOffset; - renderableActorPositionY = scrollOffset.y; - } - else - { - Extents padding; - padding = Self().GetProperty(Toolkit::Control::Property::PADDING); - - // Support Right-To-Left of padding - Dali::LayoutDirection::Type layoutDirection = static_cast(Self().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); - if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection) - { - std::swap(padding.start, padding.end); - } - - renderableActorPositionX = scrollOffset.x + mAlignmentOffset + padding.start; - renderableActorPositionY = scrollOffset.y + padding.top; - } - - mRenderableActor.SetProperty(Actor::Property::POSITION, Vector2(renderableActorPositionX, renderableActorPositionY)); - // Make sure the actors are parented correctly with/without clipping - Actor self = mStencil ? mStencil : Self(); - - Actor highlightActor; - - for(std::vector::iterator it = mClippingDecorationActors.begin(), - endIt = mClippingDecorationActors.end(); - it != endIt; - ++it) - { - self.Add(*it); - it->LowerToBottom(); - - if(it->GetProperty(Dali::Actor::Property::NAME) == "HighlightActor") - { - highlightActor = *it; - } - } - mClippingDecorationActors.clear(); - - self.Add(mRenderableActor); - - if(mBackgroundActor) - { - if(mDecorator && mDecorator->IsHighlightVisible()) - { - self.Add(mBackgroundActor); - mBackgroundActor.SetProperty(Actor::Property::POSITION, Vector2(renderableActorPositionX, renderableActorPositionY)); // In text field's coords. - mBackgroundActor.LowerBelow(highlightActor); - } - else - { - mRenderableActor.Add(mBackgroundActor); - mBackgroundActor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f)); // In renderable actor's coords. - mBackgroundActor.LowerToBottom(); - } - } - ApplyScrollPosition(); } UpdateScrollBar(); @@ -952,55 +913,7 @@ void TextEditor::MaxLengthReached() void TextEditor::InputStyleChanged(Text::InputStyle::Mask inputStyleMask) { Dali::Toolkit::TextEditor handle(GetOwner()); - - Toolkit::TextEditor::InputStyle::Mask editorInputStyleMask = Toolkit::TextEditor::InputStyle::NONE; - - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_COLOR)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::COLOR); - } - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_FONT_FAMILY)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_FAMILY); - } - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_POINT_SIZE)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::POINT_SIZE); - } - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_FONT_WEIGHT)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_STYLE); - } - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_FONT_WIDTH)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_STYLE); - } - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_FONT_SLANT)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_STYLE); - } - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_LINE_SPACING)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::LINE_SPACING); - } - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_UNDERLINE)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::UNDERLINE); - } - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_SHADOW)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::SHADOW); - } - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_EMBOSS)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::EMBOSS); - } - if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_OUTLINE)) - { - editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::OUTLINE); - } - - mInputStyleChangedSignal.Emit(handle, editorInputStyleMask); + mInputStyleChangedSignal.Emit(handle, ConvertInputStyle(inputStyleMask)); } void TextEditor::AnchorClicked(const std::string& href)