Merge "Add text selection popup style" into devel/master
authorBowon Ryu <bowon.ryu@samsung.com>
Mon, 23 May 2022 05:11:56 +0000 (05:11 +0000)
committerGerrit Code Review <gerrit@review>
Mon, 23 May 2022 05:11:56 +0000 (05:11 +0000)
16 files changed:
automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp
dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h
dali-toolkit/devel-api/controls/text-controls/text-field-devel.h
dali-toolkit/devel-api/controls/text-controls/text-selection-popup.cpp
dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-editor-property-handler.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-property-handler.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h
dali-toolkit/internal/controls/text-controls/text-selection-popup-property-handler.cpp
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/decorator/text-decorator.h

index c3a08ed..6e72f04 100644 (file)
@@ -20,6 +20,7 @@
 #include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
 #include <dali-toolkit/devel-api/text/rendering-backend.h>
 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
 
 #include <dali/devel-api/actors/actor-devel.h>
 #include <dali/devel-api/adaptor-framework/clipboard.h>
@@ -65,6 +66,7 @@ const char* const PROPERTY_NAME_CURSOR_BLINK_DURATION                = "cursorBl
 const char* const PROPERTY_NAME_CURSOR_WIDTH                         = "cursorWidth";
 const char* const PROPERTY_NAME_GRAB_HANDLE_IMAGE                    = "grabHandleImage";
 const char* const PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE            = "grabHandlePressedImage";
+const char* const PROPERTY_NAME_SELECTION_POPUP_STYLE                = "selectionPopupStyle";
 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT          = "selectionHandleImageLeft";
 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT         = "selectionHandleImageRight";
 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT  = "selectionHandlePressedImageLeft";
@@ -581,6 +583,7 @@ int UtcDaliTextEditorGetPropertyP(void)
   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_FILTER) == DevelTextEditor::Property::INPUT_FILTER);
   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextEditor::Property::STRIKETHROUGH);
   DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextEditor::Property::INPUT_STRIKETHROUGH);
+  DALI_TEST_CHECK(editor.GetPropertyIndex(PROPERTY_NAME_SELECTION_POPUP_STYLE) == DevelTextEditor::Property::SELECTION_POPUP_STYLE);
 
   END_TEST;
 }
@@ -735,6 +738,64 @@ int UtcDaliTextEditorSetPropertyP(void)
   DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, "filename", "leftHandleMarkerImage"));
   DALI_TEST_CHECK(SetPropertyMapRetrieved(editor, TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, "filename", "rightHandleMarkerImage"));
 
+  // Check the selection popup style
+  const Vector2 popupMaxSize(200.0f, 300.0f);
+  const Vector2 optionDividerSize(30.0f, 5.0f);
+  const Vector4 optionDividerPadding(20.0f, 20.0f, 10.0f, 10.0f);
+  const Vector4 labelPadding(5.0f, 5.0f, 50.0f, 25.0f);
+
+  Property::Map selectionPopupStyle;
+  selectionPopupStyle.Insert(TextSelectionPopup::Property::POPUP_MAX_SIZE, popupMaxSize);
+  selectionPopupStyle.Insert(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE, optionDividerSize);
+  selectionPopupStyle.Insert(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING, optionDividerPadding);
+  selectionPopupStyle.Insert(TextSelectionPopup::Property::LABEL_PADDING, labelPadding);
+
+  editor.SetProperty(DevelTextEditor::Property::SELECTION_POPUP_STYLE, selectionPopupStyle);
+
+  Property::Map selectionPopupStyleGet;
+  selectionPopupStyleGet = editor.GetProperty<Property::Map>(DevelTextEditor::Property::SELECTION_POPUP_STYLE);
+
+  Property::Value* popupValue;
+  popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::POPUP_MAX_SIZE);
+  DALI_TEST_CHECK(NULL != popupValue);
+  if(popupValue)
+  {
+    Vector2 popupMaxSizeGet;
+    popupValue->Get(popupMaxSizeGet);
+    DALI_TEST_EQUALS(popupMaxSizeGet, popupMaxSize, TEST_LOCATION);
+  }
+
+  popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE);
+  DALI_TEST_CHECK(NULL != popupValue);
+  if(popupValue)
+  {
+    Vector2 optionDividerSizeGet;
+    popupValue->Get(optionDividerSizeGet);
+    DALI_TEST_EQUALS(optionDividerSizeGet, optionDividerSize, TEST_LOCATION);
+  }
+
+  popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING);
+  DALI_TEST_CHECK(NULL != popupValue);
+  if(popupValue)
+  {
+    Vector4 optionDividerPaddingGet;
+    popupValue->Get(optionDividerPaddingGet);
+    DALI_TEST_EQUALS(optionDividerPaddingGet, optionDividerPadding, TEST_LOCATION);
+  }
+
+  popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::LABEL_PADDING);
+  DALI_TEST_CHECK(NULL != popupValue);
+  if(popupValue)
+  {
+    Vector4 labelPaddingGet;
+    popupValue->Get(labelPaddingGet);
+    DALI_TEST_EQUALS(labelPaddingGet, labelPadding, TEST_LOCATION);
+  }
+
+  // Reset selection popup style
+  selectionPopupStyle.Clear();
+  editor.SetProperty(DevelTextEditor::Property::SELECTION_POPUP_STYLE, selectionPopupStyle);
+
   // Check the highlight color
   editor.SetProperty(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN);
   DALI_TEST_EQUALS(editor.GetProperty<Vector4>(TextEditor::Property::SELECTION_HIGHLIGHT_COLOR), Color::GREEN, TEST_LOCATION);
index 3e8b0de..82b0f80 100644 (file)
@@ -27,6 +27,7 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-field-devel.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
 #include <dali-toolkit/devel-api/text/rendering-backend.h>
 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
 #include <dali/devel-api/adaptor-framework/key-devel.h>
@@ -72,6 +73,7 @@ const char* const PROPERTY_NAME_GRAB_HANDLE_IMAGE                    = "grabHand
 const char* const PROPERTY_NAME_GRAB_HANDLE_PRESSED_IMAGE            = "grabHandlePressedImage";
 const char* const PROPERTY_NAME_SCROLL_THRESHOLD                     = "scrollThreshold";
 const char* const PROPERTY_NAME_SCROLL_SPEED                         = "scrollSpeed";
