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/decorator/text-decorator.h>
25 #include <dali-toolkit/internal/text/text-control-interface.h>
26 #include <dali-toolkit/internal/text/text-controller.h>
27 #include <dali-toolkit/internal/text/rendering/text-renderer.h>
39 * @brief A control which renders a short text string.
41 class TextField : public Control, public Text::ControlInterface
46 * @copydoc Dali::Toollkit::TextField::New()
48 static Toolkit::TextField New();
53 * Called when a property of an object of this type is set.
54 * @param[in] object The object whose property is set.
55 * @param[in] index The property index.
56 * @param[in] value The new property value.
58 static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
61 * Called to retrieve a property of an object of this type.
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.
66 static Property::Value GetProperty( BaseObject* object, Property::Index index );
68 private: // From Control
71 * @copydoc Control::OnInitialize()
73 virtual void OnInitialize();
76 * @copydoc Control::GetNaturalSize()
78 virtual Vector3 GetNaturalSize();
81 * @copydoc Control::GetHeightForWidth()
83 virtual float GetHeightForWidth( float width );
86 * @copydoc Control::OnInitialize()
88 virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
91 * Received for single & double taps
93 void OnTap( Actor actor, const TapGesture& tap );
96 * @copydoc Text::ControlInterface::RequestTextRelayout()
98 virtual void RequestTextRelayout();
100 private: // Implementation
103 * Construct a new TextField.
108 * A reference counted object may only be deleted by calling Unreference()
110 virtual ~TextField();
114 // Undefined copy constructor and assignment operators
115 TextField(const TextField&);
116 TextField& operator=(const TextField& rhs);
120 Text::ControllerPtr mController;
121 Text::RendererPtr mRenderer;
122 Text::DecoratorPtr mDecorator;
124 TapGestureDetector mDoubleTapDetector;
126 unsigned int mRenderingBackend;
129 } // namespace Internal
131 // Helpers for public-api forwarding methods
133 inline Toolkit::Internal::TextField& GetImpl( Toolkit::TextField& textField )
135 DALI_ASSERT_ALWAYS(textField);
137 Dali::RefObject& handle = textField.GetImplementation();
139 return static_cast<Toolkit::Internal::TextField&>(handle);
142 inline const Toolkit::Internal::TextField& GetImpl( const Toolkit::TextField& textField )
144 DALI_ASSERT_ALWAYS(textField);
146 const Dali::RefObject& handle = textField.GetImplementation();
148 return static_cast<const Toolkit::Internal::TextField&>(handle);
151 } // namespace Toolkit
155 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__