Merge "Auto Scrolling Text Label" into 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  * @SINCE_1_0.0
44  */
45 class DALI_IMPORT_API TextLabel : public Control
46 {
47 public:
48
49   /**
50    * @brief The start and end property ranges for this control.
51    * @SINCE_1_0.0
52    */
53   enum PropertyRange
54   {
55     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_0.0
56     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserve property indices @SINCE_1_0.0
57   };
58
59   /**
60    * @brief An enumeration of properties belonging to the TextLabel class.
61    * @SINCE_1_0.0
62    */
63   struct Property
64   {
65     enum
66     {
67       RENDERING_BACKEND = PROPERTY_START_INDEX, ///< name "renderingBackend",     The type or rendering e.g. bitmap-based,          type INT @SINCE_1_0.0
68       TEXT,                                     ///< name "text",                 The text to display in UTF-8 format,              type STRING @SINCE_1_0.0
69       FONT_FAMILY,                              ///< name "fontFamily",           The requested font family,                        type STRING @SINCE_1_0.0
70       FONT_STYLE,                               ///< name "fontStyle",            The requested font style,                         type STRING @SINCE_1_0.0
71       POINT_SIZE,                               ///< name "pointSize",            The size of font in points,                       type FLOAT @SINCE_1_0.0
72       MULTI_LINE,                               ///< name "multiLine",            The single-line or multi-line layout option,      type BOOLEAN @SINCE_1_0.0
73       HORIZONTAL_ALIGNMENT,                     ///< name "horizontalAlignment",  The line horizontal alignment,                    type STRING,  values "BEGIN", "CENTER", "END" @SINCE_1_0.0
74       VERTICAL_ALIGNMENT,                       ///< name "verticalAlignment",    The line vertical alignment,                      type STRING,  values "TOP",   "CENTER", "BOTTOM" @SINCE_1_0.0
75       TEXT_COLOR,                               ///< name "textColor",            The text color,                                   type VECTOR4 @SINCE_1_0.0
76       SHADOW_OFFSET,                            ///< name "shadowOffset",         The drop shadow offset 0 indicates no shadow,     type VECTOR2 @SINCE_1_0.0
77       SHADOW_COLOR,                             ///< name "shadowColor",          The color of a drop shadow,                       type VECTOR4 @SINCE_1_0.0
78       UNDERLINE_ENABLED,                        ///< name "underlineEnabled",     The underline enabled flag,                       type BOOLEAN @SINCE_1_0.0
79       UNDERLINE_COLOR,                          ///< name "underlineColor",       The color of the underline,                       type VECTOR4 @SINCE_1_0.0
80       UNDERLINE_HEIGHT,                         ///< name "underlineHeight",      Overrides the underline height from font metrics, type FLOAT @SINCE_1_0.0
81       ENABLE_MARKUP,                            ///< name "enableMarkup",         Whether the mark-up processing is enabled.        type BOOLEAN @SINCE_1_0.0
82       ENABLE_AUTO_SCROLL,                       ///< name "enableAutoScroll",     Whether to start auto text scrolling              type BOOLEAN @SINCE_1_1.35
83       AUTO_SCROLL_SPEED,                        ///< name "autoScrollSpeed",      Speed at which text should auto scroll            type INT @SINCE_1_1.35
84       AUTO_SCROLL_LOOP_COUNT,                   ///< name "autoScrollLoopCount",  Number of times the text should scroll (loop)     type INT @SINCE_1_1.35
85       AUTO_SCROLL_GAP                           ///< name "autoScrollGap",        Gap before text wraps around when scrolling       type FLOAT @SINCE_1_1.35
86     };
87   };
88
89   /**
90    * @brief Create the TextLabel control.
91    *
92    * @SINCE_1_0.0
93    * @return A handle to the TextLabel control.
94    */
95   static TextLabel New();
96
97   /**
98    * @brief Create the TextLabel control.
99    *
100    * @SINCE_1_0.0
101    * @param[in] text The text to display.
102    * @return A handle to the TextLabel control.
103    */
104   static TextLabel New( const std::string& text );
105
106   /**
107    * @brief Creates an empty handle.
108    * @SINCE_1_0.0
109    */
110   TextLabel();
111
112   /**
113    * @brief Copy constructor.
114    *
115    * @SINCE_1_0.0
116    * @param[in] handle The handle to copy from.
117    */
118   TextLabel( const TextLabel& handle );
119
120   /**
121    * @brief Assignment operator.
122    *
123    * @SINCE_1_0.0
124    * @param[in] handle The handle to copy from.
125    * @return A reference to this.
126    */
127   TextLabel& operator=( const TextLabel& handle );
128
129   /**
130    * @brief Destructor
131    *
132    * This is non-virtual since derived Handle types must not contain data or virtual methods.
133    * @SINCE_1_0.0
134    */
135   ~TextLabel();
136
137   /**
138    * @brief Downcast a handle to TextLabel.
139    *
140    * If the BaseHandle points is a TextLabel the downcast returns a valid handle.
141    * If not the returned handle is left empty.
142    *
143    * @SINCE_1_0.0
144    * @param[in] handle Handle to an object
145    * @return handle to a TextLabel or an empty handle
146    */
147   static TextLabel DownCast( BaseHandle handle );
148
149 public: // Not intended for application developers
150
151   /**
152    * @brief Creates a handle using the Toolkit::Internal implementation.
153    *
154    * @SINCE_1_0.0
155    * @param[in] implementation The Control implementation.
156    */
157   DALI_INTERNAL TextLabel( Internal::TextLabel& implementation );
158
159   /**
160    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
161    *
162    * @SINCE_1_0.0
163    * @param[in]  internal  A pointer to the internal CustomActor.
164    */
165   explicit DALI_INTERNAL TextLabel( Dali::Internal::CustomActor* internal );
166 };
167
168 /**
169  * @}
170  */
171 } // namespace Toolkit
172
173 } // namespace Dali
174
175 #endif // __DALI_TOOLKIT_TEXT_LABEL_H__