1 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__
2 #define __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_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-impl.h>
23 #include <dali-toolkit/public-api/controls/text-controls/text-field.h>
24 #include <dali-toolkit/internal/text/clipping/text-clipper.h>
25 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
26 #include <dali-toolkit/internal/text/text-control-interface.h>
27 #include <dali-toolkit/internal/text/text-controller.h>
28 #include <dali-toolkit/internal/text/rendering/text-renderer.h>
40 * @brief A control which renders a short text string.
42 class TextField : public Control, public Text::ControlInterface
47 * @copydoc Dali::Toollkit::TextField::New()
49 static Toolkit::TextField New();
54 * @brief Called when a property of an object of this type is set.
56 * @param[in] object The object whose property is set.
57 * @param[in] index The property index.
58 * @param[in] value The new property value.
60 static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
63 * @brief Called to retrieve a property of an object of this type.
65 * @param[in] object The object whose property is to be retrieved.
66 * @param[in] index The property index.
67 * @return The current value of the property.
69 static Property::Value GetProperty( BaseObject* object, Property::Index index );
71 private: // From Control
74 * @copydoc Control::OnInitialize()
76 virtual void OnInitialize();
79 * @copydoc Control::GetNaturalSize()
81 virtual Vector3 GetNaturalSize();
84 * @copydoc Control::GetHeightForWidth()
86 virtual float GetHeightForWidth( float width );
89 * @copydoc Control::OnInitialize()
91 virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
94 * Received for single & double taps
96 virtual void OnTap( const TapGesture& tap );
99 * @copydoc Dali::CustomActorImpl::OnKeyEvent(const KeyEvent&)
101 virtual bool OnKeyEvent(const KeyEvent& event);
104 * @copydoc Text::ControlInterface::RequestTextRelayout()
106 virtual void RequestTextRelayout();
108 private: // Implementation
111 * @brief Enable or disable clipping.
113 * @param[in] clipping True if clipping should be enabled.
114 * @param[in] size The area to clip within.
116 void EnableClipping( bool clipping, const Vector2& size );
119 * Construct a new TextField.
124 * A reference counted object may only be deleted by calling Unreference()
126 virtual ~TextField();
130 // Undefined copy constructor and assignment operators
131 TextField(const TextField&);
132 TextField& operator=(const TextField& rhs);
136 Text::ControllerPtr mController;
137 Text::RendererPtr mRenderer;
138 Text::DecoratorPtr mDecorator;
139 Text::ClipperPtr mClipper; ///< For EXCEED_POLICY_CLIP
141 RenderableActor mRenderableActor;
143 int mRenderingBackend;
147 } // namespace Internal
149 // Helpers for public-api forwarding methods
151 inline Toolkit::Internal::TextField& GetImpl( Toolkit::TextField& textField )
153 DALI_ASSERT_ALWAYS(textField);
155 Dali::RefObject& handle = textField.GetImplementation();
157 return static_cast<Toolkit::Internal::TextField&>(handle);
160 inline const Toolkit::Internal::TextField& GetImpl( const Toolkit::TextField& textField )
162 DALI_ASSERT_ALWAYS(textField);
164 const Dali::RefObject& handle = textField.GetImplementation();
166 return static_cast<const Toolkit::Internal::TextField&>(handle);
169 } // namespace Toolkit
173 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__