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