X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-impl.h;h=1c6702c5b46c246ff1c524cc2755a8e0a5cea396;hb=b05a852e155e887cb0e9e1018205c57bfbbfa334;hp=981e498f13b54eba7f4073a9136b6e796ee0a559;hpb=f38b85e43af2185f8455c58906fa63c8e50f9899;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller-impl.h b/dali-toolkit/internal/text/text-controller-impl.h index 981e498..1c6702c 100755 --- a/dali-toolkit/internal/text/text-controller-impl.h +++ b/dali-toolkit/internal/text/text-controller-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -43,10 +43,14 @@ namespace Text const float DEFAULT_TEXTFIT_MIN = 10.f; const float DEFAULT_TEXTFIT_MAX = 100.f; const float DEFAULT_TEXTFIT_STEP = 1.f; +const float DEFAULT_FONT_SIZE_SCALE = 1.f; //Forward declarations struct CursorInfo; struct FontDefaults; +struct ControllerImplEventHandler; + +class SelectableControlInterface; struct Event { @@ -170,6 +174,7 @@ struct EventData bool mPlaceholderEllipsisFlag : 1; ///< True if the text controller sets the placeholder ellipsis. bool mShiftSelectionFlag : 1; ///< True if the text selection using Shift key is enabled. bool mUpdateAlignment : 1; ///< True if the whole text needs to be full aligned.. + bool mEditingEnabled : 1; ///< True if the editing is enabled, false otherwise. }; struct ModifyEvent @@ -202,11 +207,11 @@ struct FontDefaults fontClient.GetDefaultPlatformFontDescription( mFontDescription ); } - FontId GetFontId( TextAbstraction::FontClient& fontClient ) + FontId GetFontId( TextAbstraction::FontClient& fontClient, float fontPointSize ) { if( !mFontId ) { - const PointSize26Dot6 pointSize = static_cast( mDefaultPointSize * 64.f ); + const PointSize26Dot6 pointSize = static_cast( fontPointSize * 64.f ); mFontId = fontClient.GetFontId( mFontDescription, pointSize ); } @@ -308,9 +313,11 @@ struct OutlineDefaults struct Controller::Impl { Impl( ControlInterface* controlInterface, - EditableControlInterface* editableControlInterface ) + EditableControlInterface* editableControlInterface, + SelectableControlInterface* selectableControlInterface ) : mControlInterface( controlInterface ), mEditableControlInterface( editableControlInterface ), + mSelectableControlInterface( selectableControlInterface ), mModel(), mFontDefaults( NULL ), mUnderlineDefaults( NULL ), @@ -343,7 +350,8 @@ struct Controller::Impl mTextFitMinSize( DEFAULT_TEXTFIT_MIN ), mTextFitMaxSize( DEFAULT_TEXTFIT_MAX ), mTextFitStepSize( DEFAULT_TEXTFIT_STEP ), - mTextFitEnabled( false ) + mTextFitEnabled( false ), + mFontSizeScale( DEFAULT_FONT_SIZE_SCALE ) { mModel = Model::New(); @@ -623,6 +631,26 @@ struct Controller::Impl void OnSelectNoneEvent(); /** + * @copydoc Text::SelectableControlInterface::SetTextSelectionRange() + */ + void SetTextSelectionRange(const uint32_t *pStart, const uint32_t *pEndf); + + /** + * @copydoc Text::SelectableControlInterface::GetTextSelectionRange() + */ + Uint32Pair GetTextSelectionRange() const; + + /** + * @copydoc Text::EditableControlInterface::IsEditable() + */ + bool IsEditable() const; + + /** + * @copydoc Text::EditableControlInterface::SetEditable() + */ + void SetEditable( bool editable ); + + /** * @brief Retrieves the selected text. It removes the text if the @p deleteAfterRetrieval parameter is @e true. * * @param[out] selectedText The selected text encoded in utf8. @@ -630,13 +658,17 @@ struct Controller::Impl */ void RetrieveSelection( std::string& selectedText, bool deleteAfterRetrieval ); + void SetSelection( int start, int end ); + + std::pair< int, int > GetSelectionIndexes() const; + void ShowClipboard(); void HideClipboard(); void SetClipboardHideEnable(bool enable); - bool CopyStringToClipboard( std::string& source ); + bool CopyStringToClipboard( const std::string& source ); void SendSelectionToClipboard( bool deleteAfterSending ); @@ -757,6 +789,7 @@ public: ControlInterface* mControlInterface; ///< Reference to the text controller. EditableControlInterface* mEditableControlInterface; ///< Reference to the editable text controller. + SelectableControlInterface* mSelectableControlInterface; ///< Reference to the selectable text controller. ModelPtr mModel; ///< Pointer to the text's model. FontDefaults* mFontDefaults; ///< Avoid allocating this when the user does not specify a font. UnderlineDefaults* mUnderlineDefaults; ///< Avoid allocating this when the user does not specify underline parameters. @@ -797,6 +830,10 @@ public: float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100 float mTextFitStepSize; ///< Step Size for font intervalse. Default 1 bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled. + float mFontSizeScale; ///< Scale value for Font Size. Default 1.0 + +private: + friend ControllerImplEventHandler; }; } // namespace Text