2 * Copyright(c) 2019 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.
17 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.Binding;
21 namespace Tizen.NUI.Components
24 /// ToastStyle is a class which saves Toast's ux data.
26 /// <since_tizen> 8 </since_tizen>
27 public class ToastStyle : ControlStyle
29 static ToastStyle() { }
32 /// Creates a new instance of a ToastStyle.
34 /// <since_tizen> 8 </since_tizen>
35 public ToastStyle() : base()
41 /// Creates a new instance of a ToastStyle with Style.
43 /// <param name="style">Create ToastStyle by Style customized by user.</param>
44 /// <since_tizen> 8 </since_tizen>
45 public ToastStyle(ToastStyle style) : base(style)
52 /// Gets or sets toast show duration time.
54 /// <since_tizen> 8 </since_tizen>
55 public uint? Duration { get; set; }
60 /// <since_tizen> 8 </since_tizen>
61 public TextLabelStyle Text { get; set; }
64 /// Style's clone function.
66 /// <param name="bindableObject">The style that need to copy.</param>
67 /// <since_tizen> 8 </since_tizen>
68 public override void CopyFrom(BindableObject bindableObject)
70 base.CopyFrom(bindableObject);
71 ToastStyle toastStyle = bindableObject as ToastStyle;
72 if (toastStyle != null)
74 if (null != toastStyle.Text)
76 Text?.CopyFrom(toastStyle.Text);
78 Duration = toastStyle.Duration;
82 private void InitSubStyle()
84 Text = new TextLabelStyle()
86 PositionUsesPivotPoint = true,
87 ParentOrigin = Tizen.NUI.ParentOrigin.Center,
88 PivotPoint = Tizen.NUI.PivotPoint.Center,
89 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
90 HeightResizePolicy = ResizePolicyType.UseNaturalSize,
91 HorizontalAlignment = HorizontalAlignment.Center,
92 VerticalAlignment = VerticalAlignment.Center,
93 TextColor = Color.White