X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Fcontrols%2Ftext-controls%2Ftext-field-devel.h;h=c81210a58db27deb5112dc9852ea78753d53579e;hp=3367bec8cfc45664e72e293b94cec84e087395fe;hb=6ae6cb59fdc507c422db80110606c4125c19466b;hpb=ee67cff961ec6b3003586c542dc473dd980c18c9 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 3367bec..c81210a 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) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -21,6 +21,7 @@ #include // INTERNAL INCLUDES +#include #include namespace Dali @@ -99,7 +100,7 @@ enum /** * @brief Modifies the default text alignment to match the direction of the system language. * @details Name "matchSystemLanguageDirection", type (Property::BOOLEAN), Read/Write - * @note The default value is false + * @note The default value is true */ MATCH_SYSTEM_LANGUAGE_DIRECTION = ELLIPSIS + 3, @@ -162,6 +163,14 @@ enum FONT_SIZE_SCALE, /** + * @brief True to enable the font size scale or false to disable. + * @details Name "enableFontSizeScale", type Property::BOOLEAN. + * @note The default value is true. + * If false, font size scale is not apppied. + */ + ENABLE_FONT_SIZE_SCALE, + + /** * @brief The position for primary cursor. * @details Name "primaryCursorPosition", type Property::INTEGER. */ @@ -172,6 +181,74 @@ enum * @details Name "grabHandleColor", type Property::VECTOR4. */ GRAB_HANDLE_COLOR, + + /** + * @brief The input filter + * @details Name "inputFilter", type Property::MAP. + * + * The inputFilter map contains the following keys: + * + * | %Property Name | Type | Required | Description | + * |----------------------|----------|----------|---------------------------------------------------------------------------------------------------------------------| + * | accepted | STRING | No | A regular expression in the set of characters to be accepted by the inputFilter (the default value is empty string) | + * | rejected | STRING | No | A regular expression in the set of characters to be rejected by the inputFilter (the default value is empty string) | + * + * @note Optional. + * The character set must follow the regular expression rules. + * Behaviour can not be guaranteed for incorrect grammars. + * Refer the link below for detailed rules. + * The functions in std::regex library use the ECMAScript grammar: + * http://cplusplus.com/reference/regex/ECMAScript/ + * + * You can use enums instead of "accepted" and "rejected" strings. + * @see Dali::Toolkit::InputFilter::Property::Type + * + * Example Usage: + * @code + * Property::Map filter; + * filter[InputFilter::Property::ACCEPTED] = "[\\d]"; // accept whole digits + * filter[InputFilter::Property::REJECTED] = "[0-5]"; // reject 0, 1, 2, 3, 4, 5 + * + * field.SetProperty(DevelTextField::Property::INPUT_FILTER, filter); // acceptable inputs are 6, 7, 8, 9 + * @endcode + */ + INPUT_FILTER, + + /** + * @brief The enumerations used to specify whether to position the ellipsis at the END, START or MIDDLE of the text. + * @details Name "EllipsisPosition", type [Type](@ref Dali::Toolkit::DevelText::EllipsisPosition::Type) (Property::INTEGER), or Property::STRING. Read/Write + * @note Default is EllipsisPosition::END. + * @see DevelText::EllipsisPosition + */ + ELLIPSIS_POSITION, + + /** + * @brief A horizontal line through the text center. + * @details Name "strikethrough", type Property::MAP. + */ + STRIKETHROUGH, + + /** + * @brief The strikethrough parameters of the new input text. + * @details Name "inputStrikethrough", type Property::MAP. + */ + INPUT_STRIKETHROUGH, + + /** + * @brief The spaces between characters in Pixels. + * @details Name "characterSpacing", type Property::FLOAT. + * @note + * A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed). + * The default value is 0.f which does nothing. + */ + CHARACTER_SPACING, + + /** + * @brief Sets the selection popup style + * @details Name "selectionPopupStyle", type Property::MAP. + * @see Dali::Toolkit::TextSelectionPopup::Property + */ + SELECTION_POPUP_STYLE, }; } // namespace Property @@ -206,6 +283,136 @@ using AnchorClickedSignalType = Signal; DALI_TOOLKIT_API AnchorClickedSignalType& AnchorClickedSignal(TextField textField); /** + * @brief cursor position changed signal type. + * + * @note Signal + * - uint32_t : old position. + */ +using CursorPositionChangedSignalType = Signal; + +/** + * @brief This signal is emitted when the cursor position has been changed. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(TextField textField, uint32_t oldPosition); + * @endcode + * @param[in] textField The instance of TextField. + * @return The signal to connect to. + */ +DALI_TOOLKIT_API CursorPositionChangedSignalType& CursorPositionChangedSignal(TextField textField); + +/** + * @brief Input filtered signal type. + */ +using InputFilteredSignalType = Signal; + +/** + * @brief This signal is emitted when the character to be inserted is filtered by the input filter. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(TextField textField, Toolkit::InputFilter::Property::Type type); + * + * DevelTextField::InputFilteredSignal(textField).Connect(this, &OnInputFiltered); + * + * void OnInputFiltered(TextField textField, InputFilter::Property::Type type) + * { + * if (type == InputFilter::Property::ACCEPTED) + * { + * // If the input has been filtered with an accepted filter, the type is ACCEPTED. + * } + * else if (type == InputFilter::Property::REJECTED) + * { + * // If the input has been filtered with an rejected filter, the type is REJECTED. + * } + * } + * @endcode + * @param[in] textField The instance of TextField. + * @return The signal to connect to. + */ +DALI_TOOLKIT_API InputFilteredSignalType& InputFilteredSignal(TextField textField); + +/** + * @brief selection changed signal type. + * + * @note Signal + * - uint32_t : selection start before the change. + * - uint32_t : selection end before the change. + */ +using SelectionChangedSignalType = Signal; + +/** + * @brief This signal is emitted when the selection has been changed. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName( TextField textField, uint32_t oldStart, uint32_t oldEnd); + * @endcode + * @param[in] textField The instance of TextField. + * @return The signal to connect to + */ +DALI_TOOLKIT_API SelectionChangedSignalType& SelectionChangedSignal(TextField textField); + +/** + * @brief selection cleared signal type. + */ +using SelectionClearedSignalType = Signal; + +/** + * @brief This signal is emitted when the selection has been cleared. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName( TextField textField); + * @endcode + * @param[in] textField The instance of TextField. + * @return The signal to connect to + */ +DALI_TOOLKIT_API SelectionClearedSignalType& SelectionClearedSignal(TextField textField); + +/** + * @brief selection start signal type. + */ +using SelectionStartedSignalType = Signal; + +/** + * @brief This signal is emitted when the selection start. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName( TextField textField); + * @endcode + * @param[in] textField The instance of TextField. + * @return The signal to connect to + */ +DALI_TOOLKIT_API SelectionStartedSignalType& SelectionStartedSignal(TextField textField); + +/** + * @brief Get the rendered size of a specific text range. + * if the requested text is at multilines, multiple sizes will be returned for each text located in a separate line. + * if a line contains characters with different directions, multiple sizes will be returned for each block of contiguous characters with the same direction. + * + * @param[in] textField The instance of TextField. + * @param[in] startIndex start index of the text requested to calculate size for. + * @param[in] endIndex end index(included) of the text requested to calculate size for. + * @return list of sizes of the reuested text. + */ +DALI_TOOLKIT_API Vector GetTextSize(TextField textField, const uint32_t startIndex, const uint32_t endIndex); + +/** + * @brief Get the top/left rendered position of a specific text range. + * if the requested text is at multilines, multiple positions will be returned for each text located in a separate line. + * if a line contains characters with different directions, multiple positions will be returned for each block of contiguous characters with the same direction. + * + * @param[in] textField The instance of TextField. + * @param[in] startIndex start index of the text requested to get position to. + * @param[in] endIndex end index(included) of the text requested to get position to. + * @return list of positions of the requested text. + */ +DALI_TOOLKIT_API Vector GetTextPosition(TextField textField, const uint32_t startIndex, const uint32_t endIndex); + +/** * @brief Select the whole text of TextField. * * @param[in] textField The instance of TextField. @@ -219,6 +426,44 @@ DALI_TOOLKIT_API void SelectWholeText(TextField textField); */ DALI_TOOLKIT_API void SelectNone(TextField textField); +/** + * @brief Select the text from start index to end index of TextField. + * @note + * The selection index is based on the cursor index. + * + * text H e l l o + * index 0 1 2 3 4 5 + * if textField.SelectText(1, 4); is executed, "ell" is selected. + * + * @param[in] textField The instance of TextField. + * @param[in] start The start index of the text to select. (The starting point of start index is 0.) + * @param[in] end The end index of the text to select. (If end index > text's length, the end index is set to the length of the text.) + */ +DALI_TOOLKIT_API void SelectText(TextField textField, const uint32_t start, const uint32_t end); + +/** + * @brief Copy and return the selected text of TextField. + * + * @param[in] textField The instance of TextField. + * @return The copied text. + */ +DALI_TOOLKIT_API std::string CopyText(TextField textField); + +/** + * @brief Cut and return the selected text of TextField. + * + * @param[in] textField The instance of TextField. + * @return The cut text. + */ +DALI_TOOLKIT_API std::string CutText(TextField textField); + +/** + * @brief Paste the most recent clipboard text item into the TextField. + * + * @param[in] textField The instance of TextField. + */ +DALI_TOOLKIT_API void PasteText(TextField textField); + } // namespace DevelTextField } // namespace Toolkit