2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali-toolkit/public-api/controls/text-input/text-input.h>
19 #include <dali-toolkit/internal/controls/text-input/text-input-impl.h>
27 const char* const TextInput::SIGNAL_START_INPUT( "start-input" );
28 const char* const TextInput::SIGNAL_END_INPUT( "end-input" );
29 const char* const TextInput::SIGNAL_STYLE_CHANGED( "style-changed" );
30 const char* const TextInput::SIGNAL_MAX_INPUT_CHARACTERS_REACHED( "max-input-characters-reached" );
31 const char* const TextInput::SIGNAL_TOOLBAR_DISPLAYED = "toolbar-displayed";
32 const char* const TextInput::SIGNAL_TEXT_EXCEED_BOUNDARIES = "text-exceed-boundaries";
34 TextInput::TextInput()
38 TextInput::TextInput(Internal::TextInput& implementation)
39 : Control(implementation)
43 TextInput::TextInput( const TextInput& textInput )
44 : Control( textInput )
48 TextInput& TextInput::operator=( const TextInput& textInput )
50 if( &textInput != this )
52 Control::operator=( textInput );
58 TextInput TextInput::New()
60 return Internal::TextInput::New();
63 TextInput TextInput::DownCast( BaseHandle actor )
65 return Control::DownCast<TextInput, Internal::TextInput>(actor);
68 TextInput::~TextInput()
72 std::string TextInput::GetText() const
74 return GetImpl(*this).GetText();
77 std::string TextInput::GetMarkupText() const
79 return GetImpl(*this).GetMarkupText();
82 void TextInput::SetMaxCharacterLength(std::size_t maxChars)
84 GetImpl(*this).SetMaxCharacterLength(maxChars);
87 void TextInput::SetNumberOfLinesLimit(std::size_t maxLines)
89 GetImpl(*this).SetNumberOfLinesLimit( maxLines );
92 std::size_t TextInput::GetNumberOfLinesLimit() const
94 return GetImpl(*this).GetNumberOfLinesLimit();
97 std::size_t TextInput::GetNumberOfCharacters() const
99 return GetImpl(*this).GetNumberOfCharacters();
102 void TextInput::SetPlaceholderText( const std::string& placeHolderText )
104 GetImpl(*this).SetPlaceholderText( placeHolderText );
107 std::string TextInput::GetPlaceholderText()
109 return GetImpl(*this).GetPlaceholderText();
112 void TextInput::SetInitialText(const std::string& initialText)
114 GetImpl(*this).SetInitialText(initialText);
117 void TextInput::SetEditable(bool editMode)
119 GetImpl(*this).SetEditable(editMode, false);
122 void TextInput::SetEditable(bool editMode, const Vector2& touchPoint)
124 GetImpl(*this).SetEditable(editMode, true, touchPoint);
127 bool TextInput::IsEditable() const
129 return GetImpl(*this).IsEditable();
132 void TextInput::SetEditOnTouch( bool editOnTouch )
134 GetImpl(*this).SetEditOnTouch( editOnTouch );
137 bool TextInput::IsEditOnTouch() const
139 return GetImpl(*this).IsEditOnTouch();
142 void TextInput::SetTextSelectable( bool textSelectable )
144 GetImpl(*this).SetTextSelectable( textSelectable );
147 bool TextInput::IsTextSelectable() const
149 return GetImpl(*this).IsTextSelectable();
152 bool TextInput::IsTextSelected() const
154 return GetImpl(*this).IsTextSelected();
157 void TextInput::SelectText(std::size_t start, std::size_t end)
159 GetImpl(*this).SelectText( start, end );
162 void TextInput::DeSelectText()
164 GetImpl(*this).DeSelectText();
167 void TextInput::SetGrabHandleImage( Image image )
169 GetImpl(*this).SetGrabHandleImage(image);
172 void TextInput::SetCursorImage(Dali::Image image, const Vector4& border )
174 GetImpl(*this).SetCursorImage(image, border );
177 Vector3 TextInput::GetSelectionHandleSize()
179 return GetImpl(*this).GetSelectionHandleSize();
182 void TextInput::SetRTLCursorImage(Dali::Image image, const Vector4& border )
184 GetImpl(*this).SetRTLCursorImage(image, border );
187 void TextInput::EnableGrabHandle(bool toggle)
189 GetImpl(*this).EnableGrabHandle( toggle );
192 bool TextInput::IsGrabHandleEnabled()
194 return GetImpl(*this).IsGrabHandleEnabled();
197 void TextInput::SetBoundingRectangle( const Rect<float>& boundingOriginAndSize )
199 GetImpl(*this).SetBoundingRectangle( boundingOriginAndSize );
202 const Rect<float> TextInput::GetBoundingRectangle() const
204 return GetImpl(*this).GetBoundingRectangle();
207 void TextInput::SetActiveStyle( const TextStyle& style, const TextStyle::Mask mask )
209 GetImpl(*this).SetActiveStyle(style,mask);
212 void TextInput::ApplyStyle( const TextStyle& style, const TextStyle::Mask mask )
214 GetImpl(*this).ApplyStyle( style, mask );
217 void TextInput::ApplyStyleToAll( const TextStyle& style, const TextStyle::Mask mask )
219 GetImpl(*this).ApplyStyleToAll( style, mask );
222 TextStyle TextInput::GetStyleAtCursor() const
224 return GetImpl(*this).GetStyleAtCursor();
227 void TextInput::SetTextAlignment( Toolkit::Alignment::Type align )
229 GetImpl(*this).SetTextAlignment(align);
232 void TextInput::SetTextLineJustification( Toolkit::TextView::LineJustification justification )
234 GetImpl(*this).SetTextLineJustification(justification);
237 void TextInput::SetFadeBoundary( const Toolkit::TextView::FadeBoundary& fadeBoundary )
239 GetImpl(*this).SetFadeBoundary( fadeBoundary );
242 const Toolkit::TextView::FadeBoundary& TextInput::GetFadeBoundary() const
244 return GetImpl(*this).GetFadeBoundary();
247 Alignment::Type TextInput::GetTextAlignment() const
249 return GetImpl(*this).GetTextAlignment();
252 void TextInput::SetMultilinePolicy( TextView::MultilinePolicy policy )
254 GetImpl(*this).SetMultilinePolicy(policy);
257 TextView::MultilinePolicy TextInput::GetMultilinePolicy() const
259 return GetImpl(*this).GetMultilinePolicy();
262 void TextInput::SetWidthExceedPolicy( TextView::ExceedPolicy policy )
264 GetImpl(*this).SetWidthExceedPolicy(policy);
267 TextView::ExceedPolicy TextInput::GetWidthExceedPolicy() const
269 return GetImpl(*this).GetWidthExceedPolicy();
272 void TextInput::SetHeightExceedPolicy( TextView::ExceedPolicy policy )
274 GetImpl(*this).SetHeightExceedPolicy(policy);
277 TextView::ExceedPolicy TextInput::GetHeightExceedPolicy() const
279 return GetImpl(*this).GetHeightExceedPolicy();
282 void TextInput::SetExceedEnabled( bool enable )
284 GetImpl(*this).SetExceedEnabled( enable );
287 bool TextInput::GetExceedEnabled() const
289 return GetImpl(*this).GetExceedEnabled();
292 void TextInput::SetSortModifier( float depthOffset )
294 GetImpl( *this ).SetSortModifier( depthOffset );
297 void TextInput::SetSnapshotModeEnabled( bool enable )
299 GetImpl( *this ).SetSnapshotModeEnabled( enable );
302 bool TextInput::IsSnapshotModeEnabled() const
304 return GetImpl( *this ).IsSnapshotModeEnabled();
307 void TextInput::SetScrollEnabled( bool enable )
309 GetImpl( *this ).SetScrollEnabled( enable );
312 bool TextInput::IsScrollEnabled() const
314 return GetImpl( *this ).IsScrollEnabled();
317 void TextInput::SetScrollPosition( const Vector2& position )
319 GetImpl( *this ).SetScrollPosition( position );
322 Vector2 TextInput::GetScrollPosition() const
324 return GetImpl( *this ).GetScrollPosition();
327 TextInput::InputSignalV2& TextInput::InputStartedSignal()
329 return GetImpl(*this).InputStartedSignal();
332 TextInput::InputSignalV2& TextInput::InputFinishedSignal()
334 return GetImpl(*this).InputFinishedSignal();
337 TextInput::InputSignalV2& TextInput::CutAndPasteToolBarDisplayedSignal()
339 return GetImpl(*this).CutAndPasteToolBarDisplayedSignal();
342 TextInput::StyleChangedSignalV2& TextInput::StyleChangedSignal()
344 return GetImpl(*this).StyleChangedSignal();
347 TextInput::TextModifiedSignalType& TextInput::TextModifiedSignal()
349 return GetImpl(*this).TextModifiedSignal();
352 TextInput::MaxInputCharactersReachedSignalV2& TextInput::MaxInputCharactersReachedSignal()
354 return GetImpl(*this).MaxInputCharactersReachedSignal();
357 TextInput::InputTextExceedBoundariesSignalV2& TextInput::InputTextExceedBoundariesSignal()
359 return GetImpl(*this).InputTextExceedBoundariesSignal();
362 void TextInput::SetMarkupProcessingEnabled( bool enable )
364 return GetImpl( *this ).SetMarkupProcessingEnabled( enable );
367 bool TextInput::IsMarkupProcessingEnabled() const
369 return GetImpl( *this ).IsMarkupProcessingEnabled();
373 TextInput::TextInput( Dali::Internal::CustomActor* internal )
374 : Control( internal )
376 VerifyCustomActorPointer<Internal::TextInput>(internal);
379 } // namespace Toolkit