84f19b81898739ebe94ddb8de9b874fc262ced29
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextLabel.cs
1 /*
2  * Copyright(c) 2020 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 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
20 using System;
21 using System.Globalization;
22 using System.ComponentModel;
23 using Tizen.NUI.Binding;
24
25 namespace Tizen.NUI.BaseComponents
26 {
27     /// <summary>
28     /// A control which renders a short text string.<br />
29     /// Text labels are lightweight, non-editable, and do not respond to the user input.<br />
30     /// </summary>
31     /// <since_tizen> 3 </since_tizen>
32     public partial class TextLabel : View
33     {
34         private class TextLayout : LayoutItem
35         {
36             protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
37             {
38                 // Padding will be automatically applied by DALi TextLabel.
39                 float totalWidth = widthMeasureSpec.Size.AsDecimal();
40                 float totalHeight = heightMeasureSpec.Size.AsDecimal();
41
42                 if (widthMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
43                 {
44                     if (heightMeasureSpec.Mode != MeasureSpecification.ModeType.Exactly)
45                     {
46                         totalHeight = Owner.GetHeightForWidth(totalWidth);
47                         heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
48                     }
49                 }
50                 else
51                 {
52                     if (heightMeasureSpec.Mode == MeasureSpecification.ModeType.Exactly)
53                     {
54                         // GetWidthForHeight is not implemented.
55                         totalWidth = Owner.GetNaturalSize().Width;
56                         widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
57                     }
58                     else
59                     {
60                         Vector3 naturalSize = Owner.GetNaturalSize();
61                         totalWidth = naturalSize.Width;
62                         totalHeight = naturalSize.Height;
63
64                         heightMeasureSpec = new MeasureSpecification(new LayoutLength(totalHeight), MeasureSpecification.ModeType.Exactly);
65                         widthMeasureSpec = new MeasureSpecification(new LayoutLength(totalWidth), MeasureSpecification.ModeType.Exactly);
66                     }
67                 }
68
69                 MeasuredSize.StateType childWidthState = MeasuredSize.StateType.MeasuredSizeOK;
70                 MeasuredSize.StateType childHeightState = MeasuredSize.StateType.MeasuredSizeOK;
71
72                 SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, childWidthState),
73                                        ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, childHeightState));
74             }
75         }
76
77         static TextLabel() { }
78
79         private string textLabelSid = null;
80         private bool systemlangTextFlag = false;
81         private TextLabelSelectorData selectorData;
82
83         /// <summary>
84         /// Return a copied Style instance of the TextLabel.
85         /// </summary>
86         /// <remarks>
87         /// It returns copied style instance so that changing it does not effect to the view.
88         /// Style setting is possible by using constructor or the function of <see cref="View.ApplyStyle"/>.
89         /// </remarks>
90         [EditorBrowsable(EditorBrowsableState.Never)]
91         public TextLabelStyle Style => new TextLabelStyle(this);
92
93         /// <summary>
94         /// Creates the TextLabel control.
95         /// </summary>
96         /// <since_tizen> 3 </since_tizen>
97         public TextLabel() : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true)
98         {
99             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100             Layout = new TextLayout();
101         }
102
103         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
104         [EditorBrowsable(EditorBrowsableState.Never)]
105         public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true, viewStyle)
106         {
107             Layout = new TextLayout();
108         }
109
110         /// <summary>
111         /// Creates the TextLabel with setting the status of shown or hidden.
112         /// </summary>
113         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
114         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
115         [EditorBrowsable(EditorBrowsableState.Never)]
116         public TextLabel(bool shown) : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true)
117         {
118             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119             Layout = new TextLayout();
120             SetVisible(shown);
121         }
122
123         /// <summary>
124         /// Creates the TextLabel control.
125         /// </summary>
126         /// <param name="text">The text to display</param>
127         /// <since_tizen> 3 </since_tizen>
128         public TextLabel(string text) : this(Interop.TextLabel.TextLabel_New__SWIG_1(text), true)
129         {
130             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
131             Layout = new TextLayout();
132         }
133
134         /// <summary>
135         /// Creates the TextLabel with setting the status of shown or hidden.
136         /// </summary>
137         /// <param name="text">The text to display</param>
138         /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
139         /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
140         [EditorBrowsable(EditorBrowsableState.Never)]
141         public TextLabel(string text, bool shown) : this(Interop.TextLabel.TextLabel_New__SWIG_1(text), true)
142         {
143             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144             Layout = new TextLayout();
145             SetVisible(shown);
146         }
147
148         internal TextLabel(TextLabel handle, bool shown = true) : this(Interop.TextLabel.new_TextLabel__SWIG_1(TextLabel.getCPtr(handle)), true)
149         {
150             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151
152             if (!shown)
153             {
154                 SetVisible(false);
155             }
156         }
157
158         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(Interop.TextLabel.TextLabel_SWIGUpcast(cPtr), cMemoryOwn, viewStyle)
159         {
160             if (!shown)
161             {
162                 SetVisible(false);
163             }
164         }
165
166         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextLabel.TextLabel_SWIGUpcast(cPtr), cMemoryOwn)
167         {
168             ApplyStyle(ThemeManager.GetStyle(nameof(TextLabel)));
169
170             if (!shown)
171             {
172                 SetVisible(false);
173             }
174         }
175
176         /// <summary>
177         /// The TranslatableText property.<br />
178         /// The text can set the SID value.<br />
179         /// </summary>
180         /// <exception cref='ArgumentNullException'>
181         /// ResourceManager about multilingual is null.
182         /// </exception>
183         /// <since_tizen> 4 </since_tizen>
184         public string TranslatableText
185         {
186             get
187             {
188                 return (string)GetValue(TranslatableTextProperty);
189             }
190             set
191             {
192                 SetValue(TranslatableTextProperty, value);
193                 selectorData?.TranslatableText.UpdateIfNeeds(this, value);
194             }
195         }
196         private string translatableText
197         {
198             get
199             {
200                 return textLabelSid;
201             }
202             set
203             {
204                 if (NUIApplication.MultilingualResourceManager == null)
205                 {
206                     throw new ArgumentNullException("ResourceManager about multilingual is null");
207                 }
208                 string translatableText = null;
209                 textLabelSid = value;
210                 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
211                 if (translatableText != null)
212                 {
213                     Text = translatableText;
214                     if (systemlangTextFlag == false)
215                     {
216                         SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
217                         systemlangTextFlag = true;
218                     }
219                 }
220                 else
221                 {
222                     Text = "";
223                 }
224                 NotifyPropertyChanged();
225             }
226         }
227
228         /// <summary>
229         /// The Text property.<br />
230         /// The text to display in the UTF-8 format.<br />
231         /// </summary>
232         /// <since_tizen> 3 </since_tizen>
233         public string Text
234         {
235             get
236             {
237                 return (string)GetValue(TextProperty);
238             }
239             set
240             {
241                 SetValue(TextProperty, value);
242                 selectorData?.Text.UpdateIfNeeds(this, value);
243                 NotifyPropertyChangedAndRequestLayout();
244             }
245         }
246
247         /// <summary>
248         /// The FontFamily property.<br />
249         /// The requested font family to use.<br />
250         /// </summary>
251         /// <since_tizen> 3 </since_tizen>
252         public string FontFamily
253         {
254             get
255             {
256                 return (string)GetValue(FontFamilyProperty);
257             }
258             set
259             {
260                 SetValue(FontFamilyProperty, value);
261                 selectorData?.FontFamily.UpdateIfNeeds(this, value);
262                 NotifyPropertyChangedAndRequestLayout();
263             }
264         }
265
266         /// <summary>
267         /// The FontStyle property.<br />
268         /// The requested font style to use.<br />
269         /// </summary>
270         /// <since_tizen> 3 </since_tizen>
271         public PropertyMap FontStyle
272         {
273             get
274             {
275                 return (PropertyMap)GetValue(FontStyleProperty);
276             }
277             set
278             {
279                 SetValue(FontStyleProperty, value);
280                 NotifyPropertyChangedAndRequestLayout();
281             }
282         }
283
284         /// <summary>
285         /// The PointSize property.<br />
286         /// The size of font in points.<br />
287         /// </summary>
288         /// <since_tizen> 3 </since_tizen>
289         public float PointSize
290         {
291             get
292             {
293                 return (float)GetValue(PointSizeProperty);
294             }
295             set
296             {
297                 SetValue(PointSizeProperty, value);
298                 selectorData?.PointSize.UpdateIfNeeds(this, value);
299                 NotifyPropertyChangedAndRequestLayout();
300             }
301         }
302
303         /// <summary>
304         /// The MultiLine property.<br />
305         /// The single-line or multi-line layout option.<br />
306         /// </summary>
307         /// <since_tizen> 3 </since_tizen>
308         public bool MultiLine
309         {
310             get
311             {
312                 return (bool)GetValue(MultiLineProperty);
313             }
314             set
315             {
316                 SetValue(MultiLineProperty, value);
317                 NotifyPropertyChangedAndRequestLayout();
318             }
319         }
320
321         /// <summary>
322         /// The HorizontalAlignment property.<br />
323         /// The line horizontal alignment.<br />
324         /// </summary>
325         /// <since_tizen> 3 </since_tizen>
326         public HorizontalAlignment HorizontalAlignment
327         {
328             get
329             {
330                 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
331             }
332             set
333             {
334                 SetValue(HorizontalAlignmentProperty, value);
335                 NotifyPropertyChanged();
336             }
337         }
338
339         /// <summary>
340         /// The VerticalAlignment property.<br />
341         /// The line vertical alignment.<br />
342         /// </summary>
343         /// <since_tizen> 3 </since_tizen>
344         public VerticalAlignment VerticalAlignment
345         {
346             get
347             {
348                 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
349             }
350             set
351             {
352                 SetValue(VerticalAlignmentProperty, value);
353                 NotifyPropertyChanged();
354             }
355         }
356
357         /// <summary>
358         /// The TextColor property.<br />
359         /// The color of the text.<br />
360         /// Animation framework can be used to change the color of the text when not using mark up.<br />
361         /// Cannot animate the color when text is auto scrolling.<br />
362         /// </summary>
363         /// <remarks>
364         /// The property cascade chaining set is possible. For example, this (textLabel.TextColor.X = 0.1f;) is possible.
365         /// </remarks>
366         /// <since_tizen> 3 </since_tizen>
367         public Color TextColor
368         {
369             get
370             {
371                 Color temp = (Color)GetValue(TextColorProperty);
372                 return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
373             }
374             set
375             {
376                 SetValue(TextColorProperty, value);
377                 selectorData?.TextColor.UpdateIfNeeds(this, value);
378                 NotifyPropertyChanged();
379             }
380         }
381
382         /// <summary>
383         /// The ShadowOffset property.<br />
384         /// The drop shadow offset 0 indicates no shadow.<br />
385         /// </summary>
386         /// <since_tizen> 3 </since_tizen>
387         /// <remarks>
388         /// Deprecated.(API Level 6) Use Shadow instead.
389         /// The property cascade chaining set is possible. For example, this (textLabel.ShadowOffset.X = 0.1f;) is possible.
390         /// </remarks>
391         [Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
392         public Vector2 ShadowOffset
393         {
394             get
395             {
396                 Vector2 shadowOffset = new Vector2();
397                 Shadow.Find(TextLabel.Property.SHADOW, "offset")?.Get(shadowOffset);
398                 return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
399             }
400             set
401             {
402                 PropertyMap temp = new PropertyMap();
403                 temp.Insert("offset", new PropertyValue(value));
404
405                 PropertyMap shadowMap = Shadow;
406                 shadowMap.Merge(temp);
407
408                 SetValue(ShadowProperty, shadowMap);
409                 NotifyPropertyChanged();
410             }
411         }
412
413         /// <summary>
414         /// The ShadowColor property.<br />
415         /// The color of a drop shadow.<br />
416         /// </summary>
417         /// <since_tizen> 3 </since_tizen>
418         /// <remarks>
419         /// Deprecated.(API Level 6) Use Shadow instead.
420         /// The property cascade chaining set is possible. For example, this (textLabel.ShadowColor.X = 0.1f;) is possible.
421         /// </remarks>
422         [Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
423         public Vector4 ShadowColor
424         {
425             get
426             {
427                 Vector4 shadowColor = new Vector4();
428                 Shadow.Find(TextLabel.Property.SHADOW, "color")?.Get(shadowColor);
429                 return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
430             }
431             set
432             {
433                 PropertyMap temp = new PropertyMap();
434                 temp.Insert("color", new PropertyValue(value));
435
436                 PropertyMap shadowMap = Shadow;
437                 shadowMap.Merge(temp);
438
439                 SetValue(ShadowProperty, shadowMap);
440                 NotifyPropertyChanged();
441             }
442         }
443
444         /// <summary>
445         /// The UnderlineEnabled property.<br />
446         /// The underline enabled flag.<br />
447         /// </summary>
448         /// <since_tizen> 3 </since_tizen>
449         /// <remarks>
450         /// Deprecated.(API Level 6) Use Underline instead.
451         /// </remarks>
452         [Obsolete("Please do not use this UnderlineEnabled(Deprecated). Please use Underline instead.")]
453         public bool UnderlineEnabled
454         {
455             get
456             {
457                 bool underlineEnabled = false;
458                 Underline.Find(TextLabel.Property.UNDERLINE, "enable")?.Get(out underlineEnabled);
459                 return underlineEnabled;
460             }
461             set
462             {
463                 PropertyMap temp = new PropertyMap();
464                 temp.Add("enable", new PropertyValue(value));
465
466                 PropertyMap undelineMap = Underline;
467                 undelineMap.Merge(temp);
468
469                 SetValue(UnderlineProperty, undelineMap);
470                 NotifyPropertyChanged();
471
472             }
473         }
474
475         /// <summary>
476         /// The UnderlineColor property.<br />
477         /// Overrides the underline height from font metrics.<br />
478         /// </summary>
479         /// <since_tizen> 3 </since_tizen>
480         /// <remarks>
481         /// Deprecated.(API Level 6) Use Underline instead.
482         /// The property cascade chaining set is possible. For example, this (textLabel.UnderlineColor.X = 0.1f;) is possible.
483         /// </remarks>
484         [Obsolete("Please do not use this UnderlineColor(Deprecated). Please use Underline instead.")]
485         public Vector4 UnderlineColor
486         {
487             get
488             {
489                 Vector4 underlineColor = new Vector4();
490                 Underline.Find(TextLabel.Property.UNDERLINE, "color")?.Get(underlineColor);
491                 return new Vector4(OnUnderlineColorChanged, underlineColor.X, underlineColor.Y, underlineColor.Z, underlineColor.W);
492             }
493             set
494             {
495                 PropertyMap temp = new PropertyMap();
496                 temp.Insert("color", new PropertyValue(value));
497
498                 PropertyMap undelineMap = Underline;
499                 undelineMap.Merge(temp);
500
501                 SetValue(UnderlineProperty, undelineMap);
502                 NotifyPropertyChanged();
503             }
504         }
505
506         /// <summary>
507         /// The UnderlineHeight property.<br />
508         /// Overrides the underline height from font metrics.<br />
509         /// </summary>
510         /// <since_tizen> 3 </since_tizen>
511         /// <remarks>
512         /// Deprecated.(API Level 6) Use Underline instead.
513         /// </remarks>
514         [Obsolete("Please do not use this UnderlineHeight(Deprecated). Please use Underline instead.")]
515         public float UnderlineHeight
516         {
517             get
518             {
519                 float underlineHeight = 0.0f;
520                 Underline.Find(TextLabel.Property.UNDERLINE, "height")?.Get(out underlineHeight);
521                 return underlineHeight;
522             }
523             set
524             {
525                 PropertyMap temp = new PropertyMap();
526                 temp.Insert("height", new PropertyValue(value));
527
528                 PropertyMap undelineMap = Underline;
529                 undelineMap.Merge(temp);
530
531                 SetValue(UnderlineProperty, undelineMap);
532                 NotifyPropertyChanged();
533             }
534         }
535
536         /// <summary>
537         /// The EnableMarkup property.<br />
538         /// Whether the mark-up processing is enabled.<br />
539         /// </summary>
540         /// <since_tizen> 3 </since_tizen>
541         public bool EnableMarkup
542         {
543             get
544             {
545                 return (bool)GetValue(EnableMarkupProperty);
546             }
547             set
548             {
549                 SetValue(EnableMarkupProperty, value);
550                 NotifyPropertyChanged();
551             }
552         }
553
554         /// <summary>
555         /// The EnableAutoScroll property.<br />
556         /// Starts or stops auto scrolling.<br />
557         /// </summary>
558         /// <since_tizen> 3 </since_tizen>
559         public bool EnableAutoScroll
560         {
561             get
562             {
563                 return (bool)GetValue(EnableAutoScrollProperty);
564             }
565             set
566             {
567                 SetValue(EnableAutoScrollProperty, value);
568                 NotifyPropertyChanged();
569             }
570         }
571
572         /// <summary>
573         /// The AutoScrollSpeed property.<br />
574         /// Sets the speed of scrolling in pixels per second.<br />
575         /// </summary>
576         /// <since_tizen> 3 </since_tizen>
577         public int AutoScrollSpeed
578         {
579             get
580             {
581                 return (int)GetValue(AutoScrollSpeedProperty);
582             }
583             set
584             {
585                 SetValue(AutoScrollSpeedProperty, value);
586                 NotifyPropertyChanged();
587             }
588         }
589
590         /// <summary>
591         /// The AutoScrollLoopCount property.<br />
592         /// Number of complete loops when scrolling enabled.<br />
593         /// </summary>
594         /// <since_tizen> 3 </since_tizen>
595         public int AutoScrollLoopCount
596         {
597             get
598             {
599                 return (int)GetValue(AutoScrollLoopCountProperty);
600             }
601             set
602             {
603                 SetValue(AutoScrollLoopCountProperty, value);
604                 NotifyPropertyChanged();
605             }
606         }
607
608         /// <summary>
609         /// The AutoScrollGap property.<br />
610         /// Gap before scrolling wraps.<br />
611         /// </summary>
612         /// <since_tizen> 3 </since_tizen>
613         public float AutoScrollGap
614         {
615             get
616             {
617                 return (float)GetValue(AutoScrollGapProperty);
618             }
619             set
620             {
621                 SetValue(AutoScrollGapProperty, value);
622                 NotifyPropertyChanged();
623             }
624         }
625
626         /// <summary>
627         /// The LineSpacing property.<br />
628         /// The default extra space between lines in points.<br />
629         /// </summary>
630         /// <since_tizen> 3 </since_tizen>
631         public float LineSpacing
632         {
633             get
634             {
635                 return (float)GetValue(LineSpacingProperty);
636             }
637             set
638             {
639                 SetValue(LineSpacingProperty, value);
640                 NotifyPropertyChangedAndRequestLayout();
641             }
642         }
643
644         /// <summary>
645         /// The Underline property.<br />
646         /// The default underline parameters.<br />
647         /// </summary>
648         /// <since_tizen> 3 </since_tizen>
649         public PropertyMap Underline
650         {
651             get
652             {
653                 return (PropertyMap)GetValue(UnderlineProperty);
654             }
655             set
656             {
657                 SetValue(UnderlineProperty, value);
658                 NotifyPropertyChanged();
659             }
660         }
661
662         /// <summary>
663         /// The Shadow property.<br />
664         /// The default shadow parameters.<br />
665         /// </summary>
666         /// <since_tizen> 3 </since_tizen>
667         public PropertyMap Shadow
668         {
669             get
670             {
671                 return (PropertyMap)GetValue(ShadowProperty);
672             }
673             set
674             {
675                 SetValue(ShadowProperty, value);
676                 NotifyPropertyChanged();
677             }
678         }
679
680         /// <summary>
681         /// Describes a text shadow for a TextLabel.
682         /// It is null by default.
683         /// </summary>
684         [EditorBrowsable(EditorBrowsableState.Never)]
685         public TextShadow TextShadow
686         {
687             get
688             {
689                 return (TextShadow)GetValue(TextShadowProperty);
690             }
691             set
692             {
693                 SetValue(TextShadowProperty, value);
694                 selectorData?.TextShadow.UpdateIfNeeds(this, value);
695                 NotifyPropertyChanged();
696             }
697         }
698
699         /// <summary>
700         /// The Emboss property.<br />
701         /// The default emboss parameters.<br />
702         /// </summary>
703         /// <since_tizen> 3 </since_tizen>
704         public string Emboss
705         {
706             get
707             {
708                 return (string)GetValue(EmbossProperty);
709             }
710             set
711             {
712                 SetValue(EmbossProperty, value);
713                 NotifyPropertyChanged();
714             }
715         }
716
717         /// <summary>
718         /// The Outline property.<br />
719         /// The default outline parameters.<br />
720         /// </summary>
721         /// <since_tizen> 3 </since_tizen>
722         public PropertyMap Outline
723         {
724             get
725             {
726                 return (PropertyMap)GetValue(OutlineProperty);
727             }
728             set
729             {
730                 SetValue(OutlineProperty, value);
731                 NotifyPropertyChanged();
732             }
733         }
734
735         /// <summary>
736         /// The PixelSize property.<br />
737         /// The size of font in pixels.<br />
738         /// </summary>
739         /// <since_tizen> 3 </since_tizen>
740         public float PixelSize
741         {
742             get
743             {
744                 return (float)GetValue(PixelSizeProperty);
745             }
746             set
747             {
748                 SetValue(PixelSizeProperty, value);
749                 NotifyPropertyChangedAndRequestLayout();
750             }
751         }
752
753         /// <summary>
754         /// The Ellipsis property.<br />
755         /// Enable or disable the ellipsis.<br />
756         /// </summary>
757         /// <since_tizen> 3 </since_tizen>
758         public bool Ellipsis
759         {
760             get
761             {
762                 return (bool)GetValue(EllipsisProperty);
763             }
764             set
765             {
766                 SetValue(EllipsisProperty, value);
767                 NotifyPropertyChanged();
768             }
769         }
770
771         /// <summary>
772         /// The AutoScrollLoopDelay property.<br />
773         /// Do something.<br />
774         /// </summary>
775         /// <since_tizen> 3 </since_tizen>
776         public float AutoScrollLoopDelay
777         {
778             get
779             {
780                 return (float)GetValue(AutoScrollLoopDelayProperty);
781             }
782             set
783             {
784                 SetValue(AutoScrollLoopDelayProperty, value);
785                 NotifyPropertyChanged();
786             }
787         }
788
789         /// <summary>
790         /// The AutoScrollStopMode property.<br />
791         /// Do something.<br />
792         /// </summary>
793         /// <since_tizen> 3 </since_tizen>
794         public AutoScrollStopMode AutoScrollStopMode
795         {
796             get
797             {
798                 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
799             }
800             set
801             {
802                 SetValue(AutoScrollStopModeProperty, value);
803                 NotifyPropertyChanged();
804             }
805         }
806
807         /// <summary>
808         /// The line count of the text.
809         /// </summary>
810         /// <since_tizen> 3 </since_tizen>
811         public int LineCount
812         {
813             get
814             {
815                 int temp = 0;
816                 GetProperty(TextLabel.Property.LINE_COUNT).Get(out temp);
817                 return temp;
818             }
819         }
820
821         /// <summary>
822         /// The LineWrapMode property.<br />
823         /// line wrap mode when the text lines over layout width.<br />
824         /// </summary>
825         /// <since_tizen> 4 </since_tizen>
826         public LineWrapMode LineWrapMode
827         {
828             get
829             {
830                 return (LineWrapMode)GetValue(LineWrapModeProperty);
831             }
832             set
833             {
834                 SetValue(LineWrapModeProperty, value);
835                 NotifyPropertyChanged();
836             }
837         }
838
839         /// <summary>
840         /// The direction of the text such as left to right or right to left.
841         /// </summary>
842         /// <since_tizen> 5 </since_tizen>
843         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
844         [EditorBrowsable(EditorBrowsableState.Never)]
845         public TextDirection TextDirection
846         {
847             get
848             {
849                 int temp = 0;
850                 GetProperty(TextLabel.Property.TEXT_DIRECTION).Get(out temp);
851                 return (TextDirection)temp;
852             }
853         }
854
855         /// <summary>
856         /// The vertical line alignment of the text.
857         /// </summary>
858         /// <since_tizen> 5 </since_tizen>
859         /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
860         [EditorBrowsable(EditorBrowsableState.Never)]
861         public VerticalLineAlignment VerticalLineAlignment
862         {
863             get
864             {
865                 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
866             }
867             set
868             {
869                 SetValue(VerticalLineAlignmentProperty, value);
870                 NotifyPropertyChanged();
871             }
872         }
873
874         /// <summary>
875         /// The text alignment to match the direction of the system language.
876         /// </summary>
877         /// <since_tizen> 6 </since_tizen>
878         public bool MatchSystemLanguageDirection
879         {
880             get
881             {
882                 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
883             }
884             set
885             {
886                 SetValue(MatchSystemLanguageDirectionProperty, value);
887                 NotifyPropertyChanged();
888             }
889         }
890
891         /// <summary>
892         /// The text fit parameters.<br />
893         /// The textFit map contains the following keys :<br />
894         /// - enable (bool type) : True to enable the text fit or false to disable(the default value is false)<br />
895         /// - minSize (float type) : Minimum Size for text fit(the default value is 10.f)<br />
896         /// - maxSize (float type) : Maximum Size for text fit(the default value is 100.f)<br />
897         /// - stepSize (float type) : Step Size for font increase(the default value is 1.f)<br />
898         /// - fontSize (string type) : The size type of font, You can choose between "pointSize" or "pixelSize". (the default value is "pointSize")<br />
899         /// </summary>
900         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
901         [EditorBrowsable(EditorBrowsableState.Never)]
902         public PropertyMap TextFit
903         {
904             get
905             {
906                 return (PropertyMap)GetValue(TextFitProperty);
907             }
908             set
909             {
910                 SetValue(TextFitProperty, value);
911                 NotifyPropertyChanged();
912             }
913         }
914
915         /// <summary>
916         /// The MinLineSize property.<br />
917         /// </summary>
918         /// <since_tizen> 8 </since_tizen>
919         [EditorBrowsable(EditorBrowsableState.Never)]
920         public float MinLineSize
921         {
922             get
923             {
924                 return (float)GetValue(MinLineSizeProperty);
925             }
926             set
927             {
928                 SetValue(MinLineSizeProperty, value);
929                 NotifyPropertyChangedAndRequestLayout();
930             }
931         }
932
933         private TextLabelSelectorData SelectorData
934         {
935             get
936             {
937                 if (selectorData == null)
938                 {
939                     selectorData = new TextLabelSelectorData();
940                 }
941                 return selectorData;
942             }
943         }
944
945         /// <summary>
946         /// Downcasts a handle to textLabel handle
947         /// </summary>
948         /// <param name="handle"></param>
949         /// <returns></returns>
950         /// <since_tizen> 3 </since_tizen>
951         /// Please do not use! this will be deprecated!
952         /// Instead please use as keyword.
953         [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
954             "Like: " +
955             "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
956             "TextLabel label = handle as TextLabel")]
957         [EditorBrowsable(EditorBrowsableState.Never)]
958         public static TextLabel DownCast(BaseHandle handle)
959         {
960             TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
961
962             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
963             return ret;
964         }
965
966         /// <inheritdoc/>
967         [EditorBrowsable(EditorBrowsableState.Never)]
968         protected override void Dispose(DisposeTypes type)
969         {
970             if (disposed)
971             {
972                 return;
973             }
974
975             if (type == DisposeTypes.Explicit)
976             {
977                 //Called by User
978                 //Release your own managed resources here.
979                 //You should release all of your own disposable objects here.
980                 selectorData?.Reset(this);
981             }
982
983             base.Dispose(type);
984         }
985
986         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj)
987         {
988             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
989         }
990
991         /// This will not be public opened.
992         [EditorBrowsable(EditorBrowsableState.Never)]
993         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
994         {
995             Interop.TextLabel.delete_TextLabel(swigCPtr);
996         }
997
998         /// <summary>
999         /// Get attribues, it is abstract function and must be override.
1000         /// </summary>
1001         /// <since_tizen> 6 </since_tizen>
1002         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1003         [EditorBrowsable(EditorBrowsableState.Never)]
1004         protected override ViewStyle GetViewStyle()
1005         {
1006             return new TextLabelStyle();
1007         }
1008
1009         /// <summary>
1010         /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
1011         /// </summary>
1012         protected override void OnBindingContextChanged()
1013         {
1014             base.OnBindingContextChanged();
1015         }
1016
1017         private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1018         {
1019             Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
1020         }
1021
1022         private void  NotifyPropertyChangedAndRequestLayout()
1023         {
1024             NotifyPropertyChanged();
1025             Layout?.RequestLayout();
1026         }
1027
1028         internal new class Property
1029         {
1030             internal static readonly int TEXT = Interop.TextLabel.TextLabel_Property_TEXT_get();
1031             internal static readonly int FONT_FAMILY = Interop.TextLabel.TextLabel_Property_FONT_FAMILY_get();
1032             internal static readonly int FONT_STYLE = Interop.TextLabel.TextLabel_Property_FONT_STYLE_get();
1033             internal static readonly int POINT_SIZE = Interop.TextLabel.TextLabel_Property_POINT_SIZE_get();
1034             internal static readonly int MULTI_LINE = Interop.TextLabel.TextLabel_Property_MULTI_LINE_get();
1035             internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextLabel.TextLabel_Property_HORIZONTAL_ALIGNMENT_get();
1036             internal static readonly int VERTICAL_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_ALIGNMENT_get();
1037             internal static readonly int TEXT_COLOR = Interop.TextLabel.TextLabel_Property_TEXT_COLOR_get();
1038             internal static readonly int ENABLE_MARKUP = Interop.TextLabel.TextLabel_Property_ENABLE_MARKUP_get();
1039             internal static readonly int ENABLE_AUTO_SCROLL = Interop.TextLabel.TextLabel_Property_ENABLE_AUTO_SCROLL_get();
1040             internal static readonly int AUTO_SCROLL_SPEED = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_SPEED_get();
1041             internal static readonly int AUTO_SCROLL_LOOP_COUNT = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get();
1042             internal static readonly int AUTO_SCROLL_GAP = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_GAP_get();
1043             internal static readonly int LINE_SPACING = Interop.TextLabel.TextLabel_Property_LINE_SPACING_get();
1044             internal static readonly int UNDERLINE = Interop.TextLabel.TextLabel_Property_UNDERLINE_get();
1045             internal static readonly int SHADOW = Interop.TextLabel.TextLabel_Property_SHADOW_get();
1046             internal static readonly int EMBOSS = Interop.TextLabel.TextLabel_Property_EMBOSS_get();
1047             internal static readonly int OUTLINE = Interop.TextLabel.TextLabel_Property_OUTLINE_get();
1048             internal static readonly int PIXEL_SIZE = Interop.TextLabel.TextLabel_Property_PIXEL_SIZE_get();
1049             internal static readonly int ELLIPSIS = Interop.TextLabel.TextLabel_Property_ELLIPSIS_get();
1050             internal static readonly int AUTO_SCROLL_STOP_MODE = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_STOP_MODE_get();
1051             internal static readonly int AUTO_SCROLL_LOOP_DELAY = Interop.TextLabel.TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get();
1052             internal static readonly int LINE_COUNT = Interop.TextLabel.TextLabel_Property_LINE_COUNT_get();
1053             internal static readonly int LINE_WRAP_MODE = Interop.TextLabel.TextLabel_Property_LINE_WRAP_MODE_get();
1054             internal static readonly int TEXT_DIRECTION = Interop.TextLabel.TextLabel_Property_TEXT_DIRECTION_get();
1055             internal static readonly int VERTICAL_LINE_ALIGNMENT = Interop.TextLabel.TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get();
1056             internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextLabel.TextLabel_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
1057             internal static readonly int TEXT_FIT = Interop.TextLabel.TextLabel_Property_TEXT_FIT_get();
1058             internal static readonly int MIN_LINE_SIZE = Interop.TextLabel.TextLabel_Property_MIN_LINE_SIZE_get();
1059         }
1060
1061         private void OnShadowColorChanged(float x, float y, float z, float w)
1062         {
1063             ShadowColor = new Vector4(x, y, z, w);
1064         }
1065         private void OnShadowOffsetChanged(float x, float y)
1066         {
1067             ShadowOffset = new Vector2(x, y);
1068         }
1069         private void OnTextColorChanged(float r, float g, float b, float a)
1070         {
1071             TextColor = new Color(r, g, b, a);
1072         }
1073         private void OnUnderlineColorChanged(float x, float y, float z, float w)
1074         {
1075             UnderlineColor = new Vector4(x, y, z, w);
1076         }
1077     }
1078 }