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.
22 /// Label is a widget to display text, with simple html-like markup.
25 public class Label : Layout
27 SmartEvent _slideCompleted;
30 /// Creates and initializes a new instance of Label class.
32 /// <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>
33 public Label(EvasObject parent) : base(parent)
35 _slideCompleted = new SmartEvent(this, this.RealHandle, "slide,end");
36 _slideCompleted.On += (s, e) =>
38 SlideCompleted?.Invoke(this, EventArgs.Empty);
43 /// SlideCompleted will be triggered when the slide is completed.
45 public event EventHandler SlideCompleted;
48 /// Sets or gets wrap width of the label.
50 public int LineWrapWidth
54 return Interop.Elementary.elm_label_wrap_width_get(RealHandle);
58 Interop.Elementary.elm_label_wrap_width_set(RealHandle, value);
63 /// Sets or gets the wrapping behavior of the label.
65 public WrapType LineWrapType
69 return (WrapType)Interop.Elementary.elm_label_line_wrap_get(RealHandle);
73 Interop.Elementary.elm_label_line_wrap_set(RealHandle, (int)value);
78 /// Sets or gets the slide mode of the label widget.
80 public LabelSlideMode SlideMode
84 return (LabelSlideMode)Interop.Elementary.elm_label_slide_mode_get(RealHandle);
88 Interop.Elementary.elm_label_slide_mode_set(RealHandle, (int)value);
93 /// Sets or gets the slide duration of the label.
95 public double SlideDuration
99 return Interop.Elementary.elm_label_slide_duration_get(RealHandle);
103 Interop.Elementary.elm_label_slide_duration_set(RealHandle, value);
108 /// Sets or gets the ellipsis behavior of the label.
110 public bool IsEllipsis
114 return Interop.Elementary.elm_label_ellipsis_get(RealHandle);
118 Interop.Elementary.elm_label_ellipsis_set(RealHandle, value);
123 /// Start slide effect.
125 public void PlaySlide()
127 Interop.Elementary.elm_label_slide_go(RealHandle);
131 /// Sets the content at a part of a given container widget.
133 /// <param name="parent">EvasObject</param>
134 /// <returns>The new object, otherwise null if it cannot be created</returns>
135 protected override IntPtr CreateHandle(EvasObject parent)
137 //TODO: Fix this to use layout
138 return Interop.Elementary.elm_label_add(parent.Handle);
143 /// Enumeration for slide mode of a label widget
145 public enum LabelSlideMode
152 /// slide only if the label area is bigger than the text width length