+const char* const PROPERTY_NAME_SELECTION_POPUP_STYLE                = "selectionPopupStyle";
 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_LEFT          = "selectionHandleImageLeft";
 const char* const PROPERTY_NAME_SELECTION_HANDLE_IMAGE_RIGHT         = "selectionHandleImageRight";
 const char* const PROPERTY_NAME_SELECTION_HANDLE_PRESSED_IMAGE_LEFT  = "selectionHandlePressedImageLeft";
@@ -591,6 +593,7 @@ int UtcDaliTextFieldGetPropertyP(void)
   DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_INPUT_FILTER) == DevelTextField::Property::INPUT_FILTER);
   DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_STRIKETHROUGH) == DevelTextField::Property::STRIKETHROUGH);
   DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_INPUT_STRIKETHROUGH) == DevelTextField::Property::INPUT_STRIKETHROUGH);
+  DALI_TEST_CHECK(field.GetPropertyIndex(PROPERTY_NAME_SELECTION_POPUP_STYLE) == DevelTextField::Property::SELECTION_POPUP_STYLE);
 
   END_TEST;
 }
@@ -765,6 +768,64 @@ int UtcDaliTextFieldSetPropertyP(void)
   DALI_TEST_CHECK(SetPropertyMapRetrieved(field, TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, "filename", "leftHandleMarkerImage"));
   DALI_TEST_CHECK(SetPropertyMapRetrieved(field, TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, "filename", "rightHandleMarkerImage"));
 
+  // Check the selection popup style
+  const Vector2 popupMaxSize(200.0f, 300.0f);
+  const Vector2 optionDividerSize(30.0f, 5.0f);
+  const Vector4 optionDividerPadding(20.0f, 20.0f, 10.0f, 10.0f);
+  const Vector4 labelPadding(5.0f, 5.0f, 50.0f, 25.0f);
+
+  Property::Map selectionPopupStyle;
+  selectionPopupStyle.Insert(TextSelectionPopup::Property::POPUP_MAX_SIZE, popupMaxSize);
+  selectionPopupStyle.Insert(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE, optionDividerSize);
+  selectionPopupStyle.Insert(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING, optionDividerPadding);
+  selectionPopupStyle.Insert(TextSelectionPopup::Property::LABEL_PADDING, labelPadding);
+
+  field.SetProperty(DevelTextField::Property::SELECTION_POPUP_STYLE, selectionPopupStyle);
+
+  Property::Map selectionPopupStyleGet;
+  selectionPopupStyleGet = field.GetProperty<Property::Map>(DevelTextField::Property::SELECTION_POPUP_STYLE);
+
+  Property::Value* popupValue;
+  popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::POPUP_MAX_SIZE);
+  DALI_TEST_CHECK(NULL != popupValue);
+  if(popupValue)
+  {
+    Vector2 popupMaxSizeGet;
+    popupValue->Get(popupMaxSizeGet);
+    DALI_TEST_EQUALS(popupMaxSizeGet, popupMaxSize, TEST_LOCATION);
+  }
+
+  popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::OPTION_DIVIDER_SIZE);
+  DALI_TEST_CHECK(NULL != popupValue);
+  if(popupValue)
+  {
+    Vector2 optionDividerSizeGet;
+    popupValue->Get(optionDividerSizeGet);
+    DALI_TEST_EQUALS(optionDividerSizeGet, optionDividerSize, TEST_LOCATION);
+  }
+
+  popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::OPTION_DIVIDER_PADDING);
+  DALI_TEST_CHECK(NULL != popupValue);
+  if(popupValue)
+  {
+    Vector4 optionDividerPaddingGet;
+    popupValue->Get(optionDividerPaddingGet);
+    DALI_TEST_EQUALS(optionDividerPaddingGet, optionDividerPadding, TEST_LOCATION);
+  }
+
+  popupValue = selectionPopupStyleGet.Find(TextSelectionPopup::Property::LABEL_PADDING);
+  DALI_TEST_CHECK(NULL != popupValue);
+  if(popupValue)
+  {
+    Vector4 labelPaddingGet;
+    popupValue->Get(labelPaddingGet);
+    DALI_TEST_EQUALS(labelPaddingGet, labelPadding, TEST_LOCATION);
+  }
+
+  // Reset selection popup style
+  selectionPopupStyle.Clear();
+  field.SetProperty(DevelTextField::Property::SELECTION_POPUP_STYLE, selectionPopupStyle);
+
   // Check the highlight color
   field.SetProperty(TextField::Property::SELECTION_HIGHLIGHT_COLOR, Color::GREEN);
   DALI_TEST_EQUALS(field.GetProperty<Vector4>(TextField::Property::SELECTION_HIGHLIGHT_COLOR), Color::GREEN, TEST_LOCATION);
index c256b7a..00dce10 100644 (file)
@@ -28,7 +28,7 @@ using namespace Toolkit;
 namespace
 {
 const char* TEST_IMAGE_FILE_NAME = "selection-popup-border.9.png";
-
+const char* TEST_FONT_FAMILY = "BreezeSans";
 }
 
 void dali_textselectionpopup_startup(void)
@@ -139,6 +139,33 @@ int UtcDaliToolkitTextSelectionPopupBackgroundBorderP(void)
   END_TEST;
 }
 
+int UtcDaliToolkitTextSelectionPopupBackgroundP(void)
+{
+  ToolkitTestApplication application;
+  TextSelectionPopup     textSelectionPopup;
+  textSelectionPopup = TextSelectionPopup::New(NULL);
+
+  textSelectionPopup.SetProperty(TextSelectionPopup::Property::BACKGROUND,
+                                 Property::Map().Add(ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME));
+
+  Property::Value value = textSelectionPopup.GetProperty(TextSelectionPopup::Property::BACKGROUND);
+
+  Property::Map map;
+  value.Get(map);
+
+  Property::Value* returnValue = map.Find(Dali::Toolkit::ImageVisual::Property::URL);
+  DALI_TEST_CHECK(NULL != returnValue);
+
+  if(returnValue)
+  {
+    std::string url;
+    returnValue->Get(url);
+    DALI_TEST_EQUALS(TEST_IMAGE_FILE_NAME, url, TEST_LOCATION);
+  }
+
+  END_TEST;
+}
+
 // TextSelectionToolBar is used TextSelectionPopup, below tests it individually
 
 int UtcDaliToolkitTextSelectionToolBarP(void)
