08f757cc5bb55a3d676519e9c8724705eaf9b372
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Style / LoadingStyle.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     /// LoadingStyle is a class which saves Loading's ux data.
25     /// </summary>
26     /// <since_tizen> 8 </since_tizen>
27     public class LoadingStyle : ControlStyle
28     {
29         static LoadingStyle() { }
30
31         /// <summary>
32         /// Creates a new instance of a LoadingStyle.
33         /// </summary>
34         /// <since_tizen> 8 </since_tizen>
35         public LoadingStyle() : base() { }
36
37         /// <summary>
38         /// Creates a new instance of a LoadingStyle with style.
39         /// </summary>
40         /// <param name="style">Create LoadingStyle by style customized by user.</param>
41         /// <since_tizen> 8 </since_tizen>
42         public LoadingStyle(LoadingStyle style) : base(style)
43         {
44             if(null == style)
45             {
46                 return;
47             }
48             this.CopyFrom(style);
49         }
50
51         /// <summary>
52         /// Gets or sets loading image resources.
53         /// </summary>
54         /// <since_tizen> 8 </since_tizen>
55         public string[] Images { get; set; }
56
57         /// <summary>
58         /// Gets or sets loading image size.
59         /// </summary>
60         /// <since_tizen> 8 </since_tizen>
61         public Size LoadingSize { get; set; }
62
63         /// <summary>
64         /// Gets or sets loading frame per second.
65         /// </summary>
66         /// <since_tizen> 8 </since_tizen>
67         public Selector<int?> FrameRate { get; set; } = new Selector<int?>();
68
69         /// <summary>
70         /// Style's clone function.
71         /// </summary>
72         /// <param name="bindableObject">The style that need to copy.</param>
73         /// <since_tizen> 8 </since_tizen>
74         public override void CopyFrom(BindableObject bindableObject)
75         {
76             base.CopyFrom(bindableObject);
77
78             LoadingStyle loadingStyle = bindableObject as LoadingStyle;
79
80             if (null != loadingStyle)
81             {
82                 if (null != loadingStyle.FrameRate)
83                 {
84                     FrameRate?.Clone(loadingStyle.FrameRate);
85                 }
86                 if (null != loadingStyle.LoadingSize)
87                 {
88                     LoadingSize = loadingStyle.LoadingSize;
89                 }
90                 if (null != loadingStyle.Images)
91                 {
92                     Images = loadingStyle.Images;
93                 }
94             }
95         }
96     }
97 }