1 #ifndef DALI_TOOLKIT_TEXT_SELECTION_POPUP_H
2 #define DALI_TOOLKIT_TEXT_SELECTION_POPUP_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali-toolkit/public-api/controls/control.h>
23 #include <dali/public-api/object/property-map.h>
29 class TextSelectionPopupCallbackInterface;
31 namespace Internal DALI_INTERNAL
33 class TextSelectionPopup;
37 * @brief A control which provides a Popup with a number of buttons
39 * The style of the pop can be set through style sheets, this includes the images for the buttons
40 * A Show and Hide API is provided.
42 * If the buttons exceed the size constraints of the popup then it will offer scrolling.
46 class DALI_TOOLKIT_API TextSelectionPopup : public Control
61 * @brief The start and end property ranges for this control.
65 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
66 PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
70 * @brief An enumeration of properties belonging to the TextSelectionPopup class.
77 * @brief The maximum size the Popup can be.
78 * @details Name "popupMaxSize", type Vector2.
80 POPUP_MAX_SIZE = PROPERTY_START_INDEX,
83 * @brief The minimum size the Popup can be.
84 * @details Name "popupMinSize", type Vector2.
89 * @brief The maximum size an option can be.
90 * @details Name "optionMaxSize", type Vector2.
95 * @brief The minimum size an option can be.
96 * @details Name "optionMinSize", type Vector2.
101 * @brief The size of the divider between options.
102 * @details Name "optionDividerSize", type Vector2.
107 * @brief The padding of the divider between options.
108 * @details Name "optionDividerPadding", type Vector4.
110 OPTION_DIVIDER_PADDING,
113 * @brief The image to use as the popup clipboard icon.
114 * @details Name "popupClipboardButtonImage", type string.
116 POPUP_CLIPBOARD_BUTTON_ICON_IMAGE,
119 * @brief The image to use as the popup cut icon.
120 * @details Name "popupCutButtonImage", type string.
122 POPUP_CUT_BUTTON_ICON_IMAGE,
125 * @brief The image to use as the popup copy icon.
126 * @details Name "popupCopyButtonImage", type string.
128 POPUP_COPY_BUTTON_ICON_IMAGE,
131 * @brief The image to use as the popup paste icon.
132 * @details Name "popupPasteButtonImage", type string.
134 POPUP_PASTE_BUTTON_ICON_IMAGE,
137 * @brief The image to use as the popup select icon.
138 * @details Name "popupSelectButtonImage", type string.
140 POPUP_SELECT_BUTTON_ICON_IMAGE,
143 * @brief The image to use as the popup select all icon.
144 * @details Name "popupSelectAllButtonImage", type string.
146 POPUP_SELECT_ALL_BUTTON_ICON_IMAGE,
149 * @brief The color of the divider between options.
150 * @details Name "popupDividerColor", type Vector4.
155 * @brief The color of the icons (if supplied).
156 * @details Name "popupIconColor", type Vector4.
161 * @brief The color of the option when pressed.
162 * @details Name "popupPressedColor", type Vector4.
167 * @brief The corner radius of the option when pressed.
168 * @details Name "popupPressedCornerRadius", type float.
170 POPUP_PRESSED_CORNER_RADIUS,
173 * @brief The image to use for the option when pressed.
174 * @details Name "popupPressedImage", type string.
179 * @brief The duration of the fade-in animation.
180 * @details Name "popupFadeInDuration", type float.
182 POPUP_FADE_IN_DURATION,
185 * @brief The duration of the fade-out animation.
186 * @details Name "popupFadeOutDuration", type float.
188 POPUP_FADE_OUT_DURATION,
191 * @brief The popup background can have a separate border with a different color.
192 * @details Name "backgroundBorder", type Property::Map.
198 * @brief The popup background.
199 * @details Name "background", type Property::Map.
205 * @brief The minimum size of popup label.
206 * @details Name "labelMinimumSize", type Vector2.
212 * @brief The padding of popup label.
213 * @details Name "labelPadding", type Vector4.
219 * @brief The text visual map of popup label.
220 * @details Name "labelTextVisual", type Property::Map.
226 * @brief Whether the scroll-bar is enabled.
227 * @details Name "enableScrollBar", type Property::BOOLEAN.
235 * Create the TextSelectionPopup control.
236 * @param[in] callbackInterface The text popup callback interface which receives the button click callbacks.
237 * @return A handle to the TextSelectionPopup control.
239 static TextSelectionPopup New(TextSelectionPopupCallbackInterface* callbackInterface);
242 * @brief Creates an empty handle.
244 TextSelectionPopup();
247 * @brief Copy constructor.
249 * @param[in] handle The handle to copy from.
251 TextSelectionPopup(const TextSelectionPopup& handle);
254 * @brief Assignment operator.
256 * @param[in] handle The handle to copy from.
257 * @return A reference to this.
259 TextSelectionPopup& operator=(const TextSelectionPopup& handle);
262 * @brief Move constructor.
264 * @param[in] handle The handle to move from.
266 TextSelectionPopup(TextSelectionPopup&& handle);
269 * @brief Move assignment operator.
271 * @param[in] handle The handle to move from.
272 * @return A reference to this.
274 TextSelectionPopup& operator=(TextSelectionPopup&& handle);
279 * This is non-virtual since derived Handle types must not contain data or virtual methods.
281 ~TextSelectionPopup();
284 * @brief Downcast a handle to TextSelectionPopup.
286 * If the BaseHandle points is a TextSelectionPopup the downcast returns a valid handle.
287 * If not the returned handle is left empty.
289 * @param[in] handle Handle to an object
290 * @return handle to a TextSelectionPopup or an empty handle
292 static TextSelectionPopup DownCast(BaseHandle handle);
295 * @brief Specify which buttons to show in Popup
296 * @param[in] buttonsToEnable Buttons to enable
298 void EnableButtons(Toolkit::TextSelectionPopup::Buttons buttonsToEnable);
301 * @brief Raises the toolbar's actor above the given @e target actor.
303 * @param[in] target The actor to get above of.
305 void RaiseAbove(Actor target);
308 * @brief Show the Popup if not being shown
313 * @brief Hide the Popup if shown
318 * @brief Used to set options of text selection popup
320 * @param[in] properties The text selection popup options
322 void SetProperties(const Dali::Property::Map& properties);
325 * @brief Retrieve property map of text selection popup options
327 * @param[out] properties The text selection popup options
329 void GetProperties(Dali::Property::Map& properties);
331 public: // Not intended for application developers
333 * @brief Creates a handle using the Toolkit::Internal implementation.
335 * @param[in] implementation The Control implementation.
337 DALI_INTERNAL TextSelectionPopup(Internal::TextSelectionPopup& implementation);
340 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
342 * @param[in] internal A pointer to the internal CustomActor.
344 explicit DALI_INTERNAL TextSelectionPopup(Dali::Internal::CustomActor* internal);
346 }; // Class TextSelectionPopup
348 } // namespace Toolkit
352 #endif // DALI_TOOLKIT_TEXT_SELECTION_POPUP_H