{
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;
+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;
+const float DEFAULT_DISABLED_COLOR_OPACITY = 0.3f;
//Forward declarations
struct CursorInfo;
mMarkupProcessorEnabled(false),
mClipboardHideEnabled(true),
mIsAutoScrollEnabled(false),
+ mIsAutoScrollMaxTextureExceeded(false),
mUpdateTextDirection(true),
mIsTextDirectionRTL(false),
mUnderlineSetByString(false),
mShadowSetByString(false),
mOutlineSetByString(false),
mFontStyleSetByString(false),
+ mStrikethroughSetByString(false),
mShouldClearFocusOnEscape(true),
mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT),
mTextFitMinSize(DEFAULT_TEXTFIT_MIN),
mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
+ mDisabledColorOpacity(DEFAULT_DISABLED_COLOR_OPACITY),
mFontSizeScaleEnabled(true),
mTextFitEnabled(false),
mTextFitChanged(false),
- mIsLayoutDirectionChanged(false)
+ mIsLayoutDirectionChanged(false),
+ mIsUserInteractionEnabled(true)
{
mModel = Model::New();
mClipboard = Clipboard::Get();
mView.SetVisualModel(mModel->mVisualModel);
+ mView.SetLogicalModel(mModel->mLogicalModel);
// Use this to access FontClient i.e. to get down-scaled Emoji metrics.
mMetrics = Metrics::New(mFontClient);
Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
if(styleManager)
{
- bool temp;
- Property::Map config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
- if(config["clearFocusOnEscape"].Get(temp))
- {
- mShouldClearFocusOnEscape = temp;
- }
+ const Property::Map& config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
+ const auto clearFocusOnEscapeValue = config.Find("clearFocusOnEscape", Property::Type::BOOLEAN);
+
+ // Default is true. If config don't have "clearFocusOnEscape" property, make it true.
+ mShouldClearFocusOnEscape = (!clearFocusOnEscapeValue || clearFocusOnEscapeValue->Get<bool>());
}
}
bool SetDefaultLineSize(float lineSize);
/**
+ * @copydoc Controller::SetRelativeLineSize
+ */
+ bool SetRelativeLineSize(float relativeLineSize);
+
+ /**
+ * @copydoc Controller::GetRelativeLineSize
+ */
+ float GetRelativeLineSize();
+
+ /**
* @copydoc Text::Controller::GetPrimaryCursorPosition()
*/
CharacterIndex GetPrimaryCursorPosition() const;
void ScrollTextToMatchCursor();
/**
- * @brief fill needed relayout parameters when line size is changed & request relayout.
+ * @brief Create an actor that renders the text background color
+ *
+ * @return the created actor or an empty handle if no background color needs to be rendered.
*/
- void RelayoutForNewLineSize();
+ Actor CreateBackgroundActor();
+
+ /**
+ * @brief fill needed relayout parameters whenever a property is changed and a re-layout is needed for the entire text.
+ */
+ void RelayoutAllCharacters();
/**
* @copydoc Controller::IsInputStyleChangedSignalsQueueEmpty
void ScrollBy(Vector2 scroll);
/**
+ * @copydoc Controller::IsScrollable()
+ */
+ bool IsScrollable(const Vector2& displacement);
+
+ /**
* @copydoc Controller::GetHorizontalScrollPosition()
*/
float GetHorizontalScrollPosition();
void SetDefaultColor(const Vector4& color);
/**
+ * @copydoc Controller::SetUserInteractionEnabled()
+ */
+ void SetUserInteractionEnabled(bool enabled);
+
+ /**
* @brief Helper to clear font-specific data (only).
*/
void ClearFontData();
*/
void CopyStrikethroughFromLogicalToVisualModels();
+ /**
+ * @brief Copy CharacterSpacing-Character-Runs from Logical-Model to CharacterSpacing-Glyph-Runs in Visual-Model
+ *
+ */
+ void CopyCharacterSpacingFromLogicalToVisualModels();
+
public:
ControlInterface* mControlInterface; ///< Reference to the text controller.
EditableControlInterface* mEditableControlInterface; ///< Reference to the editable text controller.
std::unique_ptr<InputFilter> mInputFilter; ///< Avoid allocating this when the user does not specify input filter mode.
Vector2 mTextFitContentSize; ///< Size of Text fit content
- bool mRecalculateNaturalSize : 1; ///< Whether the natural size needs to be recalculated.
- bool mMarkupProcessorEnabled : 1; ///< Whether the mark-up procesor is enabled.
- bool mClipboardHideEnabled : 1; ///< Whether the ClipboardHide function work or not
- bool mIsAutoScrollEnabled : 1; ///< Whether auto text scrolling is enabled.
- bool mUpdateTextDirection : 1; ///< Whether the text direction needs to be updated.
- CharacterDirection mIsTextDirectionRTL : 1; ///< Whether the text direction is right to left or not
+ bool mRecalculateNaturalSize : 1; ///< Whether the natural size needs to be recalculated.
+ bool mMarkupProcessorEnabled : 1; ///< Whether the mark-up procesor is enabled.
+ bool mClipboardHideEnabled : 1; ///< Whether the ClipboardHide function work or not
+ bool mIsAutoScrollEnabled : 1; ///< Whether auto text scrolling is enabled.
+ bool mIsAutoScrollMaxTextureExceeded : 1; ///< Whether auto text scrolling is exceed max texture size.
+ bool mUpdateTextDirection : 1; ///< Whether the text direction needs to be updated.
+ CharacterDirection mIsTextDirectionRTL : 1; ///< Whether the text direction is right to left or not
bool mUnderlineSetByString : 1; ///< Set when underline is set by string (legacy) instead of map
bool mShadowSetByString : 1; ///< Set when shadow is set by string (legacy) instead of map
float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100
float mTextFitStepSize; ///< Step Size for font intervalse. Default 1
float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
+ float mDisabledColorOpacity; ///< Color opacity when disabled.
bool mFontSizeScaleEnabled : 1; ///< Whether the font size scale is enabled.
bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled.
bool mTextFitChanged : 1; ///< Whether the text fit property has changed.
bool mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
+ bool mIsUserInteractionEnabled : 1; ///< Whether the user interaction is enabled.
private:
friend ControllerImplEventHandler;