[Nsd] Fix feature name
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextField.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 extern alias TizenSystemSettings;
17 using TizenSystemSettings.Tizen.System;
18 namespace Tizen.NUI.BaseComponents
19 {
20
21     using System;
22     using System.Runtime.InteropServices;
23     using System.Globalization;
24     /// <summary>
25     /// A control which provides a single-line editable text field.
26     /// </summary>
27     public class TextField : View
28     {
29         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30         private string textFieldTextSid = null;
31         private string textFieldPlaceHolderTextSid = null;
32         private bool systemlangTextFlag = false;
33
34         internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextField_SWIGUpcast(cPtr), cMemoryOwn)
35         {
36             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37         }
38
39         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
40         {
41             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42         }
43
44         /// <summary>
45         /// Dispose
46         /// </summary>
47         protected override void Dispose(DisposeTypes type)
48         {
49             if (disposed)
50             {
51                 DisposeQueue.Instance.Add(this);
52                 return;
53             }
54
55             if(type == DisposeTypes.Explicit)
56             {
57                 //Called by User
58                 //Release your own managed resources here.
59                 //You should release all of your own disposable objects here.
60             }
61
62             //Release your own unmanaged resources here.
63             //You should not access any managed member here except static instance.
64             //because the execution order of Finalizes is non-deterministic.
65
66             if (swigCPtr.Handle != global::System.IntPtr.Zero)
67             {
68                 if (swigCMemOwn)
69                 {
70                     swigCMemOwn = false;
71                     NDalicPINVOKE.delete_TextField(swigCPtr);
72                 }
73                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
74             }
75
76             base.Dispose(type);
77         }
78
79         /// <summary>
80         /// Text changed event arguments.
81         /// </summary>
82         public class TextChangedEventArgs : EventArgs
83         {
84             private TextField _textField;
85
86             /// <summary>
87             /// TextField.
88             /// </summary>
89             public TextField TextField
90             {
91                 get
92                 {
93                     return _textField;
94                 }
95                 set
96                 {
97                     _textField = value;
98                 }
99             }
100         }
101
102         /// <summary>
103         /// MaxLengthReached event arguments.
104         /// </summary>
105         public class MaxLengthReachedEventArgs : EventArgs
106         {
107             private TextField _textField;
108
109             /// <summary>
110             /// TextField.
111             /// </summary>
112             public TextField TextField
113             {
114                 get
115                 {
116                     return _textField;
117                 }
118                 set
119                 {
120                     _textField = value;
121                 }
122             }
123         }
124
125
126         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
127         private delegate void TextChangedCallbackDelegate(IntPtr textField);
128         private EventHandler<TextChangedEventArgs> _textFieldTextChangedEventHandler;
129         private TextChangedCallbackDelegate _textFieldTextChangedCallbackDelegate;
130
131         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
132         private delegate void MaxLengthReachedCallbackDelegate(IntPtr textField);
133         private EventHandler<MaxLengthReachedEventArgs> _textFieldMaxLengthReachedEventHandler;
134         private MaxLengthReachedCallbackDelegate _textFieldMaxLengthReachedCallbackDelegate;
135
136         /// <summary>
137         /// TextChanged event.
138         /// </summary>
139         public event EventHandler<TextChangedEventArgs> TextChanged
140         {
141             add
142             {
143                 if (_textFieldTextChangedEventHandler == null)
144                 {
145                     _textFieldTextChangedCallbackDelegate = (OnTextChanged);
146                     TextChangedSignal().Connect(_textFieldTextChangedCallbackDelegate);
147                 }
148                 _textFieldTextChangedEventHandler += value;
149             }
150             remove
151             {
152                 _textFieldTextChangedEventHandler -= value;
153                 if (_textFieldTextChangedEventHandler == null && TextChangedSignal().Empty() == false)
154                 {
155                     TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
156                 }
157             }
158         }
159
160         private void OnTextChanged(IntPtr textField)
161         {
162             TextChangedEventArgs e = new TextChangedEventArgs();
163
164             // Populate all members of "e" (TextChangedEventArgs) with real data
165             e.TextField = Registry.GetManagedBaseHandleFromNativePtr(textField) as TextField;
166
167             if (_textFieldTextChangedEventHandler != null)
168             {
169                 //here we send all data to user event handlers
170                 _textFieldTextChangedEventHandler(this, e);
171             }
172
173         }
174
175         /// <summary>
176         /// MaxLengthReached event.
177         /// </summary>
178         public event EventHandler<MaxLengthReachedEventArgs> MaxLengthReached
179         {
180             add
181             {
182                 if (_textFieldMaxLengthReachedEventHandler == null)
183                 {
184                     _textFieldMaxLengthReachedCallbackDelegate = (OnMaxLengthReached);
185                     MaxLengthReachedSignal().Connect(_textFieldMaxLengthReachedCallbackDelegate);
186                 }
187                 _textFieldMaxLengthReachedEventHandler += value;
188             }
189             remove
190             {
191                 if (_textFieldMaxLengthReachedEventHandler == null && MaxLengthReachedSignal().Empty() == false)
192                 {
193                     this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
194                 }
195                 _textFieldMaxLengthReachedEventHandler -= value;
196             }
197         }
198
199         private void OnMaxLengthReached(IntPtr textField)
200         {
201             MaxLengthReachedEventArgs e = new MaxLengthReachedEventArgs();
202
203             // Populate all members of "e" (MaxLengthReachedEventArgs) with real data
204             e.TextField = Registry.GetManagedBaseHandleFromNativePtr(textField) as TextField;
205
206             if (_textFieldMaxLengthReachedEventHandler != null)
207             {
208                 //here we send all data to user event handlers
209                 _textFieldMaxLengthReachedEventHandler(this, e);
210             }
211
212         }
213
214         internal class Property
215         {
216             internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextField_Property_RENDERING_BACKEND_get();
217             internal static readonly int TEXT = NDalicPINVOKE.TextField_Property_TEXT_get();
218             internal static readonly int PLACEHOLDER_TEXT = NDalicPINVOKE.TextField_Property_PLACEHOLDER_TEXT_get();
219             internal static readonly int PLACEHOLDER_TEXT_FOCUSED = NDalicPINVOKE.TextField_Property_PLACEHOLDER_TEXT_FOCUSED_get();
220             internal static readonly int FONT_FAMILY = NDalicPINVOKE.TextField_Property_FONT_FAMILY_get();
221             internal static readonly int FONT_STYLE = NDalicPINVOKE.TextField_Property_FONT_STYLE_get();
222             internal static readonly int POINT_SIZE = NDalicPINVOKE.TextField_Property_POINT_SIZE_get();
223             internal static readonly int MAX_LENGTH = NDalicPINVOKE.TextField_Property_MAX_LENGTH_get();
224             internal static readonly int EXCEED_POLICY = NDalicPINVOKE.TextField_Property_EXCEED_POLICY_get();
225             internal static readonly int HORIZONTAL_ALIGNMENT = NDalicPINVOKE.TextField_Property_HORIZONTAL_ALIGNMENT_get();
226             internal static readonly int VERTICAL_ALIGNMENT = NDalicPINVOKE.TextField_Property_VERTICAL_ALIGNMENT_get();
227             internal static readonly int TEXT_COLOR = NDalicPINVOKE.TextField_Property_TEXT_COLOR_get();
228             internal static readonly int PLACEHOLDER_TEXT_COLOR = NDalicPINVOKE.TextField_Property_PLACEHOLDER_TEXT_COLOR_get();
229             internal static readonly int SHADOW_OFFSET = NDalicPINVOKE.TextField_Property_SHADOW_OFFSET_get();
230             internal static readonly int SHADOW_COLOR = NDalicPINVOKE.TextField_Property_SHADOW_COLOR_get();
231             internal static readonly int PRIMARY_CURSOR_COLOR = NDalicPINVOKE.TextField_Property_PRIMARY_CURSOR_COLOR_get();
232             internal static readonly int SECONDARY_CURSOR_COLOR = NDalicPINVOKE.TextField_Property_SECONDARY_CURSOR_COLOR_get();
233             internal static readonly int ENABLE_CURSOR_BLINK = NDalicPINVOKE.TextField_Property_ENABLE_CURSOR_BLINK_get();
234             internal static readonly int CURSOR_BLINK_INTERVAL = NDalicPINVOKE.TextField_Property_CURSOR_BLINK_INTERVAL_get();
235             internal static readonly int CURSOR_BLINK_DURATION = NDalicPINVOKE.TextField_Property_CURSOR_BLINK_DURATION_get();
236             internal static readonly int CURSOR_WIDTH = NDalicPINVOKE.TextField_Property_CURSOR_WIDTH_get();
237             internal static readonly int GRAB_HANDLE_IMAGE = NDalicPINVOKE.TextField_Property_GRAB_HANDLE_IMAGE_get();
238             internal static readonly int GRAB_HANDLE_PRESSED_IMAGE = NDalicPINVOKE.TextField_Property_GRAB_HANDLE_PRESSED_IMAGE_get();
239             internal static readonly int SCROLL_THRESHOLD = NDalicPINVOKE.TextField_Property_SCROLL_THRESHOLD_get();
240             internal static readonly int SCROLL_SPEED = NDalicPINVOKE.TextField_Property_SCROLL_SPEED_get();
241             internal static readonly int SELECTION_HANDLE_IMAGE_LEFT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_IMAGE_LEFT_get();
242             internal static readonly int SELECTION_HANDLE_IMAGE_RIGHT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_IMAGE_RIGHT_get();
243             internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_LEFT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get();
244             internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get();
245             internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_LEFT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get();
246             internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_RIGHT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get();
247             internal static readonly int SELECTION_HIGHLIGHT_COLOR = NDalicPINVOKE.TextField_Property_SELECTION_HIGHLIGHT_COLOR_get();
248             internal static readonly int DECORATION_BOUNDING_BOX = NDalicPINVOKE.TextField_Property_DECORATION_BOUNDING_BOX_get();
249             internal static readonly int INPUT_METHOD_SETTINGS = NDalicPINVOKE.TextField_Property_INPUT_METHOD_SETTINGS_get();
250             internal static readonly int INPUT_COLOR = NDalicPINVOKE.TextField_Property_INPUT_COLOR_get();
251             internal static readonly int ENABLE_MARKUP = NDalicPINVOKE.TextField_Property_ENABLE_MARKUP_get();
252             internal static readonly int INPUT_FONT_FAMILY = NDalicPINVOKE.TextField_Property_INPUT_FONT_FAMILY_get();
253             internal static readonly int INPUT_FONT_STYLE = NDalicPINVOKE.TextField_Property_INPUT_FONT_STYLE_get();
254             internal static readonly int INPUT_POINT_SIZE = NDalicPINVOKE.TextField_Property_INPUT_POINT_SIZE_get();
255             internal static readonly int UNDERLINE = NDalicPINVOKE.TextField_Property_UNDERLINE_get();
256             internal static readonly int INPUT_UNDERLINE = NDalicPINVOKE.TextField_Property_INPUT_UNDERLINE_get();
257             internal static readonly int SHADOW = NDalicPINVOKE.TextField_Property_SHADOW_get();
258             internal static readonly int INPUT_SHADOW = NDalicPINVOKE.TextField_Property_INPUT_SHADOW_get();
259             internal static readonly int EMBOSS = NDalicPINVOKE.TextField_Property_EMBOSS_get();
260             internal static readonly int INPUT_EMBOSS = NDalicPINVOKE.TextField_Property_INPUT_EMBOSS_get();
261             internal static readonly int OUTLINE = NDalicPINVOKE.TextField_Property_OUTLINE_get();
262             internal static readonly int INPUT_OUTLINE = NDalicPINVOKE.TextField_Property_INPUT_OUTLINE_get();
263             internal static readonly int HIDDEN_INPUT_SETTINGS = NDalicManualPINVOKE.TextField_Property_HIDDEN_INPUT_SETTINGS_get();
264             internal static readonly int PIXEL_SIZE = NDalicManualPINVOKE.TextField_Property_PIXEL_SIZE_get();
265             internal static readonly int ENABLE_SELECTION = NDalicManualPINVOKE.TextField_Property_ENABLE_SELECTION_get();
266             internal static readonly int PLACEHOLDER = NDalicManualPINVOKE.TextField_Property_PLACEHOLDER_get();
267
268         }
269
270         internal class InputStyle
271         {
272             internal enum Mask
273             {
274                 None = 0x0000,
275                 Color = 0x0001,
276                 FontFamily = 0x0002,
277                 PointSize = 0x0004,
278                 FontStyle = 0x0008,
279                 Underline = 0x0010,
280                 Shadow = 0x0020,
281                 Emboss = 0x0040,
282                 Outline = 0x0080
283             }
284
285         }
286
287         /// <summary>
288         /// Creates the TextField control.
289         /// </summary>
290         public TextField() : this(NDalicPINVOKE.TextField_New(), true)
291         {
292             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
293
294         }
295         internal TextField(TextField handle) : this(NDalicPINVOKE.new_TextField__SWIG_1(TextField.getCPtr(handle)), true)
296         {
297             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298         }
299
300         [Obsolete("Please do not use! this will be deprecated")]
301         public new static TextField DownCast(BaseHandle handle)
302         {
303             TextField ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as TextField;
304             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305             return ret;
306         }
307
308         internal TextFieldSignal TextChangedSignal()
309         {
310             TextFieldSignal ret = new TextFieldSignal(NDalicPINVOKE.TextField_TextChangedSignal(swigCPtr), false);
311             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312             return ret;
313         }
314
315         internal TextFieldSignal MaxLengthReachedSignal()
316         {
317             TextFieldSignal ret = new TextFieldSignal(NDalicPINVOKE.TextField_MaxLengthReachedSignal(swigCPtr), false);
318             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
319             return ret;
320         }
321
322         internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
323         {
324             SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t(NDalicPINVOKE.TextField_InputStyleChangedSignal(swigCPtr), false);
325             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326             return ret;
327         }
328
329         internal enum ExceedPolicyType
330         {
331             ExceedPolicyOriginal,
332             ExceedPolicyClip
333         }
334
335         /// <summary>
336         /// TranslatableText property.<br>
337         /// The text can be set SID value.<br>
338         /// </summary>
339         /// <exception cref='ArgumentNullException'>
340         /// ResourceManager about multilingual is null
341         /// </exception>
342         public string TranslatableText
343         {
344             get
345             {
346                 return textFieldTextSid;
347             }
348             set
349             {
350                 if (NUIApplication.MultilingualResourceManager == null)
351                 {
352                     throw new ArgumentNullException("ResourceManager about multilingual is null");
353                 }
354                 textFieldTextSid = value;
355                 Text = SetTranslatable(textFieldTextSid);
356             }
357         }
358         /// <summary>
359         /// TranslatablePlaceholderText property.<br>
360         /// The text can be set SID value.<br>
361         /// </summary>
362         /// <exception cref='ArgumentNullException'>
363         /// ResourceManager about multilingual is null
364         /// </exception>
365         public string TranslatablePlaceholderText
366         {
367             get
368             {
369                 return textFieldPlaceHolderTextSid;
370             }
371             set
372             {
373                 if (NUIApplication.MultilingualResourceManager == null)
374                 {
375                     throw new ArgumentNullException("ResourceManager about multilingual is null");
376                 }
377                 textFieldPlaceHolderTextSid = value;
378                 PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
379             }
380         }
381         private string SetTranslatable(string textFieldSid)
382         {
383             string translatableText = null;
384             translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
385             if (translatableText != null)
386             {
387                 if (systemlangTextFlag == false)
388                 {
389                     SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
390                     systemlangTextFlag = true;
391                 }
392                 return translatableText;
393             }
394             else
395             {
396                 translatableText = "";
397                 return translatableText;
398             }
399         }
400         private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
401         {
402             if (textFieldTextSid != null)
403             {
404                 Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
405             }
406             if (textFieldPlaceHolderTextSid != null)
407             {
408                 PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
409             }
410         }
411         /// Text property.
412         /// </summary>
413         public string Text
414         {
415             get
416             {
417                 string temp;
418                 GetProperty(TextField.Property.TEXT).Get(out temp);
419                 return temp;
420             }
421             set
422             {
423                 SetProperty(TextField.Property.TEXT, new Tizen.NUI.PropertyValue(value));
424             }
425         }
426
427         /// <summary>
428         /// PlaceholderText property.
429         /// </summary>
430         public string PlaceholderText
431         {
432             get
433             {
434                 string temp;
435                 GetProperty(TextField.Property.PLACEHOLDER_TEXT).Get(out temp);
436                 return temp;
437             }
438             set
439             {
440                 SetProperty(TextField.Property.PLACEHOLDER_TEXT, new Tizen.NUI.PropertyValue(value));
441             }
442         }
443
444         /// <summary>
445         /// PlaceholderTextFocused property.
446         /// </summary>
447         public string PlaceholderTextFocused
448         {
449             get
450             {
451                 string temp;
452                 GetProperty(TextField.Property.PLACEHOLDER_TEXT_FOCUSED).Get(out temp);
453                 return temp;
454             }
455             set
456             {
457                 SetProperty(TextField.Property.PLACEHOLDER_TEXT_FOCUSED, new Tizen.NUI.PropertyValue(value));
458             }
459         }
460
461         /// <summary>
462         /// FontFamily property.
463         /// </summary>
464         public string FontFamily
465         {
466             get
467             {
468                 string temp;
469                 GetProperty(TextField.Property.FONT_FAMILY).Get(out temp);
470                 return temp;
471             }
472             set
473             {
474                 SetProperty(TextField.Property.FONT_FAMILY, new Tizen.NUI.PropertyValue(value));
475             }
476         }
477
478         /// <summary>
479         /// FontStyle property.
480         /// </summary>
481         public PropertyMap FontStyle
482         {
483             get
484             {
485                 PropertyMap temp = new PropertyMap();
486                 GetProperty(TextField.Property.FONT_STYLE).Get(temp);
487                 return temp;
488             }
489             set
490             {
491                 SetProperty(TextField.Property.FONT_STYLE, new Tizen.NUI.PropertyValue(value));
492             }
493         }
494
495         /// <summary>
496         /// PointSize property.
497         /// </summary>
498         public float PointSize
499         {
500             get
501             {
502                 float temp = 0.0f;
503                 GetProperty(TextField.Property.POINT_SIZE).Get(out temp);
504                 return temp;
505             }
506             set
507             {
508                 SetProperty(TextField.Property.POINT_SIZE, new Tizen.NUI.PropertyValue(value));
509             }
510         }
511
512         /// <summary>
513         /// MaxLength property.
514         /// </summary>
515         public int MaxLength
516         {
517             get
518             {
519                 int temp = 0;
520                 GetProperty(TextField.Property.MAX_LENGTH).Get(out temp);
521                 return temp;
522             }
523             set
524             {
525                 SetProperty(TextField.Property.MAX_LENGTH, new Tizen.NUI.PropertyValue(value));
526             }
527         }
528
529         /// <summary>
530         /// ExceedPolicy property.
531         /// </summary>
532         public int ExceedPolicy
533         {
534             get
535             {
536                 int temp = 0;
537                 GetProperty(TextField.Property.EXCEED_POLICY).Get(out temp);
538                 return temp;
539             }
540             set
541             {
542                 SetProperty(TextField.Property.EXCEED_POLICY, new Tizen.NUI.PropertyValue(value));
543             }
544         }
545
546         /// <summary>
547         /// HorizontalAlignment property.
548         /// </summary>
549         public HorizontalAlignment HorizontalAlignment
550         {
551             get
552             {
553                 string temp;
554                 if (GetProperty(TextField.Property.HORIZONTAL_ALIGNMENT).Get(out temp) == false)
555                 {
556                     NUILog.Error("HorizontalAlignment get error!");
557                 }
558
559                 switch (temp)
560                 {
561                     case "BEGIN":
562                         return HorizontalAlignment.Begin;
563                     case "CENTER":
564                         return HorizontalAlignment.Center;
565                     case "END":
566                         return HorizontalAlignment.End;
567                     default:
568                         return HorizontalAlignment.Begin;
569                 }
570             }
571             set
572             {
573                 string valueToString = "";
574                 switch (value)
575                 {
576                     case HorizontalAlignment.Begin:
577                     {
578                         valueToString = "BEGIN";
579                         break;
580                     }
581                     case HorizontalAlignment.Center:
582                     {
583                         valueToString = "CENTER";
584                         break;
585                     }
586                     case HorizontalAlignment.End:
587                     {
588                         valueToString = "END";
589                         break;
590                     }
591                     default:
592                     {
593                         valueToString = "BEGIN";
594                         break;
595                     }
596                 }
597                 SetProperty(TextField.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
598             }
599         }
600
601         /// <summary>
602         /// VerticalAlignment property.
603         /// </summary>
604         public VerticalAlignment VerticalAlignment
605         {
606             get
607             {
608                 string temp;
609                 if (GetProperty(TextField.Property.VERTICAL_ALIGNMENT).Get(out temp) == false)
610                 {
611                     NUILog.Error("VerticalAlignment get error!");
612                 }
613
614                 switch (temp)
615                 {
616                     case "TOP":
617                         return VerticalAlignment.Top;
618                     case "CENTER":
619                         return VerticalAlignment.Center;
620                     case "BOTTOM":
621                         return VerticalAlignment.Bottom;
622                     default:
623                         return VerticalAlignment.Bottom;
624                 }
625             }
626             set
627             {
628                 string valueToString = "";
629                 switch (value)
630                 {
631                     case VerticalAlignment.Top:
632                     {
633                         valueToString = "TOP";
634                         break;
635                     }
636                     case VerticalAlignment.Center:
637                     {
638                         valueToString = "CENTER";
639                         break;
640                     }
641                     case VerticalAlignment.Bottom:
642                     {
643                         valueToString = "BOTTOM";
644                         break;
645                     }
646                     default:
647                     {
648                         valueToString = "BOTTOM";
649                         break;
650                     }
651                 }
652                 SetProperty(TextField.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
653             }
654         }
655
656         /// <summary>
657         /// TextColor property.
658         /// </summary>
659         public Color TextColor
660         {
661             get
662             {
663                 Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f);
664                 GetProperty(TextField.Property.TEXT_COLOR).Get(temp);
665                 return temp;
666             }
667             set
668             {
669                 SetProperty(TextField.Property.TEXT_COLOR, new Tizen.NUI.PropertyValue(value));
670             }
671         }
672
673         /// <summary>
674         /// PlaceholderTextColor property.
675         /// </summary>
676         public Vector4 PlaceholderTextColor
677         {
678             get
679             {
680                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
681                 GetProperty(TextField.Property.PLACEHOLDER_TEXT_COLOR).Get(temp);
682                 return temp;
683             }
684             set
685             {
686                 SetProperty(TextField.Property.PLACEHOLDER_TEXT_COLOR, new Tizen.NUI.PropertyValue(value));
687             }
688         }
689
690         /// <summary>
691         /// ShadowOffset property.
692         /// </summary>
693         public Vector2 ShadowOffset
694         {
695             get
696             {
697                 Vector2 temp = new Vector2(0.0f, 0.0f);
698                 GetProperty(TextField.Property.SHADOW_OFFSET).Get(temp);
699                 return temp;
700             }
701             set
702             {
703                 SetProperty(TextField.Property.SHADOW_OFFSET, new Tizen.NUI.PropertyValue(value));
704             }
705         }
706
707         /// <summary>
708         /// ShadowColor property.
709         /// </summary>
710         public Vector4 ShadowColor
711         {
712             get
713             {
714                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
715                 GetProperty(TextField.Property.SHADOW_COLOR).Get(temp);
716                 return temp;
717             }
718             set
719             {
720                 SetProperty(TextField.Property.SHADOW_COLOR, new Tizen.NUI.PropertyValue(value));
721             }
722         }
723
724         /// <summary>
725         /// PrimaryCursorColor property.
726         /// </summary>
727         public Vector4 PrimaryCursorColor
728         {
729             get
730             {
731                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
732                 GetProperty(TextField.Property.PRIMARY_CURSOR_COLOR).Get(temp);
733                 return temp;
734             }
735             set
736             {
737                 SetProperty(TextField.Property.PRIMARY_CURSOR_COLOR, new Tizen.NUI.PropertyValue(value));
738             }
739         }
740
741         /// <summary>
742         /// SecondaryCursorColor property.
743         /// </summary>
744         public Vector4 SecondaryCursorColor
745         {
746             get
747             {
748                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
749                 GetProperty(TextField.Property.SECONDARY_CURSOR_COLOR).Get(temp);
750                 return temp;
751             }
752             set
753             {
754                 SetProperty(TextField.Property.SECONDARY_CURSOR_COLOR, new Tizen.NUI.PropertyValue(value));
755             }
756         }
757
758         /// <summary>
759         /// EnableCursorBlink property.
760         /// </summary>
761         public bool EnableCursorBlink
762         {
763             get
764             {
765                 bool temp = false;
766                 GetProperty(TextField.Property.ENABLE_CURSOR_BLINK).Get(out temp);
767                 return temp;
768             }
769             set
770             {
771                 SetProperty(TextField.Property.ENABLE_CURSOR_BLINK, new Tizen.NUI.PropertyValue(value));
772             }
773         }
774
775         /// <summary>
776         /// CursorBlinkInterval property.
777         /// </summary>
778         public float CursorBlinkInterval
779         {
780             get
781             {
782                 float temp = 0.0f;
783                 GetProperty(TextField.Property.CURSOR_BLINK_INTERVAL).Get(out temp);
784                 return temp;
785             }
786             set
787             {
788                 SetProperty(TextField.Property.CURSOR_BLINK_INTERVAL, new Tizen.NUI.PropertyValue(value));
789             }
790         }
791
792         /// <summary>
793         /// CursorBlinkDuration property.
794         /// </summary>
795         public float CursorBlinkDuration
796         {
797             get
798             {
799                 float temp = 0.0f;
800                 GetProperty(TextField.Property.CURSOR_BLINK_DURATION).Get(out temp);
801                 return temp;
802             }
803             set
804             {
805                 SetProperty(TextField.Property.CURSOR_BLINK_DURATION, new Tizen.NUI.PropertyValue(value));
806             }
807         }
808
809         /// <summary>
810         /// CursorWidth property.
811         /// </summary>
812         public int CursorWidth
813         {
814             get
815             {
816                 int temp = 0;
817                 GetProperty(TextField.Property.CURSOR_WIDTH).Get(out temp);
818                 return temp;
819             }
820             set
821             {
822                 SetProperty(TextField.Property.CURSOR_WIDTH, new Tizen.NUI.PropertyValue(value));
823             }
824         }
825
826         /// <summary>
827         /// GrabHandleImage property.
828         /// </summary>
829         public string GrabHandleImage
830         {
831             get
832             {
833                 string temp;
834                 GetProperty(TextField.Property.GRAB_HANDLE_IMAGE).Get(out temp);
835                 return temp;
836             }
837             set
838             {
839                 SetProperty(TextField.Property.GRAB_HANDLE_IMAGE, new Tizen.NUI.PropertyValue(value));
840             }
841         }
842
843         /// <summary>
844         /// GrabHandlePressedImage property.
845         /// </summary>
846         public string GrabHandlePressedImage
847         {
848             get
849             {
850                 string temp;
851                 GetProperty(TextField.Property.GRAB_HANDLE_PRESSED_IMAGE).Get(out temp);
852                 return temp;
853             }
854             set
855             {
856                 SetProperty(TextField.Property.GRAB_HANDLE_PRESSED_IMAGE, new Tizen.NUI.PropertyValue(value));
857             }
858         }
859
860         /// <summary>
861         /// ScrollThreshold property.
862         /// </summary>
863         public float ScrollThreshold
864         {
865             get
866             {
867                 float temp = 0.0f;
868                 GetProperty(TextField.Property.SCROLL_THRESHOLD).Get(out temp);
869                 return temp;
870             }
871             set
872             {
873                 SetProperty(TextField.Property.SCROLL_THRESHOLD, new Tizen.NUI.PropertyValue(value));
874             }
875         }
876
877         /// <summary>
878         /// ScrollSpeed property.
879         /// </summary>
880         public float ScrollSpeed
881         {
882             get
883             {
884                 float temp = 0.0f;
885                 GetProperty(TextField.Property.SCROLL_SPEED).Get(out temp);
886                 return temp;
887             }
888             set
889             {
890                 SetProperty(TextField.Property.SCROLL_SPEED, new Tizen.NUI.PropertyValue(value));
891             }
892         }
893
894         /// <summary>
895         /// SelectionHandleImageLeft property.
896         /// </summary>
897         public PropertyMap SelectionHandleImageLeft
898         {
899             get
900             {
901                 PropertyMap temp = new PropertyMap();
902                 GetProperty(TextField.Property.SELECTION_HANDLE_IMAGE_LEFT).Get(temp);
903                 return temp;
904             }
905             set
906             {
907                 SetProperty(TextField.Property.SELECTION_HANDLE_IMAGE_LEFT, new Tizen.NUI.PropertyValue(value));
908             }
909         }
910
911         /// <summary>
912         /// SelectionHandleImageRight property.
913         /// </summary>
914         public PropertyMap SelectionHandleImageRight
915         {
916             get
917             {
918                 PropertyMap temp = new PropertyMap();
919                 GetProperty(TextField.Property.SELECTION_HANDLE_IMAGE_RIGHT).Get(temp);
920                 return temp;
921             }
922             set
923             {
924                 SetProperty(TextField.Property.SELECTION_HANDLE_IMAGE_RIGHT, new Tizen.NUI.PropertyValue(value));
925             }
926         }
927
928         /// <summary>
929         /// SelectionHandlePressedImageLeft property.
930         /// </summary>
931         public PropertyMap SelectionHandlePressedImageLeft
932         {
933             get
934             {
935                 PropertyMap temp = new PropertyMap();
936                 GetProperty(TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_LEFT).Get(temp);
937                 return temp;
938             }
939             set
940             {
941                 SetProperty(TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_LEFT, new Tizen.NUI.PropertyValue(value));
942             }
943         }
944
945         /// <summary>
946         /// SelectionHandlePressedImageRight property.
947         /// </summary>
948         public PropertyMap SelectionHandlePressedImageRight
949         {
950             get
951             {
952                 PropertyMap temp = new PropertyMap();
953                 GetProperty(TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_RIGHT).Get(temp);
954                 return temp;
955             }
956             set
957             {
958                 SetProperty(TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, new Tizen.NUI.PropertyValue(value));
959             }
960         }
961
962         /// <summary>
963         /// SelectionHandleMarkerImageLeft property.
964         /// </summary>
965         public PropertyMap SelectionHandleMarkerImageLeft
966         {
967             get
968             {
969                 PropertyMap temp = new PropertyMap();
970                 GetProperty(TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_LEFT).Get(temp);
971                 return temp;
972             }
973             set
974             {
975                 SetProperty(TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_LEFT, new Tizen.NUI.PropertyValue(value));
976             }
977         }
978
979         /// <summary>
980         /// SelectionHandleMarkerImageRight property.
981         /// </summary>
982         public PropertyMap SelectionHandleMarkerImageRight
983         {
984             get
985             {
986                 PropertyMap temp = new PropertyMap();
987                 GetProperty(TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_RIGHT).Get(temp);
988                 return temp;
989             }
990             set
991             {
992                 SetProperty(TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_RIGHT, new Tizen.NUI.PropertyValue(value));
993             }
994         }
995
996         /// <summary>
997         /// SelectionHighlightColor property.
998         /// </summary>
999         public Vector4 SelectionHighlightColor
1000         {
1001             get
1002             {
1003                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1004                 GetProperty(TextField.Property.SELECTION_HIGHLIGHT_COLOR).Get(temp);
1005                 return temp;
1006             }
1007             set
1008             {
1009                 SetProperty(TextField.Property.SELECTION_HIGHLIGHT_COLOR, new Tizen.NUI.PropertyValue(value));
1010             }
1011         }
1012
1013         /// <summary>
1014         /// DecorationBoundingBox property.
1015         /// </summary>
1016         public Rectangle DecorationBoundingBox
1017         {
1018             get
1019             {
1020                 Rectangle temp = new Rectangle(0, 0, 0, 0);
1021                 GetProperty(TextField.Property.DECORATION_BOUNDING_BOX).Get(temp);
1022                 return temp;
1023             }
1024             set
1025             {
1026                 SetProperty(TextField.Property.DECORATION_BOUNDING_BOX, new Tizen.NUI.PropertyValue(value));
1027             }
1028         }
1029
1030         /// <summary>
1031         /// InputMethodSettings property.
1032         /// </summary>
1033         public PropertyMap InputMethodSettings
1034         {
1035             get
1036             {
1037                 PropertyMap temp = new PropertyMap();
1038                 GetProperty(TextField.Property.INPUT_METHOD_SETTINGS).Get(temp);
1039                 return temp;
1040             }
1041             set
1042             {
1043                 SetProperty(TextField.Property.INPUT_METHOD_SETTINGS, new Tizen.NUI.PropertyValue(value));
1044             }
1045         }
1046
1047         /// <summary>
1048         /// InputColor property.
1049         /// </summary>
1050         public Vector4 InputColor
1051         {
1052             get
1053             {
1054                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1055                 GetProperty(TextField.Property.INPUT_COLOR).Get(temp);
1056                 return temp;
1057             }
1058             set
1059             {
1060                 SetProperty(TextField.Property.INPUT_COLOR, new Tizen.NUI.PropertyValue(value));
1061             }
1062         }
1063
1064         /// <summary>
1065         /// EnableMarkup property.
1066         /// </summary>
1067         public bool EnableMarkup
1068         {
1069             get
1070             {
1071                 bool temp = false;
1072                 GetProperty(TextField.Property.ENABLE_MARKUP).Get(out temp);
1073                 return temp;
1074             }
1075             set
1076             {
1077                 SetProperty(TextField.Property.ENABLE_MARKUP, new Tizen.NUI.PropertyValue(value));
1078             }
1079         }
1080
1081         /// <summary>
1082         /// InputFontFamily property.
1083         /// </summary>
1084         public string InputFontFamily
1085         {
1086             get
1087             {
1088                 string temp;
1089                 GetProperty(TextField.Property.INPUT_FONT_FAMILY).Get(out temp);
1090                 return temp;
1091             }
1092             set
1093             {
1094                 SetProperty(TextField.Property.INPUT_FONT_FAMILY, new Tizen.NUI.PropertyValue(value));
1095             }
1096         }
1097
1098         /// <summary>
1099         /// InputFontStyle property.
1100         /// </summary>
1101         public PropertyMap InputFontStyle
1102         {
1103             get
1104             {
1105                 PropertyMap temp = new PropertyMap();
1106                 GetProperty(TextField.Property.INPUT_FONT_STYLE).Get(temp);
1107                 return temp;
1108             }
1109             set
1110             {
1111                 SetProperty(TextField.Property.INPUT_FONT_STYLE, new Tizen.NUI.PropertyValue(value));
1112             }
1113         }
1114
1115         /// <summary>
1116         /// InputPointSize property.
1117         /// </summary>
1118         public float InputPointSize
1119         {
1120             get
1121             {
1122                 float temp = 0.0f;
1123                 GetProperty(TextField.Property.INPUT_POINT_SIZE).Get(out temp);
1124                 return temp;
1125             }
1126             set
1127             {
1128                 SetProperty(TextField.Property.INPUT_POINT_SIZE, new Tizen.NUI.PropertyValue(value));
1129             }
1130         }
1131
1132         /// <summary>
1133         /// Underline property.
1134         /// </summary>
1135         public PropertyMap Underline
1136         {
1137             get
1138             {
1139                 PropertyMap temp = new PropertyMap();
1140                 GetProperty(TextField.Property.UNDERLINE).Get(temp);
1141                 return temp;
1142             }
1143             set
1144             {
1145                 SetProperty(TextField.Property.UNDERLINE, new Tizen.NUI.PropertyValue(value));
1146             }
1147         }
1148
1149         /// <summary>
1150         /// InputUnderline property.
1151         /// </summary>
1152         public string InputUnderline
1153         {
1154             get
1155             {
1156                 string temp;
1157                 GetProperty(TextField.Property.INPUT_UNDERLINE).Get(out temp);
1158                 return temp;
1159             }
1160             set
1161             {
1162                 SetProperty(TextField.Property.INPUT_UNDERLINE, new Tizen.NUI.PropertyValue(value));
1163             }
1164         }
1165
1166         /// <summary>
1167         /// Shadow property.
1168         /// </summary>
1169         public PropertyMap Shadow
1170         {
1171             get
1172             {
1173                 PropertyMap temp = new PropertyMap();
1174                 GetProperty(TextField.Property.SHADOW).Get(temp);
1175                 return temp;
1176             }
1177             set
1178             {
1179                 SetProperty(TextField.Property.SHADOW, new Tizen.NUI.PropertyValue(value));
1180             }
1181         }
1182
1183         /// <summary>
1184         /// InputShadow property.
1185         /// </summary>
1186         public string InputShadow
1187         {
1188             get
1189             {
1190                 string temp;
1191                 GetProperty(TextField.Property.INPUT_SHADOW).Get(out temp);
1192                 return temp;
1193             }
1194             set
1195             {
1196                 SetProperty(TextField.Property.INPUT_SHADOW, new Tizen.NUI.PropertyValue(value));
1197             }
1198         }
1199
1200         /// <summary>
1201         /// Emboss property.
1202         /// </summary>
1203         public string Emboss
1204         {
1205             get
1206             {
1207                 string temp;
1208                 GetProperty(TextField.Property.EMBOSS).Get(out temp);
1209                 return temp;
1210             }
1211             set
1212             {
1213                 SetProperty(TextField.Property.EMBOSS, new Tizen.NUI.PropertyValue(value));
1214             }
1215         }
1216
1217         /// <summary>
1218         /// InputEmboss property.
1219         /// </summary>
1220         public string InputEmboss
1221         {
1222             get
1223             {
1224                 string temp;
1225                 GetProperty(TextField.Property.INPUT_EMBOSS).Get(out temp);
1226                 return temp;
1227             }
1228             set
1229             {
1230                 SetProperty(TextField.Property.INPUT_EMBOSS, new Tizen.NUI.PropertyValue(value));
1231             }
1232         }
1233
1234         /// <summary>
1235         /// Outline property.
1236         /// </summary>
1237         public string Outline
1238         {
1239             get
1240             {
1241                 string temp;
1242                 GetProperty(TextField.Property.OUTLINE).Get(out temp);
1243                 return temp;
1244             }
1245             set
1246             {
1247                 SetProperty(TextField.Property.OUTLINE, new Tizen.NUI.PropertyValue(value));
1248             }
1249         }
1250
1251         /// <summary>
1252         /// InputOutline property.
1253         /// </summary>
1254         public string InputOutline
1255         {
1256             get
1257             {
1258                 string temp;
1259                 GetProperty(TextField.Property.INPUT_OUTLINE).Get(out temp);
1260                 return temp;
1261             }
1262             set
1263             {
1264                 SetProperty(TextField.Property.INPUT_OUTLINE, new Tizen.NUI.PropertyValue(value));
1265             }
1266         }
1267
1268         /// <summary>
1269         /// HiddenInputSettings property.
1270         /// </summary>
1271         public Tizen.NUI.PropertyMap HiddenInputSettings
1272         {
1273             get
1274             {
1275                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
1276                 GetProperty(TextField.Property.HIDDEN_INPUT_SETTINGS).Get(temp);
1277                 return temp;
1278             }
1279             set
1280             {
1281                 SetProperty(TextField.Property.HIDDEN_INPUT_SETTINGS, new Tizen.NUI.PropertyValue(value));
1282             }
1283         }
1284
1285         /// <summary>
1286         /// PixelSize property.
1287         /// </summary>
1288         public float PixelSize
1289         {
1290             get
1291             {
1292                 float temp = 0.0f;
1293                 GetProperty(TextField.Property.PIXEL_SIZE).Get(out temp);
1294                 return temp;
1295             }
1296             set
1297             {
1298                 SetProperty(TextField.Property.PIXEL_SIZE, new Tizen.NUI.PropertyValue(value));
1299             }
1300         }
1301
1302         /// <summary>
1303         /// Enable selection property.
1304         /// </summary>
1305         public bool EnableSelection
1306         {
1307             get
1308             {
1309                 bool temp = false;
1310                 GetProperty(TextField.Property.ENABLE_SELECTION).Get(out temp);
1311                 return temp;
1312             }
1313             set
1314             {
1315                 SetProperty(TextField.Property.ENABLE_SELECTION, new Tizen.NUI.PropertyValue(value));
1316             }
1317         }
1318
1319         /// <summary>
1320         /// Placeholder property.
1321         /// Gets/Sets the placeholder : text, color, font family, font style, point size, and pixel size.
1322         /// </summary>
1323         /// <example>
1324         /// The following example demonstrates how to set the placeholder property.
1325         /// <code>
1326         /// PropertyMap propertyMap = new PropertyMap();
1327         /// propertyMap.Add("placeholderText", new PropertyValue("Setting Placeholder Text"));
1328         /// propertyMap.Add("placeholderTextFocused", new PropertyValue("Setting Placeholder Text Focused"));
1329         /// propertyMap.Add("placeholderColor", new PropertyValue(Color.Red));
1330         /// propertyMap.Add("placeholderFontFamily", new PropertyValue("Arial"));
1331         /// propertyMap.Add("placeholderPointSize", new PropertyValue(12.0f));
1332         ///
1333         /// PropertyMap fontStyleMap = new PropertyMap();
1334         /// fontStyleMap.Add("weight", new PropertyValue("bold"));
1335         /// fontStyleMap.Add("width", new PropertyValue("condensed"));
1336         /// fontStyleMap.Add("slant", new PropertyValue("italic"));
1337         /// propertyMap.Add("placeholderFontStyle", new PropertyValue(fontStyleMap));
1338         ///
1339         /// TextField field = new TextField();
1340         /// field.Placeholder = propertyMap;
1341         /// </code>
1342         /// </example>
1343         public Tizen.NUI.PropertyMap Placeholder
1344         {
1345             get
1346             {
1347                 Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
1348                 GetProperty(TextField.Property.PLACEHOLDER).Get(temp);
1349                 return temp;
1350             }
1351             set
1352             {
1353                 SetProperty(TextField.Property.PLACEHOLDER, new Tizen.NUI.PropertyValue(value));
1354             }
1355         }
1356
1357     }
1358
1359 }