DALi Version 1.2.45
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / text-controls / text-label.h
1 #ifndef __DALI_TOOLKIT_TEXT_LABEL_H__
2 #define __DALI_TOOLKIT_TEXT_LABEL_H__
3
4 /*
5  * Copyright (c) 2015 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
27 namespace Toolkit
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 class TextLabel;
33 }
34 /**
35  * @addtogroup dali_toolkit_controls_text_controls
36  * @{
37  */
38
39 /**
40  * @brief A control which renders a short text string.
41  *
42  * Text labels are lightweight, non-editable and do not respond to user input.
43  *
44  * @section TextLabelProperties Properties
45  * |%Property enum                    |String name          |Type            |Writable|Animatable|
46  * |----------------------------------|---------------------|----------------|--------|----------|
47  * | Property::RENDERING_BACKEND      | renderingBackend    |  INTEGER       | O      | X        |
48  * | Property::TEXT                   | text                |  STRING        | O      | X        |
49  * | Property::FONT_FAMILY            | fontFamily          |  STRING        | O      | X        |
50  * | Property::FONT_STYLE             | fontStyle           |  STRING or MAP | O      | X        |
51  * | Property::POINT_SIZE             | pointSize           |  FLOAT         | O      | X        |
52  * | Property::MULTI_LINE             | multiLine           |  BOOLEAN       | O      | X        |
53  * | Property::HORIZONTAL_ALIGNMENT   | horizontalAlignment |  STRING        | O      | X        |
54  * | Property::VERTICAL_ALIGNMENT     | verticalAlignment   |  STRING        | O      | X        |
55  * | Property::TEXT_COLOR             | textColor           |  VECTOR4       | O      | X        |
56  * | Property::ENABLE_MARKUP          | enableMarkup        |  BOOLEAN       | O      | X        |
57  * | Property::ENABLE_AUTO_SCROLL     | enableAutoScroll    |  BOOLEAN       | O      | X        |
58  * | Property::AUTO_SCROLL_SPEED      | autoScrollSpeed     |  INTEGER       | O      | X        |
59  * | Property::AUTO_SCROLL_LOOP_COUNT | autoScrollLoopCount |  INTEGER       | O      | X        |
60  * | Property::AUTO_SCROLL_GAP        | autoScrollGap       |  INTEGER       | O      | X        |
61  * | Property::SHADOW                 | shadow              |  STRING or MAP | O      | X        |
62  * | Property::UNDERLINE              | underline           |  STRING or MAP | O      | X        |
63  *
64  * @SINCE_1_0.0
65  */
66 class DALI_IMPORT_API TextLabel : public Control
67 {
68 public:
69
70   /**
71    * @brief Enumeration for the start and end property ranges for this control.
72    * @SINCE_1_0.0
73    */
74   enum PropertyRange
75   {
76     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
77     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices @SINCE_1_0.0
78   };
79
80   /**
81    * @brief Enumeration for the instance of properties belonging to the TextLabel class.
82    * @SINCE_1_0.0
83    */
84   struct Property
85   {
86     /**
87      * @brief Enumeration for the instance of properties belonging to the TextLabel class.
88      * @SINCE_1_0.0
89      */
90     enum
91     {
92       /**
93        * @brief The type of rendering e.g. bitmap-based.
94        * @details name "renderingBackend", type INT, default RENDERING_SHARED_ATLAS.
95        * @SINCE_1_0.0
96        */
97       RENDERING_BACKEND = PROPERTY_START_INDEX,
98
99       /**
100        * @brief The text to display in UTF-8 format.
101        * @details name "text", type STRING.
102        * @SINCE_1_0.0
103        */
104       TEXT,
105
106       /**
107        * @brief The requested font family to use.
108        * @details name "fontFamily", type STRING.
109        * @SINCE_1_0.0
110        */
111       FONT_FAMILY,
112
113       /**
114        * @brief The requested font style to use.
115        * @details name "fontStyle", type STRING or MAP.
116        * @SINCE_1_2.13
117        */
118       FONT_STYLE,
119
120       /**
121        * @brief The size of font in points.
122        * @details name "pointSize", type FLOAT.
123        * @SINCE_1_0.0
124        */
125       POINT_SIZE,
126
127       /**
128        * @brief The single-line or multi-line layout option.
129        * @details name "multiLine", type BOOLEAN, default false.
130        * @SINCE_1_0.0
131        */
132       MULTI_LINE,
133
134       /**
135        * @brief The line horizontal alignment.
136        * @details name "horizontalAlignment", type STRING, values "BEGIN", "CENTER", "END", default BEGIN.
137        * @SINCE_1_0.0
138        */
139       HORIZONTAL_ALIGNMENT,
140
141       /**
142        * @brief The line vertical alignment.
143        * @details name "verticalAlignment", type STRING,  values "TOP",   "CENTER", "BOTTOM" @SINCE_1_0.0, default TOP.
144        * @SINCE_1_0.0
145        */
146       VERTICAL_ALIGNMENT,
147
148       /**
149        * @brief The color of the text.
150        * @details name "textColor", type VECTOR4.
151        * @SINCE_1_0.0
152        */
153       TEXT_COLOR,
154
155       /**
156        * @DEPRECATED_1_1.37 Use SHADOW instead
157        * @brief The drop shadow offset 0 indicates no shadow.
158        * @details name "shadowOffset", type VECTOR2.
159        */
160       SHADOW_OFFSET,
161
162       /**
163        * @DEPRECATED_1_1.37 Use SHADOW instead
164        * @brief The color of a drop shadow.
165        * @details name "shadowColor", type VECTOR4
166        */
167       SHADOW_COLOR,
168
169       /**
170        * @DEPRECATED_1_1.37 Use UNDERLINE instead
171        * @brief The underline enabled flag.
172        * @details name "underlineEnabled", type BOOLEAN.
173        */
174       UNDERLINE_ENABLED,
175
176       /**
177        * @DEPRECATED_1_1.37 Use UNDERLINE instead
178        * @brief The color of the underline.
179        * @details name "underlineColor", type VECTOR4.
180        */
181       UNDERLINE_COLOR,
182
183       /**
184        * @DEPRECATED_1_1.37 Use UNDERLINE instead
185        * @brief Overrides the underline height from font metrics.
186        * @details name "underlineHeight", type FLOAT.
187        */
188       UNDERLINE_HEIGHT,
189
190       /**
191        * @brief Whether the mark-up processing is enabled.
192        * @details name "enableMarkup", type BOOLEAN.
193        * @SINCE_1_0.0
194        */
195       ENABLE_MARKUP,
196
197       /**
198        * @brief Starts or stops auto scrolling.
199        * @details name "enableAutoScroll", type BOOLEAN, default is false.
200        * @SINCE_1_1.35
201        */
202       ENABLE_AUTO_SCROLL,
203
204       /**
205        * @brief Sets the speed of scrolling in pixels per second.
206        * @details name "autoScrollSpeed", type INT, default in style sheet.
207        * @SINCE_1_1.35
208        */
209       AUTO_SCROLL_SPEED,
210
211       /**
212        * @brief Number of complete loops when scrolling enabled.
213        * @details name "autoScrollLoopCount", type INT, default in style sheet.
214        * @SINCE_1_1.35
215        */
216       AUTO_SCROLL_LOOP_COUNT,
217
218       /**
219        * @brief Gap before scrolling wraps.
220        * @details name "autoScrollGap", type INT, default in style sheet but can be overridden to prevent same text being shown at start and end.
221        * @SINCE_1_1.35
222        */
223       AUTO_SCROLL_GAP,
224
225       /**
226        * @brief The default extra space between lines in points.
227        * @details name "lineSpacing", type FLOAT.
228        * @SINCE_1_1.37
229        */
230       LINE_SPACING,
231
232       /**
233        * @brief The default underline parameters.
234        * @details name "underline", type MAP.
235        * @SINCE_1_2.13
236        */
237       UNDERLINE,
238
239       /**
240        * @brief The default shadow parameters.
241        * @details name "shadow", type MAP.
242        * @SINCE_1_2.13
243        */
244       SHADOW,
245
246       /**
247        * @brief The default emboss parameters.
248        * @details name "emboss", type MAP.
249        * @SINCE_1_2.13
250        */
251       EMBOSS,
252
253       /**
254        * @brief The default outline parameters.
255        * @details name "outline", type MAP.
256        * @SINCE_1_2.13
257        */
258       OUTLINE,
259     };
260   };
261
262   /**
263    * @brief Creates the TextLabel control.
264    *
265    * @SINCE_1_0.0
266    * @return A handle to the TextLabel control
267    */
268   static TextLabel New();
269
270   /**
271    * @brief Creates the TextLabel control.
272    *
273    * @SINCE_1_0.0
274    * @param[in] text The text to display
275    * @return A handle to the TextLabel control
276    */
277   static TextLabel New( const std::string& text );
278
279   /**
280    * @brief Creates an empty handle.
281    * @SINCE_1_0.0
282    */
283   TextLabel();
284
285   /**
286    * @brief Copy constructor.
287    *
288    * @SINCE_1_0.0
289    * @param[in] handle The handle to copy from
290    */
291   TextLabel( const TextLabel& handle );
292
293   /**
294    * @brief Assignment operator.
295    *
296    * @SINCE_1_0.0
297    * @param[in] handle The handle to copy from
298    * @return A reference to this
299    */
300   TextLabel& operator=( const TextLabel& handle );
301
302   /**
303    * @brief Destructor.
304    *
305    * This is non-virtual since derived Handle types must not contain data or virtual methods.
306    * @SINCE_1_0.0
307    */
308   ~TextLabel();
309
310   /**
311    * @brief Downcasts a handle to TextLabel.
312    *
313    * If the BaseHandle points is a TextLabel, the downcast returns a valid handle.
314    * If not, the returned handle is left empty.
315    *
316    * @SINCE_1_0.0
317    * @param[in] handle Handle to an object
318    * @return Handle to a TextLabel or an empty handle
319    */
320   static TextLabel DownCast( BaseHandle handle );
321
322 public: // Not intended for application developers
323
324   /// @cond internal
325   /**
326    * @brief Creates a handle using the Toolkit::Internal implementation.
327    *
328    * @SINCE_1_0.0
329    * @param[in] implementation The Control implementation
330    */
331   DALI_INTERNAL TextLabel( Internal::TextLabel& implementation );
332
333   /**
334    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
335    *
336    * @SINCE_1_0.0
337    * @param[in] internal A pointer to the internal CustomActor
338    */
339   explicit DALI_INTERNAL TextLabel( Dali::Internal::CustomActor* internal );
340   /// @endcond
341 };
342
343 /**
344  * @}
345  */
346 } // namespace Toolkit
347
348 } // namespace Dali
349
350 #endif // __DALI_TOOLKIT_TEXT_LABEL_H__