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-field-impl.cpp;h=0c1c13c05ee3abbf2d7f967167be8de88a40a47f;hp=bf4f7668c13a454c948f84117791f06ec95db7d3;hb=cb826363b4f5e93a8b72521d75b4f456496cf1bb;hpb=02e561a57ec4fc1af26eddfba4eb4b71a79b13b3;ds=sidebyside diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index bf4f766..0c1c13c 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -135,6 +135,8 @@ DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandlePopup", DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "textBackground", VECTOR4, BACKGROUND ) DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextField, "selectedText", STRING, SELECTED_TEXT ) DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "renderingBackend", INTEGER, RENDERING_BACKEND ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "selectedTextStart", INTEGER, SELECTED_TEXT_START ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "selectedTextEnd", INTEGER, SELECTED_TEXT_END ) DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED ) @@ -709,6 +711,26 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr impl.mController->SetBackgroundColor( backgroundColor ); break; } + case Toolkit::DevelTextField::Property::SELECTED_TEXT_START: + { + if( impl.mController ) + { + uint32_t start = static_cast(value.Get< int >()); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SELECTED_TEXT_START %d\n", impl.mController.Get(), start ); + impl.SetTextSelectionRange( &start, nullptr ); + } + break; + } + case Toolkit::DevelTextField::Property::SELECTED_TEXT_END: + { + if( impl.mController ) + { + uint32_t end = static_cast(value.Get< int >()); + DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SELECTED_TEXT_END %d\n", impl.mController.Get(), end ); + impl.SetTextSelectionRange( nullptr, &end ); + } + break; + } } // switch } // textfield } @@ -1032,6 +1054,18 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde value = impl.mController->GetSelectedText( ); break; } + case Toolkit::DevelTextField::Property::SELECTED_TEXT_START: + { + Uint32Pair range = impl.GetTextSelectionRange( ); + value = static_cast(range.first); + break; + } + case Toolkit::DevelTextField::Property::SELECTED_TEXT_END: + { + Uint32Pair range = impl.GetTextSelectionRange( ); + value = static_cast(range.second); + break; + } } //switch } @@ -1056,6 +1090,26 @@ void TextField::SelectNone() } } +void TextField::SetTextSelectionRange(const uint32_t *start, const uint32_t *end) +{ + if( mController && mController->IsShowingRealText() ) + { + mController->SetTextSelectionRange( start, end ); + SetKeyInputFocus(); + } +} + +Uint32Pair TextField::GetTextSelectionRange() const +{ + Uint32Pair range; + if( mController && mController->IsShowingRealText() ) + { + range = mController->GetTextSelectionRange(); + } + return range; +} + + InputMethodContext TextField::GetInputMethodContext() { return mInputMethodContext; @@ -1108,7 +1162,7 @@ void TextField::OnInitialize() { Actor self = Self(); - mController = Text::Controller::New( this, this ); + mController = Text::Controller::New( this, this ,this); // When using the vector-based rendering, the size of the GLyphs are different TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;