#define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
*/
// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/clipboard.h>
#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali/public-api/rendering/shader.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
-#include <dali-toolkit/internal/text/input-style.h>
#include <dali-toolkit/internal/text/controller/text-controller.h>
+#include <dali-toolkit/internal/text/input-style.h>
+#include <dali-toolkit/internal/text/multi-language-support.h>
#include <dali-toolkit/internal/text/text-model.h>
#include <dali-toolkit/internal/text/text-view.h>
#include <dali-toolkit/public-api/styling/style-manager.h>
mEmbossDefaults(NULL),
mOutlineDefaults(NULL),
mEventData(NULL),
+ mIdleCallback(NULL),
mFontClient(),
mClipboard(),
mView(),
mMetrics(),
mModifyEvents(),
mTextColor(Color::BLACK),
+ mAnchorColor(Color::MEDIUM_BLUE),
+ mAnchorClickedColor(Color::DARK_MAGENTA),
mTextUpdateInfo(),
mOperationsPending(NO_OPERATION),
mMaximumNumberOfCharacters(50u),
mHiddenInput(NULL),
mInputFilter(nullptr),
+ mTextFitContentSize(),
+ mRawText(),
+ mTextFitArray(),
mRecalculateNaturalSize(true),
mMarkupProcessorEnabled(false),
mClipboardHideEnabled(true),
mStrikethroughSetByString(false),
mShouldClearFocusOnEscape(true),
mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT),
+ mCurrentLineSize(0.f),
mTextFitMinSize(DEFAULT_TEXTFIT_MIN),
mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
+ mTextFitLineSize(0.f),
mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
mDisabledColorOpacity(DEFAULT_DISABLED_COLOR_OPACITY),
mFontSizeScaleEnabled(true),
mTextFitEnabled(false),
mTextFitChanged(false),
+ mTextFitArrayEnabled(false),
mIsLayoutDirectionChanged(false),
- mIsUserInteractionEnabled(true)
+ mIsUserInteractionEnabled(true),
+ mProcessorRegistered(false),
+ mTextCutout(false),
+ mRenderMode(DevelTextLabel::Render::SYNC)
{
mModel = Model::New();
{
mClipboard = Clipboard::Get();
}
-
+ mView.SetFontClient(mFontClient);
mView.SetVisualModel(mModel->mVisualModel);
mView.SetLogicalModel(mModel->mLogicalModel);
Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
if(styleManager)
{
- const Property::Map& config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
- const auto clearFocusOnEscapeValue = config.Find("clearFocusOnEscape", Property::Type::BOOLEAN);
+ 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>());
}
/**
+ * @copydoc Text::Controller::ResetFontAndStyleData()
+ */
+ void ResetFontAndStyleData()
+ {
+ ClearFontData();
+ ClearStyleData();
+ RequestRelayout();
+ }
+
+ /**
* @brief Helper to move the cursor, grab handle etc.
*/
bool ProcessInputEvents();
}
/**
+ * @copydoc Controller::SetAnchorColor()
+ */
+ void SetAnchorColor(const Vector4& color);
+
+ /**
+ * @copydoc Controller::GetAnchorColor()
+ */
+ const Vector4& GetAnchorColor() const;
+
+ /**
+ * @copydoc Controller::SetAnchorClickedColor()
+ */
+ void SetAnchorClickedColor(const Vector4& color);
+
+ /**
+ * @copydoc Controller::GetAnchorClickedColor()
+ */
+ const Vector4& GetAnchorClickedColor() const;
+
+ /**
+ * @brief Updates the color of anchors.
+ */
+ void UpdateAnchorColor();
+
+ /**
* @brief Helper to notify InputMethodContext with surrounding text & cursor changes.
*/
void NotifyInputMethodContext();
*/
void GetText(CharacterIndex index, std::string& text) const;
+ /**
+ * @brief Retrieves number of characters previously set.
+ *
+ * @return A length of UTF-32 characters.
+ *
+ * @see Dali::Toolkit::Text::Controller::GetNumberOfCharacters()
+ */
+ Length GetNumberOfCharacters() const;
+
bool EnsureClipboardCreated()
{
if(!mClipboard)
return mClipboard != nullptr ? true : false;
}
- bool IsClipboardEmpty()
- {
- bool result(Clipboard::IsAvailable() && EnsureClipboardCreated() && mClipboard.NumberOfItems());
- return !result; // If NumberOfItems greater than 0, return false
- }
-
bool IsClipboardVisible()
{
bool result(Clipboard::IsAvailable() && EnsureClipboardCreated() && mClipboard.IsVisible());
}
/**
+ * @brief Whether the clipboard is empty or not.
+ * Checks the types that the text controller can paste and returns the result.
+ *
+ * @return Return whether or not the clipboard is empty.
+ */
+ bool IsClipboardEmpty();
+
+ /**
* @copydoc Controller::GetLayoutDirection()
*/
Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
void SendSelectionToClipboard(bool deleteAfterSending);
- void RequestGetTextFromClipboard();
-
void RepositionSelectionHandles();
void RepositionSelectionHandles(float visualX, float visualY, Controller::NoTextTap::Action action);
EmbossDefaults* mEmbossDefaults; ///< Avoid allocating this when the user does not specify emboss parameters.
OutlineDefaults* mOutlineDefaults; ///< Avoid allocating this when the user does not specify outline parameters.
EventData* mEventData; ///< Avoid allocating everything for text input until EnableTextInput().
+ CallbackBase* mIdleCallback; ///< Callback what would be called at idler
TextAbstraction::FontClient mFontClient; ///< Handle to the font client.
Clipboard mClipboard; ///< Handle to the system clipboard
View mView; ///< The view interface to the rendering back-end.
Layout::Engine mLayoutEngine; ///< The layout engine.
Vector<ModifyEvent> mModifyEvents; ///< Temporary stores the text set until the next relayout.
Vector4 mTextColor; ///< The regular text color
+ Vector4 mAnchorColor; ///< The anchor color
+ Vector4 mAnchorClickedColor; ///< The anchor clicked color
TextUpdateInfo mTextUpdateInfo; ///< Info of the characters updated.
OperationsMask mOperationsPending; ///< Operations pending to be done to layout the text.
Length mMaximumNumberOfCharacters; ///< Maximum number of characters that can be inserted.
HiddenText* mHiddenInput; ///< Avoid allocating this when the user does not specify hidden input mode.
std::unique_ptr<InputFilter> mInputFilter; ///< Avoid allocating this when the user does not specify input filter mode.
Vector2 mTextFitContentSize; ///< Size of Text fit content
+ std::string mRawText; ///< Raw text including markup tag.
+
+ 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.
Shader mShaderBackground; ///< The shader for text background.
+ float mCurrentLineSize; ///< Used to store the MinLineSize set by user when TextFitArray is enabled.
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 mTextFitLineSize; ///< This is the LineSize that is the standard when performing TextFit.
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 mTextFitArrayEnabled : 1; ///< Whether the text's fit array is enabled.
bool mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
bool mIsUserInteractionEnabled : 1; ///< Whether the user interaction is enabled.
+ bool mProcessorRegistered : 1; ///< Whether the text controller registered into processor or not.
+ bool mTextCutout : 1; ///< Whether the text cutout enabled.
+
+ DevelTextLabel::Render::Mode mRenderMode; ///< Render mode of the text. (SYNC, ASYNC_AUTO, ASYNC_MANUAL)
private:
friend ControllerImplEventHandler;