2 * Copyright(c) 2020 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 /// LoadingStyle is a class which saves Loading's ux data.
26 /// <since_tizen> 8 </since_tizen>
27 public class LoadingStyle : ControlStyle
29 /// <summary>The FrameRateSelector bindable property.</summary>
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public static readonly BindableProperty FrameRateSelectorProperty = BindableProperty.Create("FrameRateSelector", typeof(Selector<int?>), typeof(LoadingStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
33 ((LoadingStyle)bindable).frameRate = ((Selector<int?>)newValue)?.Clone();
35 defaultValueCreator: (bindable) =>
37 return ((LoadingStyle)bindable).frameRate;
40 /// <summary>The LoadingSize bindable property.</summary>
41 [EditorBrowsable(EditorBrowsableState.Never)]
42 public static readonly BindableProperty LoadingSizeProperty = BindableProperty.Create(nameof(LoadingSize), typeof(Size), typeof(LoadingStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
44 ((LoadingStyle)bindable).Size = (Size)newValue;
46 defaultValueCreator: (bindable) =>
48 return ((LoadingStyle)bindable).Size;
51 /// <summary>The Images bindable property.</summary>
52 [EditorBrowsable(EditorBrowsableState.Never)]
53 public static readonly BindableProperty ImagesProperty = BindableProperty.Create(nameof(Images), typeof(string[]), typeof(LoadingStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
55 ((LoadingStyle)bindable).images = (string[])((string[])newValue)?.Clone();
57 defaultValueCreator: (bindable) =>
59 return ((LoadingStyle)bindable).images;
62 private Selector<int?> frameRate;
63 private string[] images;
65 static LoadingStyle() { }
68 /// Creates a new instance of a LoadingStyle.
70 /// <since_tizen> 8 </since_tizen>
71 public LoadingStyle() : base() { }
74 /// Creates a new instance of a LoadingStyle with style.
76 /// <param name="style">Create LoadingStyle by style customized by user.</param>
77 /// <since_tizen> 8 </since_tizen>
78 public LoadingStyle(LoadingStyle style) : base(style)
83 /// Gets or sets loading image resources.
85 /// <since_tizen> 8 </since_tizen>
86 public string[] Images
88 get => (string[])GetValue(ImagesProperty);
89 set => SetValue(ImagesProperty, value);
93 /// Gets or sets loading image size.
95 /// <since_tizen> 8 </since_tizen>
96 public Size LoadingSize
98 get => (Size)GetValue(LoadingSizeProperty);
99 set => SetValue(LoadingSizeProperty, value);
103 /// Gets or sets loading frame per second.
105 /// <since_tizen> 8 </since_tizen>
106 public Selector<int?> FrameRate
108 get => (Selector<int?>)GetValue(FrameRateSelectorProperty);
109 set => SetValue(FrameRateSelectorProperty, value);
113 /// Style's clone function.
115 /// <param name="bindableObject">The style that need to copy.</param>
116 /// <since_tizen> 8 </since_tizen>
117 public override void CopyFrom(BindableObject bindableObject)
119 base.CopyFrom(bindableObject);