2 * Copyright(c) 2018 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
21 using System.Globalization;
22 using System.ComponentModel;
23 using Tizen.NUI.Binding;
25 namespace Tizen.NUI.BaseComponents
29 /// A control which renders a short text string.<br />
30 /// Text labels are lightweight, non-editable, and do not respond to the user input.<br />
32 /// <since_tizen> 3 </since_tizen>
33 public class TextLabel : View
35 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
39 var textLabel = (TextLabel)bindable;
42 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT, new Tizen.NUI.PropertyValue((string)newValue));
45 defaultValueCreator: (bindable) =>
47 var textLabel = (TextLabel)bindable;
49 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT).Get(out temp);
52 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
53 [EditorBrowsable(EditorBrowsableState.Never)]
54 public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
56 var textLabel = (TextLabel)bindable;
59 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.FONT_FAMILY, new Tizen.NUI.PropertyValue((string)newValue));
62 defaultValueCreator: (bindable) =>
64 var textLabel = (TextLabel)bindable;
66 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.FONT_FAMILY).Get(out temp);
69 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
70 [EditorBrowsable(EditorBrowsableState.Never)]
71 public static readonly BindableProperty FontStyleProperty = BindableProperty.Create(nameof(FontStyle), typeof(PropertyMap), typeof(TextLabel), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
73 var textLabel = (TextLabel)bindable;
76 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.FONT_STYLE, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
79 defaultValueCreator: (bindable) =>
81 var textLabel = (TextLabel)bindable;
82 PropertyMap temp = new PropertyMap();
83 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.FONT_STYLE).Get(temp);
86 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
87 [EditorBrowsable(EditorBrowsableState.Never)]
88 public static readonly BindableProperty PointSizeProperty = BindableProperty.Create(nameof(PointSize), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
90 var textLabel = (TextLabel)bindable;
93 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.POINT_SIZE, new Tizen.NUI.PropertyValue((float)newValue));
96 defaultValueCreator: (bindable) =>
98 var textLabel = (TextLabel)bindable;
100 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.POINT_SIZE).Get(out temp);
103 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
104 [EditorBrowsable(EditorBrowsableState.Never)]
105 public static readonly BindableProperty MultiLineProperty = BindableProperty.Create(nameof(MultiLine), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
107 var textLabel = (TextLabel)bindable;
108 if (newValue != null)
110 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.MULTI_LINE, new Tizen.NUI.PropertyValue((bool)newValue));
113 defaultValueCreator: (bindable) =>
115 var textLabel = (TextLabel)bindable;
117 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.MULTI_LINE).Get(out temp);
120 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
121 [EditorBrowsable(EditorBrowsableState.Never)]
122 public static readonly BindableProperty HorizontalAlignmentProperty = BindableProperty.Create(nameof(HorizontalAlignment), typeof(HorizontalAlignment), typeof(TextLabel), HorizontalAlignment.Begin, propertyChanged: (bindable, oldValue, newValue) =>
124 var textLabel = (TextLabel)bindable;
125 string valueToString = "";
126 if (newValue != null)
128 switch ((HorizontalAlignment)newValue)
130 case HorizontalAlignment.Begin: { valueToString = "BEGIN"; break; }
131 case HorizontalAlignment.Center: { valueToString = "CENTER"; break; }
132 case HorizontalAlignment.End: { valueToString = "END"; break; }
133 default: { valueToString = "BEGIN"; break; }
135 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
138 defaultValueCreator: (bindable) =>
140 var textLabel = (TextLabel)bindable;
142 if (Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.HORIZONTAL_ALIGNMENT).Get(out temp) == false)
144 NUILog.Error("HorizontalAlignment get error!");
148 case "BEGIN": return HorizontalAlignment.Begin;
149 case "CENTER": return HorizontalAlignment.Center;
150 case "END": return HorizontalAlignment.End;
151 default: return HorizontalAlignment.Begin;
154 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
155 [EditorBrowsable(EditorBrowsableState.Never)]
156 public static readonly BindableProperty VerticalAlignmentProperty = BindableProperty.Create(nameof(VerticalAlignment), typeof(VerticalAlignment), typeof(TextLabel), VerticalAlignment.Bottom, propertyChanged: (bindable, oldValue, newValue) =>
158 var textLabel = (TextLabel)bindable;
159 string valueToString = "";
160 if (newValue != null)
162 switch ((VerticalAlignment)newValue)
164 case VerticalAlignment.Top: { valueToString = "TOP"; break; }
165 case VerticalAlignment.Center: { valueToString = "CENTER"; break; }
166 case VerticalAlignment.Bottom: { valueToString = "BOTTOM"; break; }
167 default: { valueToString = "BOTTOM"; break; }
169 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
172 defaultValueCreator: (bindable) =>
174 var textLabel = (TextLabel)bindable;
176 if (Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.VERTICAL_ALIGNMENT).Get(out temp) == false)
178 NUILog.Error("VerticalAlignment get error!");
183 case "TOP": return VerticalAlignment.Top;
184 case "CENTER": return VerticalAlignment.Center;
185 case "BOTTOM": return VerticalAlignment.Bottom;
186 default: return VerticalAlignment.Bottom;
189 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
190 [EditorBrowsable(EditorBrowsableState.Never)]
191 public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(TextLabel), Color.Transparent, propertyChanged: (bindable, oldValue, newValue) =>
193 var textLabel = (TextLabel)bindable;
194 if (newValue != null)
196 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT_COLOR, new Tizen.NUI.PropertyValue((Color)newValue));
199 defaultValueCreator: (bindable) =>
201 var textLabel = (TextLabel)bindable;
202 Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f);
203 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.TEXT_COLOR).Get(temp);
206 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
207 [EditorBrowsable(EditorBrowsableState.Never)]
208 public static readonly BindableProperty EnableMarkupProperty = BindableProperty.Create("EnableMarkup", typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
210 var textLabel = (TextLabel)bindable;
211 if (newValue != null)
213 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.ENABLE_MARKUP, new Tizen.NUI.PropertyValue((bool)newValue));
216 defaultValueCreator: (bindable) =>
218 var textLabel = (TextLabel)bindable;
220 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.ENABLE_MARKUP).Get(out temp);
223 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
224 [EditorBrowsable(EditorBrowsableState.Never)]
225 public static readonly BindableProperty EnableAutoScrollProperty = BindableProperty.Create(nameof(EnableAutoScroll), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
227 var textLabel = (TextLabel)bindable;
228 if (newValue != null)
230 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.ENABLE_AUTO_SCROLL, new Tizen.NUI.PropertyValue((bool)newValue));
233 defaultValueCreator: (bindable) =>
235 var textLabel = (TextLabel)bindable;
237 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.ENABLE_AUTO_SCROLL).Get(out temp);
240 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
241 [EditorBrowsable(EditorBrowsableState.Never)]
242 public static readonly BindableProperty AutoScrollSpeedProperty = BindableProperty.Create(nameof(AutoScrollSpeed), typeof(int), typeof(TextLabel), default(int), propertyChanged: (bindable, oldValue, newValue) =>
244 var textLabel = (TextLabel)bindable;
245 if (newValue != null)
247 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_SPEED, new Tizen.NUI.PropertyValue((int)newValue));
250 defaultValueCreator: (bindable) =>
252 var textLabel = (TextLabel)bindable;
254 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_SPEED).Get(out temp);
257 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
258 [EditorBrowsable(EditorBrowsableState.Never)]
259 public static readonly BindableProperty AutoScrollLoopCountProperty = BindableProperty.Create(nameof(AutoScrollLoopCount), typeof(int), typeof(TextLabel), default(int), propertyChanged: (bindable, oldValue, newValue) =>
261 var textLabel = (TextLabel)bindable;
262 if (newValue != null)
264 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_LOOP_COUNT, new Tizen.NUI.PropertyValue((int)newValue));
267 defaultValueCreator: (bindable) =>
269 var textLabel = (TextLabel)bindable;
271 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_LOOP_COUNT).Get(out temp);
274 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
275 [EditorBrowsable(EditorBrowsableState.Never)]
276 public static readonly BindableProperty AutoScrollGapProperty = BindableProperty.Create(nameof(AutoScrollGap), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
278 var textLabel = (TextLabel)bindable;
279 if (newValue != null)
281 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_GAP, new Tizen.NUI.PropertyValue((float)newValue));
284 defaultValueCreator: (bindable) =>
286 var textLabel = (TextLabel)bindable;
288 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_GAP).Get(out temp);
291 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
292 [EditorBrowsable(EditorBrowsableState.Never)]
293 public static readonly BindableProperty LineSpacingProperty = BindableProperty.Create(nameof(LineSpacing), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
295 var textLabel = (TextLabel)bindable;
296 if (newValue != null)
298 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_SPACING, new Tizen.NUI.PropertyValue((float)newValue));
301 defaultValueCreator: (bindable) =>
303 var textLabel = (TextLabel)bindable;
305 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_SPACING).Get(out temp);
308 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
309 [EditorBrowsable(EditorBrowsableState.Never)]
310 public static readonly BindableProperty UnderlineProperty = BindableProperty.Create(nameof(Underline), typeof(PropertyMap), typeof(TextLabel), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
312 var textLabel = (TextLabel)bindable;
313 if (newValue != null)
315 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
318 defaultValueCreator: (bindable) =>
320 var textLabel = (TextLabel)bindable;
321 PropertyMap temp = new PropertyMap();
322 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.UNDERLINE).Get(temp);
325 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
326 [EditorBrowsable(EditorBrowsableState.Never)]
327 public static readonly BindableProperty ShadowProperty = BindableProperty.Create(nameof(Shadow), typeof(PropertyMap), typeof(TextLabel), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
329 var textLabel = (TextLabel)bindable;
330 if (newValue != null)
332 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.SHADOW, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
335 defaultValueCreator: (bindable) =>
337 var textLabel = (TextLabel)bindable;
338 PropertyMap temp = new PropertyMap();
339 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.SHADOW).Get(temp);
342 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
343 [EditorBrowsable(EditorBrowsableState.Never)]
344 public static readonly BindableProperty EmbossProperty = BindableProperty.Create(nameof(Emboss), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
346 var textLabel = (TextLabel)bindable;
347 if (newValue != null)
349 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.EMBOSS, new Tizen.NUI.PropertyValue((string)newValue));
352 defaultValueCreator: (bindable) =>
354 var textLabel = (TextLabel)bindable;
356 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.EMBOSS).Get(out temp);
359 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
360 [EditorBrowsable(EditorBrowsableState.Never)]
361 public static readonly BindableProperty OutlineProperty = BindableProperty.Create(nameof(Outline), typeof(PropertyMap), typeof(TextLabel), new PropertyMap(), propertyChanged: (bindable, oldValue, newValue) =>
363 var textLabel = (TextLabel)bindable;
364 if (newValue != null)
366 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.OUTLINE, new Tizen.NUI.PropertyValue((PropertyMap)newValue));
369 defaultValueCreator: (bindable) =>
371 var textLabel = (TextLabel)bindable;
372 PropertyMap temp = new PropertyMap();
373 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.OUTLINE).Get(temp);
376 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
377 [EditorBrowsable(EditorBrowsableState.Never)]
378 public static readonly BindableProperty PixelSizeProperty = BindableProperty.Create(nameof(PixelSize), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
380 var textLabel = (TextLabel)bindable;
381 if (newValue != null)
383 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.PIXEL_SIZE, new Tizen.NUI.PropertyValue((float)newValue));
386 defaultValueCreator: (bindable) =>
388 var textLabel = (TextLabel)bindable;
390 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.PIXEL_SIZE).Get(out temp);
393 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
394 [EditorBrowsable(EditorBrowsableState.Never)]
395 public static readonly BindableProperty EllipsisProperty = BindableProperty.Create(nameof(Ellipsis), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
397 var textLabel = (TextLabel)bindable;
398 if (newValue != null)
400 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.ELLIPSIS, new Tizen.NUI.PropertyValue((bool)newValue));
403 defaultValueCreator: (bindable) =>
405 var textLabel = (TextLabel)bindable;
407 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.ELLIPSIS).Get(out temp);
410 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
411 [EditorBrowsable(EditorBrowsableState.Never)]
412 public static readonly BindableProperty AutoScrollLoopDelayProperty = BindableProperty.Create(nameof(AutoScrollLoopDelay), typeof(float), typeof(TextLabel), default(float), propertyChanged: (bindable, oldValue, newValue) =>
414 var textLabel = (TextLabel)bindable;
415 if (newValue != null)
417 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_LOOP_DELAY, new Tizen.NUI.PropertyValue((float)newValue));
420 defaultValueCreator: (bindable) =>
422 var textLabel = (TextLabel)bindable;
424 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_LOOP_DELAY).Get(out temp);
427 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
428 [EditorBrowsable(EditorBrowsableState.Never)]
429 public static readonly BindableProperty AutoScrollStopModeProperty = BindableProperty.Create(nameof(AutoScrollStopMode), typeof(AutoScrollStopMode), typeof(TextLabel), AutoScrollStopMode.FinishLoop, propertyChanged: (bindable, oldValue, newValue) =>
431 var textLabel = (TextLabel)bindable;
432 if (newValue != null)
434 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_STOP_MODE, new Tizen.NUI.PropertyValue((int)newValue));
437 defaultValueCreator: (bindable) =>
439 var textLabel = (TextLabel)bindable;
441 if (Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.AUTO_SCROLL_STOP_MODE).Get(out temp) == false)
443 NUILog.Error("AutoScrollStopMode get error!");
447 case "FINISH_LOOP": return AutoScrollStopMode.FinishLoop;
448 case "IMMEDIATE": return AutoScrollStopMode.Immediate;
449 default: return AutoScrollStopMode.FinishLoop;
452 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
453 [EditorBrowsable(EditorBrowsableState.Never)]
454 public static readonly BindableProperty LineWrapModeProperty = BindableProperty.Create(nameof(LineWrapMode), typeof(LineWrapMode), typeof(TextLabel), LineWrapMode.Word, propertyChanged: (bindable, oldValue, newValue) =>
456 var textLabel = (TextLabel)bindable;
457 if (newValue != null)
459 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue((int)newValue));
462 defaultValueCreator: (bindable) =>
464 var textLabel = (TextLabel)bindable;
466 if (false == Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.LINE_WRAP_MODE).Get(out temp))
468 NUILog.Error("LineWrapMode get error!");
470 return (LineWrapMode)temp;
472 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
473 [EditorBrowsable(EditorBrowsableState.Never)]
474 public static readonly BindableProperty VerticalLineAlignmentProperty = BindableProperty.Create(nameof(VerticalLineAlignment), typeof(VerticalLineAlignment), typeof(TextLabel), VerticalLineAlignment.Bottom, propertyChanged: (bindable, oldValue, newValue) =>
476 var textLabel = (TextLabel)bindable;
477 if (newValue != null)
479 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.VERTICAL_LINE_ALIGNMENT, new Tizen.NUI.PropertyValue((int)newValue));
482 defaultValueCreator: (bindable) =>
484 var textLabel = (TextLabel)bindable;
486 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.VERTICAL_LINE_ALIGNMENT).Get(out temp);
487 return (VerticalLineAlignment)temp;
489 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
490 [EditorBrowsable(EditorBrowsableState.Never)]
491 public static readonly BindableProperty MatchSystemLanguageDirectionProperty = BindableProperty.Create(nameof(MatchSystemLanguageDirection), typeof(bool), typeof(TextLabel), false, propertyChanged: (bindable, oldValue, newValue) =>
493 var textLabel = (TextLabel)bindable;
494 if (newValue != null)
496 Tizen.NUI.Object.SetProperty(textLabel.swigCPtr, TextLabel.Property.MATCH_SYSTEM_LANGUAGE_DIRECTION, new Tizen.NUI.PropertyValue((bool)newValue));
499 defaultValueCreator: (bindable) =>
501 var textLabel = (TextLabel)bindable;
503 Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.MATCH_SYSTEM_LANGUAGE_DIRECTION).Get(out temp);
507 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
508 private string textLabelSid = null;
509 private bool systemlangTextFlag = false;
512 /// Creates the TextLabel control.
514 /// <since_tizen> 3 </since_tizen>
515 public TextLabel() : this(NDalicPINVOKE.TextLabel_New__SWIG_0(), true)
517 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
521 /// Creates the TextLabel control.
523 /// <param name="text">The text to display</param>
524 /// <since_tizen> 3 </since_tizen>
525 public TextLabel(string text) : this(NDalicPINVOKE.TextLabel_New__SWIG_1(text), true)
527 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
530 internal TextLabel(TextLabel handle) : this(NDalicPINVOKE.new_TextLabel__SWIG_1(TextLabel.getCPtr(handle)), true)
532 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
535 internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextLabel_SWIGUpcast(cPtr), cMemoryOwn)
537 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
541 /// The TranslatableText property.<br />
542 /// The text can set the SID value.<br />
544 /// <exception cref='ArgumentNullException'>
545 /// ResourceManager about multilingual is null.
547 /// <since_tizen> 4 </since_tizen>
548 public string TranslatableText
556 if (NUIApplication.MultilingualResourceManager == null)
558 throw new ArgumentNullException("ResourceManager about multilingual is null");
560 string translatableText = null;
561 textLabelSid = value;
562 translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
563 if (translatableText != null)
565 Text = translatableText;
566 if (systemlangTextFlag == false)
568 SystemSettings.LocaleLanguageChanged += new WeakEventHandler<LocaleLanguageChangedEventArgs>(SystemSettings_LocaleLanguageChanged).Handler;
569 systemlangTextFlag = true;
576 NotifyPropertyChanged();
581 /// The Text property.<br />
582 /// The text to display in the UTF-8 format.<br />
584 /// <since_tizen> 3 </since_tizen>
589 return (string)GetValue(TextProperty);
593 SetValue(TextProperty, value);
594 NotifyPropertyChanged();
599 /// The FontFamily property.<br />
600 /// The requested font family to use.<br />
602 /// <since_tizen> 3 </since_tizen>
603 public string FontFamily
607 return (string)GetValue(FontFamilyProperty);
611 SetValue(FontFamilyProperty, value);
612 NotifyPropertyChanged();
617 /// The FontStyle property.<br />
618 /// The requested font style to use.<br />
620 /// <since_tizen> 3 </since_tizen>
621 public PropertyMap FontStyle
625 return (PropertyMap)GetValue(FontStyleProperty);
629 SetValue(FontStyleProperty, value);
630 NotifyPropertyChanged();
635 /// The PointSize property.<br />
636 /// The size of font in points.<br />
638 /// <since_tizen> 3 </since_tizen>
639 public float PointSize
643 return (float)GetValue(PointSizeProperty);
647 SetValue(PointSizeProperty, value);
648 NotifyPropertyChanged();
653 /// The MultiLine property.<br />
654 /// The single-line or multi-line layout option.<br />
656 /// <since_tizen> 3 </since_tizen>
657 public bool MultiLine
661 return (bool)GetValue(MultiLineProperty);
665 SetValue(MultiLineProperty, value);
666 NotifyPropertyChanged();
671 /// The HorizontalAlignment property.<br />
672 /// The line horizontal alignment.<br />
674 /// <since_tizen> 3 </since_tizen>
675 public HorizontalAlignment HorizontalAlignment
679 return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
683 SetValue(HorizontalAlignmentProperty, value);
684 NotifyPropertyChanged();
689 /// The VerticalAlignment property.<br />
690 /// The line vertical alignment.<br />
692 /// <since_tizen> 3 </since_tizen>
693 public VerticalAlignment VerticalAlignment
697 return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
701 SetValue(VerticalAlignmentProperty, value);
702 NotifyPropertyChanged();
707 /// The TextColor property.<br />
708 /// The color of the text.<br />
709 /// Animation framework can be used to change the color of the text when not using mark up.<br />
710 /// Cannot animate the color when text is auto scrolling.<br />
712 /// <since_tizen> 3 </since_tizen>
713 public Color TextColor
717 return (Color)GetValue(TextColorProperty);
721 SetValue(TextColorProperty, value);
722 NotifyPropertyChanged();
727 /// The ShadowOffset property.<br />
728 /// The drop shadow offset 0 indicates no shadow.<br />
730 /// <since_tizen> 3 </since_tizen>
731 [Obsolete("Please do not use! This will be deprecated! Please use Shadow property instead!")]
732 [EditorBrowsable(EditorBrowsableState.Never)]
733 public Vector2 ShadowOffset
737 PropertyMap map = new PropertyMap();
738 GetProperty(TextLabel.Property.SHADOW).Get(map);
739 Vector2 shadowOffset = new Vector2();
740 map.Find(TextLabel.Property.SHADOW, "offset")?.Get(shadowOffset);
745 PropertyMap temp = new PropertyMap();
746 temp.Insert("offset", new PropertyValue(value));
747 SetValue(ShadowProperty, temp);
748 NotifyPropertyChanged();
753 /// The ShadowColor property.<br />
754 /// The color of a drop shadow.<br />
756 /// <since_tizen> 3 </since_tizen>
757 [Obsolete("Please do not use! This will be deprecated! Please use Shadow property instead!")]
758 [EditorBrowsable(EditorBrowsableState.Never)]
759 public Vector4 ShadowColor
763 PropertyMap map = new PropertyMap();
764 GetProperty(TextLabel.Property.SHADOW).Get(map);
765 Vector4 shadowColor = new Vector4();
766 map.Find(TextLabel.Property.SHADOW, "color")?.Get(shadowColor);
771 PropertyMap temp = new PropertyMap();
772 temp.Insert("color", new PropertyValue(value));
773 SetValue(ShadowProperty, temp);
774 NotifyPropertyChanged();
779 /// The UnderlineEnabled property.<br />
780 /// The underline enabled flag.<br />
782 /// <since_tizen> 3 </since_tizen>
783 [Obsolete("Please do not use! This will be deprecated! Please use Underline property instead!")]
784 [EditorBrowsable(EditorBrowsableState.Never)]
785 public bool UnderlineEnabled
789 PropertyMap map = new PropertyMap();
790 GetProperty(TextLabel.Property.UNDERLINE).Get(map);
791 bool underlineEnabled = false;
792 map.Find(TextLabel.Property.UNDERLINE, "enable")?.Get(out underlineEnabled);
793 return underlineEnabled;
797 PropertyMap temp = new PropertyMap();
798 temp.Insert("enable", new PropertyValue(value));
799 SetValue(UnderlineProperty, temp);
800 NotifyPropertyChanged();
805 /// The UnderlineColor property.<br />
806 /// Overrides the underline height from font metrics.<br />
808 /// <since_tizen> 3 </since_tizen>
809 [Obsolete("Please do not use! This will be deprecated! Please use Underline property instead!")]
810 [EditorBrowsable(EditorBrowsableState.Never)]
811 public Vector4 UnderlineColor
815 PropertyMap map = new PropertyMap();
816 GetProperty(TextLabel.Property.UNDERLINE).Get(map);
817 Vector4 underlineColor = new Vector4();
818 map.Find(TextLabel.Property.UNDERLINE, "color")?.Get(underlineColor);
819 return underlineColor;
823 PropertyMap temp = new PropertyMap();
824 temp.Insert("color", new PropertyValue(value));
825 SetValue(UnderlineProperty, temp);
826 NotifyPropertyChanged();
831 /// The UnderlineHeight property.<br />
832 /// Overrides the underline height from font metrics.<br />
834 /// <since_tizen> 3 </since_tizen>
835 [Obsolete("Please do not use! This will be deprecated! Please use Underline property instead!")]
836 [EditorBrowsable(EditorBrowsableState.Never)]
837 public float UnderlineHeight
841 PropertyMap map = new PropertyMap();
842 GetProperty(TextLabel.Property.UNDERLINE).Get(map);
843 float underlineHeight = 0.0f;
844 map.Find(TextLabel.Property.UNDERLINE, "height")?.Get(out underlineHeight);
845 return underlineHeight;
849 PropertyMap temp = new PropertyMap();
850 temp.Insert("height", new PropertyValue(value));
851 SetValue(UnderlineProperty, temp);
852 NotifyPropertyChanged();
857 /// The EnableMarkup property.<br />
858 /// Whether the mark-up processing is enabled.<br />
860 /// <since_tizen> 3 </since_tizen>
861 public bool EnableMarkup
865 return (bool)GetValue(EnableMarkupProperty);
869 SetValue(EnableMarkupProperty, value);
870 NotifyPropertyChanged();
875 /// The EnableAutoScroll property.<br />
876 /// Starts or stops auto scrolling.<br />
878 /// <since_tizen> 3 </since_tizen>
879 public bool EnableAutoScroll
883 return (bool)GetValue(EnableAutoScrollProperty);
887 SetValue(EnableAutoScrollProperty, value);
888 NotifyPropertyChanged();
893 /// The AutoScrollSpeed property.<br />
894 /// Sets the speed of scrolling in pixels per second.<br />
896 /// <since_tizen> 3 </since_tizen>
897 public int AutoScrollSpeed
901 return (int)GetValue(AutoScrollSpeedProperty);
905 SetValue(AutoScrollSpeedProperty, value);
906 NotifyPropertyChanged();
911 /// The AutoScrollLoopCount property.<br />
912 /// Number of complete loops when scrolling enabled.<br />
914 /// <since_tizen> 3 </since_tizen>
915 public int AutoScrollLoopCount
919 return (int)GetValue(AutoScrollLoopCountProperty);
923 SetValue(AutoScrollLoopCountProperty, value);
924 NotifyPropertyChanged();
929 /// The AutoScrollGap property.<br />
930 /// Gap before scrolling wraps.<br />
932 /// <since_tizen> 3 </since_tizen>
933 public float AutoScrollGap
937 return (float)GetValue(AutoScrollGapProperty);
941 SetValue(AutoScrollGapProperty, value);
942 NotifyPropertyChanged();
947 /// The LineSpacing property.<br />
948 /// The default extra space between lines in points.<br />
950 /// <since_tizen> 3 </since_tizen>
951 public float LineSpacing
955 return (float)GetValue(LineSpacingProperty);
959 SetValue(LineSpacingProperty, value);
960 NotifyPropertyChanged();
965 /// The Underline property.<br />
966 /// The default underline parameters.<br />
968 /// <since_tizen> 3 </since_tizen>
969 public PropertyMap Underline
973 return (PropertyMap)GetValue(UnderlineProperty);
977 SetValue(UnderlineProperty, value);
978 NotifyPropertyChanged();
983 /// The Shadow property.<br />
984 /// The default shadow parameters.<br />
986 /// <since_tizen> 3 </since_tizen>
987 public PropertyMap Shadow
991 return (PropertyMap)GetValue(ShadowProperty);
995 SetValue(ShadowProperty, value);
996 NotifyPropertyChanged();
1001 /// The Emboss property.<br />
1002 /// The default emboss parameters.<br />
1004 /// <since_tizen> 3 </since_tizen>
1005 public string Emboss
1009 return (string)GetValue(EmbossProperty);
1013 SetValue(EmbossProperty, value);
1014 NotifyPropertyChanged();
1019 /// The Outline property.<br />
1020 /// The default outline parameters.<br />
1022 /// <since_tizen> 3 </since_tizen>
1023 public PropertyMap Outline
1027 return (PropertyMap)GetValue(OutlineProperty);
1031 SetValue(OutlineProperty, value);
1032 NotifyPropertyChanged();
1037 /// The PixelSize property.<br />
1038 /// The size of font in pixels.<br />
1040 /// <since_tizen> 3 </since_tizen>
1041 public float PixelSize
1045 return (float)GetValue(PixelSizeProperty);
1049 SetValue(PixelSizeProperty, value);
1050 NotifyPropertyChanged();
1055 /// The Ellipsis property.<br />
1056 /// Enable or disable the ellipsis.<br />
1058 /// <since_tizen> 3 </since_tizen>
1059 public bool Ellipsis
1063 return (bool)GetValue(EllipsisProperty);
1067 SetValue(EllipsisProperty, value);
1068 NotifyPropertyChanged();
1073 /// The AutoScrollLoopDelay property.<br />
1074 /// Do something.<br />
1076 /// <since_tizen> 3 </since_tizen>
1077 public float AutoScrollLoopDelay
1081 return (float)GetValue(AutoScrollLoopDelayProperty);
1085 SetValue(AutoScrollLoopDelayProperty, value);
1086 NotifyPropertyChanged();
1091 /// The AutoScrollStopMode property.<br />
1092 /// Do something.<br />
1094 /// <since_tizen> 3 </since_tizen>
1095 public AutoScrollStopMode AutoScrollStopMode
1099 return (AutoScrollStopMode)GetValue(AutoScrollStopModeProperty);
1103 SetValue(AutoScrollStopModeProperty, value);
1104 NotifyPropertyChanged();
1109 /// The line count of the text.
1111 /// <since_tizen> 3 </since_tizen>
1112 public int LineCount
1117 GetProperty(TextLabel.Property.LINE_COUNT).Get(out temp);
1123 /// The LineWrapMode property.<br />
1124 /// line wrap mode when the text lines over layout width.<br />
1126 /// <since_tizen> 4 </since_tizen>
1127 public LineWrapMode LineWrapMode
1131 return (LineWrapMode)GetValue(LineWrapModeProperty);
1135 SetValue(LineWrapModeProperty, value);
1136 NotifyPropertyChanged();
1141 /// The direction of the text such as left to right or right to left.
1143 /// <since_tizen> 5 </since_tizen>
1144 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1145 [EditorBrowsable(EditorBrowsableState.Never)]
1146 public TextDirection TextDirection
1151 GetProperty(TextLabel.Property.TEXT_DIRECTION).Get(out temp);
1152 return (TextDirection)temp;
1157 /// The vertical line alignment of the text.
1159 /// <since_tizen> 5 </since_tizen>
1160 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1161 [EditorBrowsable(EditorBrowsableState.Never)]
1162 public VerticalLineAlignment VerticalLineAlignment
1166 return (VerticalLineAlignment)GetValue(VerticalLineAlignmentProperty);
1170 SetValue(VerticalLineAlignmentProperty, value);
1171 NotifyPropertyChanged();
1176 /// The text alignment to match the direction of the system language.
1178 /// <since_tizen> 5 </since_tizen>
1179 /// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
1180 [EditorBrowsable(EditorBrowsableState.Never)]
1181 public bool MatchSystemLanguageDirection
1185 return (bool)GetValue(MatchSystemLanguageDirectionProperty);
1189 SetValue(MatchSystemLanguageDirectionProperty, value);
1190 NotifyPropertyChanged();
1194 /// Downcasts a handle to textLabel handle
1196 /// <param name="handle"></param>
1197 /// <returns></returns>
1198 /// <since_tizen> 3 </since_tizen>
1199 /// Please do not use! this will be deprecated!
1200 /// Instead please use as keyword.
1201 [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead! " +
1203 "BaseHandle handle = new TextLabel(\"Hello World!\"); " +
1204 "TextLabel label = handle as TextLabel")]
1205 [EditorBrowsable(EditorBrowsableState.Never)]
1206 public static TextLabel DownCast(BaseHandle handle)
1208 TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel;
1210 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1214 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj)
1216 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
1222 /// <since_tizen> 3 </since_tizen>
1223 protected override void Dispose(DisposeTypes type)
1230 if (type == DisposeTypes.Explicit)
1233 //Release your own managed resources here.
1234 //You should release all of your own disposable objects here.
1237 //Release your own unmanaged resources here.
1238 //You should not access any managed member here except static instance.
1239 //because the execution order of Finalizes is non-deterministic.
1241 if (swigCPtr.Handle != global::System.IntPtr.Zero)
1245 swigCMemOwn = false;
1246 NDalicPINVOKE.delete_TextLabel(swigCPtr);
1248 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1255 /// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
1257 protected override void OnBindingContextChanged()
1259 base.OnBindingContextChanged();
1262 private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
1264 Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-")));
1267 internal new class Property
1269 internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextLabel_Property_RENDERING_BACKEND_get();
1270 internal static readonly int TEXT = NDalicPINVOKE.TextLabel_Property_TEXT_get();
1271 internal static readonly int FONT_FAMILY = NDalicPINVOKE.TextLabel_Property_FONT_FAMILY_get();
1272 internal static readonly int FONT_STYLE = NDalicPINVOKE.TextLabel_Property_FONT_STYLE_get();
1273 internal static readonly int POINT_SIZE = NDalicPINVOKE.TextLabel_Property_POINT_SIZE_get();
1274 internal static readonly int MULTI_LINE = NDalicPINVOKE.TextLabel_Property_MULTI_LINE_get();
1275 internal static readonly int HORIZONTAL_ALIGNMENT = NDalicPINVOKE.TextLabel_Property_HORIZONTAL_ALIGNMENT_get();
1276 internal static readonly int VERTICAL_ALIGNMENT = NDalicPINVOKE.TextLabel_Property_VERTICAL_ALIGNMENT_get();
1277 internal static readonly int TEXT_COLOR = NDalicPINVOKE.TextLabel_Property_TEXT_COLOR_get();
1278 internal static readonly int ENABLE_MARKUP = NDalicPINVOKE.TextLabel_Property_ENABLE_MARKUP_get();
1279 internal static readonly int ENABLE_AUTO_SCROLL = NDalicPINVOKE.TextLabel_Property_ENABLE_AUTO_SCROLL_get();
1280 internal static readonly int AUTO_SCROLL_SPEED = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_SPEED_get();
1281 internal static readonly int AUTO_SCROLL_LOOP_COUNT = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get();
1282 internal static readonly int AUTO_SCROLL_GAP = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_GAP_get();
1283 internal static readonly int LINE_SPACING = NDalicPINVOKE.TextLabel_Property_LINE_SPACING_get();
1284 internal static readonly int UNDERLINE = NDalicPINVOKE.TextLabel_Property_UNDERLINE_get();
1285 internal static readonly int SHADOW = NDalicPINVOKE.TextLabel_Property_SHADOW_get();
1286 internal static readonly int EMBOSS = NDalicPINVOKE.TextLabel_Property_EMBOSS_get();
1287 internal static readonly int OUTLINE = NDalicPINVOKE.TextLabel_Property_OUTLINE_get();
1288 internal static readonly int PIXEL_SIZE = NDalicManualPINVOKE.TextLabel_Property_PIXEL_SIZE_get();
1289 internal static readonly int ELLIPSIS = NDalicManualPINVOKE.TextLabel_Property_ELLIPSIS_get();
1290 internal static readonly int AUTO_SCROLL_STOP_MODE = NDalicManualPINVOKE.TextLabel_Property_AUTO_SCROLL_STOP_MODE_get();
1291 internal static readonly int AUTO_SCROLL_LOOP_DELAY = NDalicManualPINVOKE.TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get();
1292 internal static readonly int LINE_COUNT = NDalicManualPINVOKE.TextLabel_Property_LINE_COUNT_get();
1293 internal static readonly int LINE_WRAP_MODE = NDalicManualPINVOKE.TextLabel_Property_LINE_WRAP_MODE_get();
1294 internal static readonly int TEXT_DIRECTION = NDalicManualPINVOKE.TextLabel_Property_TEXT_DIRECTION_get();
1295 internal static readonly int VERTICAL_LINE_ALIGNMENT = NDalicManualPINVOKE.TextLabel_Property_VERTICAL_LINE_ALIGNMENT_get();
1296 internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = NDalicManualPINVOKE.TextLabel_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();