Merge "Use RegisterUniqueProperty for some more renderers" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-effects-style.h
index fcc2381..d87e810 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -20,6 +20,8 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
+#include <dali/devel-api/scripting/scripting.h>
 
 namespace Dali
 {
@@ -27,6 +29,12 @@ namespace Toolkit
 {
 namespace Text
 {
+const Scripting::StringEnum UNDERLINE_TYPE_STRING_TABLE[] =
+  {
+    {"solid", Text::Underline::SOLID},
+    {"dashed", Text::Underline::DASHED},
+    {"double", Text::Underline::DOUBLE}};
+const unsigned int UNDERLINE_TYPE_STRING_TABLE_COUNT = sizeof(UNDERLINE_TYPE_STRING_TABLE) / sizeof(UNDERLINE_TYPE_STRING_TABLE[0]);
 namespace EffectStyle
 {
 enum Type
@@ -60,13 +68,22 @@ bool ParseShadowProperties(const Property::Map& shadowProperties,
  * @param[out] color The underline's color.
  * @param[out] heightDefined Whether the underline's height is defined.
  * @param[out] height The underline's height.
+ * @param[out] type The underline's type; DASHED, DOUBLE, etc. Default is a solid underline.
+ * @param[out] dashWidth The dashed underline's width.
+ * @param[out] dashGap The dashed underline's gap.
  */
-bool ParseUnderlineProperties(const Property::Map& underlineProperties,
-                              bool&                enabled,
-                              bool&                colorDefined,
-                              Vector4&             color,
-                              bool&                heightDefined,
-                              float&               height);
+bool ParseUnderlineProperties(const Property::Map&   underlineProperties,
+                              bool&                  enabled,
+                              bool&                  colorDefined,
+                              Vector4&               color,
+                              bool&                  heightDefined,
+                              float&                 height,
+                              bool&                  typeDefined,
+                              Text::Underline::Type& type,
+                              bool&                  widthDefined,
+                              float&                 dashWidth,
+                              bool&                  dashGapDefined,
+                              float&                 dashGap);
 
 /**
  * @brief Parses the outline properties.
@@ -97,6 +114,23 @@ bool ParseBackgroundProperties(const Property::Map& backgroundProperties,
                                Vector4&             color);
 
 /**
+ * @brief Parses the strikethrough properties.
+ *
+ * @param[in] strikethroughProperties The map with the strikethrough properties.
+ * @param[out] enabled Whether the strikethrough is enabled.
+ * @param[out] colorDefined Whether the strikethrough's color is defined.
+ * @param[out] color The strikethrough's color.
+ * @param[out] heightDefined Whether the strikethrough's height is defined.
+ * @param[out] height The strikethrough's height.
+ */
+bool ParseStrikethroughProperties(const Property::Map& strikethroughProperties,
+                                  bool&                enabled,
+                                  bool&                colorDefined,
+                                  Vector4&             color,
+                                  bool&                heightDefined,
+                                  float&               height);
+
+/**
  * @brief Sets the underline properties.
  *
  * @param[in] controller The text's controller.
@@ -108,6 +142,17 @@ bool ParseBackgroundProperties(const Property::Map& backgroundProperties,
 bool SetUnderlineProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
 
 /**
+ * @brief Sets the strikethrough properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[in] value The values of the strikethrough's properties.
+ * @param[in] type Whether the property is for the default strikethrough or the input strikethrough.
+ *
+ * @return Whether the strikethrough properties have been updated.
+ */
+bool SetStrikethroughProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
+
+/**
  * @brief Retrieves the underline's properties.
  *
  * @param[in] controller The text's controller.
@@ -117,6 +162,15 @@ bool SetUnderlineProperties(ControllerPtr controller, const Property::Value& val
 void GetUnderlineProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
 
 /**
+ * @brief Retrieves the strikethrough's properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[out] value The value of the strikethrough's properties.
+ * @param[in] type Whether the property is for the default strikethrough or the input strikethrough.
+ */
+void GetStrikethroughProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
+
+/**
  * @brief Sets the shadow properties.
  *
  * @param[in] controller The text's controller.
@@ -196,6 +250,15 @@ bool SetBackgroundProperties(ControllerPtr controller, const Property::Value& va
  */
 void GetBackgroundProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
 
+/**
+ * @brief Converts a underline type string into @e Underline::Type
+ *
+ * @param[in] underlineTypeStr The underline type string. Must end with '\0'.
+ *
+ * @return The @e Underline::Type value corresponding to the string.
+ */
+Underline::Type StringToUnderlineType(const char* const underlineTypeStr);
+
 } // namespace Text
 
 } // namespace Toolkit