2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <dali-toolkit/internal/controls/text-controls/text-field-property-handler.h>
19 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
20 #include <dali-toolkit/devel-api/text/rendering-backend.h>
22 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
23 #include <dali-toolkit/internal/text/text-controller.h>
24 #include <dali-toolkit/internal/text/text-effects-style.h>
25 #include <dali-toolkit/internal/text/text-enumerations-impl.h>
26 #include <dali-toolkit/internal/text/text-font-style.h>
27 #include <dali-toolkit/public-api/text/text-enumerations.h>
28 #include <dali/integration-api/debug.h>
30 #if defined(DEBUG_ENABLED)
31 extern Debug::Filter* gTextFieldLogFilter;
34 namespace Dali::Toolkit::Internal
36 const char* const TextField::PropertyHandler::IMAGE_MAP_FILENAME_STRING{"filename"};
38 /// Retrieves a filename from a value that is a Property::Map
39 std::string TextField::PropertyHandler::GetImageFileNameFromPropertyValue(const Property::Value& value)
42 const Property::Map* map = value.GetMap();
45 const Property::Value* filenameValue = map->Find(TextField::PropertyHandler::IMAGE_MAP_FILENAME_STRING);
48 filenameValue->Get(filename);
54 void TextField::PropertyHandler::SetProperty(Toolkit::TextField textField, Property::Index index, const Property::Value& value)
56 TextField& impl(GetImpl(textField));
57 DALI_ASSERT_DEBUG(impl.mController && "No text controller");
58 DALI_ASSERT_DEBUG(impl.mDecorator && "No text decorator");
62 case Toolkit::DevelTextField::Property::RENDERING_BACKEND:
64 int backend = value.Get<int>();
65 DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField %p RENDERING_BACKEND %d\n", impl.mController.Get(), backend);
67 #ifndef ENABLE_VECTOR_BASED_TEXT_RENDERING
68 if(DevelText::RENDERING_VECTOR_BASED == backend)
70 backend = TextAbstraction::BITMAP_GLYPH; // Fallback to bitmap-based rendering
73 if(impl.mRenderingBackend != backend)
75 impl.mRenderingBackend = backend;
76 impl.mRenderer.Reset();
78 // When using the vector-based rendering, the size of the GLyphs are different
79 TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
80 impl.mController->SetGlyphType(glyphType);
84 case Toolkit::TextField::Property::TEXT:
86 const std::string& text = value.Get<std::string>();
87 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p TEXT %s\n", impl.mController.Get(), text.c_str());
89 impl.mController->SetText(text);
93 case Toolkit::TextField::Property::PLACEHOLDER_TEXT:
95 const std::string& text = value.Get<std::string>();
96 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str());
98 impl.mController->SetPlaceholderText(Text::Controller::PLACEHOLDER_TYPE_INACTIVE, text);
101 case Toolkit::TextField::Property::PLACEHOLDER_TEXT_FOCUSED:
103 const std::string& text = value.Get<std::string>();
104 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_FOCUSED %s\n", impl.mController.Get(), text.c_str());
106 impl.mController->SetPlaceholderText(Text::Controller::PLACEHOLDER_TYPE_ACTIVE, text);
109 case Toolkit::TextField::Property::FONT_FAMILY:
111 const std::string& fontFamily = value.Get<std::string>();
112 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str());
113 impl.mController->SetDefaultFontFamily(fontFamily);
116 case Toolkit::TextField::Property::FONT_STYLE:
118 SetFontStyleProperty(impl.mController, value, Text::FontStyle::DEFAULT);
121 case Toolkit::TextField::Property::POINT_SIZE:
123 const float pointSize = value.Get<float>();
124 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p POINT_SIZE %f\n", impl.mController.Get(), pointSize);
126 if(!Equals(impl.mController->GetDefaultFontSize(Text::Controller::POINT_SIZE), pointSize))
128 impl.mController->SetDefaultFontSize(pointSize, Text::Controller::POINT_SIZE);
132 case Toolkit::TextField::Property::MAX_LENGTH:
134 const int max = value.Get<int>();
135 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p MAX_LENGTH %d\n", impl.mController.Get(), max);
137 impl.mController->SetMaximumNumberOfCharacters(max);
140 case Toolkit::TextField::Property::EXCEED_POLICY:
142 impl.mExceedPolicy = value.Get<int>();
144 if(Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == impl.mExceedPolicy)
146 impl.EnableClipping();
150 UnparentAndReset(impl.mStencil);
152 impl.RequestTextRelayout();
156 case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT:
158 Text::HorizontalAlignment::Type alignment(static_cast<Text::HorizontalAlignment::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
159 if(Text::GetHorizontalAlignmentEnumeration(value, alignment))
161 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p HORIZONTAL_ALIGNMENT %d\n", impl.mController.Get(), alignment);
162 impl.mController->SetHorizontalAlignment(alignment);
166 case Toolkit::TextField::Property::VERTICAL_ALIGNMENT:
168 Toolkit::Text::VerticalAlignment::Type alignment(static_cast<Text::VerticalAlignment::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
169 if(Text::GetVerticalAlignmentEnumeration(value, alignment))
171 impl.mController->SetVerticalAlignment(alignment);
172 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p VERTICAL_ALIGNMENT %d\n", impl.mController.Get(), alignment);
176 case Toolkit::TextField::Property::TEXT_COLOR:
178 const Vector4& textColor = value.Get<Vector4>();
179 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a);
181 if(impl.mController->GetDefaultColor() != textColor)
183 impl.mController->SetDefaultColor(textColor);
184 impl.mController->SetInputColor(textColor);
185 impl.mRenderer.Reset();
189 case Toolkit::TextField::Property::PLACEHOLDER_TEXT_COLOR:
191 const Vector4& textColor = value.Get<Vector4>();
192 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a);
194 if(impl.mController->GetPlaceholderTextColor() != textColor)
196 impl.mController->SetPlaceholderTextColor(textColor);
197 impl.mRenderer.Reset();
201 case Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR:
203 const Vector4& color = value.Get<Vector4>();
204 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a);
206 impl.mDecorator->SetCursorColor(Toolkit::Text::PRIMARY_CURSOR, color);
207 impl.RequestTextRelayout();
210 case Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR:
212 const Vector4& color = value.Get<Vector4>();
213 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a);
215 impl.mDecorator->SetCursorColor(Toolkit::Text::SECONDARY_CURSOR, color);
216 impl.RequestTextRelayout();
219 case Toolkit::TextField::Property::ENABLE_CURSOR_BLINK:
221 const bool enable = value.Get<bool>();
222 DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable);
224 impl.mController->SetEnableCursorBlink(enable);
225 impl.RequestTextRelayout();
228 case Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL:
230 const float interval = value.Get<float>();
231 DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval);
233 impl.mDecorator->SetCursorBlinkInterval(interval);
236 case Toolkit::TextField::Property::CURSOR_BLINK_DURATION:
238 const float duration = value.Get<float>();
239 DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_DURATION %f\n", impl.mController.Get(), duration);
241 impl.mDecorator->SetCursorBlinkDuration(duration);
244 case Toolkit::TextField::Property::CURSOR_WIDTH:
246 const int width = value.Get<int>();
247 DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField %p CURSOR_WIDTH %d\n", impl.mController.Get(), width);
249 impl.mDecorator->SetCursorWidth(width);
250 impl.mController->GetLayoutEngine().SetCursorWidth(width);
253 case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE:
255 const std::string imageFileName = value.Get<std::string>();
256 DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), imageFileName.c_str());
258 if(imageFileName.size())
260 impl.mDecorator->SetHandleImage(Toolkit::Text::GRAB_HANDLE, Toolkit::Text::HANDLE_IMAGE_RELEASED, imageFileName);
261 impl.RequestTextRelayout();
265 case Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE:
267 const std::string imageFileName = value.Get<std::string>();
268 DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), imageFileName.c_str());
270 if(imageFileName.size())
272 impl.mDecorator->SetHandleImage(Toolkit::Text::GRAB_HANDLE, Toolkit::Text::HANDLE_IMAGE_PRESSED, imageFileName);
273 impl.RequestTextRelayout();
277 case Toolkit::TextField::Property::SCROLL_THRESHOLD:
279 const float threshold = value.Get<float>();
280 DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField %p SCROLL_THRESHOLD %f\n", impl.mController.Get(), threshold);
282 impl.mDecorator->SetScrollThreshold(threshold);
285 case Toolkit::TextField::Property::SCROLL_SPEED:
287 const float speed = value.Get<float>();
288 DALI_LOG_INFO(gTextFieldLogFilter, Debug::Verbose, "TextField %p SCROLL_SPEED %f\n", impl.mController.Get(), speed);
290 impl.mDecorator->SetScrollSpeed(speed);
293 case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT:
295 const std::string filename = GetImageFileNameFromPropertyValue(value);
299 impl.mDecorator->SetHandleImage(Toolkit::Text::LEFT_SELECTION_HANDLE, Toolkit::Text::HANDLE_IMAGE_RELEASED, filename);
300 impl.RequestTextRelayout();
304 case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT:
306 const std::string filename = GetImageFileNameFromPropertyValue(value);
310 impl.mDecorator->SetHandleImage(Toolkit::Text::RIGHT_SELECTION_HANDLE, Toolkit::Text::HANDLE_IMAGE_RELEASED, filename);
311 impl.RequestTextRelayout();
315 case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT:
317 const std::string filename = GetImageFileNameFromPropertyValue(value);
321 impl.mDecorator->SetHandleImage(Toolkit::Text::LEFT_SELECTION_HANDLE, Toolkit::Text::HANDLE_IMAGE_PRESSED, filename);
322 impl.RequestTextRelayout();
326 case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT:
328 const std::string filename = GetImageFileNameFromPropertyValue(value);
332 impl.mDecorator->SetHandleImage(Toolkit::Text::RIGHT_SELECTION_HANDLE, Toolkit::Text::HANDLE_IMAGE_PRESSED, filename);
333 impl.RequestTextRelayout();
337 case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT:
339 const std::string filename = GetImageFileNameFromPropertyValue(value);
343 impl.mDecorator->SetHandleImage(Toolkit::Text::LEFT_SELECTION_HANDLE_MARKER,
344 Toolkit::Text::HANDLE_IMAGE_RELEASED,
346 impl.RequestTextRelayout();
350 case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT:
352 const std::string filename = GetImageFileNameFromPropertyValue(value);
356 impl.mDecorator->SetHandleImage(Toolkit::Text::RIGHT_SELECTION_HANDLE_MARKER,
357 Toolkit::Text::HANDLE_IMAGE_RELEASED,
359 impl.RequestTextRelayout();
363 case Toolkit::TextField::Property::SELECTION_HIGHLIGHT_COLOR:
365 const Vector4 color = value.Get<Vector4>();
366 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p SELECTION_HIGHLIGHT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a);
368 impl.mDecorator->SetHighlightColor(color);
369 impl.RequestTextRelayout();
372 case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX:
374 const Rect<int>& box = value.Get<Rect<int> >();
375 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height);
377 impl.mDecorator->SetBoundingBox(box);
378 impl.RequestTextRelayout();
381 case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
383 const Property::Map* map = value.GetMap();
386 impl.mInputMethodOptions.ApplyProperty(*map);
388 impl.mController->SetInputModePassword(impl.mInputMethodOptions.IsPassword());
390 Toolkit::Control control = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
391 if(control == textField)
393 impl.mInputMethodContext.ApplyOptions(impl.mInputMethodOptions);
397 case Toolkit::TextField::Property::INPUT_COLOR:
399 const Vector4& inputColor = value.Get<Vector4>();
400 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a);
402 impl.mController->SetInputColor(inputColor);
405 case Toolkit::TextField::Property::ENABLE_MARKUP:
407 const bool enableMarkup = value.Get<bool>();
408 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p ENABLE_MARKUP %d\n", impl.mController.Get(), enableMarkup);
410 impl.mController->SetMarkupProcessorEnabled(enableMarkup);
413 case Toolkit::TextField::Property::INPUT_FONT_FAMILY:
415 const std::string& fontFamily = value.Get<std::string>();
416 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str());
417 impl.mController->SetInputFontFamily(fontFamily);
420 case Toolkit::TextField::Property::INPUT_FONT_STYLE:
422 SetFontStyleProperty(impl.mController, value, Text::FontStyle::INPUT);
425 case Toolkit::TextField::Property::INPUT_POINT_SIZE:
427 const float pointSize = value.Get<float>();
428 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p INPUT_POINT_SIZE %f\n", impl.mController.Get(), pointSize);
429 impl.mController->SetInputFontPointSize(pointSize);
432 case Toolkit::TextField::Property::UNDERLINE:
434 const bool update = SetUnderlineProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
437 impl.mRenderer.Reset();
441 case Toolkit::TextField::Property::INPUT_UNDERLINE:
443 const bool update = SetUnderlineProperties(impl.mController, value, Text::EffectStyle::INPUT);
446 impl.mRenderer.Reset();
450 case Toolkit::TextField::Property::SHADOW:
452 const bool update = SetShadowProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
455 impl.mRenderer.Reset();
459 case Toolkit::TextField::Property::INPUT_SHADOW:
461 const bool update = SetShadowProperties(impl.mController, value, Text::EffectStyle::INPUT);
464 impl.mRenderer.Reset();
468 case Toolkit::TextField::Property::EMBOSS:
470 const bool update = SetEmbossProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
473 impl.mRenderer.Reset();
477 case Toolkit::TextField::Property::INPUT_EMBOSS:
479 const bool update = SetEmbossProperties(impl.mController, value, Text::EffectStyle::INPUT);
482 impl.mRenderer.Reset();
486 case Toolkit::TextField::Property::OUTLINE:
488 const bool update = SetOutlineProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
491 impl.mRenderer.Reset();
495 case Toolkit::TextField::Property::INPUT_OUTLINE:
497 const bool update = SetOutlineProperties(impl.mController, value, Text::EffectStyle::INPUT);
500 impl.mRenderer.Reset();
504 case Toolkit::TextField::Property::HIDDEN_INPUT_SETTINGS:
506 const Property::Map* map = value.GetMap();
509 impl.mController->SetHiddenInputOption(*map);
513 case Toolkit::TextField::Property::PIXEL_SIZE:
515 const float pixelSize = value.Get<float>();
516 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize);
518 if(!Equals(impl.mController->GetDefaultFontSize(Text::Controller::PIXEL_SIZE), pixelSize))
520 impl.mController->SetDefaultFontSize(pixelSize, Text::Controller::PIXEL_SIZE);
524 case Toolkit::TextField::Property::ENABLE_SELECTION:
526 const bool enableSelection = value.Get<bool>();
527 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection);
528 impl.mController->SetSelectionEnabled(enableSelection);
531 case Toolkit::TextField::Property::PLACEHOLDER:
533 const Property::Map* map = value.GetMap();
536 impl.mController->SetPlaceholderProperty(*map);
540 case Toolkit::TextField::Property::ELLIPSIS:
542 const bool ellipsis = value.Get<bool>();
543 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis);
545 impl.mController->SetTextElideEnabled(ellipsis);
548 case Toolkit::DevelTextField::Property::ENABLE_SHIFT_SELECTION:
550 const bool shiftSelection = value.Get<bool>();
551 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection);
553 impl.mController->SetShiftSelectionEnabled(shiftSelection);
556 case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE:
558 const bool grabHandleEnabled = value.Get<bool>();
559 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE %d\n", impl.mController.Get(), grabHandleEnabled);
561 impl.mController->SetGrabHandleEnabled(grabHandleEnabled);
564 case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
566 impl.mController->SetMatchLayoutDirection(value.Get<bool>() ? DevelText::MatchLayoutDirection::LOCALE : DevelText::MatchLayoutDirection::CONTENTS);
569 case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
571 const bool grabHandlePopupEnabled = value.Get<bool>();
572 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE_POPUP %d\n", impl.mController.Get(), grabHandlePopupEnabled);
574 impl.mController->SetGrabHandlePopupEnabled(grabHandlePopupEnabled);
577 case Toolkit::DevelTextField::Property::BACKGROUND:
579 const Vector4 backgroundColor = value.Get<Vector4>();
580 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p BACKGROUND %f,%f,%f,%f\n", impl.mController.Get(), backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a);
582 impl.mController->SetBackgroundEnabled(true);
583 impl.mController->SetBackgroundColor(backgroundColor);
586 case Toolkit::DevelTextField::Property::SELECTED_TEXT_START:
588 uint32_t start = static_cast<uint32_t>(value.Get<int>());
589 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p SELECTED_TEXT_START %d\n", impl.mController.Get(), start);
590 impl.SetTextSelectionRange(&start, nullptr);
593 case Toolkit::DevelTextField::Property::SELECTED_TEXT_END:
595 uint32_t end = static_cast<uint32_t>(value.Get<int>());
596 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p SELECTED_TEXT_END %d\n", impl.mController.Get(), end);
597 impl.SetTextSelectionRange(nullptr, &end);
600 case Toolkit::DevelTextField::Property::ENABLE_EDITING:
602 const bool editable = value.Get<bool>();
603 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p ENABLE_EDITING %d\n", impl.mController.Get(), editable);
604 impl.SetEditable(editable);
607 case Toolkit::DevelTextField::Property::FONT_SIZE_SCALE:
609 const float scale = value.Get<float>();
610 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p FONT_SIZE_SCALE %f\n", impl.mController.Get(), scale);
612 if(!Equals(impl.mController->GetFontSizeScale(), scale))
614 impl.mController->SetFontSizeScale(scale);
618 case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
620 uint32_t position = static_cast<uint32_t>(value.Get<int>());
621 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p PRIMARY_CURSOR_POSITION %d\n", impl.mController.Get(), position);
622 if(impl.mController->SetPrimaryCursorPosition(position, impl.HasKeyInputFocus()))
624 impl.SetKeyInputFocus();
628 case Toolkit::DevelTextField::Property::GRAB_HANDLE_COLOR:
630 const Vector4 color = value.Get<Vector4>();
631 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p GRAB_HANDLE_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a);
633 impl.mDecorator->SetHandleColor(color);
634 impl.RequestTextRelayout();
638 case Toolkit::DevelTextField::Property::INPUT_FILTER:
640 const Property::Map* map = value.GetMap();
643 impl.mController->SetInputFilterOption(*map);
647 case Toolkit::DevelTextField::Property::ELLIPSIS_POSITION:
649 DevelText::EllipsisPosition::Type ellipsisPositionType(static_cast<DevelText::EllipsisPosition::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
650 if(Text::GetEllipsisPositionTypeEnumeration(value, ellipsisPositionType))
652 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p EllipsisPosition::Type %d\n", impl.mController.Get(), ellipsisPositionType);
653 impl.mController->SetEllipsisPosition(ellipsisPositionType);
660 Property::Value TextField::PropertyHandler::GetProperty(Toolkit::TextField textField, Property::Index index)
662 Property::Value value;
663 TextField& impl(GetImpl(textField));
664 DALI_ASSERT_DEBUG(impl.mController && "No text controller");
665 DALI_ASSERT_DEBUG(impl.mDecorator && "No text decorator");
669 case Toolkit::DevelTextField::Property::RENDERING_BACKEND:
671 value = impl.mRenderingBackend;
674 case Toolkit::TextField::Property::TEXT:
677 impl.mController->GetText(text);
678 DALI_LOG_INFO(gTextFieldLogFilter, Debug::General, "TextField %p returning text: %s\n", impl.mController.Get(), text.c_str());
682 case Toolkit::TextField::Property::PLACEHOLDER_TEXT:
685 impl.mController->GetPlaceholderText(Text::Controller::PLACEHOLDER_TYPE_INACTIVE, text);
689 case Toolkit::TextField::Property::PLACEHOLDER_TEXT_FOCUSED:
692 impl.mController->GetPlaceholderText(Text::Controller::PLACEHOLDER_TYPE_ACTIVE, text);
696 case Toolkit::TextField::Property::FONT_FAMILY:
698 value = impl.mController->GetDefaultFontFamily();
701 case Toolkit::TextField::Property::FONT_STYLE:
703 GetFontStyleProperty(impl.mController, value, Text::FontStyle::DEFAULT);
706 case Toolkit::TextField::Property::POINT_SIZE:
708 value = impl.mController->GetDefaultFontSize(Text::Controller::POINT_SIZE);
711 case Toolkit::TextField::Property::MAX_LENGTH:
713 value = impl.mController->GetMaximumNumberOfCharacters();
716 case Toolkit::TextField::Property::EXCEED_POLICY:
718 value = impl.mExceedPolicy;
721 case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT:
723 const char* name = Text::GetHorizontalAlignmentString(impl.mController->GetHorizontalAlignment());
726 value = std::string(name);
730 case Toolkit::TextField::Property::VERTICAL_ALIGNMENT:
732 const char* name = Text::GetVerticalAlignmentString(impl.mController->GetVerticalAlignment());
736 value = std::string(name);
740 case Toolkit::TextField::Property::TEXT_COLOR:
742 value = impl.mController->GetDefaultColor();
745 case Toolkit::TextField::Property::PLACEHOLDER_TEXT_COLOR:
747 value = impl.mController->GetPlaceholderTextColor();
750 case Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR:
752 value = impl.mDecorator->GetColor(Text::PRIMARY_CURSOR);
755 case Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR:
757 value = impl.mDecorator->GetColor(Text::SECONDARY_CURSOR);
760 case Toolkit::TextField::Property::ENABLE_CURSOR_BLINK:
762 value = impl.mController->GetEnableCursorBlink();
765 case Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL:
767 value = impl.mDecorator->GetCursorBlinkInterval();
770 case Toolkit::TextField::Property::CURSOR_BLINK_DURATION:
772 value = impl.mDecorator->GetCursorBlinkDuration();
775 case Toolkit::TextField::Property::CURSOR_WIDTH:
777 value = impl.mDecorator->GetCursorWidth();
780 case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE:
782 value = impl.mDecorator->GetHandleImage(Text::GRAB_HANDLE, Text::HANDLE_IMAGE_RELEASED);
785 case Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE:
787 value = impl.mDecorator->GetHandleImage(Text::GRAB_HANDLE, Text::HANDLE_IMAGE_PRESSED);
790 case Toolkit::TextField::Property::SCROLL_THRESHOLD:
792 value = impl.mDecorator->GetScrollThreshold();
795 case Toolkit::TextField::Property::SCROLL_SPEED:
797 value = impl.mDecorator->GetScrollSpeed();
800 case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT:
802 impl.GetHandleImagePropertyValue(value, Text::LEFT_SELECTION_HANDLE, Text::HANDLE_IMAGE_RELEASED);
805 case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT:
807 impl.GetHandleImagePropertyValue(value, Text::RIGHT_SELECTION_HANDLE, Text::HANDLE_IMAGE_RELEASED);
810 case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT:
812 impl.GetHandleImagePropertyValue(value, Text::LEFT_SELECTION_HANDLE, Text::HANDLE_IMAGE_PRESSED);
815 case Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT:
817 impl.GetHandleImagePropertyValue(value, Text::RIGHT_SELECTION_HANDLE, Text::HANDLE_IMAGE_PRESSED);
820 case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT:
822 impl.GetHandleImagePropertyValue(value, Text::LEFT_SELECTION_HANDLE_MARKER, Text::HANDLE_IMAGE_RELEASED);
825 case Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT:
827 impl.GetHandleImagePropertyValue(value, Text::RIGHT_SELECTION_HANDLE_MARKER, Text::HANDLE_IMAGE_RELEASED);
830 case Toolkit::TextField::Property::SELECTION_HIGHLIGHT_COLOR:
832 value = impl.mDecorator->GetHighlightColor();
835 case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX:
837 Rect<int> boundingBox;
838 impl.mDecorator->GetBoundingBox(boundingBox);
842 case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
845 impl.mInputMethodOptions.RetrieveProperty(map);
849 case Toolkit::TextField::Property::INPUT_COLOR:
851 value = impl.mController->GetInputColor();
854 case Toolkit::TextField::Property::ENABLE_MARKUP:
856 value = impl.mController->IsMarkupProcessorEnabled();
859 case Toolkit::TextField::Property::INPUT_FONT_FAMILY:
861 value = impl.mController->GetInputFontFamily();
864 case Toolkit::TextField::Property::INPUT_FONT_STYLE:
866 GetFontStyleProperty(impl.mController, value, Text::FontStyle::INPUT);
869 case Toolkit::TextField::Property::INPUT_POINT_SIZE:
871 value = impl.mController->GetInputFontPointSize();
874 case Toolkit::TextField::Property::UNDERLINE:
876 GetUnderlineProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
879 case Toolkit::TextField::Property::INPUT_UNDERLINE:
881 GetUnderlineProperties(impl.mController, value, Text::EffectStyle::INPUT);
884 case Toolkit::TextField::Property::SHADOW:
886 GetShadowProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
889 case Toolkit::TextField::Property::INPUT_SHADOW:
891 GetShadowProperties(impl.mController, value, Text::EffectStyle::INPUT);
894 case Toolkit::TextField::Property::EMBOSS:
896 GetEmbossProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
899 case Toolkit::TextField::Property::INPUT_EMBOSS:
901 GetEmbossProperties(impl.mController, value, Text::EffectStyle::INPUT);
904 case Toolkit::TextField::Property::OUTLINE:
906 GetOutlineProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
909 case Toolkit::TextField::Property::INPUT_OUTLINE:
911 GetOutlineProperties(impl.mController, value, Text::EffectStyle::INPUT);
914 case Toolkit::TextField::Property::HIDDEN_INPUT_SETTINGS:
917 impl.mController->GetHiddenInputOption(map);
921 case Toolkit::TextField::Property::PIXEL_SIZE:
923 value = impl.mController->GetDefaultFontSize(Text::Controller::PIXEL_SIZE);
926 case Toolkit::TextField::Property::ENABLE_SELECTION:
928 value = impl.mController->IsSelectionEnabled();
931 case Toolkit::TextField::Property::PLACEHOLDER:
934 impl.mController->GetPlaceholderProperty(map);
938 case Toolkit::TextField::Property::ELLIPSIS:
940 value = impl.mController->IsTextElideEnabled();
943 case Toolkit::DevelTextField::Property::ENABLE_SHIFT_SELECTION:
945 value = impl.mController->IsShiftSelectionEnabled();
948 case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE:
950 value = impl.mController->IsGrabHandleEnabled();
953 case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
955 value = impl.mController->GetMatchLayoutDirection() != DevelText::MatchLayoutDirection::CONTENTS;
958 case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
960 value = impl.mController->IsGrabHandlePopupEnabled();
963 case Toolkit::DevelTextField::Property::BACKGROUND:
965 value = impl.mController->GetBackgroundColor();
968 case Toolkit::DevelTextField::Property::SELECTED_TEXT:
970 value = impl.mController->GetSelectedText();
973 case Toolkit::DevelTextField::Property::SELECTED_TEXT_START:
975 Uint32Pair range = impl.GetTextSelectionRange();
976 value = static_cast<int>(range.first);
979 case Toolkit::DevelTextField::Property::SELECTED_TEXT_END:
981 Uint32Pair range = impl.GetTextSelectionRange();
982 value = static_cast<int>(range.second);
985 case Toolkit::DevelTextField::Property::ENABLE_EDITING:
987 value = impl.IsEditable();
990 case Toolkit::DevelTextField::Property::FONT_SIZE_SCALE:
992 value = impl.mController->GetFontSizeScale();
995 case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
997 value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
1000 case Toolkit::DevelTextField::Property::GRAB_HANDLE_COLOR:
1002 value = impl.mDecorator->GetHandleColor();
1005 case Toolkit::DevelTextField::Property::INPUT_FILTER:
1008 impl.mController->GetInputFilterOption(map);
1012 case Toolkit::DevelTextField::Property::ELLIPSIS_POSITION:
1014 value = impl.mController->GetEllipsisPosition();
1021 } // namespace Dali::Toolkit::Internal