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=d12a708eb8c3d04a74b8a15f74239d7d97ac8fdb;hp=4cca3fdd790f684344560c913caf9dd77c4de7fb;hb=5bc22f12881a16d7c5143c5e220fc0075aef6061;hpb=c052b6678e2c6d8a65545dbbe4531ea7057c1999 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 4cca3fd..d12a708 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -137,6 +137,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "selectedTextEnd" DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "enableEditing", BOOLEAN, ENABLE_EDITING ) DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "fontSizeScale", FLOAT, FONT_SIZE_SCALE ) DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION ) +DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR ) DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED ) @@ -754,6 +755,15 @@ void TextField::SetProperty(BaseObject* object, Property::Index index, const Pro } break; } + case Toolkit::DevelTextField::Property::GRAB_HANDLE_COLOR: + { + const Vector4 color = value.Get(); + DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p GRAB_HANDLE_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a); + + impl.mDecorator->SetHandleColor(color); + impl.RequestTextRelayout(); + break; + } } // switch } // textfield } @@ -1104,6 +1114,11 @@ Property::Value TextField::GetProperty(BaseObject* object, Property::Index index value = static_cast(impl.mController->GetPrimaryCursorPosition()); break; } + case Toolkit::DevelTextField::Property::GRAB_HANDLE_COLOR: + { + value = impl.mDecorator->GetHandleColor(); + break; + } } //switch } @@ -1333,6 +1348,14 @@ float TextField::GetHeightForWidth(float width) return mController->GetHeightForWidth(width) + padding.top + padding.bottom; } +void TextField::ResizeActor(Actor& actor, const Vector2& size) +{ + if(actor.GetProperty(Dali::Actor::Property::SIZE).GetVectorXY() != size) + { + actor.SetProperty(Actor::Property::SIZE, size); + } +} + void TextField::OnRelayout(const Vector2& size, RelayoutContainer& container) { DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextField OnRelayout\n"); @@ -1362,10 +1385,12 @@ void TextField::OnRelayout(const Vector2& size, RelayoutContainer& container) if(mStencil) { mStencil.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top)); + ResizeActor(mStencil, contentSize); } if(mActiveLayer) { mActiveLayer.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top)); + ResizeActor(mActiveLayer, contentSize); } const Text::Controller::UpdateTextType updateTextType = mController->Relayout(contentSize, layoutDirection); @@ -1378,7 +1403,7 @@ void TextField::OnRelayout(const Vector2& size, RelayoutContainer& container) if(mDecorator && (Text::Controller::NONE_UPDATED != (Text::Controller::DECORATOR_UPDATED & updateTextType))) { - mDecorator->Relayout(size); + mDecorator->Relayout(contentSize); } if(!mRenderer) @@ -1387,6 +1412,12 @@ void TextField::OnRelayout(const Vector2& size, RelayoutContainer& container) } RenderText(updateTextType); + + // If there is text changed, callback is called. + if(mTextChanged) + { + EmitTextChangedSignal(); + } } // The text-field emits signals when the input style changes. These changes of style are @@ -1677,10 +1708,23 @@ void TextField::CaretMoved(unsigned int position) } } -void TextField::TextChanged() +void TextField::TextChanged(bool immediate) +{ + if(immediate) // Emits TextChangedSignal immediately + { + EmitTextChangedSignal(); + } + else + { + mTextChanged = true; + } +} + +void TextField::EmitTextChangedSignal() { Dali::Toolkit::TextField handle(GetOwner()); mTextChangedSignal.Emit(handle); + mTextChanged = false; } void TextField::MaxLengthReached() @@ -1857,7 +1901,8 @@ TextField::TextField() mAlignmentOffset(0.f), mRenderingBackend(DEFAULT_RENDERING_BACKEND), mExceedPolicy(Dali::Toolkit::TextField::EXCEED_POLICY_CLIP), - mHasBeenStaged(false) + mHasBeenStaged(false), + mTextChanged(false) { } @@ -2071,7 +2116,7 @@ Dali::Accessibility::States TextField::AccessibleImpl::CalculateStates() { using namespace Dali::Accessibility; - auto states = Control::Impl::AccessibleImpl::CalculateStates(); + auto states = DevelControl::AccessibleImpl::CalculateStates(); states[State::EDITABLE] = true; states[State::FOCUSABLE] = true;