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/public-api/text/decorator/text-decorator.h>
25 #include <dali-toolkit/public-api/text/text-control-interface.h>
26 #include <dali-toolkit/public-api/text/text-controller.h>
38 * @brief A control which renders a short text string.
40 class TextField : public Control, public Text::ControlInterface
47 TEXTFIELD_PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
48 TEXTFIELD_PROPERTY_END_INDEX = TEXTFIELD_PROPERTY_START_INDEX + 1000 ///< Reserving 1000 property indices
52 * @copydoc Dali::Toollkit::TextField::New()
54 static Toolkit::TextField New();
59 * Called when a property of an object of this type is set.
60 * @param[in] object The object whose property is set.
61 * @param[in] index The property index.
62 * @param[in] value The new property value.
64 static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
67 * Called to retrieve a property of an object of this type.
68 * @param[in] object The object whose property is to be retrieved.
69 * @param[in] index The property index.
70 * @return The current value of the property.
72 static Property::Value GetProperty( BaseObject* object, Property::Index index );
74 private: // From Control
77 * @copydoc Control::OnInitialize()
79 virtual void OnInitialize();
82 * @copydoc Control::GetNaturalSize()
84 virtual Vector3 GetNaturalSize();
87 * @copydoc Control::GetHeightForWidth()
89 virtual float GetHeightForWidth( float width );
92 * @copydoc Control::OnInitialize()
94 virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
97 * @copydoc Control::OnTap()
99 virtual void OnTap( const TapGesture& tap );
102 * TODO - Fix TapGestureDetector to support single and double tap
104 void OnDoubleTap( Actor actor, const TapGesture& tap );
107 * @copydoc Text::ControlInterface::RequestTextRelayout()
109 virtual void RequestTextRelayout();
111 private: // Implementation
114 * Construct a new TextField.
119 * A reference counted object may only be deleted by calling Unreference()
121 virtual ~TextField();
125 // Undefined copy constructor and assignment operators
126 TextField(const TextField&);
127 TextField& operator=(const TextField& rhs);
131 Text::ControllerPtr mController;
132 Text::RendererPtr mRenderer;
133 Text::DecoratorPtr mDecorator;
135 TapGestureDetector mDoubleTapDetector;
137 unsigned int mRenderingBackend;
140 } // namespace Internal
142 // Helpers for public-api forwarding methods
144 inline Toolkit::Internal::TextField& GetImpl( Toolkit::TextField& textField )
146 DALI_ASSERT_ALWAYS(textField);
148 Dali::RefObject& handle = textField.GetImplementation();
150 return static_cast<Toolkit::Internal::TextField&>(handle);
153 inline const Toolkit::Internal::TextField& GetImpl( const Toolkit::TextField& textField )
155 DALI_ASSERT_ALWAYS(textField);
157 const Dali::RefObject& handle = textField.GetImplementation();
159 return static_cast<const Toolkit::Internal::TextField&>(handle);
162 } // namespace Toolkit
166 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__