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