Merge "Added code for stylable transitions" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-label-impl.h
1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H
3
4 /*
5  * Copyright (c) 2016 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-impl.h>
23 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
24 #include <dali-toolkit/internal/text/text-control-interface.h>
25 #include <dali-toolkit/internal/visuals/text/text-visual.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Internal
34 {
35
36 /**
37  * @brief A control which renders a short text string.
38  */
39 class TextLabel : public Control, public Text::ControlInterface
40 {
41 public:
42
43   /**
44    * @copydoc Dali::Toollkit::TextLabel::New()
45    */
46   static Toolkit::TextLabel New();
47
48   // Properties
49
50   /**
51    * @brief Called when a property of an object of this type is set.
52    *
53    * @param[in] object The object whose property is set.
54    * @param[in] index The property index.
55    * @param[in] value The new property value.
56    */
57   static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
58
59   /**
60    * @brief Called to retrieve a property of an object of this type.
61    *
62    * @param[in] object The object whose property is to be retrieved.
63    * @param[in] index The property index.
64    * @return The current value of the property.
65    */
66   static Property::Value GetProperty( BaseObject* object, Property::Index index );
67
68 private: // From Control
69
70   /**
71    * @copydoc Control::OnInitialize()
72    */
73   virtual void OnInitialize();
74
75   /**
76    * @copydoc Control::OnStyleChange()
77    */
78   virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
79
80   /**
81    * @copydoc Control::OnRelayout()
82    */
83   virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
84
85   /**
86    * @copydoc Control::GetNaturalSize()
87    */
88   virtual Vector3 GetNaturalSize();
89
90   /**
91    * @copydoc Control::GetHeightForWidth()
92    */
93   virtual float GetHeightForWidth( float width );
94
95   /**
96    * @copydoc Control::OnStageConnection()
97    */
98   virtual void OnStageConnection( int depth );
99
100 // From ControlInterface
101
102   /**
103    * @copydoc Text::ControlInterface::RequestTextRelayout()
104    */
105   virtual void RequestTextRelayout();
106
107 private: // Implementation
108
109   /**
110    * Construct a new TextLabel.
111    */
112   TextLabel();
113
114   /**
115    * A reference counted object may only be deleted by calling Unreference()
116    */
117   virtual ~TextLabel();
118
119 private:
120
121   // Undefined copy constructor and assignment operators
122   TextLabel(const TextLabel&);
123   TextLabel& operator=(const TextLabel& rhs);
124
125 private: // Data
126
127   Toolkit::Visual::Base mVisual;
128 };
129
130 } // namespace Internal
131
132 // Helpers for public-api forwarding methods
133
134 inline Toolkit::Internal::TextLabel& GetImpl( Toolkit::TextLabel& textLabel )
135 {
136   DALI_ASSERT_ALWAYS(textLabel);
137
138   Dali::RefObject& handle = textLabel.GetImplementation();
139
140   return static_cast<Toolkit::Internal::TextLabel&>(handle);
141 }
142
143 inline const Toolkit::Internal::TextLabel& GetImpl( const Toolkit::TextLabel& textLabel )
144 {
145   DALI_ASSERT_ALWAYS(textLabel);
146
147   const Dali::RefObject& handle = textLabel.GetImplementation();
148
149   return static_cast<const Toolkit::Internal::TextLabel&>(handle);
150 }
151
152 } // namespace Toolkit
153
154 } // namespace Dali
155
156 #endif // DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H