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