License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / text-input / text-input.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <dali-toolkit/public-api/controls/text-input/text-input.h>
19 #include <dali-toolkit/internal/controls/text-input/text-input-impl.h>
20
21 namespace Dali
22 {
23
24 namespace Toolkit
25 {
26
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";
33
34 TextInput::TextInput()
35 {
36 }
37
38 TextInput::TextInput(Internal::TextInput& implementation)
39 : Control(implementation)
40 {
41 }
42
43 TextInput::TextInput( const TextInput& textInput )
44 : Control( textInput )
45 {
46 }
47
48 TextInput& TextInput::operator=( const TextInput& textInput )
49 {
50   if( &textInput != this )
51   {
52     Control::operator=( textInput );
53   }
54
55   return *this;
56 }
57
58 TextInput TextInput::New()
59 {
60   return Internal::TextInput::New();
61 }
62
63 TextInput TextInput::DownCast( BaseHandle actor )
64 {
65   return Control::DownCast<TextInput, Internal::TextInput>(actor);
66 }
67
68 TextInput::~TextInput()
69 {
70 }
71
72 std::string TextInput::GetText() const
73 {
74   return GetImpl(*this).GetText();
75 }
76
77 std::string TextInput::GetMarkupText() const
78 {
79   return GetImpl(*this).GetMarkupText();
80 }
81
82 void TextInput::SetMaxCharacterLength(std::size_t maxChars)
83 {
84   GetImpl(*this).SetMaxCharacterLength(maxChars);
85 }
86
87 void TextInput::SetNumberOfLinesLimit(std::size_t maxLines)
88 {
89   GetImpl(*this).SetNumberOfLinesLimit( maxLines );
90 }
91
92 std::size_t TextInput::GetNumberOfLinesLimit() const
93 {
94   return GetImpl(*this).GetNumberOfLinesLimit();
95 }
96
97 std::size_t TextInput::GetNumberOfCharacters() const
98 {
99   return GetImpl(*this).GetNumberOfCharacters();
100 }
101
102 void TextInput::SetPlaceholderText( const std::string& placeHolderText )
103 {
104   GetImpl(*this).SetPlaceholderText( placeHolderText );
105 }
106
107 std::string TextInput::GetPlaceholderText()
108 {
109   return GetImpl(*this).GetPlaceholderText();
110 }
111
112 void TextInput::SetInitialText(const std::string& initialText)
113 {
114   GetImpl(*this).SetInitialText(initialText);
115 }
116
117 void TextInput::SetEditable(bool editMode)
118 {
119   GetImpl(*this).SetEditable(editMode, false);
120 }
121
122 void TextInput::SetEditable(bool editMode, const Vector2& touchPoint)
123 {
124   GetImpl(*this).SetEditable(editMode, true, touchPoint);
125 }
126
127 bool TextInput::IsEditable() const
128 {
129   return GetImpl(*this).IsEditable();
130 }
131
132 void TextInput::SetEditOnTouch( bool editOnTouch )
133 {
134   GetImpl(*this).SetEditOnTouch( editOnTouch );
135 }
136
137 bool TextInput::IsEditOnTouch() const
138 {
139   return GetImpl(*this).IsEditOnTouch();
140 }
141
142 void TextInput::SetTextSelectable( bool textSelectable )
143 {
144   GetImpl(*this).SetTextSelectable( textSelectable );
145 }
146
147 bool TextInput::IsTextSelectable() const
148 {
149   return GetImpl(*this).IsTextSelectable();
150 }
151
152 bool TextInput::IsTextSelected() const
153 {
154   return GetImpl(*this).IsTextSelected();
155 }
156
157 void TextInput::SelectText(std::size_t start, std::size_t end)
158 {
159   GetImpl(*this).SelectText( start, end );
160 }
161
162 void TextInput::DeSelectText()
163 {
164   GetImpl(*this).DeSelectText();
165 }
166
167 void TextInput::SetGrabHandleImage( Image image )
168 {
169   GetImpl(*this).SetGrabHandleImage(image);
170 }
171
172 void TextInput::SetCursorImage(Dali::Image image, const Vector4& border )
173 {
174   GetImpl(*this).SetCursorImage(image, border );
175 }
176
177 Vector3 TextInput::GetSelectionHandleSize()
178 {
179   return GetImpl(*this).GetSelectionHandleSize();
180 }
181
182 void TextInput::SetRTLCursorImage(Dali::Image image, const Vector4& border )
183 {
184   GetImpl(*this).SetRTLCursorImage(image, border );
185 }
186
187 void TextInput::EnableGrabHandle(bool toggle)
188 {
189   GetImpl(*this).EnableGrabHandle( toggle );
190 }
191
192 bool TextInput::IsGrabHandleEnabled()
193 {
194   return GetImpl(*this).IsGrabHandleEnabled();
195 }
196
197 void TextInput::SetBoundingRectangle( const Rect<float>& boundingOriginAndSize )
198 {
199   GetImpl(*this).SetBoundingRectangle( boundingOriginAndSize );
200 }
201
202 const Rect<float> TextInput::GetBoundingRectangle() const
203 {
204   return GetImpl(*this).GetBoundingRectangle();
205 }
206
207 void TextInput::SetActiveStyle( const TextStyle& style, const TextStyle::Mask mask )
208 {
209   GetImpl(*this).SetActiveStyle(style,mask);
210 }
211
212 void TextInput::ApplyStyle( const TextStyle& style, const TextStyle::Mask mask )
213 {
214   GetImpl(*this).ApplyStyle( style, mask );
215 }
216
217 void TextInput::ApplyStyleToAll( const TextStyle& style, const TextStyle::Mask mask )
218 {
219   GetImpl(*this).ApplyStyleToAll( style, mask );
220 }
221
222 TextStyle TextInput::GetStyleAtCursor() const
223 {
224   return GetImpl(*this).GetStyleAtCursor();
225 }
226
227 void TextInput::SetTextAlignment( Toolkit::Alignment::Type align )
228 {
229   GetImpl(*this).SetTextAlignment(align);
230 }
231
232 void TextInput::SetTextLineJustification( Toolkit::TextView::LineJustification justification )
233 {
234   GetImpl(*this).SetTextLineJustification(justification);
235 }
236
237 void TextInput::SetFadeBoundary( const Toolkit::TextView::FadeBoundary& fadeBoundary )
238 {
239   GetImpl(*this).SetFadeBoundary( fadeBoundary );
240 }
241
242 const Toolkit::TextView::FadeBoundary& TextInput::GetFadeBoundary() const
243 {
244   return GetImpl(*this).GetFadeBoundary();
245 }
246
247 Alignment::Type TextInput::GetTextAlignment() const
248 {
249   return GetImpl(*this).GetTextAlignment();
250 }
251
252 void TextInput::SetMultilinePolicy( TextView::MultilinePolicy policy )
253 {
254   GetImpl(*this).SetMultilinePolicy(policy);
255 }
256
257 TextView::MultilinePolicy TextInput::GetMultilinePolicy() const
258 {
259   return GetImpl(*this).GetMultilinePolicy();
260 }
261
262 void TextInput::SetWidthExceedPolicy( TextView::ExceedPolicy policy )
263 {
264   GetImpl(*this).SetWidthExceedPolicy(policy);
265 }
266
267 TextView::ExceedPolicy TextInput::GetWidthExceedPolicy() const
268 {
269   return GetImpl(*this).GetWidthExceedPolicy();
270 }
271
272 void TextInput::SetHeightExceedPolicy( TextView::ExceedPolicy policy )
273 {
274   GetImpl(*this).SetHeightExceedPolicy(policy);
275 }
276
277 TextView::ExceedPolicy TextInput::GetHeightExceedPolicy() const
278 {
279   return GetImpl(*this).GetHeightExceedPolicy();
280 }
281
282 void TextInput::SetExceedEnabled( bool enable )
283 {
284   GetImpl(*this).SetExceedEnabled( enable );
285 }
286
287 bool TextInput::GetExceedEnabled() const
288 {
289   return GetImpl(*this).GetExceedEnabled();
290 }
291
292 void TextInput::SetSortModifier( float depthOffset )
293 {
294   GetImpl( *this ).SetSortModifier( depthOffset );
295 }
296
297 void TextInput::SetSnapshotModeEnabled( bool enable )
298 {
299   GetImpl( *this ).SetSnapshotModeEnabled( enable );
300 }
301
302 bool TextInput::IsSnapshotModeEnabled() const
303 {
304   return GetImpl( *this ).IsSnapshotModeEnabled();
305 }
306
307 void TextInput::SetScrollEnabled( bool enable )
308 {
309   GetImpl( *this ).SetScrollEnabled( enable );
310 }
311
312 bool TextInput::IsScrollEnabled() const
313 {
314   return GetImpl( *this ).IsScrollEnabled();
315 }
316
317 void TextInput::SetScrollPosition( const Vector2& position )
318 {
319   GetImpl( *this ).SetScrollPosition( position );
320 }
321
322 Vector2 TextInput::GetScrollPosition() const
323 {
324   return GetImpl( *this ).GetScrollPosition();
325 }
326
327 TextInput::InputSignalV2& TextInput::InputStartedSignal()
328 {
329   return GetImpl(*this).InputStartedSignal();
330 }
331
332 TextInput::InputSignalV2& TextInput::InputFinishedSignal()
333 {
334   return GetImpl(*this).InputFinishedSignal();
335 }
336
337 TextInput::InputSignalV2& TextInput::CutAndPasteToolBarDisplayedSignal()
338 {
339   return GetImpl(*this).CutAndPasteToolBarDisplayedSignal();
340 }
341
342 TextInput::StyleChangedSignalV2& TextInput::StyleChangedSignal()
343 {
344   return GetImpl(*this).StyleChangedSignal();
345 }
346
347 TextInput::MaxInputCharactersReachedSignalV2& TextInput::MaxInputCharactersReachedSignal()
348 {
349   return GetImpl(*this).MaxInputCharactersReachedSignal();
350 }
351
352 TextInput::InputTextExceedBoundariesSignalV2& TextInput::InputTextExceedBoundariesSignal()
353 {
354   return GetImpl(*this).InputTextExceedBoundariesSignal();
355 }
356
357 void TextInput::SetMarkupProcessingEnabled( bool enable )
358 {
359   return GetImpl( *this ).SetMarkupProcessingEnabled( enable );
360 }
361
362 bool TextInput::IsMarkupProcessingEnabled() const
363 {
364   return GetImpl( *this ).IsMarkupProcessingEnabled();
365 }
366
367
368 TextInput::TextInput( Dali::Internal::CustomActor* internal )
369 : Control( internal )
370 {
371   VerifyCustomActorPointer<Internal::TextInput>(internal);
372 }
373
374 } // namespace Toolkit
375
376 } // namespace Dali