1 #ifndef DALI_TOOLKIT_TEXT_SELECTION_POPUP_H
2 #define DALI_TOOLKIT_TEXT_SELECTION_POPUP_H
5 * Copyright (c) 2020 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 image to use as the popup clipboard icon.
107 * @details Name "popupClipboardButtonImage", type string.
109 POPUP_CLIPBOARD_BUTTON_ICON_IMAGE,
112 * @brief The image to use as the popup cut icon.
113 * @details Name "popupCutButtonImage", type string.
115 POPUP_CUT_BUTTON_ICON_IMAGE,
118 * @brief The image to use as the popup copy icon.
119 * @details Name "popupCopyButtonImage", type string.
121 POPUP_COPY_BUTTON_ICON_IMAGE,
124 * @brief The image to use as the popup paste icon.
125 * @details Name "popupPasteButtonImage", type string.
127 POPUP_PASTE_BUTTON_ICON_IMAGE,
130 * @brief The image to use as the popup select icon.
131 * @details Name "popupSelectButtonImage", type string.
133 POPUP_SELECT_BUTTON_ICON_IMAGE,
136 * @brief The image to use as the popup select all icon.
137 * @details Name "popupSelectAllButtonImage", type string.
139 POPUP_SELECT_ALL_BUTTON_ICON_IMAGE,
142 * @brief The color of the divider between options.
143 * @details Name "popupDividerColor", type Vector4.
148 * @brief The color of the icons (if supplied).
149 * @details Name "popupIconColor", type Vector4.
154 * @brief The color of the option when pressed.
155 * @details Name "popupPressedColor", type Vector4.
160 * @brief The image to use for the option when pressed.
161 * @details Name "popupPressedImage", type string.
166 * @brief The duration of the fade-in animation.
167 * @details Name "popupFadeInDuration", type float.
169 POPUP_FADE_IN_DURATION,
172 * @brief The duration of the fade-out animation.
173 * @details Name "popupFadeOutDuration", type float.
175 POPUP_FADE_OUT_DURATION,
178 * @brief The popup background can have a separate border with a different color.
179 * @details Name "backgroundBorder", type Property::Map.
187 * Create the TextSelectionPopup control.
188 * @param[in] callbackInterface The text popup callback interface which receives the button click callbacks.
189 * @return A handle to the TextSelectionPopup control.
191 static TextSelectionPopup New(TextSelectionPopupCallbackInterface* callbackInterface);
194 * @brief Creates an empty handle.
196 TextSelectionPopup();
199 * @brief Copy constructor.
201 * @param[in] handle The handle to copy from.
203 TextSelectionPopup(const TextSelectionPopup& handle);
206 * @brief Assignment operator.
208 * @param[in] handle The handle to copy from.
209 * @return A reference to this.
211 TextSelectionPopup& operator=(const TextSelectionPopup& handle);
216 * This is non-virtual since derived Handle types must not contain data or virtual methods.
218 ~TextSelectionPopup();
221 * @brief Downcast a handle to TextSelectionPopup.
223 * If the BaseHandle points is a TextSelectionPopup the downcast returns a valid handle.
224 * If not the returned handle is left empty.
226 * @param[in] handle Handle to an object
227 * @return handle to a TextSelectionPopup or an empty handle
229 static TextSelectionPopup DownCast(BaseHandle handle);
232 * @brief Specify which buttons to show in Popup
233 * @param[in] buttonsToEnable Buttons to enable
235 void EnableButtons(Toolkit::TextSelectionPopup::Buttons buttonsToEnable);
238 * @brief Raises the toolbar's actor above the given @e target actor.
240 * @param[in] target The actor to get above of.
242 void RaiseAbove(Actor target);
245 * @brief Show the Popup if not being shown
250 * @brief Hide the Popup if shown
254 public: // Not intended for application developers
256 * @brief Creates a handle using the Toolkit::Internal implementation.
258 * @param[in] implementation The Control implementation.
260 DALI_INTERNAL TextSelectionPopup(Internal::TextSelectionPopup& implementation);
263 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
265 * @param[in] internal A pointer to the internal CustomActor.
267 explicit DALI_INTERNAL TextSelectionPopup(Dali::Internal::CustomActor* internal);
269 }; // Class TextSelectionPopup
271 } // namespace Toolkit
275 #endif // DALI_TOOLKIT_TEXT_SELECTION_POPUP_H