const bool isVerticalScrollEnabled = mEventData->mDecorator->IsVerticalScrollEnabled();
if(isHorizontalScrollEnabled || isVerticalScrollEnabled)
{
- const Vector2& targetSize = mModel->mVisualModel->mControlSize;
- const Vector2& layoutSize = mModel->mVisualModel->GetLayoutSize();
+ const Vector2& targetSize = mModel->mVisualModel->mControlSize;
+ const Vector2& layoutSize = mModel->mVisualModel->GetLayoutSize();
if(isHorizontalScrollEnabled)
{
return it == mModel->mLogicalModel->mAnchors.End() ? -1 : it - mModel->mLogicalModel->mAnchors.Begin();
}
+bool Controller::Impl::ShouldClearFocusOnEscape() const
+{
+ if(DALI_UNLIKELY(mShouldClearFocusOnEscape == ClearFocusOnEscapeState::UNKNOWN))
+ {
+ mShouldClearFocusOnEscape = ClearFocusOnEscapeState::ENABLE;
+
+ Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
+ if(styleManager)
+ {
+ const auto clearFocusOnEscapeValue = Toolkit::DevelStyleManager::GetConfigurations(styleManager).Find("clearFocusOnEscape", Property::Type::BOOLEAN);
+
+ // Default is ENABLE. If config don't have "clearFocusOnEscape" property, make it ENABLE.
+ mShouldClearFocusOnEscape = (!clearFocusOnEscapeValue || clearFocusOnEscapeValue->Get<bool>()) ? ClearFocusOnEscapeState::ENABLE : ClearFocusOnEscapeState::DISABLE;
+ }
+ }
+ DALI_ASSERT_DEBUG(mShouldClearFocusOnEscape != ClearFocusOnEscapeState::UNKNOWN && "mShouldClearFocusOnEscape Should be set now");
+
+ return (mShouldClearFocusOnEscape == ClearFocusOnEscapeState::ENABLE);
+}
+
void Controller::Impl::CopyUnderlinedFromLogicalToVisualModels(bool shouldClearPreUnderlineRuns)
{
//Underlined character runs for markup-processor
struct Controller::Impl
{
+public:
+ enum class ClearFocusOnEscapeState
+ {
+ UNKNOWN = -1, ///< Unknown state
+ ENABLE = 0,
+ DISABLE = 1,
+ };
+
+public:
Impl(ControlInterface* controlInterface,
EditableControlInterface* editableControlInterface,
SelectableControlInterface* selectableControlInterface,
mOutlineSetByString(false),
mFontStyleSetByString(false),
mStrikethroughSetByString(false),
- mShouldClearFocusOnEscape(true),
+ mShouldClearFocusOnEscape(ClearFocusOnEscapeState::UNKNOWN),
mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT),
mCurrentLineSize(0.f),
mTextFitMinSize(DEFAULT_TEXTFIT_MIN),
// Set the text properties to default
mModel->mVisualModel->SetUnderlineEnabled(false);
mModel->mVisualModel->SetUnderlineHeight(0.0f);
-
- Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
- if(styleManager)
- {
- const auto clearFocusOnEscapeValue = Toolkit::DevelStyleManager::GetConfigurations(styleManager).Find("clearFocusOnEscape", Property::Type::BOOLEAN);
-
- // Default is true. If config don't have "clearFocusOnEscape" property, make it true.
- mShouldClearFocusOnEscape = (!clearFocusOnEscapeValue || clearFocusOnEscapeValue->Get<bool>());
- }
}
~Impl()
*/
Toolkit::TextAnchor CreateAnchorActor(Anchor anchor);
+ /**
+ * @brief Return true when text control should clear key input focus when escape key is pressed.
+ *
+ * @note We ask to style manager configurations, and store the option.
+ * @note Default is true. Mean, without any options, text control should clear key input focus when escape key is pressed.
+ *
+ * @return Whether text control should clear key input focus or not when escape key is pressed.
+ */
+ bool ShouldClearFocusOnEscape() const;
+
public:
/**
* @brief Gets implementation from the controller handle.
std::vector<Toolkit::DevelTextLabel::FitOption> mTextFitArray; ///< List of FitOption for TextFitArray operation.
- 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
- 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 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
+ 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
+
+ mutable ClearFocusOnEscapeState mShouldClearFocusOnEscape : 3; ///< Whether text control should clear key input focus.
+ ///< Make it mutable so we can update it at const method.
+
+ LayoutDirection::Type mLayoutDirection; ///< Current system language direction
Shader mShaderBackground; ///< The shader for text background.