From ab9500345f798f495c9201ab7cb3df88e24f7671 Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Tue, 23 Mar 2021 13:52:56 +0900 Subject: [PATCH] support grabHandleColor property to TextField/TextEditor Change-Id: I4ae47e2abd2cb1200eaed7fb404aaa58e48ecc55 Signed-off-by: Bowon Ryu --- .../devel-api/controls/text-controls/text-editor-devel.h | 8 +++++++- .../devel-api/controls/text-controls/text-field-devel.h | 8 +++++++- .../internal/controls/text-controls/text-editor-impl.cpp | 15 +++++++++++++++ .../internal/controls/text-controls/text-field-impl.cpp | 15 +++++++++++++++ 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h index 0b4334e..77ed805 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -181,6 +181,12 @@ enum Type * @details Name "primaryCursorPosition", type Property::INTEGER. */ PRIMARY_CURSOR_POSITION, + + /** + * @brief The color of the grab color. + * @details Name "grabHandleColor", type Property::VECTOR4. + */ + GRAB_HANDLE_COLOR, }; } // namespace Property diff --git a/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h index 8c8229d..ac239ef 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXT_FIELD_DEVEL_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -167,7 +167,13 @@ enum */ PRIMARY_CURSOR_POSITION, + /** + * @brief The color of the grab color. + * @details Name "grabHandleColor", type Property::VECTOR4. + */ + GRAB_HANDLE_COLOR, }; + } // namespace Property /** 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 3d48333..19c26c5 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -146,6 +146,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableEditing", 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_SIGNAL_REGISTRATION(Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED ) DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED) @@ -764,6 +765,15 @@ void TextEditor::SetProperty(BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::DevelTextEditor::Property::GRAB_HANDLE_COLOR: + { + const Vector4 color = value.Get(); + 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; + } } // switch } // texteditor } @@ -1120,6 +1130,11 @@ Property::Value TextEditor::GetProperty(BaseObject* object, Property::Index inde value = static_cast(impl.mController->GetPrimaryCursorPosition()); break; } + case Toolkit::DevelTextEditor::Property::GRAB_HANDLE_COLOR: + { + value = impl.mDecorator->GetHandleColor(); + break; + } } //switch } 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 47b32e9..d29bfad 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 } -- 2.7.4