Add callbacks for form repost decision and frame rendering.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / text-controls / text-selection-popup.h
1 #ifndef DALI_TOOLKIT_TEXT_SELECTION_POPUP_H
2 #define DALI_TOOLKIT_TEXT_SELECTION_POPUP_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 class TextSelectionPopupCallbackInterface;
29
30 namespace Internal DALI_INTERNAL
31 {
32 class TextSelectionPopup;
33 }
34
35 /**
36  * @brief A control which provides a Popup with a number of buttons
37  *
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.
40  *
41  * If the buttons exceed the size constraints of the popup then it will offer scrolling.
42  *
43  *
44  */
45 class DALI_TOOLKIT_API TextSelectionPopup : public Control
46 {
47 public:
48   enum Buttons
49   {
50     CUT        = 1u << 0,
51     COPY       = 1u << 1,
52     PASTE      = 1u << 2,
53     SELECT     = 1u << 3,
54     SELECT_ALL = 1u << 4,
55     CLIPBOARD  = 1u << 5,
56     NONE       = 1u << 6,
57   };
58
59   /**
60    * @brief The start and end property ranges for this control.
61    */
62   enum PropertyRange
63   {
64     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
65     PROPERTY_END_INDEX   = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
66   };
67
68   /**
69    * @brief An enumeration of properties belonging to the TextSelectionPopup class.
70    */
71   struct Property
72   {
73     enum
74     {
75       /**
76        * @brief The maximum size the Popup can be.
77        * @details Name "popupMaxSize", type Vector2.
78        */
79       POPUP_MAX_SIZE = PROPERTY_START_INDEX,
80
81       /**
82        * @brief The minimum size the Popup can be.
83        * @details Name "popupMinSize", type Vector2.
84        */
85       POPUP_MIN_SIZE,
86
87       /**
88        * @brief The maximum size an option can be.
89        * @details Name "optionMaxSize", type Vector2.
90        */
91       OPTION_MAX_SIZE,
92
93       /**
94        * @brief The minimum size an option can be.
95        * @details Name "optionMinSize", type Vector2.
96        */
97       OPTION_MIN_SIZE,
98
99       /**
100        * @brief The size of the divider between options.
101        * @details Name "optionDividerSize", type Vector2.
102        */
103       OPTION_DIVIDER_SIZE,
104
105       /**
106        * @brief The image to use as the popup clipboard icon.
107        * @details Name "popupClipboardButtonImage", type string.
108        */
109       POPUP_CLIPBOARD_BUTTON_ICON_IMAGE,
110
111       /**
112        * @brief The image to use as the popup cut icon.
113        * @details Name "popupCutButtonImage", type string.
114        */
115       POPUP_CUT_BUTTON_ICON_IMAGE,
116
117       /**
118        * @brief The image to use as the popup copy icon.
119        * @details Name "popupCopyButtonImage", type string.
120        */
121       POPUP_COPY_BUTTON_ICON_IMAGE,
122
123       /**
124        * @brief The image to use as the popup paste icon.
125        * @details Name "popupPasteButtonImage", type string.
126        */
127       POPUP_PASTE_BUTTON_ICON_IMAGE,
128
129       /**
130        * @brief The image to use as the popup select icon.
131        * @details Name "popupSelectButtonImage", type string.
132        */
133       POPUP_SELECT_BUTTON_ICON_IMAGE,
134
135       /**
136        * @brief The image to use as the popup select all icon.
137        * @details Name "popupSelectAllButtonImage", type string.
138        */
139       POPUP_SELECT_ALL_BUTTON_ICON_IMAGE,
140
141       /**
142        * @brief The color of the divider between options.
143        * @details Name "popupDividerColor", type Vector4.
144        */
145       POPUP_DIVIDER_COLOR,
146
147       /**
148        * @brief The color of the icons (if supplied).
149        * @details Name "popupIconColor", type Vector4.
150        */
151       POPUP_ICON_COLOR,
152
153       /**
154        * @brief The color of the option when pressed.
155        * @details Name "popupPressedColor", type Vector4.
156        */
157       POPUP_PRESSED_COLOR,
158
159       /**
160        * @brief The image to use for the option when pressed.
161        * @details Name "popupPressedImage", type string.
162        */
163       POPUP_PRESSED_IMAGE,
164
165       /**
166        * @brief The duration of the fade-in animation.
167        * @details Name "popupFadeInDuration", type float.
168        */
169       POPUP_FADE_IN_DURATION,
170
171       /**
172        * @brief The duration of the fade-out animation.
173        * @details Name "popupFadeOutDuration", type float.
174        */
175       POPUP_FADE_OUT_DURATION,
176
177       /**
178        * @brief The popup background can have a separate border with a different color.
179        * @details Name "backgroundBorder", type Property::Map.
180        * @note Optional.
181        */
182       BACKGROUND_BORDER
183     };
184   };
185
186   /**
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.
190    */
191   static TextSelectionPopup New(TextSelectionPopupCallbackInterface* callbackInterface);
192
193   /**
194    * @brief Creates an empty handle.
195    */
196   TextSelectionPopup();
197
198   /**
199    * @brief Copy constructor.
200    *
201    * @param[in] handle The handle to copy from.
202    */
203   TextSelectionPopup(const TextSelectionPopup& handle);
204
205   /**
206    * @brief Assignment operator.
207    *
208    * @param[in] handle The handle to copy from.
209    * @return A reference to this.
210    */
211   TextSelectionPopup& operator=(const TextSelectionPopup& handle);
212
213   /**
214    * @brief Destructor
215    *
216    * This is non-virtual since derived Handle types must not contain data or virtual methods.
217    */
218   ~TextSelectionPopup();
219
220   /**
221    * @brief Downcast a handle to TextSelectionPopup.
222    *
223    * If the BaseHandle points is a TextSelectionPopup the downcast returns a valid handle.
224    * If not the returned handle is left empty.
225    *
226    * @param[in] handle Handle to an object
227    * @return handle to a TextSelectionPopup or an empty handle
228    */
229   static TextSelectionPopup DownCast(BaseHandle handle);
230
231   /**
232    * @brief Specify which buttons to show in Popup
233    * @param[in] buttonsToEnable Buttons to enable
234    */
235   void EnableButtons(Toolkit::TextSelectionPopup::Buttons buttonsToEnable);
236
237   /**
238    * @brief Raises the toolbar's actor above the given @e target actor.
239    *
240    * @param[in] target The actor to get above of.
241    */
242   void RaiseAbove(Actor target);
243
244   /**
245    * @brief Show the Popup if not being shown
246    */
247   void ShowPopup();
248
249   /**
250    * @brief Hide the Popup if shown
251    */
252   void HidePopup();
253
254 public: // Not intended for application developers
255   /**
256    * @brief Creates a handle using the Toolkit::Internal implementation.
257    *
258    * @param[in] implementation The Control implementation.
259    */
260   DALI_INTERNAL TextSelectionPopup(Internal::TextSelectionPopup& implementation);
261
262   /**
263    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
264    *
265    * @param[in]  internal  A pointer to the internal CustomActor.
266    */
267   explicit DALI_INTERNAL TextSelectionPopup(Dali::Internal::CustomActor* internal);
268
269 }; // Class TextSelectionPopup
270
271 } // namespace Toolkit
272
273 } // namespace Dali
274
275 #endif // DALI_TOOLKIT_TEXT_SELECTION_POPUP_H