X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.h;h=324038444fcf93ef62d6740de0ae5befa9fabb9f;hp=aaa3a66de5c27e846ab77faaf6db13da549441ac;hb=00758f1301dd0bfbf6dc87659a6db9d0ba2c6816;hpb=64b92adb4035ab57f5ad265e0676a8ca8a23c64b diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index aaa3a66..3240384 100644 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -28,17 +28,14 @@ #include #include #include +#include #include #include #include #include #include -namespace Dali -{ -namespace Toolkit -{ -namespace Text +namespace Dali::Toolkit::Text { class Controller; class ControlInterface; @@ -51,9 +48,10 @@ class RenderingController; */ enum SelectionType { - INTERACTIVE = 0x0000, - ALL = 0x0001, - NONE = 0x0002 + INTERACTIVE = 0x0000, ///< Select the word where the cursor is located. + ALL = 0x0001, ///< Select the whole text. + NONE = 0x0002, ///< Unselect the whole text. + RANGE = 0x0003 ///< Select the range text. }; typedef IntrusivePtr ControllerPtr; @@ -168,7 +166,10 @@ public: // Constructor. * * @return A pointer to a new Controller. */ - static ControllerPtr New(); + static ControllerPtr New() + { + return ControllerPtr(new Controller()); + } /** * @brief Create a new instance of a Controller. @@ -177,7 +178,10 @@ public: // Constructor. * * @return A pointer to a new Controller. */ - static ControllerPtr New(ControlInterface* controlInterface); + static ControllerPtr New(ControlInterface* controlInterface) + { + return ControllerPtr(new Controller(controlInterface)); + } /** * @brief Create a new instance of a Controller. @@ -192,7 +196,13 @@ public: // Constructor. static ControllerPtr New(ControlInterface* controlInterface, EditableControlInterface* editableControlInterface, SelectableControlInterface* selectableControlInterface, - AnchorControlInterface* anchorControlInterface); + AnchorControlInterface* anchorControlInterface) + { + return ControllerPtr(new Controller(controlInterface, + editableControlInterface, + selectableControlInterface, + anchorControlInterface)); + } public: // Configure the text controller. /** @@ -230,6 +240,13 @@ public: // Configure the text controller. bool IsMarkupProcessorEnabled() const; /** + * @brief Retrieves whether the current text contains anchors. + * + * @return @e true if the current text contains anchors. @e false. + */ + bool HasAnchors() const; + + /** * @brief Enables/disables the auto text scrolling * * By default is disabled. @@ -1386,6 +1403,16 @@ public: // Queries & retrieves. void GetHiddenInputOption(Property::Map& options); /** + * @brief Used to set the input filter option + */ + void SetInputFilterOption(const Property::Map& options); + + /** + * @brief Used to get the input filter option + */ + void GetInputFilterOption(Property::Map& options); + + /** * @brief Sets the Placeholder Properties. * * @param[in] map The placeholder property map @@ -1418,6 +1445,18 @@ public: // Queries & retrieves. void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment); /** + * @brief Retrieves ellipsis position + * @return The ellipsis position + */ + Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const; + + /** + * @brief Sets ellipsis position + * @param[in] ellipsisPosition The ellipsis position for the text + */ + void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition); + + /** * @brief Retrieves ignoreSpaceAfterText value from model * @return The value of ignoreSpaceAfterText */ @@ -1430,24 +1469,36 @@ public: // Queries & retrieves. void SetIgnoreSpacesAfterText(bool ignore); /** - * @brief Retrieves matchSystemLanguageDirection value from model - * @return The value of matchSystemLanguageDirection + * @brief Sets SetMatchLayoutDirection value to model + * @param[in] match The value of matchLayoutDirection for the text */ - bool IsMatchSystemLanguageDirection() const; + void SetMatchLayoutDirection(DevelText::MatchLayoutDirection type); /** - * @brief Sets matchSystemLanguageDirection value to model - * @param[in] match The value of matchSystemLanguageDirection for the text + * @brief Retrieves matchLayoutDirection value from model + * @return The value of matchLayoutDirection */ - void SetMatchSystemLanguageDirection(bool match); + DevelText::MatchLayoutDirection GetMatchLayoutDirection() const; /** - * @brief Sets layoutDirection value - * @param[in] layoutDirection The value of system language direction + * @brief Sets layoutDirection type value. + * @param[in] layoutDirection The value of the layout direction type. */ void SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection); /** + * @brief Gets layoutDirection type value. + * @param[in] actor The actor which will get the layout direction type. + * @return The value of the layout direction type. + */ + Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const; + + /** + * @brief Sets the layout direction changed. + */ + void ChangedLayoutDirection(); + + /** * @brief Retrieves if showing real text or not. * @return The value of showing real text. */ @@ -1546,9 +1597,10 @@ public: // Text-input Event Queuing. * @brief Used to set the Primary cursor position. * * @param[in] index for the Primary cursor position. + * @param[in] focused true if UI control has gained focus to receive key event, false otherwise. * @return[in] true if cursor position changed, false otherwise. */ - bool SetPrimaryCursorPosition(CharacterIndex index); + bool SetPrimaryCursorPosition(CharacterIndex index, bool focused); /** * @brief Creates a selection event. @@ -1562,6 +1614,18 @@ public: // Text-input Event Queuing. void SelectEvent(float x, float y, SelectionType selection); /** + * @brief Creates a selection event with a selection index. + * + * It could be called from the SelectText(). + * The start and end parameters are passed through the event. + * + * @param[in] start The start selection position. + * @param[in] end The end selection position. + * @param[in] selection type like the range. + */ + void SelectEvent(const uint32_t start, const uint32_t end, SelectionType selection); + + /** * @copydoc Text::SelectableControlInterface::SetTextSelectionRange() */ void SetTextSelectionRange(const uint32_t* start, const uint32_t* end); @@ -1577,11 +1641,31 @@ public: // Text-input Event Queuing. void SelectWholeText(); /** + * @copydoc Text::EditableControlInterface::CopyText() + */ + string CopyText(); + + /** + * @copydoc Text::EditableControlInterface::CutText() + */ + string CutText(); + + /** + * @copydoc Text::EditableControlInterface::PasteText() + */ + void PasteText(); + + /** * @copydoc Text::SelectableControlInterface::SelectNone() */ void SelectNone(); /** + * @copydoc Text::SelectableControlInterface::SelectText() + */ + void SelectText(const uint32_t start, const uint32_t end); + + /** * @copydoc Text::SelectableControlInterface::GetSelectedText() */ string GetSelectedText() const; @@ -1690,8 +1774,7 @@ private: // Update. void InsertText(const std::string& text, InsertType type); /** - * @brief Paste given string into Text model - * @param[in] stringToPaste this string will be inserted into the text model + * @copydoc Text::EditableControlInterface::PasteText() */ void PasteText(const std::string& stringToPaste); @@ -1813,16 +1896,27 @@ private: // Helpers. */ void ResetScrollPosition(); + /** + * @brief fill needed relayout parameters when line size is changed & request relayout. + */ + void RelayoutForNewLineSize(); + private: // Private contructors & copy operator. /** * @brief Private constructor. */ - Controller(); + Controller() + : Controller(nullptr, nullptr, nullptr, nullptr) + { + } /** * @brief Private constructor. */ - Controller(ControlInterface* controlInterface); + Controller(ControlInterface* controlInterface) + : Controller(controlInterface, nullptr, nullptr, nullptr) + { + } /** * @brief Private constructor. @@ -1832,11 +1926,8 @@ private: // Private contructors & copy operator. SelectableControlInterface* selectableControlInterface, AnchorControlInterface* anchorControlInterface); - // Undefined - Controller(const Controller& handle); - - // Undefined - Controller& operator=(const Controller& handle); + Controller(const Controller& handle) = delete; + Controller& operator=(const Controller& handle) = delete; protected: // Destructor. /** @@ -1857,10 +1948,6 @@ private: Impl* mImpl; }; -} // namespace Text - -} // namespace Toolkit - -} // namespace Dali +} // namespace Dali::Toolkit::Text #endif // DALI_TOOLKIT_TEXT_CONTROLLER_H