1 #ifndef DALI_TOOLKIT_TEXT_SELECTION_POPUP_H
2 #define DALI_TOOLKIT_TEXT_SELECTION_POPUP_H
5 * Copyright (c) 2021 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>
28 class TextSelectionPopupCallbackInterface;
30 namespace Internal DALI_INTERNAL
32 class TextSelectionPopup;
36 * @brief A control which provides a Popup with a number of buttons
38 * The style of the pop can be set through style sheets, this includes the images for the buttons
39 * A Show and Hide API is provided.
41 * If the buttons exceed the size constraints of the popup then it will offer scrolling.
45 class DALI_TOOLKIT_API TextSelectionPopup : public Control
60 * @brief The start and end property ranges for this control.
64 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
65 PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
69 * @brief An enumeration of properties belonging to the TextSelectionPopup class.
76 * @brief The maximum size the Popup can be.
77 * @details Name "popupMaxSize", type Vector2.
79 POPUP_MAX_SIZE = PROPERTY_START_INDEX,
82 * @brief The minimum size the Popup can be.
83 * @details Name "popupMinSize", type Vector2.
88 * @brief The maximum size an option can be.
89 * @details Name "optionMaxSize", type Vector2.
94 * @brief The minimum size an option can be.
95 * @details Name "optionMinSize", type Vector2.
100 * @brief The size of the divider between options.
101 * @details Name "optionDividerSize", type Vector2.
106 * @brief The padding of the divider between options.
107 * @details Name "optionDividerPadding", type Vector4.
109 OPTION_DIVIDER_PADDING,
112 * @brief The image to use as the popup clipboard icon.
113 * @details Name "popupClipboardButtonImage", type string.
115 POPUP_CLIPBOARD_BUTTON_ICON_IMAGE,
118 * @brief The image to use as the popup cut icon.
119 * @details Name "popupCutButtonImage", type string.
121 POPUP_CUT_BUTTON_ICON_IMAGE,
124 * @brief The image to use as the popup copy icon.
125 * @details Name "popupCopyButtonImage", type string.
127 POPUP_COPY_BUTTON_ICON_IMAGE,
130 * @brief The image to use as the popup paste icon.
131 * @details Name "popupPasteButtonImage", type string.
133 POPUP_PASTE_BUTTON_ICON_IMAGE,
136 * @brief The image to use as the popup select icon.
137 * @details Name "popupSelectButtonImage", type string.
139 POPUP_SELECT_BUTTON_ICON_IMAGE,
142 * @brief The image to use as the popup select all icon.
143 * @details Name "popupSelectAllButtonImage", type string.
145 POPUP_SELECT_ALL_BUTTON_ICON_IMAGE,
148 * @brief The color of the divider between options.
149 * @details Name "popupDividerColor", type Vector4.
154 * @brief The color of the icons (if supplied).
155 * @details Name "popupIconColor", type Vector4.
160 * @brief The color of the option when pressed.
161 * @details Name "popupPressedColor", type Vector4.
166 * @brief The image to use for the option when pressed.
167 * @details Name "popupPressedImage", type string.
172 * @brief The duration of the fade-in animation.
173 * @details Name "popupFadeInDuration", type float.
175 POPUP_FADE_IN_DURATION,
178 * @brief The duration of the fade-out animation.
179 * @details Name "popupFadeOutDuration", type float.
181 POPUP_FADE_OUT_DURATION,
184 * @brief The popup background can have a separate border with a different color.
185 * @details Name "backgroundBorder", type Property::Map.
193 * Create the TextSelectionPopup control.
194 * @param[in] callbackInterface The text popup callback interface which receives the button click callbacks.
195 * @return A handle to the TextSelectionPopup control.
197 static TextSelectionPopup New(TextSelectionPopupCallbackInterface* callbackInterface);
200 * @brief Creates an empty handle.
202 TextSelectionPopup();
205 * @brief Copy constructor.
207 * @param[in] handle The handle to copy from.
209 TextSelectionPopup(const TextSelectionPopup& handle);
212 * @brief Assignment operator.
214 * @param[in] handle The handle to copy from.
215 * @return A reference to this.
217 TextSelectionPopup& operator=(const TextSelectionPopup& handle);
222 * This is non-virtual since derived Handle types must not contain data or virtual methods.
224 ~TextSelectionPopup();
227 * @brief Downcast a handle to TextSelectionPopup.
229 * If the BaseHandle points is a TextSelectionPopup the downcast returns a valid handle.
230 * If not the returned handle is left empty.
232 * @param[in] handle Handle to an object
233 * @return handle to a TextSelectionPopup or an empty handle
235 static TextSelectionPopup DownCast(BaseHandle handle);
238 * @brief Specify which buttons to show in Popup
239 * @param[in] buttonsToEnable Buttons to enable
241 void EnableButtons(Toolkit::TextSelectionPopup::Buttons buttonsToEnable);
244 * @brief Raises the toolbar's actor above the given @e target actor.
246 * @param[in] target The actor to get above of.
248 void RaiseAbove(Actor target);
251 * @brief Show the Popup if not being shown
256 * @brief Hide the Popup if shown
260 public: // Not intended for application developers
262 * @brief Creates a handle using the Toolkit::Internal implementation.
264 * @param[in] implementation The Control implementation.
266 DALI_INTERNAL TextSelectionPopup(Internal::TextSelectionPopup& implementation);
269 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
271 * @param[in] internal A pointer to the internal CustomActor.
273 explicit DALI_INTERNAL TextSelectionPopup(Dali::Internal::CustomActor* internal);
275 }; // Class TextSelectionPopup
277 } // namespace Toolkit
281 #endif // DALI_TOOLKIT_TEXT_SELECTION_POPUP_H