Merge "Add callbacks for form repost decision and frame rendering." into devel/master
authorJIYUN YANG <ji.yang@samsung.com>
Mon, 29 Mar 2021 07:14:51 +0000 (07:14 +0000)
committerGerrit Code Review <gerrit@review>
Mon, 29 Mar 2021 07:14:51 +0000 (07:14 +0000)
automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp
dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h

index 04bbf79..11b9f46 100644 (file)
@@ -260,15 +260,18 @@ int UtcDaliToolkitTextSelectionPopupSizeProperties(void)
   const Vector2 optionMaxSize(50.0f, 100.0f);
   const Vector2 optionMinSize(10.0f, 10.0f);
   const Vector2 optionDividerSize(5.0f, 5.0f);
+  const Vector4 optionDividerPadding(20.0f, 20.0f, 10.0f, 10.0f);
   popup.SetProperty(TextSelectionPopup::Property::POPUP_MAX_SIZE, popupMaxSize);
   popup.SetProperty(TextSelectionPopup::Property::OPTION_MAX_SIZE, optionMaxSize);
   popup.SetProperty(TextSelectionPopup::Property::OPTION_MIN_SIZE, optionMinSize);
   popup.SetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE, optionDividerSize);
+  popup.SetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING, optionDividerPadding);
 
   DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_MAX_SIZE).Get<Vector2>(), popupMaxSize, TEST_LOCATION);
   DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_MAX_SIZE).Get<Vector2>(), optionMaxSize, TEST_LOCATION);
   DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_MIN_SIZE).Get<Vector2>(), optionMinSize, TEST_LOCATION);
   DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE).Get<Vector2>(), optionDividerSize, TEST_LOCATION);
+  DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING).Get<Vector4>(), optionDividerPadding, TEST_LOCATION);
 
   END_TEST;
 }
index 551066f..4080c90 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_SELECTION_POPUP_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
@@ -103,6 +103,12 @@ public:
       OPTION_DIVIDER_SIZE,
 
       /**
+       * @brief The padding of the divider between options.
+       * @details Name "optionDividerPadding", type Vector4.
+       */
+      OPTION_DIVIDER_PADDING,
+
+      /**
        * @brief The image to use as the popup clipboard icon.
        * @details Name "popupClipboardButtonImage", type string.
        */
index bccfe84..4b7ea13 100644 (file)
@@ -107,6 +107,7 @@ DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupMinSize", VECTOR2,
 DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "optionMaxSize", VECTOR2, OPTION_MAX_SIZE)
 DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "optionMinSize", VECTOR2, OPTION_MIN_SIZE)
 DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "optionDividerSize", VECTOR2, OPTION_DIVIDER_SIZE)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "optionDividerPadding", VECTOR4, OPTION_DIVIDER_PADDING)
 DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupClipboardButtonImage", STRING, POPUP_CLIPBOARD_BUTTON_ICON_IMAGE)
 DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupCutButtonImage", STRING, POPUP_CUT_BUTTON_ICON_IMAGE)
 DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupCopyButtonImage", STRING, POPUP_COPY_BUTTON_ICON_IMAGE)
@@ -172,6 +173,12 @@ void TextSelectionPopup::SetProperty(BaseObject* object, Property::Index index,
         impl.SetDimensionToCustomise(OPTION_DIVIDER_SIZE, value.Get<Vector2>());
         break;
       }
