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> 6 </since_tizen>
27 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
28 [EditorBrowsable(EditorBrowsableState.Never)]
29 public class ToastStyle : ControlStyle
31 static ToastStyle() { }
34 /// Creates a new instance of a ToastStyle.
36 /// <since_tizen> 6 </since_tizen>
37 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
38 [EditorBrowsable(EditorBrowsableState.Never)]
39 public ToastStyle() : base()
45 /// Creates a new instance of a ToastStyle with Style.
47 /// <param name="style">Create ToastStyle by Style customized by user.</param>
48 /// <since_tizen> 6 </since_tizen>
49 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
50 [EditorBrowsable(EditorBrowsableState.Never)]
51 public ToastStyle(ToastStyle style) : base(style)
58 /// Gets or sets toast show duration time.
60 /// <since_tizen> 6 </since_tizen>
61 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
62 [EditorBrowsable(EditorBrowsableState.Never)]
63 public uint? Duration { get; set; }
68 /// <since_tizen> 6 </since_tizen>
69 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
70 [EditorBrowsable(EditorBrowsableState.Never)]
71 public TextLabelStyle Text { get; set; }
74 /// Style's clone function.
76 /// <since_tizen> 6 </since_tizen>
77 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
78 [EditorBrowsable(EditorBrowsableState.Never)]
79 public override void CopyFrom(BindableObject bindableObject)
81 base.CopyFrom(bindableObject);
82 ToastStyle toastStyle = bindableObject as ToastStyle;
83 if (toastStyle != null)
85 if (null != toastStyle.Text)
87 Text.CopyFrom(toastStyle.Text);
89 Duration = toastStyle.Duration;
93 private void InitSubStyle()
95 Text = new TextLabelStyle()
97 PositionUsesPivotPoint = true,
98 ParentOrigin = Tizen.NUI.ParentOrigin.Center,
99 PivotPoint = Tizen.NUI.PivotPoint.Center,
100 WidthResizePolicy = ResizePolicyType.UseNaturalSize,
101 HeightResizePolicy = ResizePolicyType.UseNaturalSize,
102 HorizontalAlignment = HorizontalAlignment.Center,
103 VerticalAlignment = VerticalAlignment.Center,
104 TextColor = Color.White