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-editor-devel.h;h=879bdf02ab76032a572864dfe65670bbadbf4865;hp=c73c5829ca16147d6aff69d6f7b33241f68db52e;hb=a70d28d882e56f123f8eec322b4ca9594b2307cd;hpb=ee67cff961ec6b3003586c542dc473dd980c18c9 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 c73c582..879bdf0 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) 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 @@ -111,7 +112,7 @@ enum Type /** * @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, @@ -177,6 +178,14 @@ enum Type 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. */ @@ -187,6 +196,92 @@ enum Type * @details Name "grabHandleColor", type Property::VECTOR4. */ GRAB_HANDLE_COLOR, + + /** + * @brief Enables the grab handle popup for text selection. + * @details Name "enableGrabHandlePopup", type Property::BOOLEAN. + * @note The default value is true, which means the grab handle popup is enabled by default. + */ + ENABLE_GRAB_HANDLE_POPUP, + + /** + * @brief The settings to relating to the System's Input Method, Key and Value. + * @details Name "inputMethodSettings", type Property::MAP. + * + * @note VARIATION key can be changed depending on PANEL_LAYOUT. + * For example, when PANEL_LAYOUT key is InputMethod::PanelLayout::NORMAL, + * then VARIATION would be among NORMAL, WITH_FILENAME, and WITH_PERSON_NAME in Dali::InputMethod::NormalLayout. + * For more information, see Dali::InputMethod::Category. + * + * Example Usage: + * @code + * Property::Map propertyMap; + * InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER; + * InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD; + * InputMethod::ButtonAction::Type buttonAction = InputMethod::ButtonAction::GO; + * int inputVariation = 1; + * propertyMap["PANEL_LAYOUT"] = panelLayout; + * propertyMap["AUTO_CAPITALIZE"] = autoCapital; + * propertyMap["BUTTON_ACTION"] = buttonAction; + * propertyMap["VARIATION"] = inputVariation; + * + * editor.SetProperty(DevelTextEditor::Property::INPUT_METHOD_SETTINGS, propertyMap); + * @endcode + */ + INPUT_METHOD_SETTINGS, + + /** + * @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 + * + * editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, filter); // acceptable inputs are 6, 7, 8, 9 + * @endcode + */ + INPUT_FILTER, + + /** + * @brief Whether we should show the ellipsis if required. + * @details Name "ellipsis", type Property::BOOLEAN. + */ + ELLIPSIS, + + /** + * @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 Sets the height of the line in points. + * @details Name "minLineSize", type Property::FLOAT. + * @note If the font size is larger than the line size, it works with the font size. + */ + MIN_LINE_SIZE, }; } // namespace Property @@ -238,6 +333,95 @@ using AnchorClickedSignalType = Signal; DALI_TOOLKIT_API AnchorClickedSignalType& AnchorClickedSignal(TextEditor textEditor); /** + * @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(TextEditor textEditor, uint32_t oldPosition); + * @endcode + * @param[in] textEditor The instance of TextEditor. + * @return The signal to connect to. + */ +DALI_TOOLKIT_API CursorPositionChangedSignalType& CursorPositionChangedSignal(TextEditor textEditor); + +/** + * @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(TextEditor textEditor, Toolkit::InputFilter::Property::Type type); + * + * DevelTextEditor::InputFilteredSignal(textEditor).Connect(this, &OnInputFiltered); + * + * void OnInputFiltered(TextEditor textEditor, 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] textEditor The instance of TextEditor. + * @return The signal to connect to. + */ +DALI_TOOLKIT_API InputFilteredSignalType& InputFilteredSignal(TextEditor textEditor); + +/** + * @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( TextEditor textEditor, uint32_t oldStart, uint32_t oldEnd); + * @endcode + * @param[in] textEditor The instance of TextEditor. + * @return The signal to connect to + */ +DALI_TOOLKIT_API SelectionChangedSignalType& SelectionChangedSignal(TextEditor textEditor); + +/** + * @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( TextEditor textEditor); + * @endcode + * @param[in] textEditor The instance of TextEditor. + * @return The signal to connect to + */ +DALI_TOOLKIT_API SelectionClearedSignalType& SelectionClearedSignal(TextEditor textEditor); + +/** * @brief Select the whole text of TextEditor. * * @param[in] textEditor The instance of TextEditor. @@ -252,6 +436,21 @@ DALI_TOOLKIT_API void SelectWholeText(TextEditor textEditor); DALI_TOOLKIT_API void SelectNone(TextEditor textEditor); /** + * @brief Select the text from start index to end index of TextEditor. + * @note + * The selection index is based on the cursor index. + * + * text H e l l o + * index 0 1 2 3 4 5 + * if textEditor.SelectText(1, 4); is executed, "ell" is selected. + * + * @param[in] textEditor The instance of TextEditor. + * @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(TextEditor textEditor, const uint32_t start, const uint32_t end); + +/** * @brief Scroll the TextEditor by specific amount. * * @param[in] textEditor The instance of TextEditor. @@ -259,6 +458,53 @@ DALI_TOOLKIT_API void SelectNone(TextEditor textEditor); */ DALI_TOOLKIT_API void ScrollBy(TextEditor textEditor, Vector2 scroll); +/** + * @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] textEditor The instance of TextEditor. + * @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(TextEditor textEditor, 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] textEditor The instance of TextEditor. + * @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(TextEditor textEditor, const uint32_t startIndex, const uint32_t endIndex); + +/** + * @brief Copy and return the selected text of TextEditor. + * + * @param[in] textEditor The instance of TextEditor. + * @return The copied text. + */ +DALI_TOOLKIT_API std::string CopyText(TextEditor textEditor); + +/** + * @brief Cut and return the selected text of TextEditor. + * + * @param[in] textEditor The instance of TextEditor. + * @return The cut text. + */ +DALI_TOOLKIT_API std::string CutText(TextEditor textEditor); + +/** + * @brief Paste the most recent clipboard text item into the TextEditor. + * + * @param[in] textEditor The instance of TextEditor. + */ +DALI_TOOLKIT_API void PasteText(TextEditor textEditor); + } // namespace DevelTextEditor } // namespace Toolkit