[dali_1.2.52] Merge branch 'devel/master'
[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        *
123        * Conversion from Pixel size to Point size :
124        *  Point size = Pixel size * 72 / DPI
125        * @details name "pointSize", type FLOAT.
126        * @SINCE_1_0.0
127        */
128       POINT_SIZE,
129
130       /**
131        * @brief The single-line or multi-line layout option.
132        * @details name "multiLine", type BOOLEAN, default false.
133        * @SINCE_1_0.0
134        */
135       MULTI_LINE,
136
137       /**
138        * @brief The line horizontal alignment.
139        * @details name "horizontalAlignment", type STRING, values "BEGIN", "CENTER", "END", default BEGIN.
140        * @SINCE_1_0.0
141        */
142       HORIZONTAL_ALIGNMENT,
143
144       /**
145        * @brief The line vertical alignment.
146        * @details name "verticalAlignment", type STRING,  values "TOP",   "CENTER", "BOTTOM" @SINCE_1_0.0, default TOP.
147        * @SINCE_1_0.0
148        */
149       VERTICAL_ALIGNMENT,
150
151       /**
152        * @brief The color of the text.
153        * @details name "textColor", type VECTOR4.
154        * @SINCE_1_0.0
155        */
156       TEXT_COLOR,
157
158       /**
159        * @DEPRECATED_1_1.37 Use SHADOW instead
160        * @brief The drop shadow offset 0 indicates no shadow.
161        * @details name "shadowOffset", type VECTOR2.
162        */
163       SHADOW_OFFSET,
164
165       /**
166        * @DEPRECATED_1_1.37 Use SHADOW instead
167        * @brief The color of a drop shadow.
168        * @details name "shadowColor", type VECTOR4
169        */
170       SHADOW_COLOR,
171
172       /**
173        * @DEPRECATED_1_1.37 Use UNDERLINE instead
174        * @brief The underline enabled flag.
175        * @details name "underlineEnabled", type BOOLEAN.
176        */
177       UNDERLINE_ENABLED,
178
179       /**
180        * @DEPRECATED_1_1.37 Use UNDERLINE instead
181        * @brief The color of the underline.
182        * @details name "underlineColor", type VECTOR4.
183        */
184       UNDERLINE_COLOR,
185
186       /**
187        * @DEPRECATED_1_1.37 Use UNDERLINE instead
188        * @brief Overrides the underline height from font metrics.
189        * @details name "underlineHeight", type FLOAT.
190        */
191       UNDERLINE_HEIGHT,
192
193       /**
194        * @brief Whether the mark-up processing is enabled.
195        * @details name "enableMarkup", type BOOLEAN.
196        * @SINCE_1_0.0
197        */
198       ENABLE_MARKUP,
199
200       /**
201        * @brief Starts or stops auto scrolling.
202        * @details name "enableAutoScroll", type BOOLEAN, default is false.
203        * @SINCE_1_1.35
204        */
205       ENABLE_AUTO_SCROLL,
206
207       /**
208        * @brief Sets the speed of scrolling in pixels per second.
209        * @details name "autoScrollSpeed", type INT, default in style sheet.
210        * @SINCE_1_1.35
211        */
212       AUTO_SCROLL_SPEED,
213
214       /**
215        * @brief Number of complete loops when scrolling enabled.
216        * @details name "autoScrollLoopCount", type INT, default in style sheet.
217        * @SINCE_1_1.35
218        */
219       AUTO_SCROLL_LOOP_COUNT,
220
221       /**
222        * @brief Gap before scrolling wraps.
223        * @details name "autoScrollGap", type INT, default in style sheet but can be overridden to prevent same text being shown at start and end.
224        * @SINCE_1_1.35
225        */
226       AUTO_SCROLL_GAP,
227
228       /**
229        * @brief The default extra space between lines in points.
230        * @details name "lineSpacing", type FLOAT.
231        * @SINCE_1_1.37
232        */
233       LINE_SPACING,
234
235       /**
236        * @brief The default underline parameters.
237        * @details name "underline", type MAP.
238        * @SINCE_1_2.13
239        */
240       UNDERLINE,
241
242       /**
243        * @brief The default shadow parameters.
244        * @details name "shadow", type MAP.
245        * @SINCE_1_2.13
246        */
247       SHADOW,
248
249       /**
250        * @brief The default emboss parameters.
251        * @details name "emboss", type MAP.
252        * @SINCE_1_2.13
253        */
254       EMBOSS,
255
256       /**
257        * @brief The default outline parameters.
258        * @details name "outline", type MAP.
259        * @SINCE_1_2.13
260        */
261       OUTLINE,
262     };
263   };
264
265   /**
266    * @brief Creates the TextLabel control.
267    *
268    * @SINCE_1_0.0
269    * @return A handle to the TextLabel control
270    */
271   static TextLabel New();
272
273   /**
274    * @brief Creates the TextLabel control.
275    *
276    * @SINCE_1_0.0
277    * @param[in] text The text to display
278    * @return A handle to the TextLabel control
279    */
280   static TextLabel New( const std::string& text );
281
282   /**
283    * @brief Creates an empty handle.
284    * @SINCE_1_0.0
285    */
286   TextLabel();
287
288   /**
289    * @brief Copy constructor.
290    *
291    * @SINCE_1_0.0
292    * @param[in] handle The handle to copy from
293    */
294   TextLabel( const TextLabel& handle );
295
296   /**
297    * @brief Assignment operator.
298    *
299    * @SINCE_1_0.0
300    * @param[in] handle The handle to copy from
301    * @return A reference to this
302    */
303   TextLabel& operator=( const TextLabel& handle );
304
305   /**
306    * @brief Destructor.
307    *
308    * This is non-virtual since derived Handle types must not contain data or virtual methods.
309    * @SINCE_1_0.0
310    */
311   ~TextLabel();
312
313   /**
314    * @brief Downcasts a handle to TextLabel.
315    *
316    * If the BaseHandle points is a TextLabel, the downcast returns a valid handle.
317    * If not, the returned handle is left empty.
318    *
319    * @SINCE_1_0.0
320    * @param[in] handle Handle to an object
321    * @return Handle to a TextLabel or an empty handle
322    */
323   static TextLabel DownCast( BaseHandle handle );
324
325 public: // Not intended for application developers
326
327   /// @cond internal
328   /**
329    * @brief Creates a handle using the Toolkit::Internal implementation.
330    *
331    * @SINCE_1_0.0
332    * @param[in] implementation The Control implementation
333    */
334   DALI_INTERNAL TextLabel( Internal::TextLabel& implementation );
335
336   /**
337    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
338    *
339    * @SINCE_1_0.0
340    * @param[in] internal A pointer to the internal CustomActor
341    */
342   explicit DALI_INTERNAL TextLabel( Dali::Internal::CustomActor* internal );
343   /// @endcond
344 };
345
346 /**
347  * @}
348  */
349 } // namespace Toolkit
350
351 } // namespace Dali
352
353 #endif // __DALI_TOOLKIT_TEXT_LABEL_H__