2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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.
21 /// Label is a widget to display text, with simple html-like markup.
24 public class Label : Layout
26 SmartEvent _slideCompleted;
29 /// Creates and initializes a new instance of Label class.
31 /// <param name="parent">The parent is a given container which will be attached by Label as a child. It's <see cref="EvasObject"/> type.</param>
32 public Label(EvasObject parent) : base(parent)
34 _slideCompleted = new SmartEvent(this, this.RealHandle, "slide,end");
35 _slideCompleted.On += (s, e) =>
37 SlideCompleted?.Invoke(this, EventArgs.Empty);
42 /// SlideCompleted will be triggered when the slide is completed.
44 public event EventHandler SlideCompleted;
47 /// Sets or gets wrap width of the label.
49 public int LineWrapWidth
53 return Interop.Elementary.elm_label_wrap_width_get(RealHandle);
57 Interop.Elementary.elm_label_wrap_width_set(RealHandle, value);
62 /// Sets or gets the wrapping behavior of the label.
64 public WrapType LineWrapType
68 return (WrapType)Interop.Elementary.elm_label_line_wrap_get(RealHandle);
72 Interop.Elementary.elm_label_line_wrap_set(RealHandle, (int)value);
73 if (value != WrapType.None)
75 Interop.Evas.evas_object_size_hint_min_get(RealHandle, IntPtr.Zero, out int h);
76 Interop.Evas.evas_object_size_hint_min_set(RealHandle, 0, h);
82 /// Sets or gets the slide mode of the label widget.
84 public LabelSlideMode SlideMode
88 return (LabelSlideMode)Interop.Elementary.elm_label_slide_mode_get(RealHandle);
92 Interop.Elementary.elm_label_slide_mode_set(RealHandle, (int)value);
97 /// Sets or gets the slide duration of the label.
99 public double SlideDuration
103 return Interop.Elementary.elm_label_slide_duration_get(RealHandle);
107 Interop.Elementary.elm_label_slide_duration_set(RealHandle, value);
112 /// Sets or gets the slide Speed of the label.
115 /// The speed of the slide animation in px per seconds.
116 /// If you set the duration of the slide using elm_label_slide_duration_set() you cannot get the correct speed using this function until the label is actually rendered and resized.
118 /// <seealso cref="SlideDuration"/>
119 public double SlideSpeed
123 return Interop.Elementary.elm_label_slide_speed_get(RealHandle);
127 Interop.Elementary.elm_label_slide_speed_set(RealHandle, value);
132 /// Sets or gets the ellipsis behavior of the label.
134 public bool IsEllipsis
138 return Interop.Elementary.elm_label_ellipsis_get(RealHandle);
142 Interop.Elementary.elm_label_ellipsis_set(RealHandle, value);
147 /// Sets or gets the style of the label text.
150 /// APIs, elm_label_text_style_user_peek/pop/push, are internal APIs only in Tizen. Avalilable since Tizen_4.0.
153 public string TextStyle
157 return Interop.Elementary.elm_label_text_style_user_peek(RealHandle);
161 if (string.IsNullOrEmpty(value))
163 Interop.Elementary.elm_label_text_style_user_pop(RealHandle);
167 Interop.Elementary.elm_label_text_style_user_push(RealHandle, value);
173 /// Start slide effect.
175 public void PlaySlide()
177 Interop.Elementary.elm_label_slide_go(RealHandle);
181 /// Sets the content at a part of a given container widget.
183 /// <param name="parent">EvasObject</param>
184 /// <returns>The new object, otherwise null if it cannot be created</returns>
185 protected override IntPtr CreateHandle(EvasObject parent)
187 return Interop.Elementary.elm_label_add(parent.Handle);
192 /// Enumeration for slide mode of a label widget
194 public enum LabelSlideMode
201 /// slide only if the label area is bigger than the text width length