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 | 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::SHADOW_OFFSET | shadowOffset | VECTOR2 | O | X |
57 * | Property::SHADOW_COLOR | shadowColor | VECTOR4 | O | X |
58 * | Property::UNDERLINE_ENABLED | underlineEnabled | BOOLEAN | O | X |
59 * | Property::UNDERLINE_COLOR | underlineColor | VECTOR4 | O | X |
60 * | Property::UNDERLINE_HEIGHT | underlineHeight | FLOAT | O | X |
61 * | Property::ENABLE_MARKUP | enableMarkup | BOOLEAN | O | X |
62 * | Property::ENABLE_AUTO_SCROLL | enableAutoScroll | BOOLEAN | O | X |
63 * | Property::AUTO_SCROLL_SPEED | autoScrollSpeed | INTEGER | O | X |
64 * | Property::AUTO_SCROLL_LOOP_COUNT | autoScrollLoopCount | INTEGER | O | X |
65 * | Property::AUTO_SCROLL_GAP | autoScrollGap | INTEGER | O | X |
69 class DALI_IMPORT_API TextLabel : public Control
74 * @brief The start and end property ranges for this control.
79 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
80 PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices @SINCE_1_0.0
84 * @brief An enumeration of properties belonging to the TextLabel class.
92 * @brief The type of rendering e.g. bitmap-based
93 * @details name "renderingBackend", type INT, default RENDERING_SHARED_ATLAS
96 RENDERING_BACKEND = PROPERTY_START_INDEX,
99 * @brief The text to display in UTF-8 format,
100 * @details name "text", type STRING
106 * @brief The requested font family to use,
107 * @details name "fontFamily", type STRING
113 * @brief The requested font style to use,
114 * @details name "fontStyle", type STRING
120 * @brief The size of font in points
121 * @details name "pointSize", type FLOAT
127 * @brief The single-line or multi-line layout option
128 * @details name "multiLine", type FLOAT, default SINGLE_LINE_BOX
134 * @brief The line horizontal alignment
135 * @details name "horizontalAlignment", type STRING, values "BEGIN", "CENTER", "END", default BEGIN
138 HORIZONTAL_ALIGNMENT,
141 * @brief The line vertical alignment
142 * @details name "verticalAlignment", type STRING, values "TOP", "CENTER", "BOTTOM" @SINCE_1_0.0, default TOP
148 * @brief The color of the text
149 * @details name "textColor", type VECTOR4
155 * @brief The drop shadow offset 0 indicates no shadow
156 * @details name "shadowOffset", type VECTOR4
162 * @brief The color of a drop shadow
163 * @details name "shadowColor", type VECTOR4
169 * @brief The underline enabled flag
170 * @details name "underlineEnabled", type BOOLEAN
176 * @brief The color of the underline
177 * @details name "underlineColor", type VECTOR4
183 * @brief Overrides the underline height from font metrics
184 * @details name "underlineHeight", type FLOAT
190 * @brief Whether the mark-up processing is enabled
191 * @details name "enableMarkup", type BOOLEAN
197 * @brief Start or stop auto scrolling,
198 * @details name "enableMarkup", type BOOLEAN, default is false
204 * @brief Start or stop auto scrolling,
205 * @details name "autoScrollSpeed", type INT, default in style sheet
211 * @brief Number of complete loops when scrolling enabled
212 * @details name "autoScrollLoopCount", type INT, default in style sheet
215 AUTO_SCROLL_LOOP_COUNT,
218 * @brief Gap before before scrolling wraps
219 * @details name "autoScrollGap", type INT, default in style sheet but can be overridden to prevent same text being show at start and end.
227 * @brief Create the TextLabel control.
230 * @return A handle to the TextLabel control.
232 static TextLabel New();
235 * @brief Create the TextLabel control.
238 * @param[in] text The text to display.
239 * @return A handle to the TextLabel control.
241 static TextLabel New( const std::string& text );
244 * @brief Creates an empty handle.
250 * @brief Copy constructor.
253 * @param[in] handle The handle to copy from.
255 TextLabel( const TextLabel& handle );
258 * @brief Assignment operator.
261 * @param[in] handle The handle to copy from.
262 * @return A reference to this.
264 TextLabel& operator=( const TextLabel& handle );
269 * This is non-virtual since derived Handle types must not contain data or virtual methods.
275 * @brief Downcast a handle to TextLabel.
277 * If the BaseHandle points is a TextLabel the downcast returns a valid handle.
278 * If not the returned handle is left empty.
281 * @param[in] handle Handle to an object
282 * @return handle to a TextLabel or an empty handle
284 static TextLabel DownCast( BaseHandle handle );
286 public: // Not intended for application developers
289 * @brief Creates a handle using the Toolkit::Internal implementation.
292 * @param[in] implementation The Control implementation.
294 DALI_INTERNAL TextLabel( Internal::TextLabel& implementation );
297 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
300 * @param[in] internal A pointer to the internal CustomActor.
302 explicit DALI_INTERNAL TextLabel( Dali::Internal::CustomActor* internal );
308 } // namespace Toolkit
312 #endif // __DALI_TOOLKIT_TEXT_LABEL_H__