@@ -276,18 +303,21 @@ int UtcDaliToolkitTextSelectionPopupSizeProperties(void)
   END_TEST;
 }
 
-int UtcDaliToolkitTextSelectionPopupDurationProperties(void)
+int UtcDaliToolkitTextSelectionPopupFloatProperties(void)
 {
   ToolkitTestApplication application;
   TextSelectionPopup     popup = TextSelectionPopup::New(nullptr);
 
   const float popupFadeInDuration = 5.0f;
   const float popupFadeOutDuration = 10.0f;
+  const float popupPressedCornerRadius = 15.0f;
   popup.SetProperty(TextSelectionPopup::Property::POPUP_FADE_IN_DURATION, popupFadeInDuration);
   popup.SetProperty(TextSelectionPopup::Property::POPUP_FADE_OUT_DURATION, popupFadeOutDuration);
+  popup.SetProperty(TextSelectionPopup::Property::POPUP_PRESSED_CORNER_RADIUS, popupPressedCornerRadius);
 
   DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_FADE_IN_DURATION).Get<float>(), popupFadeInDuration, TEST_LOCATION);
   DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_FADE_OUT_DURATION).Get<float>(), popupFadeOutDuration, TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_PRESSED_CORNER_RADIUS).Get<float>(), popupPressedCornerRadius, TEST_LOCATION);
 
   END_TEST;
 }
@@ -306,4 +336,92 @@ int UtcDaliToolkitTextSelectionPopupColorProperties(void)
   DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_PRESSED_COLOR).Get<Vector4>(), Color::BLACK, TEST_LOCATION);
 
   END_TEST;
+}
+
+int UtcDaliToolkitTextSelectionPopupScrollBarP(void)
+{
+  ToolkitTestApplication application;
+  TextSelectionPopup     popup = TextSelectionPopup::New(nullptr);
+  DALI_TEST_CHECK(popup);
+
+  popup.SetProperty(TextSelectionPopup::Property::ENABLE_SCROLL_BAR, true);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::ENABLE_SCROLL_BAR).Get<bool>(), true, TEST_LOCATION);
+
+  popup.SetProperty(TextSelectionPopup::Property::ENABLE_SCROLL_BAR, false);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::ENABLE_SCROLL_BAR).Get<bool>(), false, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliToolkitTextSelectionPopupLabelTextVisualP(void)
+{
+  ToolkitTestApplication application;
+  TextSelectionPopup     popup = TextSelectionPopup::New(nullptr);
+  DALI_TEST_CHECK(popup);
+
+  Property::Map textVisualMapSet;
+
+  textVisualMapSet.Insert(TextVisual::Property::FONT_FAMILY, TEST_FONT_FAMILY);
+  textVisualMapSet.Insert(TextVisual::Property::POINT_SIZE, 50.f);
+  textVisualMapSet.Insert(TextVisual::Property::TEXT_COLOR, Color::RED);
+
+  popup.SetProperty(TextSelectionPopup::Property::LABEL_TEXT_VISUAL, textVisualMapSet);
+
+  Property::Map textVisualMapGet;
+  Property::Map styleMapGet;
+
+  textVisualMapGet = popup.GetProperty(TextSelectionPopup::Property::LABEL_TEXT_VISUAL).Get<Property::Map>();
+  DALI_TEST_EQUALS(textVisualMapGet.Count(), 3u, TEST_LOCATION);
+
+  Property::Value* returnValue;
+
+  returnValue = textVisualMapGet.Find(TextVisual::Property::FONT_FAMILY);
+  DALI_TEST_CHECK(NULL != returnValue);
+
+  if(returnValue)
+  {
+    std::string fontFamily;
+    returnValue->Get(fontFamily);
+    DALI_TEST_EQUALS(fontFamily, TEST_FONT_FAMILY, TEST_LOCATION);
+  }
+
+  returnValue = textVisualMapGet.Find(TextVisual::Property::POINT_SIZE);
+  DALI_TEST_CHECK(NULL != returnValue);
+
+  if(returnValue)
+  {
+    float pointSize;
+    returnValue->Get(pointSize);
+    DALI_TEST_EQUALS(pointSize, 50.0f, TEST_LOCATION);
+  }
+
+  returnValue = textVisualMapGet.Find(TextVisual::Property::TEXT_COLOR);
+  DALI_TEST_CHECK(NULL != returnValue);
+
+  if(returnValue)
+  {
+    Vector4 textColor;
+    returnValue->Get(textColor);
+    DALI_TEST_EQUALS(textColor, Color::RED, TEST_LOCATION);
+  }
+
+  END_TEST;
+}
+
+int UtcDaliToolkitTextSelectionPopupLabelProperties(void)
+{
+  ToolkitTestApplication application;
+  TextSelectionPopup     popup = TextSelectionPopup::New(nullptr);
+  DALI_TEST_CHECK(popup);
+
+  const Vector2 labelMinimumSize(100.0f, 50.0f);
+  const Vector4 labelPadding(10.0f, 20.0f, 30.0f, 40.0f);
+
+  popup.SetProperty(TextSelectionPopup::Property::LABEL_MINIMUM_SIZE, labelMinimumSize);
+  popup.SetProperty(TextSelectionPopup::Property::LABEL_PADDING, labelPadding);
+
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::LABEL_MINIMUM_SIZE).Get<Vector2>(), labelMinimumSize, TEST_LOCATION);
+  DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::LABEL_PADDING).Get<Vector4>(), labelPadding, TEST_LOCATION);
+
+  END_TEST;
 }
