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.
19 #include <dali-toolkit/public-api/controls/text-input/text-input.h>
22 #include <dali/public-api/adaptor-framework/clipboard.h>
23 #include <dali/public-api/adaptor-framework/clipboard-event-notifier.h>
24 #include <dali/public-api/adaptor-framework/imf-manager.h>
25 #include <dali/public-api/adaptor-framework/timer.h>
28 #include <dali-toolkit/public-api/controls/text-input/text-input.h>
29 #include <dali-toolkit/internal/controls/text-input/text-input-impl.h>
37 TextInput::TextInput()
41 TextInput::TextInput(Internal::TextInput& implementation)
42 : Control(implementation)
46 TextInput::TextInput( const TextInput& textInput )
47 : Control( textInput )
51 TextInput& TextInput::operator=( const TextInput& textInput )
53 if( &textInput != this )
55 Control::operator=( textInput );
61 TextInput TextInput::New()
63 return Internal::TextInput::New();
66 TextInput TextInput::DownCast( BaseHandle actor )
68 return Control::DownCast<TextInput, Internal::TextInput>(actor);
71 TextInput::~TextInput()
75 std::string TextInput::GetText() const
77 return GetImpl(*this).GetText();
80 std::string TextInput::GetMarkupText() const
82 return GetImpl(*this).GetMarkupText();
85 void TextInput::SetMaxCharacterLength(std::size_t maxChars)
87 GetImpl(*this).SetMaxCharacterLength(maxChars);
90 void TextInput::SetNumberOfLinesLimit(std::size_t maxLines)
92 GetImpl(*this).SetNumberOfLinesLimit( maxLines );
95 std::size_t TextInput::GetNumberOfLinesLimit() const
97 return GetImpl(*this).GetNumberOfLinesLimit();
100 std::size_t TextInput::GetNumberOfCharacters() const
102 return GetImpl(*this).GetNumberOfCharacters();
105 void TextInput::SetPlaceholderText( const std::string& placeHolderText )
107 GetImpl(*this).SetPlaceholderText( placeHolderText );
110 std::string TextInput::GetPlaceholderText()
112 return GetImpl(*this).GetPlaceholderText();
115 void TextInput::SetInitialText(const std::string& initialText)
117 GetImpl(*this).SetInitialText(initialText);
120 void TextInput::SetEditable(bool editMode)
122 GetImpl(*this).SetEditable(editMode, false);
125 void TextInput::SetEditable(bool editMode, const Vector2& touchPoint)
127 GetImpl(*this).SetEditable(editMode, true, touchPoint);
130 bool TextInput::IsEditable() const
132 return GetImpl(*this).IsEditable();
135 void TextInput::SetEditOnTouch( bool editOnTouch )
137 GetImpl(*this).SetEditOnTouch( editOnTouch );
140 bool TextInput::IsEditOnTouch() const
142 return GetImpl(*this).IsEditOnTouch();
145 void TextInput::SetTextSelectable( bool textSelectable )
147 GetImpl(*this).SetTextSelectable( textSelectable );
150 bool TextInput::IsTextSelectable() const
152 return GetImpl(*this).IsTextSelectable();
155 bool TextInput::IsTextSelected() const
157 return GetImpl(*this).IsTextSelected();
160 void TextInput::SelectText(std::size_t start, std::size_t end)
162 GetImpl(*this).SelectText( start, end );
165 void TextInput::DeSelectText()
167 GetImpl(*this).DeSelectText();
170 void TextInput::SetGrabHandleImage( Image image )
172 GetImpl(*this).SetGrabHandleImage(image);
175 void TextInput::SetCursorImage(Dali::Image image, const Vector4& border )
177 GetImpl(*this).SetCursorImage(image, border );
180 Vector3 TextInput::GetSelectionHandleSize()
182 return GetImpl(*this).GetSelectionHandleSize();
185 void TextInput::SetRTLCursorImage(Dali::Image image, const Vector4& border )
187 GetImpl(*this).SetRTLCursorImage(image, border );
190 void TextInput::EnableGrabHandle(bool toggle)
192 GetImpl(*this).EnableGrabHandle( toggle );
195 bool TextInput::IsGrabHandleEnabled()
197 return GetImpl(*this).IsGrabHandleEnabled();
200 void TextInput::SetBoundingRectangle( const Rect<float>& boundingOriginAndSize )
202 GetImpl(*this).SetBoundingRectangle( boundingOriginAndSize );
205 const Rect<float> TextInput::GetBoundingRectangle() const
207 return GetImpl(*this).GetBoundingRectangle();
210 void TextInput::SetActiveStyle( const TextStyle& style, const TextStyle::Mask mask )
212 GetImpl(*this).SetActiveStyle(style,mask);
215 void TextInput::ApplyStyle( const TextStyle& style, const TextStyle::Mask mask )
217 GetImpl(*this).ApplyStyle( style, mask );
220 void TextInput::ApplyStyleToAll( const TextStyle& style, const TextStyle::Mask mask )
222 GetImpl(*this).ApplyStyleToAll( style, mask );
225 TextStyle TextInput::GetStyleAtCursor() const
227 return GetImpl(*this).GetStyleAtCursor();
230 void TextInput::SetTextAlignment( Toolkit::Alignment::Type align )
232 GetImpl(*this).SetTextAlignment(align);
235 void TextInput::SetTextLineJustification( Toolkit::TextView::LineJustification justification )
237 GetImpl(*this).SetTextLineJustification(justification);
240 void TextInput::SetFadeBoundary( const Toolkit::TextView::FadeBoundary& fadeBoundary )
242 GetImpl(*this).SetFadeBoundary( fadeBoundary );
245 const Toolkit::TextView::FadeBoundary& TextInput::GetFadeBoundary() const
247 return GetImpl(*this).GetFadeBoundary();
250 Alignment::Type TextInput::GetTextAlignment() const
252 return GetImpl(*this).GetTextAlignment();
255 void TextInput::SetMultilinePolicy( TextView::MultilinePolicy policy )
257 GetImpl(*this).SetMultilinePolicy(policy);
260 TextView::MultilinePolicy TextInput::GetMultilinePolicy() const
262 return GetImpl(*this).GetMultilinePolicy();
265 void TextInput::SetWidthExceedPolicy( TextView::ExceedPolicy policy )
267 GetImpl(*this).SetWidthExceedPolicy(policy);
270 TextView::ExceedPolicy TextInput::GetWidthExceedPolicy() const
272 return GetImpl(*this).GetWidthExceedPolicy();
275 void TextInput::SetHeightExceedPolicy( TextView::ExceedPolicy policy )
277 GetImpl(*this).SetHeightExceedPolicy(policy);
280 TextView::ExceedPolicy TextInput::GetHeightExceedPolicy() const
282 return GetImpl(*this).GetHeightExceedPolicy();
285 void TextInput::SetExceedEnabled( bool enable )
287 GetImpl(*this).SetExceedEnabled( enable );
290 bool TextInput::GetExceedEnabled() const
292 return GetImpl(*this).GetExceedEnabled();
295 void TextInput::SetSortModifier( float depthOffset )
297 GetImpl( *this ).SetSortModifier( depthOffset );
300 void TextInput::SetSnapshotModeEnabled( bool enable )
302 GetImpl( *this ).SetSnapshotModeEnabled( enable );
305 bool TextInput::IsSnapshotModeEnabled() const
307 return GetImpl( *this ).IsSnapshotModeEnabled();
310 void TextInput::SetScrollEnabled( bool enable )
312 GetImpl( *this ).SetScrollEnabled( enable );
315 bool TextInput::IsScrollEnabled() const
317 return GetImpl( *this ).IsScrollEnabled();
320 void TextInput::SetScrollPosition( const Vector2& position )
322 GetImpl( *this ).SetScrollPosition( position );
325 Vector2 TextInput::GetScrollPosition() const
327 return GetImpl( *this ).GetScrollPosition();
330 TextInput::InputSignalType& TextInput::InputStartedSignal()
332 return GetImpl(*this).InputStartedSignal();
335 TextInput::InputSignalType& TextInput::InputFinishedSignal()
337 return GetImpl(*this).InputFinishedSignal();
340 TextInput::InputSignalType& TextInput::CutAndPasteToolBarDisplayedSignal()
342 return GetImpl(*this).CutAndPasteToolBarDisplayedSignal();
345 TextInput::StyleChangedSignalType& TextInput::StyleChangedSignal()
347 return GetImpl(*this).StyleChangedSignal();
350 TextInput::TextModifiedSignalType& TextInput::TextModifiedSignal()
352 return GetImpl(*this).TextModifiedSignal();
355 TextInput::MaxInputCharactersReachedSignalType& TextInput::MaxInputCharactersReachedSignal()
357 return GetImpl(*this).MaxInputCharactersReachedSignal();
360 TextInput::InputTextExceedBoundariesSignalType& TextInput::InputTextExceedBoundariesSignal()
362 return GetImpl(*this).InputTextExceedBoundariesSignal();
365 void TextInput::SetMarkupProcessingEnabled( bool enable )
367 return GetImpl( *this ).SetMarkupProcessingEnabled( enable );
370 bool TextInput::IsMarkupProcessingEnabled() const
372 return GetImpl( *this ).IsMarkupProcessingEnabled();
376 TextInput::TextInput( Dali::Internal::CustomActor* internal )
377 : Control( internal )
379 VerifyCustomActorPointer<Internal::TextInput>(internal);
382 } // namespace Toolkit