projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add vertical alignment for text editor
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
text
/
text-controller-impl.h
diff --git
a/dali-toolkit/internal/text/text-controller-impl.h
b/dali-toolkit/internal/text/text-controller-impl.h
index
e49971a
..
5944039
100644
(file)
--- 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
/*
#define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
/*
- * Copyright (c) 202
1
Samsung Electronics Co., Ltd.
+ * Copyright (c) 202
2
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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-41,6
+41,7
@@
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_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;
//Forward declarations
struct CursorInfo;
@@
-351,14
+352,19
@@
struct Controller::Impl
mShadowSetByString(false),
mOutlineSetByString(false),
mFontStyleSetByString(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),
mShouldClearFocusOnEscape(true),
mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT),
mTextFitMinSize(DEFAULT_TEXTFIT_MIN),
mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
- mTextFitEnabled(false),
mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
- mIsLayoutDirectionChanged(false)
+ mDisabledColorOpacity(DEFAULT_DISABLED_COLOR_OPACITY),
+ mFontSizeScaleEnabled(true),
+ mTextFitEnabled(false),
+ mTextFitChanged(false),
+ mIsLayoutDirectionChanged(false),
+ mIsUserInteractionEnabled(true)
{
mModel = Model::New();
{
mModel = Model::New();
@@
-366,6
+372,7
@@
struct Controller::Impl
mClipboard = Clipboard::Get();
mView.SetVisualModel(mModel->mVisualModel);
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);
// Use this to access FontClient i.e. to get down-scaled Emoji metrics.
mMetrics = Metrics::New(mFontClient);
@@
-496,6
+503,11
@@
struct Controller::Impl
}
}
}
}
+ float GetFontSizeScale()
+ {
+ return mFontSizeScaleEnabled ? mFontSizeScale : 1.0f;
+ }
+
/**
* @brief Helper to notify InputMethodContext with surrounding text & cursor changes.
*/
/**
* @brief Helper to notify InputMethodContext with surrounding text & cursor changes.
*/
@@
-523,6
+535,13
@@
struct Controller::Impl
Length GetNumberOfWhiteSpaces(CharacterIndex index) const;
/**
Length GetNumberOfWhiteSpaces(CharacterIndex index) const;
/**
+ * @brief Retrieve any text previously set.
+ *
+ * @param[out] text A string of UTF-8 characters.
+ */
+ void GetText(std::string& text) const;
+
+ /**
* @brief Retrieve any text previously set starting from the given @p index.
*
* @param[in] index The character index from where to retrieve the text.
* @brief Retrieve any text previously set starting from the given @p index.
*
* @param[in] index The character index from where to retrieve the text.
@@
-550,6
+569,12
@@
struct Controller::Impl
Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
/**
Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
/**
+ * @brief Checks text direction.
+ * @return The text direction.
+ */
+ Toolkit::DevelText::TextDirection::Type GetTextDirection();
+
+ /**
* @brief Calculates the start character index of the first paragraph to be updated and
* the end character index of the last paragraph to be updated.
*
* @brief Calculates the start character index of the first paragraph to be updated and
* the end character index of the last paragraph to be updated.
*
@@
-605,6
+630,16
@@
struct Controller::Impl
bool SetDefaultLineSize(float lineSize);
/**
bool SetDefaultLineSize(float lineSize);
/**
+ * @copydoc Controller::SetRelativeLineSize
+ */
+ bool SetRelativeLineSize(float relativeLineSize);
+
+ /**
+ * @copydoc Controller::GetRelativeLineSize
+ */
+ float GetRelativeLineSize();
+
+ /**
* @copydoc Text::Controller::GetPrimaryCursorPosition()
*/
CharacterIndex GetPrimaryCursorPosition() const;
* @copydoc Text::Controller::GetPrimaryCursorPosition()
*/
CharacterIndex GetPrimaryCursorPosition() const;
@@
-615,6
+650,21
@@
struct Controller::Impl
bool SetPrimaryCursorPosition(CharacterIndex index, bool focused);
/**
bool SetPrimaryCursorPosition(CharacterIndex index, bool focused);
/**
+ * @copydoc Text::SelectableControlInterface::GetSelectedText()
+ */
+ string GetSelectedText();
+
+ /**
+ * @copydoc Text::EditableControlInterface::CopyText()
+ */
+ string CopyText();
+
+ /**
+ * @copydoc Text::EditableControlInterface::CutText()
+ */
+ string CutText();
+
+ /**
* @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
*/
void SetTextSelectionRange(const uint32_t* pStart, const uint32_t* pEndf);
* @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
*/
void SetTextSelectionRange(const uint32_t* pStart, const uint32_t* pEndf);
@@
-762,9
+812,9
@@
struct Controller::Impl
Actor CreateBackgroundActor();
/**
Actor CreateBackgroundActor();
/**
- * @brief fill needed relayout parameters when
line size is changed & request relayou
t.
+ * @brief fill needed relayout parameters when
ever a property is changed and a re-layout is needed for the entire tex
t.
*/
*/
- void Relayout
ForNewLineSize
();
+ void Relayout
AllCharacters
();
/**
* @copydoc Controller::IsInputStyleChangedSignalsQueueEmpty
/**
* @copydoc Controller::IsInputStyleChangedSignalsQueueEmpty
@@
-827,6
+877,11
@@
struct Controller::Impl
void SetDefaultColor(const Vector4& color);
/**
void SetDefaultColor(const Vector4& color);
/**
+ * @copydoc Controller::SetUserInteractionEnabled()
+ */
+ void SetUserInteractionEnabled(bool enabled);
+
+ /**
* @brief Helper to clear font-specific data (only).
*/
void ClearFontData();
* @brief Helper to clear font-specific data (only).
*/
void ClearFontData();
@@
-908,6
+963,18
@@
private:
*/
void CopyUnderlinedFromLogicalToVisualModels(bool shouldClearPreUnderlineRuns);
*/
void CopyUnderlinedFromLogicalToVisualModels(bool shouldClearPreUnderlineRuns);
+ /**
+ * @brief Copy strikethrough-Character-Runs from Logical-Model to strikethrough-Glyph-Runs in Visual-Model
+ *
+ */
+ 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.
public:
ControlInterface* mControlInterface; ///< Reference to the text controller.
EditableControlInterface* mEditableControlInterface; ///< Reference to the editable text controller.
@@
-945,6
+1012,7
@@
public:
bool mShadowSetByString : 1; ///< Set when shadow is set by string (legacy) instead of map
bool mOutlineSetByString : 1; ///< Set when outline is set by string (legacy) instead of map
bool mFontStyleSetByString : 1; ///< Set when font style is set by string (legacy) instead of map
bool mShadowSetByString : 1; ///< Set when shadow is set by string (legacy) instead of map
bool mOutlineSetByString : 1; ///< Set when outline is set by string (legacy) instead of map
bool mFontStyleSetByString : 1; ///< Set when font style is set by string (legacy) instead of map
+ bool mStrikethroughSetByString : 1; ///< Set when strikethrough is set by string (legacy) instead of map
bool mShouldClearFocusOnEscape : 1; ///< Whether text control should clear key input focus
LayoutDirection::Type mLayoutDirection; ///< Current system language direction
bool mShouldClearFocusOnEscape : 1; ///< Whether text control should clear key input focus
LayoutDirection::Type mLayoutDirection; ///< Current system language direction
@@
-953,10
+1021,13
@@
public:
float mTextFitMinSize; ///< Minimum Font Size for text fit. Default 10
float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100
float mTextFitStepSize; ///< Step Size for font intervalse. Default 1
float mTextFitMinSize; ///< Minimum Font Size for text fit. Default 10
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 mTextFitChanged; ///< Whether the text fit property has changed.
float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
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 mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
+ bool mIsUserInteractionEnabled : 1; ///< Whether the user interaction is enabled.
private:
friend ControllerImplEventHandler;
private:
friend ControllerImplEventHandler;