\ No newline at end of file
index 4645576..92c2e59 100644 (file)
@@ -318,6 +318,13 @@ enum Type
    * @note Return type is Property::STRING
    */
   VERTICAL_ALIGNMENT,
+
+  /**
+   * @brief Sets the selection popup style
+   * @details Name "selectionPopupStyle", type Property::MAP.
+   * @see Dali::Toolkit::TextSelectionPopup::Property
+   */
+  SELECTION_POPUP_STYLE,
 };
 
 } // namespace Property
index 5eb3fda..c81210a 100644 (file)
@@ -242,6 +242,13 @@ enum
   *   The default value is 0.f which does nothing.
   */
   CHARACTER_SPACING,
+
+  /**
+   * @brief Sets the selection popup style
+   * @details Name "selectionPopupStyle", type Property::MAP.
+   * @see Dali::Toolkit::TextSelectionPopup::Property
+   */
+  SELECTION_POPUP_STYLE,
 };
 
 } // namespace Property
index 9f92518..5d953db 100644 (file)
@@ -79,6 +79,16 @@ void TextSelectionPopup::HidePopup()
   GetImpl(*this).HidePopup();
 }
 
+void TextSelectionPopup::SetProperties(const Dali::Property::Map& properties)
+{
+  GetImpl(*this).SetProperties(properties);
+}
+
+void TextSelectionPopup::GetProperties(Dali::Property::Map& properties)
+{
+  GetImpl(*this).GetProperties(properties);
+}
+
 TextSelectionPopup::TextSelectionPopup(Internal::TextSelectionPopup& implementation)
 : Control(implementation)
 {
index 4080c90..a4cb2a7 100644 (file)
@@ -20,6 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control.h>
+#include <dali/public-api/object/property-map.h>
 
 namespace Dali
 {
@@ -163,6 +164,12 @@ public:
       POPUP_PRESSED_COLOR,
 
       /**
+       * @brief The corner radius of the option when pressed.
+       * @details Name "popupPressedCornerRadius", type float.
+       */
+      POPUP_PRESSED_CORNER_RADIUS,
+
+      /**
        * @brief The image to use for the option when pressed.
        * @details Name "popupPressedImage", type string.
        */
@@ -185,7 +192,42 @@ public:
        * @details Name "backgroundBorder", type Property::Map.
        * @note Optional.
        */
-      BACKGROUND_BORDER
+      BACKGROUND_BORDER,
+
+      /**
+       * @brief The popup background.
+       * @details Name "background", type Property::Map.
+       * @note Optional.
+       */
+      BACKGROUND,
+
+      /**
+       * @brief The minimum size of popup label.
+       * @details Name "labelMinimumSize", type Vector2.
+       * @note Optional.
+       */
+      LABEL_MINIMUM_SIZE,
+
+      /**
+       * @brief The padding of popup label.
+       * @details Name "labelPadding", type Vector4.
+       * @note Optional.
+       */
+      LABEL_PADDING,
+
+      /**
+       * @brief The text visual map of popup label.
+       * @details Name "labelTextVisual", type Property::Map.
+       * @note Optional.
+       */
+      LABEL_TEXT_VISUAL,
+
+      /**
+       * @brief Whether the scroll-bar is enabled.
+       * @details Name "enableScrollBar", type Property::BOOLEAN.
+       * @note Optional.
+       */
+      ENABLE_SCROLL_BAR
     };
   };
 
@@ -257,6 +299,20 @@ public:
    */
   void HidePopup();
 
