[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / visual-base-impl.h
index c958992..7ebf239 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_VISUAL_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.
@@ -92,12 +92,20 @@ public:
   void SetTransformAndSize(const Property::Map& transform, Size controlSize);
 
   /**
-   * @brief Performs an action on the visual with the given action name and attributes.
+   * @brief Performs an action on the visual with the given action id and attributes.
    *
-   * @param[in] actionName The name of the action to perform this API only takes an Index
+   * @param[in] actionId The id of the action to perform this API only takes an Index
    * @param[in] attributes The list of attributes for the action. ( optional for this data structure to have content )
    */
-  void DoAction(const Dali::Property::Index actionName, const Dali::Property::Value attributes);
+  void DoAction(const Dali::Property::Index actionId, const Dali::Property::Value attributes);
+
+  /**
+   * @brief Performs an action on the visual with the given action id and attributes.
+   *
+   * @param[in] actionId The id of the action to perform this API only takes an Index
+   * @param[in] attributes The list of attributes for the action. ( optional for this data structure to have content )
+   */
+  void DoActionExtension(const Dali::Property::Index actionId, const Dali::Any attributes);
 
   /**
    * @copydoc Toolkit::Visual::Base::GetHeightForWidth
@@ -155,7 +163,7 @@ public:
    *
    * @param[in] preMultiplied whether alpha is pre-multiplied.
    */
-  void EnablePreMultipliedAlpha(bool preMultiplied);
+  virtual void EnablePreMultipliedAlpha(bool preMultiplied);
 
   /**
    * @brief Query whether alpha is pre-multiplied.
@@ -186,6 +194,13 @@ public:
   Renderer GetRenderer();
 
   /**
+   * Convert all string keys to int keys
+   * @param[in] key The key to convert
+   * @return the index key supplied or matching, or INVALID_INDEX if no match
+   */
+  static Property::Index GetIntKey(Property::Key key);
+
+  /**
    * Sets the mix color ( including opacity )  of the visual.
    * @param[in] mixColor The new mix color
    */
@@ -232,8 +247,8 @@ public:
   void ResourceReady(Toolkit::Visual::ResourceStatus resourceStatus);
 
   /**
-   * @brief Called when the visuals resources are loaded / ready
-   * @return true if ready, false otherwise
+   * @brief Called when the visuals resources are loaded / ready or failed (mean, broken image ready)
+   * @return true if ready or failed (mean, broken image ready), false otherwise
    */
   virtual bool IsResourceReady() const;
 
@@ -356,6 +371,14 @@ protected:
   virtual void OnDoAction(const Property::Index actionId, const Property::Value& attributes);
 
   /**
+   * @brief Called by DoActionExtension() allowing sub classes to do the given action.
+   *
+   * @param[in] actionId The action to perform
+   * @param[in] attributes The list of attributes for the action. ( optional for this data structure to have content )
+   */
+  virtual void OnDoActionExtension(const Property::Index actionId, Dali::Any attributes);
+
+  /**
    * @brief Update the shader when some properties are changed.
    */
   virtual void UpdateShader()
@@ -363,6 +386,16 @@ protected:
   }
 
   /**
+   * @brief Generate a shader by the current properties from each sub classes's own shader-generate logic.
+   * @param[in] factoryCache The visual factory cache to store the generated shader.
+   * @return If the function defined, Generated shader by the current properties. Else, empty shader.
+   */
+  virtual Dali::Shader GenerateShader() const
+  {
+    return Dali::Shader();
+  }
+
+  /**
    * @brief Called by GetPropertyObject() allowing sub classes to respond to the GetPropertyObject event
    * @note The derived class is required to register the given property.
    * @param[in] key The key of the visual's property.
@@ -389,6 +422,13 @@ protected:
    */
   bool IsRoundedCornerRequired() const;
 
+  /**
+   * @brief Query whether the borderline of the visual requires to be rendered.
+   *
+   * @return Returns true if the outline is required, false otherwise.
+   */
+  bool IsBorderlineRequired() const;
+
 private:
   /**
    * Register the mix color uniform on the Renderer and store the property index.
@@ -398,6 +438,11 @@ private:
   void RegisterMixColor();
 
   /**
+   * Register the uniform on the DecoratedVisualRenderer and store the property index if necessary.
+   */
+  void RegisterDecoration();
+
+  /**
    * Find the matching property on the renderer or shader. If it's a shader
    * property, register it on the renderer in order to animate it for this
    * visual independently.