DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY(Toolkit, TextEditor, "selectedText", STRING, SELECTED_TEXT )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED)
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
+DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "anchorClicked", SIGNAL_ANCHOR_CLICKED )
DALI_TYPE_REGISTRATION_END()
// clang-format on
}
break;
}
+ case Toolkit::DevelTextEditor::Property::GRAB_HANDLE_COLOR:
+ {
+ const Vector4 color = value.Get<Vector4>();
+ DALI_LOG_INFO(gLogFilter, Debug::General, "TextEditor %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;
+ }
+ case Toolkit::DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP:
+ {
+ const bool grabHandlePopupEnabled = value.Get<bool>();
+ DALI_LOG_INFO(gLogFilter, Debug::General, "TextEditor %p ENABLE_GRAB_HANDLE_POPUP %d\n", impl.mController.Get(), grabHandlePopupEnabled);
+
+ impl.mController->SetGrabHandlePopupEnabled(grabHandlePopupEnabled);
+ break;
+ }
} // switch
} // texteditor
}
value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
break;
}
+ case Toolkit::DevelTextEditor::Property::GRAB_HANDLE_COLOR:
+ {
+ value = impl.mDecorator->GetHandleColor();
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP:
+ {
+ value = impl.mController->IsGrabHandlePopupEnabled();
+ break;
+ }
} //switch
}
return mMaxLengthReachedSignal;
}
+DevelTextEditor::AnchorClickedSignalType& TextEditor::AnchorClickedSignal()
+{
+ return mAnchorClickedSignal;
+}
+
Text::ControllerPtr TextEditor::getController()
{
return mController;
editorImpl.MaxLengthReachedSignal().Connect(tracker, functor);
}
}
+ else if(0 == strcmp(signalName.c_str(), SIGNAL_ANCHOR_CLICKED))
+ {
+ if(editor)
+ {
+ Internal::TextEditor& editorImpl(GetImpl(editor));
+ editorImpl.AnchorClickedSignal().Connect(tracker, functor);
+ }
+ }
else
{
// signalName does not match any signal
{
Actor self = Self();
- mController = Text::Controller::New(this, this, this);
+ mController = Text::Controller::New(this, this, this, this);
mDecorator = Text::Decorator::New(*mController,
*mController);
// If there is text changed, callback is called.
if(mTextChanged)
{
- Dali::Toolkit::TextEditor handle(GetOwner());
- mTextChangedSignal.Emit(handle);
- mTextChanged = false;
+ EmitTextChangedSignal();
}
}
padding = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
const Vector2& localPoint = gesture.GetLocalPoint();
mController->TapEvent(gesture.GetNumberOfTaps(), localPoint.x - padding.start, localPoint.y - padding.top);
+ mController->AnchorEvent(localPoint.x - padding.start, localPoint.y - padding.top);
SetKeyInputFocus();
}
}
}
-void TextEditor::TextChanged()
+void TextEditor::TextChanged(bool immediate)
{
- mTextChanged = true;
+ if(immediate) // Emits TextChangedSignal immediately
+ {
+ EmitTextChangedSignal();
+ }
+ else
+ {
+ mTextChanged = true;
+ }
+}
+
+void TextEditor::EmitTextChangedSignal()
+{
+ Dali::Toolkit::TextEditor handle(GetOwner());
+ mTextChangedSignal.Emit(handle);
+ mTextChanged = false;
}
void TextEditor::MaxLengthReached()
mInputStyleChangedSignal.Emit(handle, editorInputStyleMask);
}
+void TextEditor::AnchorClicked(const std::string& href)
+{
+ Dali::Toolkit::TextEditor handle(GetOwner());
+ mAnchorClickedSignal.Emit(handle, href.c_str(), href.length());
+}
+
void TextEditor::AddDecoration(Actor& actor, bool needsClipping)
{
if(actor)
std::string TextEditor::AccessibleImpl::GetName()
{
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
return slf.GetProperty(Toolkit::TextEditor::Property::TEXT)
.Get<std::string>();
}
if(endOffset <= startOffset)
return {};
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt =
slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
size_t TextEditor::AccessibleImpl::GetCharacterCount()
{
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt =
slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
size_t TextEditor::AccessibleImpl::GetCaretOffset()
{
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
return Dali::Toolkit::GetImpl(slf).getController()->GetCursorPosition();
}
bool TextEditor::AccessibleImpl::SetCaretOffset(size_t offset)
{
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
if(offset > txt.size())
return false;
Dali::Accessibility::Range TextEditor::AccessibleImpl::GetTextAtOffset(
size_t offset, Dali::Accessibility::TextBoundary boundary)
{
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
auto txt_size = txt.size();
if(selectionNum > 0)
return {};
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto ctrl = Dali::Toolkit::GetImpl(slf).getController();
std::string ret;
ctrl->RetrieveSelection(ret);
if(selectionNum > 0)
return false;
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
Dali::Toolkit::GetImpl(slf).getController()->SetSelection(0, 0);
return true;
}
if(selectionNum > 0)
return false;
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
Dali::Toolkit::GetImpl(slf).getController()->SetSelection(startOffset,
endOffset);
return true;
if(endPosition <= startPosition)
return false;
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
Dali::Toolkit::GetImpl(slf).getController()->CopyStringToClipboard(txt.substr(startPosition, endPosition - startPosition));
if(endPosition <= startPosition)
return false;
- auto slf = Toolkit::TextEditor::DownCast(self);
+ auto slf = Toolkit::TextEditor::DownCast(Self());
auto txt = slf.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
Dali::Toolkit::GetImpl(slf).getController()->CopyStringToClipboard(txt.substr(startPosition, endPosition - startPosition));