+  /**
+   * @brief Used to set options of text selection popup
+   *
+   * @param[in] properties The text selection popup options
+   */
+  void SetProperties(const Dali::Property::Map& properties);
+
+  /**
+   * @brief Retrieve property map of text selection popup options
+   *
+   * @param[out] properties The text selection popup options
+   */
+  void GetProperties(Dali::Property::Map& properties);
+
 public: // Not intended for application developers
   /**
    * @brief Creates a handle using the Toolkit::Internal implementation.
index b44029c..432ea08 100644 (file)
@@ -160,6 +160,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "inputStrikethro
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "characterSpacing",                     FLOAT,     CHARACTER_SPACING                   )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "relativeLineSize",                     FLOAT,     RELATIVE_LINE_SIZE                  )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "verticalAlignment",                    STRING,    VERTICAL_ALIGNMENT                  )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "selectionPopupStyle",                  MAP,       SELECTION_POPUP_STYLE               )
 
 DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "textChanged",           SIGNAL_TEXT_CHANGED           )
 DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputStyleChanged",     SIGNAL_INPUT_STYLE_CHANGED    )
index 361607a..403f777 100644 (file)
@@ -742,6 +742,15 @@ void TextEditor::PropertyHandler::SetProperty(Toolkit::TextEditor textEditor, Pr
       impl.mRenderer.Reset();
       break;
     }
+    case Toolkit::DevelTextEditor::Property::SELECTION_POPUP_STYLE:
+    {
+      const Property::Map* map = value.GetMap();
+      if(map)
+      {
+        impl.mDecorator->SetSelectionPopupStyle(*map);
+      }
+      break;
+    }
   }
 }
 
@@ -1164,6 +1173,13 @@ Property::Value TextEditor::PropertyHandler::GetProperty(Toolkit::TextEditor tex
       value = impl.mController->GetRelativeLineSize();
       break;
     }
+    case Toolkit::DevelTextEditor::Property::SELECTION_POPUP_STYLE:
+    {
+      Property::Map map;
+      impl.mDecorator->GetSelectionPopupStyle(map);
+      value = map;
+      break;
+    }
   } //switch
   return value;
 }
index b7a6eb4..21c8d3d 100644 (file)
@@ -145,6 +145,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "ellipsisPosition
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "strikethrough",                    MAP,       STRIKETHROUGH                       )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "inputStrikethrough",               MAP,       INPUT_STRIKETHROUGH                 )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "characterSpacing",                 FLOAT,     CHARACTER_SPACING                   )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "selectionPopupStyle",              MAP,       SELECTION_POPUP_STYLE               )
 
 DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "textChanged",           SIGNAL_TEXT_CHANGED           )
 DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "maxLengthReached",      SIGNAL_MAX_LENGTH_REACHED     )
index c4080b7..f1247f9 100644 (file)
@@ -700,6 +700,15 @@ void TextField::PropertyHandler::SetProperty(Toolkit::TextField textField, Prope
       impl.mController->SetCharacterSpacing(characterSpacing);
       break;
     }
+    case Toolkit::DevelTextField::Property::SELECTION_POPUP_STYLE:
+    {
+      const Property::Map* map = value.GetMap();
+      if(map)
+      {
+        impl.mDecorator->SetSelectionPopupStyle(*map);
+      }
+      break;
+    }
   }
 }
 
@@ -1080,6 +1089,13 @@ Property::Value TextField::PropertyHandler::GetProperty(Toolkit::TextField textF
       value = impl.mController->GetCharacterSpacing();
       break;
     }
+    case Toolkit::DevelTextField::Property::SELECTION_POPUP_STYLE:
+    {
+      Property::Map map;
+      impl.mDecorator->GetSelectionPopupStyle(map);
+      value = map;
+      break;
+    }
   } //switch
   return value;
 }
index ffa258d..862a69c 100644 (file)
@@ -26,7 +26,6 @@
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/math/vector2.h>
 #include <dali/public-api/math/vector4.h>
-#include <dali/public-api/object/property-map.h>
 #include <dali/public-api/object/type-registry-helper.h>
 #include <string.h>
 #include <cfloat>
@@ -37,6 +36,7 @@
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
 #include <dali-toolkit/internal/controls/text-controls/text-selection-popup-property-handler.h>
 #include <dali-toolkit/internal/helpers/color-conversion.h>
@@ -59,6 +59,8 @@ namespace
 
 const std::string   TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME("TextSelectionPopupButton");
 const Dali::Vector4 DEFAULT_OPTION_PRESSED_COLOR(Dali::Vector4(0.24f, 0.72f, 0.8f, 1.0f));
+const float         DEFAULT_OPTION_PRESSED_CORNER_RADIUS = 0.0f;
+const Dali::Vector4 DEFAULT_LABEL_PADDING(Dali::Vector4(24.0f, 24.0f, 14.0f, 14.0f));
 
 #if defined(DEBUG_ENABLED)
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
@@ -103,25 +105,31 @@ BaseHandle Create()
 
 DALI_TYPE_REGISTRATION_BEGIN(Toolkit::TextSelectionPopup, Toolkit::Control, Create);
 
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupMaxSize", VECTOR2, POPUP_MAX_SIZE)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupMinSize", VECTOR2, POPUP_MIN_SIZE)
-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)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupPasteButtonImage", STRING, POPUP_PASTE_BUTTON_ICON_IMAGE)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupSelectButtonImage", STRING, POPUP_SELECT_BUTTON_ICON_IMAGE)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupSelectAllButtonImage", STRING, POPUP_SELECT_ALL_BUTTON_ICON_IMAGE)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupDividerColor", VECTOR4, POPUP_DIVIDER_COLOR)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupIconColor", VECTOR4, POPUP_ICON_COLOR)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupPressedColor", VECTOR4, POPUP_PRESSED_COLOR)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupPressedImage", STRING, POPUP_PRESSED_IMAGE)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupFadeInDuration", FLOAT, POPUP_FADE_IN_DURATION)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupFadeOutDuration", FLOAT, POPUP_FADE_OUT_DURATION)
-DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "backgroundBorder", MAP, BACKGROUND_BORDER)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupMaxSize",              VECTOR2, POPUP_MAX_SIZE)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupMinSize",              VECTOR2, POPUP_MIN_SIZE)
+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)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupPasteButtonImage",     STRING,  POPUP_PASTE_BUTTON_ICON_IMAGE)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupSelectButtonImage",    STRING,  POPUP_SELECT_BUTTON_ICON_IMAGE)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupSelectAllButtonImage", STRING,  POPUP_SELECT_ALL_BUTTON_ICON_IMAGE)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupDividerColor",         VECTOR4, POPUP_DIVIDER_COLOR)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupIconColor",            VECTOR4, POPUP_ICON_COLOR)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupPressedColor",         VECTOR4, POPUP_PRESSED_COLOR)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupPressedCornerRadius",  FLOAT,   POPUP_PRESSED_CORNER_RADIUS)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupPressedImage",         STRING,  POPUP_PRESSED_IMAGE)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupFadeInDuration",       FLOAT,   POPUP_FADE_IN_DURATION)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "popupFadeOutDuration",      FLOAT,   POPUP_FADE_OUT_DURATION)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "backgroundBorder",          MAP,     BACKGROUND_BORDER)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "background",                MAP,     BACKGROUND)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "labelMinimumSize",          VECTOR2, LABEL_MINIMUM_SIZE)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "labelPadding",              VECTOR4, LABEL_PADDING)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "labelTextVisual",           MAP,     LABEL_TEXT_VISUAL)
+DALI_PROPERTY_REGISTRATION(Toolkit, TextSelectionPopup, "enableScrollBar",           BOOLEAN, ENABLE_SCROLL_BAR)
 
 DALI_TYPE_REGISTRATION_END()
 
@@ -157,7 +165,6 @@ void TextSelectionPopup::SetProperty(BaseObject* object, Property::Index index,
 Property::Value TextSelectionPopup::GetProperty(BaseObject* object, Property::Index index)
 {
   Property::Value value;
-
   Toolkit::TextSelectionPopup selectionPopup = Toolkit::TextSelectionPopup::DownCast(Dali::BaseHandle(object));
 
   if(selectionPopup)
@@ -167,6 +174,59 @@ Property::Value TextSelectionPopup::GetProperty(BaseObject* object, Property::In
   return value;
 }
 
+void TextSelectionPopup::SetProperties(const Property::Map& properties)
+{
+  Toolkit::TextSelectionPopup selectionPopup = Toolkit::TextSelectionPopup::DownCast(Self());
+
+  if(selectionPopup)
+  {
+    const Property::Map::SizeType count = properties.Count();
+    for(Property::Map::SizeType position = 0; position < count; ++position)
+    {
+      KeyValuePair     keyValue = properties.GetKeyValue(position);
+      Property::Key&   key      = keyValue.first;
+      Property::Value& value    = keyValue.second;
+      PropertyHandler::SetProperty(selectionPopup, key.indexKey, value);
+    }
+  }
+}
+
+void TextSelectionPopup::GetProperties(Property::Map& properties)
+{
+  Property::Map map;
+
+  map.Insert(Toolkit::TextSelectionPopup::Property::POPUP_MAX_SIZE, GetDimensionToCustomise(POPUP_MAXIMUM_SIZE));
+  map.Insert(Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_SIZE, GetDimensionToCustomise(OPTION_DIVIDER_SIZE));
+  map.Insert(Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_PADDING, Vector4(mOptionDividerPadding.left, mOptionDividerPadding.right, mOptionDividerPadding.top, mOptionDividerPadding.bottom));
+  map.Insert(Toolkit::TextSelectionPopup::Property::LABEL_MINIMUM_SIZE, mLabelMinimumSize);
+  map.Insert(Toolkit::TextSelectionPopup::Property::LABEL_PADDING, Vector4(mLabelPadding.left, mLabelPadding.right, mLabelPadding.top, mLabelPadding.bottom));
+  map.Insert(Toolkit::TextSelectionPopup::Property::LABEL_TEXT_VISUAL, mLabelTextVisual);
+  map.Insert(Toolkit::TextSelectionPopup::Property::ENABLE_SCROLL_BAR, mEnableScrollBar);
+  map.Insert(Toolkit::TextSelectionPopup::Property::POPUP_DIVIDER_COLOR, mDividerColor);
+  map.Insert(Toolkit::TextSelectionPopup::Property::POPUP_FADE_IN_DURATION, mFadeInDuration);
+  map.Insert(Toolkit::TextSelectionPopup::Property::POPUP_FADE_OUT_DURATION, mFadeOutDuration);
+  map.Insert(Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_COLOR, mPressedColor);
+  map.Insert(Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_CORNER_RADIUS, mPressedCornerRadius);
+
+  Property::Map backgroundMap;
+  Toolkit::Visual::Base backgroundVisual = DevelControl::GetVisual(*this, Toolkit::Control::Property::BACKGROUND);
+  if(backgroundVisual)
+  {
+    backgroundVisual.CreatePropertyMap(backgroundMap);
+  }
+  map.Insert(Toolkit::TextSelectionPopup::Property::BACKGROUND, backgroundMap);
+
+  Property::Map borderMap;
+  Toolkit::Visual::Base borderVisual = DevelControl::GetVisual(*this, Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER);
+  if(borderVisual)
+  {
+    borderVisual.CreatePropertyMap(borderMap);
+  }
+  map.Insert(Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER, borderMap);
+
+  properties = map;
+}
+
 void TextSelectionPopup::EnableButtons(Toolkit::TextSelectionPopup::Buttons buttonsToEnable)
 {
   mEnabledButtons = buttonsToEnable;
@@ -481,6 +541,17 @@ Padding TextSelectionPopup::GetOptionDividerPadding() const
   return mOptionDividerPadding;
 }
 
+void TextSelectionPopup::SetLabelPadding(const Padding& padding)
+{
+  DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextSelectionPopup::SetLabelPadding padding(%f,%f,%f,%f)\n", padding.left, padding.right, padding.top, padding.bottom);
+  mLabelPadding = Padding(padding.left, padding.right, padding.top, padding.bottom);
+}
+
+Padding TextSelectionPopup::GetLabelPadding() const
+{
+  return mLabelPadding;
+}
+
 void TextSelectionPopup::CreateOrderedListOfPopupOptions()
 {
   mOrderListOfButtons.clear();
@@ -506,6 +577,7 @@ void TextSelectionPopup::AddOption(const ButtonRequirement& button, bool showDiv
   Toolkit::PushButton option = Toolkit::PushButton::New();
   option.SetProperty(Dali::Actor::Property::NAME, button.name);
   option.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
+  option.SetProperty(Actor::Property::MINIMUM_SIZE, mLabelMinimumSize);
 
   switch(button.id)
   {
@@ -550,11 +622,14 @@ void TextSelectionPopup::AddOption(const ButtonRequirement& button, bool showDiv
   if(showCaption)
   {
     // PushButton layout properties.
-    option.SetProperty(Toolkit::PushButton::Property::LABEL_PADDING, Vector4(24.0f, 24.0f, 14.0f, 14.0f));
+    const Padding padding(mLabelPadding);
+    option.SetProperty(Toolkit::PushButton::Property::LABEL_PADDING, padding);
 
     // Label properties.
     Property::Map buttonLabelProperties;
     buttonLabelProperties.Insert(Toolkit::TextVisual::Property::TEXT, button.caption);
+    buttonLabelProperties.Merge(mLabelTextVisual);
+
     option.SetProperty(Toolkit::Button::Property::LABEL, buttonLabelProperties);
   }
   if(showIcons)
@@ -576,10 +651,16 @@ void TextSelectionPopup::AddOption(const ButtonRequirement& button, bool showDiv
   {
     // The image can be blank, the color can be used in that case.
     selectedBackgroundValue = Property::Value{{Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR},
-                                              {Toolkit::ColorVisual::Property::MIX_COLOR, mPressedColor}};
+                                              {Toolkit::ColorVisual::Property::MIX_COLOR, mPressedColor},
+                                              {Toolkit::DevelVisual::Property::CORNER_RADIUS, mPressedCornerRadius},
+                                              {Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, Toolkit::Visual::Transform::Policy::RELATIVE}};
   }
   option.SetProperty(Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, selectedBackgroundValue);
-  option.SetProperty(Toolkit::Control::Property::STYLE_NAME, TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME);
+  // The value set by user takes precedence over the theme value.
+  if(mLabelTextVisual.Count() == 0)
+  {
+    option.SetProperty(Toolkit::Control::Property::STYLE_NAME, TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME);
+  }
 
   // 5 Add option to tool bar
   mToolbar.AddOption(option);
@@ -638,6 +719,7 @@ void TextSelectionPopup::AddPopupOptionsToToolbar(bool showIcons, bool showCapti
 #ifdef DECORATOR_DEBUG
     mToolbar.SetProperty(Dali::Actor::Property::NAME, "TextSelectionToolbar");
 #endif
+    mToolbar.SetProperty(Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR, mEnableScrollBar);
     self.Add(mToolbar);
   }
 
@@ -691,6 +773,22 @@ void TextSelectionPopup::CreateBackgroundBorder(Property::Map& propertyMap)
   }
 }
 
+void TextSelectionPopup::CreateBackground(Property::Map& propertyMap)
+{
+  // Removes previous image if necessary
+  DevelControl::UnregisterVisual(*this, Toolkit::Control::Property::BACKGROUND);
+
+  if(!propertyMap.Empty())
+  {
+    Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual(propertyMap);
+
+    if(visual)
+    {
+      DevelControl::RegisterVisual(*this, Toolkit::Control::Property::BACKGROUND, visual, DepthIndex::BACKGROUND);
+    }
+  }
+}
+
 TextSelectionPopup::TextSelectionPopup(TextSelectionPopupCallbackInterface* callbackInterface)
 : Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)),
   mToolbar(),
@@ -699,9 +797,14 @@ TextSelectionPopup::TextSelectionPopup(TextSelectionPopupCallbackInterface* call
   mOptionMinSize(),
   mOptionDividerSize(),
   mOptionDividerPadding(),
+  mLabelMinimumSize(),
+  mLabelPadding(DEFAULT_LABEL_PADDING),
+  mLabelTextVisual(),
+  mEnableScrollBar(true),
   mEnabledButtons(Toolkit::TextSelectionPopup::NONE),
   mCallbackInterface(callbackInterface),
   mPressedColor(DEFAULT_OPTION_PRESSED_COLOR),
+  mPressedCornerRadius(DEFAULT_OPTION_PRESSED_CORNER_RADIUS),
   mDividerColor(Color::WHITE),
   mIconColor(Color::WHITE),
   mSelectOptionPriority(1),
index db51100..b3739d6 100644 (file)
@@ -115,6 +115,16 @@ public:
   static Property::Value GetProperty(BaseObject* object, Property::Index index);
 
   /**
+   * @brief Toolkit::TextSelectionPopup::SetProperties()
+   */
+  void SetProperties(const Property::Map& properties);
+
+  /**
+   * @brief Toolkit::TextSelectionPopup::GetProperties()
+   */
+  void GetProperties(Property::Map& properties);
+
+  /**
    * @copydoc Toolkit::EnableButtons
    */
   void EnableButtons(Toolkit::TextSelectionPopup::Buttons buttonsToEnable);
