Merge "(Vector) Support dynamic properties" into devel/master
authorHeeyong Song <heeyong.song@samsung.com>
Fri, 22 Jul 2022 01:00:29 +0000 (01:00 +0000)
committerGerrit Code Review <gerrit@review>
Fri, 22 Jul 2022 01:00:29 +0000 (01:00 +0000)
1  2 
dali-toolkit/devel-api/controls/control-devel.h
dali-toolkit/internal/controls/control/control-data-impl.cpp
dali-toolkit/internal/controls/control/control-data-impl.h

@@@ -2,7 -2,7 +2,7 @@@
  #define DALI_TOOLKIT_CONTROL_DEVEL_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.
@@@ -215,14 -215,6 +215,14 @@@ enu
     *
     */
    COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID,
 +
 +  /**
 +   * @brief Identifier that allows the automation framework to find and interact with this element.
 +   * @details Name "automationId", type Property::STRING.
 +   * @note This is a string identifier (compared to @c Actor::Property::ID which is an integer).
 +   * It will also appear in the AT-SPI tree under the key "automationId".
 +   */
 +  AUTOMATION_ID,
  };
  
  } // namespace Property
@@@ -368,6 -360,18 +368,18 @@@ DALI_TOOLKIT_API Dali::Animation Create
  DALI_TOOLKIT_API void DoAction(Control& control, Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes);
  
  /**
+  * @brief Perform an action on a visual registered to this control.
+  *
+  * Visuals will have actions, this API is used to perform one of these actions with the given attributes.
+  *
+  * @param[in] control The control.
+  * @param[in] visualIndex The Property index of the visual.
+  * @param[in] actionId The action to perform.  See Visual to find supported actions.
+  * @param[in] attributes Optional attributes for the action.
+  */
+ DALI_TOOLKIT_API void DoActionExtension(Control& control, Dali::Property::Index visualIndex, Dali::Property::Index actionId, Dali::Any attributes);
+ /**
   * @brief Set input method context.
   *
   * @param[in] control The control.
@@@ -485,7 -485,6 +485,7 @@@ const PropertyRegistration Control::Imp
  const PropertyRegistration Control::Impl::PROPERTY_23(typeRegistration, "accessibilityHidden",            Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN,             Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
  const PropertyRegistration Control::Impl::PROPERTY_24(typeRegistration, "clockwiseFocusableActorId",      Toolkit::DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID,     Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
  const PropertyRegistration Control::Impl::PROPERTY_25(typeRegistration, "counterClockwiseFocusableActorId", Toolkit::DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
 +const PropertyRegistration Control::Impl::PROPERTY_26(typeRegistration, "automationId",                   Toolkit::DevelControl::Property::AUTOMATION_ID,                    Property::STRING,  &Control::Impl::SetProperty, &Control::Impl::GetProperty);
  
  // clang-format on
  
@@@ -1096,6 -1095,15 +1096,15 @@@ void Control::Impl::DoAction(Dali::Prop
    }
  }
  
+ void Control::Impl::DoActionExtension(Dali::Property::Index visualIndex, Dali::Property::Index actionId, Dali::Any attributes)
+ {
+   RegisteredVisualContainer::Iterator iter;
+   if(FindVisual(visualIndex, mVisuals, iter))
+   {
+     Toolkit::GetImplementation((*iter)->visual).DoActionExtension(actionId, attributes);
+   }
+ }
  void Control::Impl::AppendAccessibilityAttribute(const std::string& key, const std::string value)
  {
    Property::Value* checkedValue = mAccessibilityAttributes.Find(key);
@@@ -1395,16 -1403,6 +1404,16 @@@ void Control::Impl::SetProperty(BaseObj
          }
          break;
        }
 +
 +      case Toolkit::DevelControl::Property::AUTOMATION_ID:
 +      {
 +        std::string automationId;
 +        if(value.Get(automationId))
 +        {
 +          controlImpl.mImpl->mAutomationId = automationId;
 +        }
 +        break;
 +      }
      }
    }
  }
@@@ -1577,12 -1575,6 +1586,12 @@@ Property::Value Control::Impl::GetPrope
          value = controlImpl.mImpl->mCounterClockwiseFocusableActorId;
          break;
        }
 +
 +      case Toolkit::DevelControl::Property::AUTOMATION_ID:
 +      {
 +        value = controlImpl.mImpl->mAutomationId;
 +        break;
 +      }
      }
    }
  
@@@ -224,6 -224,11 +224,11 @@@ public
    void DoAction(Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes);
  
    /**
+    * @copydoc Dali::Toolkit::DevelControl::DoActionExtension()
+    */
+   void DoActionExtension(Dali::Property::Index visualIndex, Dali::Property::Index actionId, Dali::Any attributes);
+   /**
     * @brief Function used to set control properties.
     * @param[in] object The object whose property to set
     * @param[in] index The index of the property to set
@@@ -537,7 -542,6 +542,7 @@@ public
    std::string mAccessibilityName;
    std::string mAccessibilityDescription;
    std::string mAccessibilityTranslationDomain;
 +  std::string mAutomationId;
  
    bool mAccessibilityHighlightable = false;
    bool mAccessibilityHidden        = false;
    static const PropertyRegistration PROPERTY_23;
    static const PropertyRegistration PROPERTY_24;
    static const PropertyRegistration PROPERTY_25;
 +  static const PropertyRegistration PROPERTY_26;
  
  private:
    // Accessibility - notification for highlighted object to check if it is showing.