X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-editor-impl.cpp;h=6fc1a3d7a6d9cba0a178462244e1a0e49a20f5cb;hb=22451f7abe0230b418d551d9eac0c685273e72f1;hp=50139ceb17094a743f8999d719c15912dc043a41;hpb=9c26b8bf8e9f8bc74f809a6ffd2ac2208125bc03;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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 50139ce..6fc1a3d 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -155,6 +155,10 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "inputFilter", DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "ellipsis", BOOLEAN, ELLIPSIS ) DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION ) DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "minLineSize", FLOAT, MIN_LINE_SIZE ) +DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "strikethrough", MAP, STRIKETHROUGH ) +DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "inputStrikethrough", MAP, INPUT_STRIKETHROUGH ) +DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "characterSpacing", FLOAT, CHARACTER_SPACING ) +DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "relativeLineSize", FLOAT, RELATIVE_LINE_SIZE ) DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED ) @@ -164,6 +168,7 @@ DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputFiltered", SIGNAL_IN DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "cursorPositionChanged", SIGNAL_CURSOR_POSITION_CHANGED) DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "selectionChanged", SIGNAL_SELECTION_CHANGED ) DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "selectionCleared", SIGNAL_SELECTION_CLEARED ) +DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "selectionStarted", SIGNAL_SELECTION_STARTED ) DALI_TYPE_REGISTRATION_END() // clang-format on @@ -216,6 +221,11 @@ Toolkit::TextEditor::InputStyle::Mask ConvertInputStyle(Text::InputStyle::Mask i { editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::OUTLINE); } + if(InputStyle::NONE != static_cast(inputStyleMask & InputStyle::INPUT_STRIKETHROUGH)) + { + editorInputStyleMask = static_cast(editorInputStyleMask | Toolkit::TextEditor::InputStyle::STRIKETHROUGH); + } + return editorInputStyleMask; } @@ -397,6 +407,11 @@ DevelTextEditor::SelectionClearedSignalType& TextEditor::SelectionClearedSignal( return mSelectionClearedSignal; } +DevelTextEditor::SelectionStartedSignalType& TextEditor::SelectionStartedSignal() +{ + return mSelectionStartedSignal; +} + Text::ControllerPtr TextEditor::GetTextController() { return mController; @@ -465,6 +480,14 @@ bool TextEditor::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* editorImpl.SelectionClearedSignal().Connect(tracker, functor); } } + else if(0 == strcmp(signalName.c_str(), SIGNAL_SELECTION_STARTED)) + { + if(editor) + { + Internal::TextEditor& editorImpl(GetImpl(editor)); + editorImpl.SelectionStartedSignal().Connect(tracker, functor); + } + } else { // signalName does not match any signal @@ -678,6 +701,11 @@ void TextEditor::OnRelayout(const Vector2& size, RelayoutContainer& container) mActiveLayer.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top)); ResizeActor(mActiveLayer, contentSize); } + if(mCursorLayer) + { + mCursorLayer.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top)); + ResizeActor(mCursorLayer, contentSize); + } // If there is text changed, callback is called. if(mTextChanged) @@ -711,6 +739,11 @@ void TextEditor::OnRelayout(const Vector2& size, RelayoutContainer& container) EmitCursorPositionChangedSignal(); } + if(mSelectionStarted) + { + EmitSelectionStartedSignal(); + } + if(mSelectionChanged) { EmitSelectionChangedSignal(); @@ -968,6 +1001,13 @@ void TextEditor::EmitSelectionClearedSignal() mSelectionCleared = false; } +void TextEditor::EmitSelectionStartedSignal() +{ + Dali::Toolkit::TextEditor handle(GetOwner()); + mSelectionStartedSignal.Emit(handle); + mSelectionStarted = false; +} + void TextEditor::SelectionChanged(uint32_t oldStart, uint32_t oldEnd, uint32_t newStart, uint32_t newEnd) { if(((oldStart != newStart) || (oldEnd != newEnd)) && !mSelectionChanged) @@ -976,6 +1016,13 @@ void TextEditor::SelectionChanged(uint32_t oldStart, uint32_t oldEnd, uint32_t n { mSelectionCleared = true; } + else + { + if(oldStart == oldEnd) + { + mSelectionStarted = true; + } + } mSelectionChanged = true; mOldSelectionStart = oldStart; @@ -991,7 +1038,7 @@ void TextEditor::SelectionChanged(uint32_t oldStart, uint32_t oldEnd, uint32_t n } } -void TextEditor::AddDecoration(Actor& actor, bool needsClipping) +void TextEditor::AddDecoration(Actor& actor, DecorationType type, bool needsClipping) { if(actor) { @@ -999,16 +1046,27 @@ void TextEditor::AddDecoration(Actor& actor, bool needsClipping) { mClippingDecorationActors.push_back(actor); } - else + + // If the actor is a layer type, add it. + if(type == DecorationType::ACTIVE_LAYER) + { + AddLayer(mActiveLayer, actor); + } + else if(type == DecorationType::CURSOR_LAYER) { - actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); - actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); - Self().Add(actor); - mActiveLayer = actor; + AddLayer(mCursorLayer, actor); } } } +void TextEditor::AddLayer(Actor& layer, Actor& actor) +{ + actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + Self().Add(actor); + layer = actor; +} + void TextEditor::SetTextSelectionRange(const uint32_t* start, const uint32_t* end) { if(mController && mController->IsShowingRealText()) @@ -1275,7 +1333,8 @@ TextEditor::TextEditor() mSelectionCleared(false), mOldPosition(0u), mOldSelectionStart(0u), - mOldSelectionEnd(0u) + mOldSelectionEnd(0u), + mSelectionStarted(false) { }