@@ -247,6 +257,18 @@ private: // Implementation
    */
   Padding GetOptionDividerPadding() const;
 
+  /**
+   * Set label padding
+   * @param[in] padding BEGIN END BOTTOM TOP
+   */
+  void SetLabelPadding(const Padding& padding);
+
+  /**
+   * Get label padding
+   * @return Padding
+   */
+  Padding GetLabelPadding() const;
+
   void CreateOrderedListOfPopupOptions();
 
   void AddOption(const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption);
@@ -263,6 +285,14 @@ private: // Implementation
   void CreateBackgroundBorder(Property::Map& propertyMap);
 
   /**
+   * Creates the background image
+   *
+   * @param[in] propertyMap The properties describing the background
+   */
+  void CreateBackground(Property::Map& propertyMap);
+
+
+  /**
    * Construct a new TextField.
    */
   TextSelectionPopup(TextSelectionPopupCallbackInterface* callbackInterface);
@@ -310,15 +340,21 @@ private: // Data
   Size    mOptionDividerSize;    // Size of divider line
   Padding mOptionDividerPadding; // Padding of divider line
 
+  Vector2       mLabelMinimumSize; // Minimum size of label
+  Padding       mLabelPadding;     // Padding of label
+  Property::Map mLabelTextVisual;  // Text visual map of label
+  bool          mEnableScrollBar;  // Enable scrollbar
+
   std::vector<ButtonRequirement> mOrderListOfButtons; // List of buttons in the order to be displayed and a flag to indicate if needed.
 
   Toolkit::TextSelectionPopup::Buttons          mEnabledButtons; // stores enabled buttons
   Toolkit::TextSelectionPopupCallbackInterface* mCallbackInterface;
 
