2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
17 #include <dali-toolkit/public-api/controls/text-input/text-input.h>
18 #include <dali-toolkit/internal/controls/text-input/text-input-impl.h>
26 const char* const TextInput::SIGNAL_START_INPUT( "start-input" );
27 const char* const TextInput::SIGNAL_END_INPUT( "end-input" );
28 const char* const TextInput::SIGNAL_STYLE_CHANGED( "style-changed" );
29 const char* const TextInput::SIGNAL_MAX_INPUT_CHARACTERS_REACHED( "max-input-characters-reached" );
30 const char* const TextInput::SIGNAL_TOOLBAR_DISPLAYED = "toolbar-displayed";
31 const char* const TextInput::SIGNAL_TEXT_EXCEED_BOUNDARIES = "text-exceed-boundaries";
33 TextInput::TextInput()
37 TextInput::TextInput(Internal::TextInput& implementation)
38 : Control(implementation)
42 TextInput::TextInput( const TextInput& textInput )
43 : Control( textInput )
47 TextInput& TextInput::operator=( const TextInput& textInput )
49 if( &textInput != this )
51 Control::operator=( textInput );
57 TextInput TextInput::New()
59 return Internal::TextInput::New();
62 TextInput TextInput::DownCast( BaseHandle actor )
64 return Control::DownCast<TextInput, Internal::TextInput>(actor);
67 TextInput::~TextInput()
71 std::string TextInput::GetText() const
73 return GetImpl(*this).GetText();
76 std::string TextInput::GetMarkupText() const
78 return GetImpl(*this).GetMarkupText();
81 void TextInput::SetMaxCharacterLength(std::size_t maxChars)
83 GetImpl(*this).SetMaxCharacterLength(maxChars);
86 void TextInput::SetNumberOfLinesLimit(std::size_t maxLines)
88 GetImpl(*this).SetNumberOfLinesLimit( maxLines );
91 std::size_t TextInput::GetNumberOfLinesLimit() const
93 return GetImpl(*this).GetNumberOfLinesLimit();
96 std::size_t TextInput::GetNumberOfCharacters() const
98 return GetImpl(*this).GetNumberOfCharacters();
101 void TextInput::SetPlaceholderText( const std::string& placeHolderText )
103 GetImpl(*this).SetPlaceholderText( placeHolderText );
106 std::string TextInput::GetPlaceholderText()
108 return GetImpl(*this).GetPlaceholderText();
111 void TextInput::SetInitialText(const std::string& initialText)
113 GetImpl(*this).SetInitialText(initialText);
116 void TextInput::SetEditable(bool editMode)
118 GetImpl(*this).SetEditable(editMode, false);
121 void TextInput::SetEditable(bool editMode, const Vector2& touchPoint)
123 GetImpl(*this).SetEditable(editMode, true, touchPoint);
126 bool TextInput::IsEditable() const
128 return GetImpl(*this).IsEditable();
131 void TextInput::SetEditOnTouch( bool editOnTouch )
133 GetImpl(*this).SetEditOnTouch( editOnTouch );
136 bool TextInput::IsEditOnTouch() const
138 return GetImpl(*this).IsEditOnTouch();
141 void TextInput::SetTextSelectable( bool textSelectable )
143 GetImpl(*this).SetTextSelectable( textSelectable );
146 bool TextInput::IsTextSelectable() const
148 return GetImpl(*this).IsTextSelectable();
151 bool TextInput::IsTextSelected() const
153 return GetImpl(*this).IsTextSelected();
156 void TextInput::SelectText(std::size_t start, std::size_t end)
158 GetImpl(*this).SelectText( start, end );
161 void TextInput::DeSelectText()
163 GetImpl(*this).DeSelectText();
166 void TextInput::SetGrabHandleImage( Image image )
168 GetImpl(*this).SetGrabHandleImage(image);
171 void TextInput::SetCursorImage(Dali::Image image, const Vector4& border )
173 GetImpl(*this).SetCursorImage(image, border );
176 Vector3 TextInput::GetSelectionHandleSize()
178 return GetImpl(*this).GetSelectionHandleSize();
181 void TextInput::SetRTLCursorImage(Dali::Image image, const Vector4& border )
183 GetImpl(*this).SetRTLCursorImage(image, border );
186 void TextInput::EnableGrabHandle(bool toggle)
188 GetImpl(*this).EnableGrabHandle( toggle );
191 bool TextInput::IsGrabHandleEnabled()
193 return GetImpl(*this).IsGrabHandleEnabled();
196 void TextInput::SetBoundingRectangle( const Rect<float>& boundingOriginAndSize )
198 GetImpl(*this).SetBoundingRectangle( boundingOriginAndSize );
201 const Rect<float> TextInput::GetBoundingRectangle() const
203 return GetImpl(*this).GetBoundingRectangle();
206 void TextInput::SetActiveStyle( const TextStyle& style, const TextStyle::Mask mask )
208 GetImpl(*this).SetActiveStyle(style,mask);
211 void TextInput::ApplyStyle( const TextStyle& style, const TextStyle::Mask mask )
213 GetImpl(*this).ApplyStyle( style, mask );
216 void TextInput::ApplyStyleToAll( const TextStyle& style, const TextStyle::Mask mask )
218 GetImpl(*this).ApplyStyleToAll( style, mask );
221 TextStyle TextInput::GetStyleAtCursor() const
223 return GetImpl(*this).GetStyleAtCursor();
226 void TextInput::SetTextAlignment( Toolkit::Alignment::Type align )
228 GetImpl(*this).SetTextAlignment(align);
231 void TextInput::SetTextLineJustification( Toolkit::TextView::LineJustification justification )
233 GetImpl(*this).SetTextLineJustification(justification);
236 void TextInput::SetFadeBoundary( const Toolkit::TextView::FadeBoundary& fadeBoundary )
238 GetImpl(*this).SetFadeBoundary( fadeBoundary );
241 const Toolkit::TextView::FadeBoundary& TextInput::GetFadeBoundary() const
243 return GetImpl(*this).GetFadeBoundary();
246 Alignment::Type TextInput::GetTextAlignment() const
248 return GetImpl(*this).GetTextAlignment();
251 void TextInput::SetMultilinePolicy( TextView::MultilinePolicy policy )
253 GetImpl(*this).SetMultilinePolicy(policy);
256 TextView::MultilinePolicy TextInput::GetMultilinePolicy() const
258 return GetImpl(*this).GetMultilinePolicy();
261 void TextInput::SetWidthExceedPolicy( TextView::ExceedPolicy policy )
263 GetImpl(*this).SetWidthExceedPolicy(policy);
266 TextView::ExceedPolicy TextInput::GetWidthExceedPolicy() const
268 return GetImpl(*this).GetWidthExceedPolicy();
271 void TextInput::SetHeightExceedPolicy( TextView::ExceedPolicy policy )
273 GetImpl(*this).SetHeightExceedPolicy(policy);
276 TextView::ExceedPolicy TextInput::GetHeightExceedPolicy() const
278 return GetImpl(*this).GetHeightExceedPolicy();
281 void TextInput::SetExceedEnabled( bool enable )
283 GetImpl(*this).SetExceedEnabled( enable );
286 bool TextInput::GetExceedEnabled() const
288 return GetImpl(*this).GetExceedEnabled();
291 void TextInput::SetSortModifier( float depthOffset )
293 GetImpl( *this ).SetSortModifier( depthOffset );
296 void TextInput::SetSnapshotModeEnabled( bool enable )
298 GetImpl( *this ).SetSnapshotModeEnabled( enable );
301 bool TextInput::IsSnapshotModeEnabled() const
303 return GetImpl( *this ).IsSnapshotModeEnabled();
306 void TextInput::SetScrollEnabled( bool enable )
308 GetImpl( *this ).SetScrollEnabled( enable );
311 bool TextInput::IsScrollEnabled() const
313 return GetImpl( *this ).IsScrollEnabled();
316 void TextInput::SetScrollPosition( const Vector2& position )
318 GetImpl( *this ).SetScrollPosition( position );
321 Vector2 TextInput::GetScrollPosition() const
323 return GetImpl( *this ).GetScrollPosition();
326 TextInput::InputSignalV2& TextInput::InputStartedSignal()
328 return GetImpl(*this).InputStartedSignal();
331 TextInput::InputSignalV2& TextInput::InputFinishedSignal()
333 return GetImpl(*this).InputFinishedSignal();
336 TextInput::InputSignalV2& TextInput::CutAndPasteToolBarDisplayedSignal()
338 return GetImpl(*this).CutAndPasteToolBarDisplayedSignal();
341 TextInput::StyleChangedSignalV2& TextInput::StyleChangedSignal()
343 return GetImpl(*this).StyleChangedSignal();
346 TextInput::MaxInputCharactersReachedSignalV2& TextInput::MaxInputCharactersReachedSignal()
348 return GetImpl(*this).MaxInputCharactersReachedSignal();
351 TextInput::InputTextExceedBoundariesSignalV2& TextInput::InputTextExceedBoundariesSignal()
353 return GetImpl(*this).InputTextExceedBoundariesSignal();
356 void TextInput::SetMarkupProcessingEnabled( bool enable )
358 return GetImpl( *this ).SetMarkupProcessingEnabled( enable );
361 bool TextInput::IsMarkupProcessingEnabled() const
363 return GetImpl( *this ).IsMarkupProcessingEnabled();
367 TextInput::TextInput( Dali::Internal::CustomActor* internal )
368 : Control( internal )
370 VerifyCustomActorPointer<Internal::TextInput>(internal);
373 } // namespace Toolkit