[NUI][AT-SPI] Add IAtspiTable and IAtspiTableCell interfaces (#5305)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Style / ToastStyle.cs
1 /*
2  * Copyright(c) 2019 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.Binding;
20
21 namespace Tizen.NUI.Components
22 {
23     /// <summary>
24     /// ToastStyle is a class which saves Toast's ux data.
25     /// </summary>
26     [EditorBrowsable(EditorBrowsableState.Never)]
27     public class ToastStyle : ControlStyle
28     {
29         /// <summary>The Duration bindable property.</summary>
30         [EditorBrowsable(EditorBrowsableState.Never)]
31         public static readonly BindableProperty DurationProperty = BindableProperty.Create(nameof(Duration), typeof(uint?), typeof(ToastStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
32         {
33             ((ToastStyle)bindable).duration = (uint?)newValue;
34         },
35         defaultValueCreator: (bindable) =>
36         {
37             return ((ToastStyle)bindable).duration;
38         });
39
40         private uint? duration;
41
42         static ToastStyle() { }
43
44         /// <summary>
45         /// Creates a new instance of a ToastStyle.
46         /// </summary>
47         [EditorBrowsable(EditorBrowsableState.Never)]
48         public ToastStyle() : base()
49         {
50         }
51
52         /// <summary>
53         /// Creates a new instance of a ToastStyle with Style.
54         /// </summary>
55         /// <param name="style">Create ToastStyle by Style customized by user.</param>
56         [EditorBrowsable(EditorBrowsableState.Never)]
57         public ToastStyle(ToastStyle style) : base(style)
58         {
59         }
60
61         /// <summary>
62         /// Gets or sets toast show duration time.
63         /// </summary>
64         [EditorBrowsable(EditorBrowsableState.Never)]
65         public uint? Duration
66         {
67             get => (uint?)GetValue(DurationProperty);
68             set => SetValue(DurationProperty, value);
69         }
70
71         /// <summary>
72         /// Text's Style.
73         /// </summary>
74         [EditorBrowsable(EditorBrowsableState.Never)]
75         public TextLabelStyle Text { get; set; } = new TextLabelStyle();
76
77         /// <inheritdoc/>
78         [EditorBrowsable(EditorBrowsableState.Never)]
79         public override void CopyFrom(BindableObject bindableObject)
80         {
81             base.CopyFrom(bindableObject);
82
83             if (bindableObject is ToastStyle toastStyle)
84             {
85                 Text.CopyFrom(toastStyle.Text);
86             }
87         }
88     }
89 }