-  std::string mPressedImage; // Image used for the popup option when pressed.
-  Vector4     mPressedColor; // Color of the popup option when pressed.
-  Vector4     mDividerColor; // Color of the divider between buttons
-  Vector4     mIconColor;    // Color of the popup icon.
+  std::string mPressedImage;        // Image used for the popup option when pressed.
+  Vector4     mPressedColor;        // Color of the popup option when pressed.
+  float       mPressedCornerRadius; // Corner radius of the popup option when pressed.
+  Vector4     mDividerColor;        // Color of the divider between buttons
+  Vector4     mIconColor;           // Color of the popup icon.
 
   // Priority of Options/Buttons in the Cut and Paste pop-up, higher priority buttons are displayed first, left to right.
   std::size_t mSelectOptionPriority;    // Position of Select Button
index fe6e93f..424cb9c 100644 (file)
@@ -100,6 +100,11 @@ void TextSelectionPopup::PropertyHandler::SetProperty(Toolkit::TextSelectionPopu
       impl.mPressedColor = value.Get<Vector4>();
       break;
     }
+    case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_CORNER_RADIUS:
+    {
+      impl.mPressedCornerRadius = value.Get<float>();
+      break;
+    }
     case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_IMAGE:
     {
       impl.SetPressedImage(value.Get<std::string>());
@@ -121,6 +126,33 @@ void TextSelectionPopup::PropertyHandler::SetProperty(Toolkit::TextSelectionPopu
       impl.CreateBackgroundBorder(map);
       break;
     }
+    case Toolkit::TextSelectionPopup::Property::BACKGROUND:
+    {
+      Property::Map map = value.Get<Property::Map>();
+      impl.CreateBackground(map);
+      break;
+    }
+    case Toolkit::TextSelectionPopup::Property::LABEL_MINIMUM_SIZE:
+    {
+      impl.mLabelMinimumSize = value.Get<Vector2>();
+      break;
+    }
+    case Toolkit::TextSelectionPopup::Property::LABEL_PADDING:
+    {
+      Vector4 padding(value.Get<Vector4>());
+      impl.SetLabelPadding(Padding(padding.x, padding.y, padding.z, padding.w));
+      break;
+    }
+    case Toolkit::TextSelectionPopup::Property::LABEL_TEXT_VISUAL:
+    {
+      impl.mLabelTextVisual = value.Get<Property::Map>();
+      break;
+    }
+    case Toolkit::TextSelectionPopup::Property::ENABLE_SCROLL_BAR:
+    {
+      impl.mEnableScrollBar = value.Get<bool>();
+      break;
+    }
   }
 }
 
