#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>
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";
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;
}
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);
#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>
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";
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;
}
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);
namespace
{
const char* TEST_IMAGE_FILE_NAME = "selection-popup-border.9.png";
-
+const char* TEST_FONT_FAMILY = "BreezeSans";
}
void dali_textselectionpopup_startup(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)
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;
}
DALI_TEST_EQUALS(popup.GetProperty(TextSelectionPopup::Property::POPUP_ICON_COLOR).Get<Vector4>(), Color::BLUE, TEST_LOCATION);
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
* @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
* 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
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)
{
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
+#include <dali/public-api/object/property-map.h>
namespace Dali
{
*/
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.
* @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
};
};
*/
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.
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 )
impl.mRenderer.Reset();
break;
}
+ case Toolkit::DevelTextEditor::Property::SELECTION_POPUP_STYLE:
+ {
+ const Property::Map* map = value.GetMap();
+ if(map)
+ {
+ impl.mDecorator->SetSelectionPopupStyle(*map);
+ }
+ break;
+ }
}
}
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;
}
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 )
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;
+ }
}
}
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;
}
#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>
#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>
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");
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()
Property::Value TextSelectionPopup::GetProperty(BaseObject* object, Property::Index index)
{
Property::Value value;
-
Toolkit::TextSelectionPopup selectionPopup = Toolkit::TextSelectionPopup::DownCast(Dali::BaseHandle(object));
if(selectionPopup)
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;
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();
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)
{
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)
{
// 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);
#ifdef DECORATOR_DEBUG
mToolbar.SetProperty(Dali::Actor::Property::NAME, "TextSelectionToolbar");
#endif
+ mToolbar.SetProperty(Toolkit::TextSelectionToolbar::Property::ENABLE_SCROLL_BAR, mEnableScrollBar);
self.Add(mToolbar);
}
}
}
+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(),
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),
*/
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
*/
*/
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);
*/
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.
*/
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
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>());
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;
+ }
}
}
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();
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;
}
}
+ 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.
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);
}
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)
#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>
*/
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.
*