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