1 #ifndef __DALI_TOOLKIT_TEXT_LABEL_H__
2 #define __DALI_TOOLKIT_TEXT_LABEL_H__
5 * Copyright (c) 2015 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>
30 namespace Internal DALI_INTERNAL
35 * @addtogroup dali_toolkit_controls_text_controls
40 * @brief A control which renders a short text string.
42 * Text labels are lightweight, non-editable and do not respond to user input.
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 |
66 class DALI_IMPORT_API TextLabel : public Control
71 * @brief The start and end property ranges for this control.
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
81 * @brief An enumeration of properties belonging to the TextLabel class.
87 * @brief An enumeration of properties belonging to the TextLabel class.
93 * @brief The type of rendering e.g. bitmap-based
94 * @details name "renderingBackend", type INT, default RENDERING_SHARED_ATLAS
97 RENDERING_BACKEND = PROPERTY_START_INDEX,
100 * @brief The text to display in UTF-8 format,
101 * @details name "text", type STRING
107 * @brief The requested font family to use,
108 * @details name "fontFamily", type STRING
114 * @brief The requested font style to use,
115 * @details name "fontStyle", type STRING or MAP
121 * @brief The size of font in points
122 * @details name "pointSize", type FLOAT
128 * @brief The single-line or multi-line layout option
129 * @details name "multiLine", type BOOLEAN, default false
135 * @brief The line horizontal alignment
136 * @details name "horizontalAlignment", type STRING, values "BEGIN", "CENTER", "END", default BEGIN
139 HORIZONTAL_ALIGNMENT,
142 * @brief The line vertical alignment
143 * @details name "verticalAlignment", type STRING, values "TOP", "CENTER", "BOTTOM" @SINCE_1_0.0, default TOP
149 * @brief The color of the text
150 * @details name "textColor", type VECTOR4
156 * @brief The drop shadow offset 0 indicates no shadow
157 * @details name "shadowOffset", type VECTOR2
158 * @DEPRECATED_1_1.37 Use SHADOW instead
163 * @brief The color of a drop shadow
164 * @details name "shadowColor", type VECTOR4
165 * @DEPRECATED_1_1.37 Use SHADOW instead
170 * @brief The underline enabled flag
171 * @details name "underlineEnabled", type BOOLEAN
172 * @DEPRECATED_1_1.37 Use UNDERLINE instead
177 * @brief The color of the underline
178 * @details name "underlineColor", type VECTOR4
179 * @DEPRECATED_1_1.37 Use UNDERLINE instead
184 * @brief Overrides the underline height from font metrics
185 * @details name "underlineHeight", type FLOAT
186 * @DEPRECATED_1_1.37 Use UNDERLINE instead
191 * @brief Whether the mark-up processing is enabled
192 * @details name "enableMarkup", type BOOLEAN
198 * @brief Start or stop auto scrolling,
199 * @details name "enableAutoScroll", type BOOLEAN, default is false
205 * @brief Sets the speed of scrolling in pixels per second,
206 * @details name "autoScrollSpeed", type INT, default in style sheet
212 * @brief Number of complete loops when scrolling enabled
213 * @details name "autoScrollLoopCount", type INT, default in style sheet
216 AUTO_SCROLL_LOOP_COUNT,
219 * @brief Gap before before scrolling wraps
220 * @details name "autoScrollGap", type INT, default in style sheet but can be overridden to prevent same text being show at start and end.
226 * @brief The default extra space between lines in points.
227 * @details name "lineSpacing", type FLOAT.
233 * @brief The default underline parameters.
234 * @details name "underline", type MAP.
240 * @brief The default shadow parameters.
241 * @details name "shadow", type MAP.
247 * @brief The default emboss parameters.
248 * @details name "emboss", type MAP.
254 * @brief The default outline parameters.
255 * @details name "outline", type MAP.
263 * @brief Create the TextLabel control.
266 * @return A handle to the TextLabel control.
268 static TextLabel New();
271 * @brief Create the TextLabel control.
274 * @param[in] text The text to display.
275 * @return A handle to the TextLabel control.
277 static TextLabel New( const std::string& text );
280 * @brief Creates an empty handle.
286 * @brief Copy constructor.
289 * @param[in] handle The handle to copy from.
291 TextLabel( const TextLabel& handle );
294 * @brief Assignment operator.
297 * @param[in] handle The handle to copy from.
298 * @return A reference to this.
300 TextLabel& operator=( const TextLabel& handle );
305 * This is non-virtual since derived Handle types must not contain data or virtual methods.
311 * @brief Downcast a handle to TextLabel.
313 * If the BaseHandle points is a TextLabel the downcast returns a valid handle.
314 * If not the returned handle is left empty.
317 * @param[in] handle Handle to an object
318 * @return handle to a TextLabel or an empty handle
320 static TextLabel DownCast( BaseHandle handle );
322 public: // Not intended for application developers
326 * @brief Creates a handle using the Toolkit::Internal implementation.
329 * @param[in] implementation The Control implementation.
331 DALI_INTERNAL TextLabel( Internal::TextLabel& implementation );
334 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
337 * @param[in] internal A pointer to the internal CustomActor.
339 explicit DALI_INTERNAL TextLabel( Dali::Internal::CustomActor* internal );
346 } // namespace Toolkit
350 #endif // __DALI_TOOLKIT_TEXT_LABEL_H__