[dali_2.3.19] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / text-controls / text-selection-toolbar.h
1 #ifndef DALI_TOOLKIT_TEXT_SELECTION_TOOLBAR_H
2 #define DALI_TOOLKIT_TEXT_SELECTION_TOOLBAR_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 namespace Internal DALI_INTERNAL
29 {
30 class TextSelectionToolbar;
31 }
32
33 /**
34  * @brief A control which provides a Popup with a number of buttons
35  *
36  * The style of the pop can be set through style sheets, this includes the images for the buttons
37  * A Show and Hide API is provided.
38  *
39  * If the buttons exceed the size constraints of the popup then it will offer scrolling.
40  *
41  *
42  */
43 class DALI_TOOLKIT_API TextSelectionToolbar : public Control
44 {
45 public:
46   /**
47    * @brief The start and end property ranges for this control.
48    */
49   enum PropertyRange
50   {
51     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
52     PROPERTY_END_INDEX   = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
53   };
54
55   /**
56    * @brief An enumeration of properties belonging to the TextSelectionToolbar class.
57    */
58   struct Property
59   {
60     enum
61     {
62       MAX_SIZE = PROPERTY_START_INDEX, ///< name "maxSize",                 The maximum size the Popup can be,              type VECTOR2
63       ENABLE_OVERSHOOT,                ///< name "enableOvershoot",         Whether the overshoot image is enabled,         type BOOLEAN
64       ENABLE_SCROLL_BAR,               ///< name "enableScrollBar",         Whether the scroll-bar is enabled,              type BOOLEAN
65       SCROLL_BAR_PADDING,              ///< name "scrollBarPadding",        The padding used to position the scroll bar,    type VECTOR2
66       SCROLL_VIEW,                     ///< name "scrollView",              Properties to set on scroll view                type Property::Map
67     };
68   };
69
70   /**
71    * Create the TextSelectionToolbar control.
72    * @return A handle to the TextSelectionToolbar control.
73    */
74   static TextSelectionToolbar New();
75
76   /**
77    * @brief Creates an empty handle.
78    */
79   TextSelectionToolbar();
80
81   /**
82    * @brief Copy constructor.
83    *
84    * @param[in] handle The handle to copy from.
85    */
86   TextSelectionToolbar(const TextSelectionToolbar& handle);
87
88   /**
89    * @brief Assignment operator.
90    *
91    * @param[in] handle The handle to copy from.
92    * @return A reference to this.
93    */
94   TextSelectionToolbar& operator=(const TextSelectionToolbar& handle);
95
96   /**
97    * @brief Destructor
98    *
99    * This is non-virtual since derived Handle types must not contain data or virtual methods.
100    */
101   ~TextSelectionToolbar();
102
103   /**
104    * @brief Add a option to the the Tool bar
105    * @param[in] option Option actor to add
106    */
107   void AddOption(Actor& option);
108
109   /**
110    * @brief Add a divider to the the Tool bar
111    * @param[in] divider Actor to be used as divider
112    */
113   void AddDivider(Actor& divider);
114
115   /**
116    *  @brief ResizeDividers
117    *  @param[in] size New size of dividers, provide 0 for height to automatically set height
118    */
119   void ResizeDividers(Size& size);
120
121   /**
122    * @brief Raises the actor above the given @e target actor.
123    *
124    * @param[in] target The actor to get above of.
125    */
126   void RaiseAbove(Actor target);
127
128   /**
129    * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2&)
130    */
131   void ScrollTo(const Vector2& position);
132
133   /**
134    * @brief Downcast a handle to TextSelectionToolbar.
135    *
136    * If the BaseHandle points is a TextSelectionToolbar the downcast returns a valid handle.
137    * If not the returned handle is left empty.
138    *
139    * @param[in] handle Handle to an object
140    * @return handle to a TextSelectionToolbar or an empty handle
141    */
142   static TextSelectionToolbar DownCast(BaseHandle handle);
143
144 public: // Not intended for application developers
145   /**
146    * @brief Creates a handle using the Toolkit::Internal implementation.
147    *
148    * @param[in] implementation The Control implementation.
149    */
150   DALI_INTERNAL TextSelectionToolbar(Internal::TextSelectionToolbar& implementation);
151
152   /**
153    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
154    *
155    * @param[in]  internal  A pointer to the internal CustomActor.
156    */
157   explicit DALI_INTERNAL TextSelectionToolbar(Dali::Internal::CustomActor* internal);
158
159 }; // Class TextSelectionToolbar
160
161 } // namespace Toolkit
162
163 } // namespace Dali
164
165 #endif // DALI_TOOLKIT_TEXT_SELECTION_TOOLBAR_H