#define DALI_TOOLKIT_TEXT_CONTROLLER_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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-toolkit/devel-api/text/spanned.h>
#include <dali/devel-api/adaptor-framework/input-method-context.h>
#include <dali/public-api/events/gesture.h>
void GetText(std::string& text) const;
/**
+ * @brief Set the @p spannedText
+ * the spanned text contains content (text) and format (spans with ranges)
+ * the text is copied into text-controller and the spans are applied on ranges
+ *
+ * @param[in] spannedText the text with spans.
+ */
+ void SetSpannedText(const Text::Spanned& spannedText);
+
+ /**
* @brief Replaces any placeholder text previously set.
*
* @param[in] type Different placeholder-text can be shown when the control is active/inactive.
*
* @return The default font family.
*/
- const std::string& GetDefaultFontFamily() const;
+ std::string GetDefaultFontFamily() const;
/**
* @brief Sets the placeholder text font family.
*
* @return The placeholder text font family
*/
- const std::string& GetPlaceholderFontFamily() const;
+ std::string GetPlaceholderFontFamily() const;
/**
* @brief Sets the default font weight.
*
* @return The emboss's properties string.
*/
- const std::string& GetDefaultEmbossProperties() const;
+ std::string GetDefaultEmbossProperties() const;
/**
* @brief Sets the outline's properties string.
*
* @return The outline's properties string.
*/
- const std::string& GetDefaultOutlineProperties() const;
+ std::string GetDefaultOutlineProperties() const;
/**
* @brief Sets the default line spacing.
*
* @return The input text's font family name.
*/
- const std::string& GetInputFontFamily() const;
+ std::string GetInputFontFamily() const;
/**
* @brief Sets the input font's weight.
*
* @return The shadow's properties string.
*/
- const std::string& GetInputShadowProperties() const;
+ std::string GetInputShadowProperties() const;
/**
* @brief Sets the input underline's properties string.
*
* @return The underline's properties string.
*/
- const std::string& GetInputUnderlineProperties() const;
+ std::string GetInputUnderlineProperties() const;
/**
* @brief Sets the input emboss's properties string.
*
* @return The emboss's properties string.
*/
- const std::string& GetInputEmbossProperties() const;
+ std::string GetInputEmbossProperties() const;
/**
* @brief Sets input the outline's properties string.
*
* @return The outline's properties string.
*/
- const std::string& GetInputOutlineProperties() const;
+ std::string GetInputOutlineProperties() const;
/**
* @brief Sets the input strikethrough's properties string.
*
* @return The strikethrough's properties string.
*/
- const std::string& GetInputStrikethroughProperties() const;
+ std::string GetInputStrikethroughProperties() const;
/**
* @brief Set the control's interface.
*
* @return A pointer to the text's model.
*/
- const ModelInterface* const GetTextModel() const;
+ const ModelInterface* GetTextModel() const;
/**
* @brief Used to get scrolled distance by user input
Rect<float> GetCharacterBoundingRectangle(const uint32_t charIndex);
/**
+ * @brief Get the character index.
+ * If the text is not yet rendered or the text is empty, -1 is returned.
+ *
+ * @param[in] visualX visual x position.
+ * @param[in] visualY visual y position.
+ * @return character index.
+ */
+ int GetCharacterIndexAtPosition(float visualX, float visualY);
+
+ /**
* @brief Gets the bounding box of a specific text range.
*
* @param[in] startIndex start index of the text requested to get bounding box to.
struct PlaceholderHandler;
struct Relayouter;
struct TextUpdater;
+ struct SpannableHandler;
- Impl* mImpl;
+ std::unique_ptr<Impl> mImpl{nullptr};
};
} // namespace Dali::Toolkit::Text