Merge "(Vector) Support dynamic properties" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / control / control-data-impl.h
index c31ed81..46cc97b 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_CONTROL_DATA_IMPL_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.
@@ -35,7 +35,9 @@
 #include <dali-toolkit/public-api/visuals/visual-properties.h>
 #include <dali/devel-api/common/owner-container.h>
 #include <dali/integration-api/debug.h>
+#include <map>
 #include <memory>
+#include <set>
 
 namespace Dali
 {
@@ -69,7 +71,7 @@ typedef Dali::OwnerContainer<RegisteredVisual*> RegisteredVisualContainer;
  */
 class Control::Impl : public ConnectionTracker, public Visual::EventObserver
 {
-  friend class Toolkit::DevelControl::AccessibleImpl;
+  friend class Toolkit::DevelControl::ControlAccessible;
 
 public:
   /**
@@ -139,6 +141,12 @@ public:
   void NotifyVisualEvent(Visual::Base& object, Property::Index signalId) override;
 
   /**
+   * @brief Called when the visual needs relayout request.
+   * @param[in] object The visual who requests relayout
+   */
+  void RelayoutRequest(Visual::Base& object) override;
+
+  /**
    * @copydoc Dali::Toolkit::DevelControl::RegisterVisual()
    */
   void RegisterVisual(Property::Index index, Toolkit::Visual::Base& visual);
@@ -216,6 +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
@@ -393,32 +406,38 @@ public:
   Dali::Property GetVisualProperty(Dali::Property::Index index, Dali::Property::Key visualPropertyKey);
 
   /**
-   * @brief Make visual transition from source control to this control about specific Property::Index
-   * If both of source and this control have Property::Index property, than create animation between them.
+   * @brief Retrieves source and destination visual properties for the Transition of this Control.
+   * The properties of this Control will be transitioned from the propeties of source Control to that of destination control.
+   * If a property value is different between source and destination Control,
+   * the property information of each Control will be included in sourceProperties and destinationProperties.
+   *
+   * @param[out] sourceProperties Source property list to be applied on this Control.
+   * @param[out] destinationProperties Destination property list to be applied on this Control.
+   * @param[in] source Source control of the animation.
+   * @param[in] destination Destination control of the animation.
    *
-   * @param[in] animation Return animation from source to this control.
-   * @param[in] source Source control to be used property animation.
-   * @param[in] visualIndex Property::Index to make animation.
-   * @param[in] alphaFunction alpha function of the animation.
-   * @param[in] timePeriod time period of the animation.
+   * @note This method do not handle Actor properties.
+   * And the size and order of the sourceProperties and destinationProperties must be synchronized.
+   *
+   * This method triggers Control::OnCreateTransition().
    */
-  void MakeVisualTransition(Dali::Animation& animation, Dali::Toolkit::Control source, Dali::Property::Index visualIndex, AlphaFunction alphaFunction, TimePeriod timePeriod);
+  void CreateTransitions(std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& sourceProperties,
+                         std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& destinationProperties,
+                         Dali::Toolkit::Control                                              source,
+                         Dali::Toolkit::Control                                              destination);
 
   /**
-   * @brief Gets the current control's accessible object.
+   * @brief Update visual properties.
+   * @param[in] properties Property list to be used to update visual properties of this Control.
    *
-   * @return The handle to Accessible object
+   * @note This method triggers Control::OnUpdateVisualProperties().
    */
-  Dali::Accessibility::Accessible* GetAccessibilityObject();
+  void UpdateVisualProperties(const std::vector<std::pair<Dali::Property::Index, Dali::Property::Map>>& properties);
 
   /**
-   * @brief Gets Accessible object handle.
-   *
-   * The method acquires Accessible handle from Actor object
-   * @param  actor Actor object
-   * @return The handle to Accessible object
+   * @copydoc Dali::Toolkit::Internal::Control::GetAccessibleObject()
    */
-  static Dali::Accessibility::Accessible* GetAccessibilityObject(Dali::Actor actor);
+  Toolkit::DevelControl::ControlAccessible* GetAccessibleObject();
 
 private:
   /**
@@ -470,9 +489,8 @@ private:
 
   /**
    * @brief Checks highlighted object geometry if it is showing or not
-   * @param[in] propertyNotification PropertyNotification
    */
-  void CheckHighlightedObjectGeometry(Dali::PropertyNotification& propertyNotification);
+  void CheckHighlightedObjectGeometry();
 
   /**
    * @brief Register property notification to check highlighted object position
@@ -490,10 +508,12 @@ public:
   std::string         mSubStateName;
   Property::Map       mAccessibilityAttributes;
 
-  int mLeftFocusableActorId;  ///< Actor ID of Left focusable control.
-  int mRightFocusableActorId; ///< Actor ID of Right focusable control.
-  int mUpFocusableActorId;    ///< Actor ID of Up focusable control.
-  int mDownFocusableActorId;  ///< Actor ID of Down focusable control.
+  int mLeftFocusableActorId;             ///< Actor ID of Left focusable control.
+  int mRightFocusableActorId;            ///< Actor ID of Right focusable control.
+  int mUpFocusableActorId;               ///< Actor ID of Up focusable control.
+  int mDownFocusableActorId;             ///< Actor ID of Down focusable control.
+  int mClockwiseFocusableActorId;        ///< Actor ID of Clockwise focusable control.
+  int mCounterClockwiseFocusableActorId; ///< Actor ID of Counter clockwise focusable control.
 
   RegisteredVisualContainer                 mVisuals; ///< Stores visuals needed by the control, non trivial type so std::vector used.
   std::string                               mStyleName;
@@ -522,18 +542,15 @@ public:
   std::string mAccessibilityName;
   std::string mAccessibilityDescription;
   std::string mAccessibilityTranslationDomain;
-  bool        mAccessibilityNameSet              = false;
-  bool        mAccessibilityDescriptionSet       = false;
-  bool        mAccessibilityTranslationDomainSet = false;
+  std::string mAutomationId;
 
-  bool mAccessibilityHighlightable    = false;
-  bool mAccessibilityHighlightableSet = false;
+  bool mAccessibilityHighlightable = false;
+  bool mAccessibilityHidden        = false;
 
   Dali::Accessibility::Role mAccessibilityRole = Dali::Accessibility::Role::UNKNOWN;
 
-  std::vector<std::vector<Accessibility::Address>>                       mAccessibilityRelations;
-  std::function<std::unique_ptr<Dali::Accessibility::Accessible>(Actor)> mAccessibilityConstructor;
-  std::unique_ptr<Dali::Accessibility::Accessible>                       mAccessibilityObject;
+  std::map<Dali::Accessibility::RelationType, std::set<Accessibility::Accessible*>> mAccessibilityRelations;
+  std::unique_ptr<Toolkit::DevelControl::ControlAccessible>                         mAccessibleObject;
 
   // Gesture Detection
   PinchGestureDetector     mPinchGestureDetector;
@@ -552,6 +569,7 @@ public:
   bool             mIsKeyboardFocusGroup : 1;             ///< Stores whether the control is a focus group.
   bool             mIsEmittingResourceReadySignal : 1;    ///< True during ResourceReady().
   bool             mNeedToEmitResourceReady : 1;          ///< True if need to emit the resource ready signal again.
+  bool             mDispatchKeyEvents : 1;                ///< Whether the actor emits key event signals
 
   RegisteredVisualContainer mRemoveVisuals; ///< List of visuals that are being replaced by another visual once ready
 
@@ -578,12 +596,16 @@ public:
   static const PropertyRegistration PROPERTY_20;
   static const PropertyRegistration PROPERTY_21;
   static const PropertyRegistration PROPERTY_22;
+  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.
-  bool                                      mIsAccessibilityPositionPropertyNotificationSet{false};
-  Dali::PropertyNotification                mAccessibilityPositionNotification;
-  Dali::Accessibility::MovedOutOfScreenType mAccessibilityMovedOutOfScreenDirection{Accessibility::MovedOutOfScreenType::NONE};
+  bool                                        mIsAccessibilityPositionPropertyNotificationSet{false};
+  Dali::PropertyNotification                  mAccessibilityPositionNotification;
+  Dali::Accessibility::ScreenRelativeMoveType mAccessibilityLastScreenRelativeMoveType{Accessibility::ScreenRelativeMoveType::OUTSIDE};
 };
 
 } // namespace Internal