X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-text-updater.h;h=1070966311203df62a7d24034a5fe518a390fe29;hb=29a52105283ce8ced672ed92545daeacf882316a;hp=147ccb9fca01e1b7018fc5e809cab86f06086a7b;hpb=8ca4aa19ff1c7282e1a724d4660bf34e5a4b77fa;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller-text-updater.h b/dali-toolkit/internal/text/text-controller-text-updater.h index 147ccb9..1070966 100644 --- a/dali-toolkit/internal/text/text-controller-text-updater.h +++ b/dali-toolkit/internal/text/text-controller-text-updater.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXT_UPDATER_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. @@ -18,7 +18,6 @@ * */ - // EXTERNAL INCLUDES #include @@ -27,13 +26,10 @@ namespace Dali { - namespace Toolkit { - namespace Text { - /** * @brief Methods that update the text */ @@ -43,25 +39,65 @@ struct Controller::TextUpdater /// @param[in] controller The controller static void SetText(Controller& controller, const std::string& text); - /// @copydoc Text::Contoller::InsertText - /// @param[in] controller The controller + /** + * @brief Called by editable UI controls when key events are received. + * + * @param[in] controller The controller + * @param[in] text The text to insert. + * @param[in] type Used to distinguish between regular key events and InputMethodContext events. + */ static void InsertText(Controller& controller, const std::string& text, Controller::InsertType type); - /// @copydoc Text::Contoller::PasteText + /// @copydoc Text::EditableControlInterface::PasteText() /// @param[in] controller The controller static void PasteText(Controller& controller, const std::string& stringToPaste); - /// @copydoc Text::Contoller::RemoveText - /// @param[in] controller The controller + /** + * @brief Remove a given number of characters + * + * When predictve text is used the pre-edit text is removed and inserted again with the new characters. + * The UpdateInputStyleType @type parameter if set to DONT_UPDATE_INPUT_STYLE avoids to update the input + * style when pre-edit text is removed. + * + * @param[in] controller The controller + * @param[in] cursorOffset Start position from the current cursor position to start deleting characters. + * @param[in] numberOfCharacters The number of characters to delete from the cursorOffset. + * @param[in] type Whether to update the input style. + * @return True if the remove was successful. + */ static bool RemoveText(Controller& controller, int cursorOffset, int numberOfCharacters, UpdateInputStyleType type); - /// @copydoc Text::Contoller::RemoveSelectedText - /// @param[in] controller The controller + /** + * @brief Checks if text is selected and if so removes it. + * @param[in] controller The controller + * @return true if text was removed + */ static bool RemoveSelectedText(Controller& controller); - /// @copydoc Text::Contoller::ResetText - /// @param[in] controller The controller + /** + * @brief Used to remove the text included the placeholder text. + * @param[in] controller The controller + */ static void ResetText(Controller& controller); + + /** + * @brief Update anchor position from given number of inserted characters. + * + * @param[in] controller The controller + * @param[in] numberOfCharacters The number of inserted characters. + * @param[in] previousCursorIndex A cursor position before event occurs. + */ + static void InsertTextAnchor(Controller& controller, int numberOfCharacters, CharacterIndex previousCursorIndex); + + /** + * @brief Update anchor position from given number of removed characters. + * + * @param[in] controller The controller + * @param[in] cursorOffset Start position from the current cursor position to start deleting characters. + * @param[in] numberOfCharacters The number of removed characters. + * @param[in] previousCursorIndex A cursor position before event occurs. + */ + static void RemoveTextAnchor(Controller& controller, int cursorOffset, int numberOfCharacters, CharacterIndex previousCursorIndex); }; } // namespace Text