04ec99312ca583754cf7560b059d9dda16fe44ee
[platform/core/uifw/dali-toolkit.git] / base / 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 #include <dali-toolkit/public-api/text/rendering/text-renderer.h>
24
25 namespace Dali
26 {
27
28 namespace Toolkit
29 {
30
31 namespace Internal DALI_INTERNAL
32 {
33 class TextLabel;
34 }
35
36 /**
37  * @brief A control which renders a short text string.
38  */
39 class DALI_IMPORT_API TextLabel : public Control
40 {
41 public:
42
43   // Property indices
44   static const Property::Index PROPERTY_TEXT; ///< name "text", type STRING
45
46   // Property names
47   static const std::string TEXT_PROPERTY_NAME; ///< Property, name "text", type STRING
48
49   /**
50    * Create the TextLabel control.
51    * @return A handle to the TextLabel control.
52    */
53   static TextLabel New();
54
55   /**
56    * @brief Creates an empty handle.
57    */
58   TextLabel();
59
60   /**
61    * @brief Copy constructor.
62    *
63    * @param[in] handle The handle to copy from.
64    */
65   TextLabel( const TextLabel& handle );
66
67   /**
68    * @brief Assignment operator.
69    *
70    * @param[in] handle The handle to copy from.
71    * @return A reference to this.
72    */
73   TextLabel& operator=( const TextLabel& handle );
74
75   /**
76    * @brief Destructor
77    *
78    * This is non-virtual since derived Handle types must not contain data or virtual methods.
79    */
80   ~TextLabel();
81
82   /**
83    * @brief Downcast a handle to TextLabel.
84    *
85    * If the BaseHandle points is a TextLabel the downcast returns a valid handle.
86    * If not the returned handle is left empty.
87    *
88    * @param[in] handle Handle to an object
89    * @return handle to a TextLabel or an empty handle
90    */
91   static TextLabel DownCast( BaseHandle handle );
92
93   /**
94    * @brief Set the rendering back-end used by the TextLabel.
95    *
96    * @param[in] renderer The text renderer to use.
97    */
98   void SetRenderer( Text::RendererPtr renderer );
99
100 public: // Not intended for application developers
101
102   /**
103    * @brief Creates a handle using the Toolkit::Internal implementation.
104    *
105    * @param[in] implementation The Control implementation.
106    */
107   DALI_INTERNAL TextLabel( Internal::TextLabel& implementation );
108
109   /**
110    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
111    *
112    * @param[in]  internal  A pointer to the internal CustomActor.
113    */
114   explicit DALI_INTERNAL TextLabel( Dali::Internal::CustomActor* internal );
115 };
116
117 } // namespace Toolkit
118
119 } // namespace Dali
120
121 #endif // __DALI_TOOLKIT_TEXT_LABEL_H__