@@ -202,6 +234,11 @@ Property::Value TextSelectionPopup::PropertyHandler::GetProperty(Toolkit::TextSe
       value = impl.mPressedColor;
       break;
     }
+    case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_CORNER_RADIUS:
+    {
+      value = impl.mPressedCornerRadius;
+      break;
+    }
     case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_IMAGE:
     {
       value = impl.GetPressedImage();
@@ -228,6 +265,38 @@ Property::Value TextSelectionPopup::PropertyHandler::GetProperty(Toolkit::TextSe
       value = map;
       break;
     }
+    case Toolkit::TextSelectionPopup::Property::BACKGROUND:
+    {
+      Property::Map         map;
+      Toolkit::Visual::Base visual = DevelControl::GetVisual(impl, Toolkit::Control::Property::BACKGROUND);
+      if(visual)
+      {
+        visual.CreatePropertyMap(map);
+      }
+      value = map;
+      break;
+    }
+    case Toolkit::TextSelectionPopup::Property::LABEL_MINIMUM_SIZE:
+    {
+      value = impl.mLabelMinimumSize;
+      break;
+    }
+    case Toolkit::TextSelectionPopup::Property::LABEL_PADDING:
+    {
+      Padding padding = impl.GetLabelPadding();
+      value           = Vector4(padding.left, padding.right, padding.top, padding.bottom);
+      break;
+    }
+    case Toolkit::TextSelectionPopup::Property::LABEL_TEXT_VISUAL:
+    {
+      value = impl.mLabelTextVisual;
+      break;
+    }
+    case Toolkit::TextSelectionPopup::Property::ENABLE_SCROLL_BAR:
+    {
+      value = impl.mEnableScrollBar;
+      break;
+    }
   }
 
   return value;
index d89adf9..543c232 100644 (file)
@@ -946,6 +946,19 @@ struct Decorator::Impl : public ConnectionTracker
     }
   }
 
+  void CreateSelectionPopup()
+  {
+    if(!mCopyPastePopup.actor)
+    {
+      mCopyPastePopup.actor = TextSelectionPopup::New(&mTextSelectionPopupCallbackInterface);
+  #ifdef DECORATOR_DEBUG
+      mCopyPastePopup.actor.SetProperty(Dali::Actor::Property::NAME, "mCopyPastePopup");
+  #endif
+      mCopyPastePopup.actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+      mCopyPastePopup.actor.OnRelayoutSignal().Connect(this, &Decorator::Impl::SetPopupPosition); // Position popup after size negotiation
+    }
+  }
+
   void CalculateHandleWorldCoordinates(HandleImpl& handle, Vector2& position)
   {
     // Gets the world position of the active layer. The active layer is where the handles are added.
@@ -2302,17 +2315,7 @@ bool Decorator::IsPopupActive() const
 void Decorator::SetEnabledPopupButtons(TextSelectionPopup::Buttons& enabledButtonsBitMask)
 {
   mImpl->mEnabledPopupButtons = enabledButtonsBitMask;
-
-  if(!mImpl->mCopyPastePopup.actor)
-  {
-    mImpl->mCopyPastePopup.actor = TextSelectionPopup::New(&mImpl->mTextSelectionPopupCallbackInterface);
-#ifdef DECORATOR_DEBUG
-    mImpl->mCopyPastePopup.actor.SetProperty(Dali::Actor::Property::NAME, "mCopyPastePopup");
-#endif
-    mImpl->mCopyPastePopup.actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
-    mImpl->mCopyPastePopup.actor.OnRelayoutSignal().Connect(mImpl, &Decorator::Impl::SetPopupPosition); // Position popup after size negotiation
-  }
-
+  mImpl->CreateSelectionPopup();
   mImpl->mCopyPastePopup.actor.EnableButtons(mImpl->mEnabledPopupButtons);
 }
 
@@ -2321,6 +2324,20 @@ TextSelectionPopup::Buttons& Decorator::GetEnabledPopupButtons()
   return mImpl->mEnabledPopupButtons;
 }
 
+void Decorator::SetSelectionPopupStyle(const Property::Map& options)
+{
+  mImpl->CreateSelectionPopup();
+  mImpl->mCopyPastePopup.actor.SetProperties(options);
+}
+
+void Decorator::GetSelectionPopupStyle(Property::Map& options)
+{
+  if(mImpl->mCopyPastePopup.actor)
+  {
+    mImpl->mCopyPastePopup.actor.GetProperties(options);
+  }
+}
+
 /** Scroll **/
 
 void Decorator::SetScrollThreshold(float threshold)
index ad3037e..dc6a5d5 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/math/rect.h>
 #include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/object/property-map.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
@@ -558,6 +559,20 @@ public:
   TextSelectionPopup::Buttons& GetEnabledPopupButtons();
 
   /**
+   * @brief Used to set the selection popup options
+   *
+   * @param[in] options The property map of selection popup options
+   */
+  void SetSelectionPopupStyle(const Property::Map& options);
+
+  /**
+   * @brief Used to get the selection popup options
+   *
+   * @param[out] options The property map of selection popup options
+   */
+  void GetSelectionPopupStyle(Property::Map& options);
+
+  /**
    * @brief Sets the scroll threshold.
    *
    * It defines a square area inside the control, close to the edge.