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/actors/mesh-actor.h>
23 #include <dali/public-api/adaptor-framework/clipboard.h>
24 #include <dali/public-api/adaptor-framework/clipboard-event-notifier.h>
25 #include <dali/public-api/adaptor-framework/imf-manager.h>
26 #include <dali/public-api/adaptor-framework/timer.h>
29 #include <dali-toolkit/public-api/controls/text-input/text-input.h>
30 #include <dali-toolkit/internal/controls/text-input/text-input-impl.h>
38 TextInput::TextInput()
42 TextInput::TextInput(Internal::TextInput& implementation)
43 : Control(implementation)
47 TextInput::TextInput( const TextInput& textInput )
48 : Control( textInput )
52 TextInput& TextInput::operator=( const TextInput& textInput )
54 if( &textInput != this )
56 Control::operator=( textInput );
62 TextInput TextInput::New()
64 return Internal::TextInput::New();
67 TextInput TextInput::DownCast( BaseHandle actor )
69 return Control::DownCast<TextInput, Internal::TextInput>(actor);
72 TextInput::~TextInput()
76 std::string TextInput::GetText() const
78 return GetImpl(*this).GetText();
81 std::string TextInput::GetMarkupText() const
83 return GetImpl(*this).GetMarkupText();
86 void TextInput::SetMaxCharacterLength(std::size_t maxChars)
88 GetImpl(*this).SetMaxCharacterLength(maxChars);
91 void TextInput::SetNumberOfLinesLimit(std::size_t maxLines)
93 GetImpl(*this).SetNumberOfLinesLimit( maxLines );
96 std::size_t TextInput::GetNumberOfLinesLimit() const
98 return GetImpl(*this).GetNumberOfLinesLimit();
101 std::size_t TextInput::GetNumberOfCharacters() const
103 return GetImpl(*this).GetNumberOfCharacters();
106 void TextInput::SetPlaceholderText( const std::string& placeHolderText )
108 GetImpl(*this).SetPlaceholderText( placeHolderText );
111 std::string TextInput::GetPlaceholderText()
113 return GetImpl(*this).GetPlaceholderText();
116 void TextInput::SetInitialText(const std::string& initialText)
118 GetImpl(*this).SetInitialText(initialText);
121 void TextInput::SetEditable(bool editMode)
123 GetImpl(*this).SetEditable(editMode, false);
126 void TextInput::SetEditable(bool editMode, const Vector2& touchPoint)
128 GetImpl(*this).SetEditable(editMode, true, touchPoint);
131 bool TextInput::IsEditable() const
133 return GetImpl(*this).IsEditable();
136 void TextInput::SetEditOnTouch( bool editOnTouch )
138 GetImpl(*this).SetEditOnTouch( editOnTouch );
141 bool TextInput::IsEditOnTouch() const
143 return GetImpl(*this).IsEditOnTouch();
146 void TextInput::SetTextSelectable( bool textSelectable )
148 GetImpl(*this).SetTextSelectable( textSelectable );
151 bool TextInput::IsTextSelectable() const
153 return GetImpl(*this).IsTextSelectable();
156 bool TextInput::IsTextSelected() const
158 return GetImpl(*this).IsTextSelected();
161 void TextInput::SelectText(std::size_t start, std::size_t end)
163 GetImpl(*this).SelectText( start, end );
166 void TextInput::DeSelectText()
168 GetImpl(*this).DeSelectText();
171 void TextInput::SetGrabHandleImage( Image image )
173 GetImpl(*this).SetGrabHandleImage(image);
176 void TextInput::SetCursorImage(Dali::Image image, const Vector4& border )
178 GetImpl(*this).SetCursorImage(image, border );
181 Vector3 TextInput::GetSelectionHandleSize()
183 return GetImpl(*this).GetSelectionHandleSize();
186 void TextInput::SetRTLCursorImage(Dali::Image image, const Vector4& border )
188 GetImpl(*this).SetRTLCursorImage(image, border );
191 void TextInput::EnableGrabHandle(bool toggle)
193 GetImpl(*this).EnableGrabHandle( toggle );
196 bool TextInput::IsGrabHandleEnabled()
198 return GetImpl(*this).IsGrabHandleEnabled();
201 void TextInput::SetBoundingRectangle( const Rect<float>& boundingOriginAndSize )
203 GetImpl(*this).SetBoundingRectangle( boundingOriginAndSize );
206 const Rect<float> TextInput::GetBoundingRectangle() const
208 return GetImpl(*this).GetBoundingRectangle();
211 void TextInput::SetActiveStyle( const TextStyle& style, const TextStyle::Mask mask )
213 GetImpl(*this).SetActiveStyle(style,mask);
216 void TextInput::ApplyStyle( const TextStyle& style, const TextStyle::Mask mask )
218 GetImpl(*this).ApplyStyle( style, mask );
221 void TextInput::ApplyStyleToAll( const TextStyle& style, const TextStyle::Mask mask )
223 GetImpl(*this).ApplyStyleToAll( style, mask );
226 TextStyle TextInput::GetStyleAtCursor() const
228 return GetImpl(*this).GetStyleAtCursor();
231 void TextInput::SetTextAlignment( Toolkit::Alignment::Type align )
233 GetImpl(*this).SetTextAlignment(align);
236 void TextInput::SetTextLineJustification( Toolkit::TextView::LineJustification justification )
238 GetImpl(*this).SetTextLineJustification(justification);
241 void TextInput::SetFadeBoundary( const Toolkit::TextView::FadeBoundary& fadeBoundary )
243 GetImpl(*this).SetFadeBoundary( fadeBoundary );
246 const Toolkit::TextView::FadeBoundary& TextInput::GetFadeBoundary() const
248 return GetImpl(*this).GetFadeBoundary();
251 Alignment::Type TextInput::GetTextAlignment() const
253 return GetImpl(*this).GetTextAlignment();
256 void TextInput::SetMultilinePolicy( TextView::MultilinePolicy policy )
258 GetImpl(*this).SetMultilinePolicy(policy);
261 TextView::MultilinePolicy TextInput::GetMultilinePolicy() const
263 return GetImpl(*this).GetMultilinePolicy();
266 void TextInput::SetWidthExceedPolicy( TextView::ExceedPolicy policy )
268 GetImpl(*this).SetWidthExceedPolicy(policy);
271 TextView::ExceedPolicy TextInput::GetWidthExceedPolicy() const
273 return GetImpl(*this).GetWidthExceedPolicy();
276 void TextInput::SetHeightExceedPolicy( TextView::ExceedPolicy policy )
278 GetImpl(*this).SetHeightExceedPolicy(policy);
281 TextView::ExceedPolicy TextInput::GetHeightExceedPolicy() const
283 return GetImpl(*this).GetHeightExceedPolicy();
286 void TextInput::SetExceedEnabled( bool enable )
288 GetImpl(*this).SetExceedEnabled( enable );
291 bool TextInput::GetExceedEnabled() const
293 return GetImpl(*this).GetExceedEnabled();
296 void TextInput::SetSortModifier( float depthOffset )
298 GetImpl( *this ).SetSortModifier( depthOffset );
301 void TextInput::SetSnapshotModeEnabled( bool enable )
303 GetImpl( *this ).SetSnapshotModeEnabled( enable );
306 bool TextInput::IsSnapshotModeEnabled() const
308 return GetImpl( *this ).IsSnapshotModeEnabled();
311 void TextInput::SetScrollEnabled( bool enable )
313 GetImpl( *this ).SetScrollEnabled( enable );
316 bool TextInput::IsScrollEnabled() const
318 return GetImpl( *this ).IsScrollEnabled();
321 void TextInput::SetScrollPosition( const Vector2& position )
323 GetImpl( *this ).SetScrollPosition( position );
326 Vector2 TextInput::GetScrollPosition() const
328 return GetImpl( *this ).GetScrollPosition();
331 TextInput::InputSignalType& TextInput::InputStartedSignal()
333 return GetImpl(*this).InputStartedSignal();
336 TextInput::InputSignalType& TextInput::InputFinishedSignal()
338 return GetImpl(*this).InputFinishedSignal();
341 TextInput::InputSignalType& TextInput::CutAndPasteToolBarDisplayedSignal()
343 return GetImpl(*this).CutAndPasteToolBarDisplayedSignal();
346 TextInput::StyleChangedSignalType& TextInput::StyleChangedSignal()
348 return GetImpl(*this).StyleChangedSignal();
351 TextInput::TextModifiedSignalType& TextInput::TextModifiedSignal()
353 return GetImpl(*this).TextModifiedSignal();
356 TextInput::MaxInputCharactersReachedSignalType& TextInput::MaxInputCharactersReachedSignal()
358 return GetImpl(*this).MaxInputCharactersReachedSignal();
361 TextInput::InputTextExceedBoundariesSignalType& TextInput::InputTextExceedBoundariesSignal()
363 return GetImpl(*this).InputTextExceedBoundariesSignal();
366 void TextInput::SetMarkupProcessingEnabled( bool enable )
368 return GetImpl( *this ).SetMarkupProcessingEnabled( enable );
371 bool TextInput::IsMarkupProcessingEnabled() const
373 return GetImpl( *this ).IsMarkupProcessingEnabled();
377 TextInput::TextInput( Dali::Internal::CustomActor* internal )
378 : Control( internal )
380 VerifyCustomActorPointer<Internal::TextInput>(internal);
383 } // namespace Toolkit