Set position to use the anchor point false default.
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / TextLabel.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Tizen.NUI.BaseComponents
28 {
29
30     /// <summary>
31     /// A control which renders a short text string.<br>
32     /// Text labels are lightweight, non-editable and do not respond to user input.<br>
33     /// </summary>
34     public class TextLabel : View
35     {
36         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
37
38         internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextLabel_SWIGUpcast(cPtr), cMemoryOwn)
39         {
40             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
41             // By default, we do not want the position to use the anchor point
42             PositionUsesAnchorPoint = false;
43         }
44
45         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj)
46         {
47             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
48         }
49
50         /// <summary>
51         /// Dispose
52         /// </summary>
53         public override void Dispose()
54         {
55             if (!Window.IsInstalled())
56             {
57                 DisposeQueue.Instance.Add(this);
58                 return;
59             }
60
61             lock (this)
62             {
63                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
64                 {
65                     if (swigCMemOwn)
66                     {
67                         swigCMemOwn = false;
68                         NDalicPINVOKE.delete_TextLabel(swigCPtr);
69                     }
70                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
71                 }
72                 global::System.GC.SuppressFinalize(this);
73                 base.Dispose();
74             }
75         }
76
77
78         internal class Property : global::System.IDisposable
79         {
80             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
81             protected bool swigCMemOwn;
82
83             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
84             {
85                 swigCMemOwn = cMemoryOwn;
86                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
87             }
88
89             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
90             {
91                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
92             }
93
94             ~Property()
95             {
96                 DisposeQueue.Instance.Add(this);
97             }
98
99             public virtual void Dispose()
100             {
101                 if (!Window.IsInstalled()) {
102                     DisposeQueue.Instance.Add(this);
103                     return;
104                 }
105
106                 lock (this)
107                 {
108                     if (swigCPtr.Handle != global::System.IntPtr.Zero)
109                     {
110                         if (swigCMemOwn)
111                         {
112                             swigCMemOwn = false;
113                             NDalicPINVOKE.delete_TextLabel_Property(swigCPtr);
114                         }
115                         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
116                     }
117                     global::System.GC.SuppressFinalize(this);
118                 }
119             }
120
121             internal Property() : this(NDalicPINVOKE.new_TextLabel_Property(), true)
122             {
123                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124             }
125
126             internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextLabel_Property_RENDERING_BACKEND_get();
127             internal static readonly int TEXT = NDalicPINVOKE.TextLabel_Property_TEXT_get();
128             internal static readonly int FONT_FAMILY = NDalicPINVOKE.TextLabel_Property_FONT_FAMILY_get();
129             internal static readonly int FONT_STYLE = NDalicPINVOKE.TextLabel_Property_FONT_STYLE_get();
130             internal static readonly int POINT_SIZE = NDalicPINVOKE.TextLabel_Property_POINT_SIZE_get();
131             internal static readonly int MULTI_LINE = NDalicPINVOKE.TextLabel_Property_MULTI_LINE_get();
132             internal static readonly int HORIZONTAL_ALIGNMENT = NDalicPINVOKE.TextLabel_Property_HORIZONTAL_ALIGNMENT_get();
133             internal static readonly int VERTICAL_ALIGNMENT = NDalicPINVOKE.TextLabel_Property_VERTICAL_ALIGNMENT_get();
134             internal static readonly int TEXT_COLOR = NDalicPINVOKE.TextLabel_Property_TEXT_COLOR_get();
135             internal static readonly int SHADOW_OFFSET = NDalicPINVOKE.TextLabel_Property_SHADOW_OFFSET_get();
136             internal static readonly int SHADOW_COLOR = NDalicPINVOKE.TextLabel_Property_SHADOW_COLOR_get();
137             internal static readonly int UNDERLINE_ENABLED = NDalicPINVOKE.TextLabel_Property_UNDERLINE_ENABLED_get();
138             internal static readonly int UNDERLINE_COLOR = NDalicPINVOKE.TextLabel_Property_UNDERLINE_COLOR_get();
139             internal static readonly int UNDERLINE_HEIGHT = NDalicPINVOKE.TextLabel_Property_UNDERLINE_HEIGHT_get();
140             internal static readonly int ENABLE_MARKUP = NDalicPINVOKE.TextLabel_Property_ENABLE_MARKUP_get();
141             internal static readonly int ENABLE_AUTO_SCROLL = NDalicPINVOKE.TextLabel_Property_ENABLE_AUTO_SCROLL_get();
142             internal static readonly int AUTO_SCROLL_SPEED = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_SPEED_get();
143             internal static readonly int AUTO_SCROLL_LOOP_COUNT = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get();
144             internal static readonly int AUTO_SCROLL_GAP = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_GAP_get();
145             internal static readonly int LINE_SPACING = NDalicPINVOKE.TextLabel_Property_LINE_SPACING_get();
146             internal static readonly int UNDERLINE = NDalicPINVOKE.TextLabel_Property_UNDERLINE_get();
147             internal static readonly int SHADOW = NDalicPINVOKE.TextLabel_Property_SHADOW_get();
148             internal static readonly int EMBOSS = NDalicPINVOKE.TextLabel_Property_EMBOSS_get();
149             internal static readonly int OUTLINE = NDalicPINVOKE.TextLabel_Property_OUTLINE_get();
150
151         }
152
153         /// <summary>
154         /// Creates the TextLabel control.
155         /// </summary>
156         public TextLabel() : this(NDalicPINVOKE.TextLabel_New__SWIG_0(), true)
157         {
158             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159
160         }
161
162         /// <summary>
163         /// Creates the TextLabel control.
164         /// </summary>
165         /// <param name="text">The text to display</param>
166         public TextLabel(string text) : this(NDalicPINVOKE.TextLabel_New__SWIG_1(text), true)
167         {
168             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169
170         }
171         internal TextLabel(TextLabel handle) : this(NDalicPINVOKE.new_TextLabel__SWIG_1(TextLabel.getCPtr(handle)), true)
172         {
173             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174         }
175
176         internal TextLabel Assign(TextLabel handle)
177         {
178             TextLabel ret = new TextLabel(NDalicPINVOKE.TextLabel_Assign(swigCPtr, TextLabel.getCPtr(handle)), false);
179             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180             return ret;
181         }
182
183         /// <summary>
184         /// Downcasts a handle to TextLabel.
185         /// </summary>
186         /// <param name="handle">Handle to an object</param>
187         public new static TextLabel DownCast(BaseHandle handle)
188         {
189             TextLabel ret = new TextLabel(NDalicPINVOKE.TextLabel_DownCast(BaseHandle.getCPtr(handle)), true);
190             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191             return ret;
192         }
193
194         internal enum PropertyRange
195         {
196             PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
197             PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000
198         }
199
200         /// <summary>
201         /// RenderingBackend property.<br>
202         /// The type of rendering e.g. bitmap-based.
203         /// </summary>
204         public int RenderingBackend
205         {
206             get
207             {
208                 int temp = 0;
209                 GetProperty(TextLabel.Property.RENDERING_BACKEND).Get(ref temp);
210                 return temp;
211             }
212             set
213             {
214                 SetProperty(TextLabel.Property.RENDERING_BACKEND, new Tizen.NUI.PropertyValue(value));
215             }
216         }
217
218         /// <summary>
219         /// Text property.<br>
220         /// The text to display in UTF-8 format.<br>
221         /// </summary>
222         public string Text
223         {
224             get
225             {
226                 string temp;
227                 GetProperty(TextLabel.Property.TEXT).Get(out temp);
228                 return temp;
229             }
230             set
231             {
232                 SetProperty(TextLabel.Property.TEXT, new Tizen.NUI.PropertyValue(value));
233             }
234         }
235
236         /// <summary>
237         /// FontFamily property.<br>
238         /// The requested font family to use.<br>
239         /// </summary>
240         public string FontFamily
241         {
242             get
243             {
244                 string temp;
245                 GetProperty(TextLabel.Property.FONT_FAMILY).Get(out temp);
246                 return temp;
247             }
248             set
249             {
250                 SetProperty(TextLabel.Property.FONT_FAMILY, new Tizen.NUI.PropertyValue(value));
251             }
252         }
253
254         /// <summary>
255         /// FontStyle property.<br>
256         /// The requested font style to use.<br>
257         /// </summary>
258         public PropertyMap FontStyle
259         {
260             get
261             {
262                 PropertyMap temp = new PropertyMap();
263                 GetProperty(TextLabel.Property.FONT_STYLE).Get(temp);
264                 return temp;
265             }
266             set
267             {
268                 SetProperty(TextLabel.Property.FONT_STYLE, new Tizen.NUI.PropertyValue(value));
269             }
270         }
271
272         /// <summary>
273         /// PointSize property.<br>
274         /// The size of font in points.<br>
275         /// </summary>
276         public float PointSize
277         {
278             get
279             {
280                 float temp = 0.0f;
281                 GetProperty(TextLabel.Property.POINT_SIZE).Get(ref temp);
282                 return temp;
283             }
284             set
285             {
286                 SetProperty(TextLabel.Property.POINT_SIZE, new Tizen.NUI.PropertyValue(value));
287             }
288         }
289
290         /// <summary>
291         /// MultiLine property.<br>
292         /// The single-line or multi-line layout option.<br>
293         /// </summary>
294         public bool MultiLine
295         {
296             get
297             {
298                 bool temp = false;
299                 GetProperty(TextLabel.Property.MULTI_LINE).Get(ref temp);
300                 return temp;
301             }
302             set
303             {
304                 SetProperty(TextLabel.Property.MULTI_LINE, new Tizen.NUI.PropertyValue(value));
305             }
306         }
307
308         /// <summary>
309         /// HorizontalAlignment property.<br>
310         /// The line horizontal alignment.<br>
311         /// </summary>
312         public HorizontalAlignment HorizontalAlignment
313         {
314             get
315             {
316                 string temp;
317                 if (GetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT).Get(out temp) == false)
318                 {
319 #if DEBUG_ON
320                     Tizen.Log.Error("NUI", "HorizontalAlignment get error!");
321 #endif
322                 }
323                 switch (temp)
324                 {
325                     case "BEGIN":
326                         return HorizontalAlignment.Begin;
327                     case "CENTER":
328                         return HorizontalAlignment.Center;
329                     case "END":
330                         return HorizontalAlignment.End;
331                     default:
332                         return HorizontalAlignment.Begin;
333                 }
334             }
335             set
336             {
337                 string valueToString = "";
338                 switch (value)
339                 {
340                     case HorizontalAlignment.Begin:
341                     {
342                         valueToString = "BEGIN";
343                         break;
344                     }
345                     case HorizontalAlignment.Center:
346                     {
347                         valueToString = "CENTER";
348                         break;
349                     }
350                     case HorizontalAlignment.End:
351                     {
352                         valueToString = "END";
353                         break;
354                     }
355                     default:
356                     {
357                         valueToString = "BEGIN";
358                         break;
359                     }
360                 }
361                 SetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
362             }
363         }
364
365         /// <summary>
366         /// VerticalAlignment property.<br>
367         /// The line vertical alignment.<br>
368         /// </summary>
369         public VerticalAlignment VerticalAlignment
370         {
371             get
372             {
373                 string temp;
374                 if (GetProperty(TextLabel.Property.VERTICAL_ALIGNMENT).Get(out temp) == false)
375                 {
376 #if DEBUG_ON
377                     Tizen.Log.Error("NUI", "VerticalAlignment get error!");
378 #endif
379                 }
380
381                 switch (temp)
382                 {
383                     case "TOP":
384                         return VerticalAlignment.Top;
385                     case "CENTER":
386                         return VerticalAlignment.Center;
387                     case "BOTTOM":
388                         return VerticalAlignment.Bottom;
389                     default:
390                         return VerticalAlignment.Bottom;
391                 }
392             }
393             set
394             {
395                 string valueToString = "";
396                 switch (value)
397                 {
398                     case VerticalAlignment.Top:
399                     {
400                         valueToString = "TOP";
401                         break;
402                     }
403                     case VerticalAlignment.Center:
404                     {
405                         valueToString = "CENTER";
406                         break;
407                     }
408                     case VerticalAlignment.Bottom:
409                     {
410                         valueToString = "BOTTOM";
411                         break;
412                     }
413                     default:
414                     {
415                         valueToString = "BOTTOM";
416                         break;
417                     }
418                 }
419                 SetProperty(TextLabel.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
420             }
421         }
422
423         /// <summary>
424         /// TextColor property.<br>
425         /// The color of the text.<br>
426         /// </summary>
427         public Color TextColor
428         {
429             get
430             {
431                 Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f);
432                 GetProperty(TextLabel.Property.TEXT_COLOR).Get(temp);
433                 return temp;
434             }
435             set
436             {
437                 SetProperty(TextLabel.Property.TEXT_COLOR, new Tizen.NUI.PropertyValue(value));
438             }
439         }
440
441         /// <summary>
442         /// ShadowOffset property.<br>
443         /// The drop shadow offset 0 indicates no shadow.<br>
444         /// </summary>
445         public Vector2 ShadowOffset
446         {
447             get
448             {
449                 Vector2 temp = new Vector2(0.0f, 0.0f);
450                 GetProperty(TextLabel.Property.SHADOW_OFFSET).Get(temp);
451                 return temp;
452             }
453             set
454             {
455                 SetProperty(TextLabel.Property.SHADOW_OFFSET, new Tizen.NUI.PropertyValue(value));
456             }
457         }
458
459         /// <summary>
460         /// ShadowColor property.<br>
461         /// The color of a drop shadow.<br>
462         /// </summary>
463         public Vector4 ShadowColor
464         {
465             get
466             {
467                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
468                 GetProperty(TextLabel.Property.SHADOW_COLOR).Get(temp);
469                 return temp;
470             }
471             set
472             {
473                 SetProperty(TextLabel.Property.SHADOW_COLOR, new Tizen.NUI.PropertyValue(value));
474             }
475         }
476
477         /// <summary>
478         /// UnderlineEnabled property.<br>
479         /// The underline enabled flag.<br>
480         /// </summary>
481         public bool UnderlineEnabled
482         {
483             get
484             {
485                 bool temp = false;
486                 GetProperty(TextLabel.Property.UNDERLINE_ENABLED).Get(ref temp);
487                 return temp;
488             }
489             set
490             {
491                 SetProperty(TextLabel.Property.UNDERLINE_ENABLED, new Tizen.NUI.PropertyValue(value));
492             }
493         }
494
495         /// <summary>
496         /// UnderlineColor property.<br>
497         /// Overrides the underline height from font metrics.<br>
498         /// </summary>
499         public Vector4 UnderlineColor
500         {
501             get
502             {
503                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
504                 GetProperty(TextLabel.Property.UNDERLINE_COLOR).Get(temp);
505                 return temp;
506             }
507             set
508             {
509                 SetProperty(TextLabel.Property.UNDERLINE_COLOR, new Tizen.NUI.PropertyValue(value));
510             }
511         }
512
513         /// <summary>
514         /// UnderlineHeight property.<br>
515         /// Overrides the underline height from font metrics.<br>
516         /// </summary>
517         public float UnderlineHeight
518         {
519             get
520             {
521                 float temp = 0.0f;
522                 GetProperty(TextLabel.Property.UNDERLINE_HEIGHT).Get(ref temp);
523                 return temp;
524             }
525             set
526             {
527                 SetProperty(TextLabel.Property.UNDERLINE_HEIGHT, new Tizen.NUI.PropertyValue(value));
528             }
529         }
530
531         /// <summary>
532         /// EnableMarkup property.<br>
533         /// Whether the mark-up processing is enabled.<br>
534         /// </summary>
535         public bool EnableMarkup
536         {
537             get
538             {
539                 bool temp = false;
540                 GetProperty(TextLabel.Property.ENABLE_MARKUP).Get(ref temp);
541                 return temp;
542             }
543             set
544             {
545                 SetProperty(TextLabel.Property.ENABLE_MARKUP, new Tizen.NUI.PropertyValue(value));
546             }
547         }
548
549         /// <summary>
550         /// EnableAutoScroll property.<br>
551         /// Starts or stops auto scrolling.<br>
552         /// </summary>
553         public bool EnableAutoScroll
554         {
555             get
556             {
557                 bool temp = false;
558                 GetProperty(TextLabel.Property.ENABLE_AUTO_SCROLL).Get(ref temp);
559                 return temp;
560             }
561             set
562             {
563                 SetProperty(TextLabel.Property.ENABLE_AUTO_SCROLL, new Tizen.NUI.PropertyValue(value));
564             }
565         }
566
567         /// <summary>
568         /// AutoScrollSpeed property.<br>
569         /// Sets the speed of scrolling in pixels per second.<br>
570         /// </summary>
571         public int AutoScrollSpeed
572         {
573             get
574             {
575                 int temp = 0;
576                 GetProperty(TextLabel.Property.AUTO_SCROLL_SPEED).Get(ref temp);
577                 return temp;
578             }
579             set
580             {
581                 SetProperty(TextLabel.Property.AUTO_SCROLL_SPEED, new Tizen.NUI.PropertyValue(value));
582             }
583         }
584
585         /// <summary>
586         /// AutoScrollLoopCount property.<br>
587         /// Number of complete loops when scrolling enabled.<br>
588         /// </summary>
589         public int AutoScrollLoopCount
590         {
591             get
592             {
593                 int temp = 0;
594                 GetProperty(TextLabel.Property.AUTO_SCROLL_LOOP_COUNT).Get(ref temp);
595                 return temp;
596             }
597             set
598             {
599                 SetProperty(TextLabel.Property.AUTO_SCROLL_LOOP_COUNT, new Tizen.NUI.PropertyValue(value));
600             }
601         }
602
603         /// <summary>
604         /// AutoScrollGap property.<br>
605         /// Gap before scrolling wraps.<br>
606         /// </summary>
607         public float AutoScrollGap
608         {
609             get
610             {
611                 float temp = 0.0f;
612                 GetProperty(TextLabel.Property.AUTO_SCROLL_GAP).Get(ref temp);
613                 return temp;
614             }
615             set
616             {
617                 SetProperty(TextLabel.Property.AUTO_SCROLL_GAP, new Tizen.NUI.PropertyValue(value));
618             }
619         }
620
621         /// <summary>
622         /// LineSpacing property.<br>
623         /// The default extra space between lines in points.<br>
624         /// </summary>
625         public float LineSpacing
626         {
627             get
628             {
629                 float temp = 0.0f;
630                 GetProperty(TextLabel.Property.LINE_SPACING).Get(ref temp);
631                 return temp;
632             }
633             set
634             {
635                 SetProperty(TextLabel.Property.LINE_SPACING, new Tizen.NUI.PropertyValue(value));
636             }
637         }
638
639         /// <summary>
640         /// Underline property.<br>
641         /// The default underline parameters.<br>
642         /// </summary>
643         public PropertyMap Underline
644         {
645             get
646             {
647                 PropertyMap temp = new PropertyMap();
648                 GetProperty(TextLabel.Property.UNDERLINE).Get(temp);
649                 return temp;
650             }
651             set
652             {
653                 SetProperty(TextLabel.Property.UNDERLINE, new Tizen.NUI.PropertyValue(value));
654             }
655         }
656
657         /// <summary>
658         /// Shadow property.<br>
659         /// The default shadow parameters.<br>
660         /// </summary>
661         public PropertyMap Shadow
662         {
663             get
664             {
665                 PropertyMap temp = new PropertyMap();
666                 GetProperty(TextLabel.Property.SHADOW).Get(temp);
667                 return temp;
668             }
669             set
670             {
671                 SetProperty(TextLabel.Property.SHADOW, new Tizen.NUI.PropertyValue(value));
672             }
673         }
674
675         /// <summary>
676         /// Emboss property.<br>
677         /// The default emboss parameters.<br>
678         /// </summary>
679         public string Emboss
680         {
681             get
682             {
683                 string temp;
684                 GetProperty(TextLabel.Property.EMBOSS).Get( out temp);
685                 return temp;
686             }
687             set
688             {
689                 SetProperty(TextLabel.Property.EMBOSS, new Tizen.NUI.PropertyValue(value));
690             }
691         }
692
693         /// <summary>
694         /// Outline property.<br>
695         /// The default outline parameters.<br>
696         /// </summary>
697         public string Outline
698         {
699             get
700             {
701                 string temp;
702                 GetProperty(TextLabel.Property.OUTLINE).Get(out temp);
703                 return temp;
704             }
705             set
706             {
707                 SetProperty(TextLabel.Property.OUTLINE, new Tizen.NUI.PropertyValue(value));
708             }
709         }
710
711     }
712 }