+      case Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_PADDING:
+      {
+        Vector4 padding(value.Get<Vector4>());
+        impl.SetOptionDividerPadding(Padding(padding.x, padding.y, padding.z, padding.w));
+        break;
+      }
       case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE:
       {
         impl.SetButtonImage(Toolkit::TextSelectionPopup::CLIPBOARD, value.Get<std::string>());
@@ -274,6 +281,12 @@ Property::Value TextSelectionPopup::GetProperty(BaseObject* object, Property::In
         value = impl.GetDimensionToCustomise(OPTION_DIVIDER_SIZE);
         break;
       }
+      case Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_PADDING:
+      {
+        Padding padding = impl.GetOptionDividerPadding();
+        value           = Vector4(padding.x, padding.y, padding.top, padding.bottom);
+        break;
+      }
       case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE:
       {
         value = impl.GetButtonImage(Toolkit::TextSelectionPopup::CLIPBOARD);
@@ -628,6 +641,17 @@ std::string TextSelectionPopup::GetPressedImage() const
   return mPressedImage;
 }
 
+void TextSelectionPopup::SetOptionDividerPadding(const Padding& padding)
+{
+  DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextSelectionPopup::SetOptionDividerPadding padding(%f,%f,%f,%f)\n", padding.left, padding.right, padding.bottom, padding.top);
+  mOptionDividerPadding = Padding(padding.left, padding.right, padding.bottom, padding.top);
+}
+
+Padding TextSelectionPopup::GetOptionDividerPadding() const
+{
+  return mOptionDividerPadding;
+}
+
 void TextSelectionPopup::CreateOrderedListOfPopupOptions()
 {
   mOrderListOfButtons.clear();
@@ -734,7 +758,8 @@ void TextSelectionPopup::AddOption(const ButtonRequirement& button, bool showDiv
   // 6. Add the divider
   if(showDivider)
   {
-    const Size size(mOptionDividerSize.width, 0.0f); // Height FILL_TO_PARENT
+    const Size    size(mOptionDividerSize.width, 0.0f); // Height FILL_TO_PARENT
+    const Padding padding(mOptionDividerPadding);
 
     Toolkit::Control divider = Toolkit::Control::New();
 #ifdef DECORATOR_DEBUG
@@ -742,6 +767,7 @@ void TextSelectionPopup::AddOption(const ButtonRequirement& button, bool showDiv
 #endif
     divider.SetProperty(Actor::Property::SIZE, size);
     divider.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT);
+    divider.SetProperty(Actor::Property::PADDING, padding);
     divider.SetBackgroundColor(mDividerColor);
     mToolbar.AddDivider(divider);
   }
@@ -843,6 +869,7 @@ TextSelectionPopup::TextSelectionPopup(TextSelectionPopupCallbackInterface* call
   mOptionMaxSize(),
   mOptionMinSize(),
   mOptionDividerSize(),
+  mOptionDividerPadding(),
   mEnabledButtons(Toolkit::TextSelectionPopup::NONE),
   mCallbackInterface(callbackInterface),
   mPressedColor(DEFAULT_OPTION_PRESSED_COLOR),
index 82947a1..64130e1 100644 (file)
@@ -229,6 +229,18 @@ private: // Implementation
    */
   std::string GetPressedImage() const;
 
+  /**
+   * Set option divider padding
+   * @param[in] padding BEGIN END BOTTOM TOP
+   */
+  void SetOptionDividerPadding(const Padding& padding);
+
+  /**
+   * Get option divider padding
+   * @return Padding
+   */
+  Padding GetOptionDividerPadding() const;
+
   void CreateOrderedListOfPopupOptions();
 
   void AddOption(const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption);
@@ -272,10 +284,11 @@ private: // Data
   std::string mSelectIconImage;
   std::string mSelectAllIconImage;
 
-  Size mPopupMaxSize;      // Maximum size of the Popup
-  Size mOptionMaxSize;     // Maximum size of an Option button
-  Size mOptionMinSize;     // Minimum size of an Option button
-  Size mOptionDividerSize; // Size of divider line
+  Size    mPopupMaxSize;         // Maximum size of the Popup
+  Size    mOptionMaxSize;        // Maximum size of an Option button
+  Size    mOptionMinSize;        // Minimum size of an Option button
+  Size    mOptionDividerSize;    // Size of divider line
+  Padding mOptionDividerPadding; // Padding of divider line
 
   std::vector<ButtonRequirement> mOrderListOfButtons; // List of buttons in the order to be displayed and a flag to indicate if needed.