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;
20 using Tizen.NUI.Components;
23 namespace Tizen.NUI.Wearable
26 /// CircularSliderStyle is a class which saves CircularSlider's ux data.
28 [Obsolete("This has been deprecated in API12")]
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class CircularSliderStyle : ControlStyle
32 /// <summary>Bindable property of Thickness</summary>
33 [EditorBrowsable(EditorBrowsableState.Never)]
34 public static readonly BindableProperty ThicknessProperty = BindableProperty.Create(nameof(Thickness), typeof(float?), typeof(CircularSliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
36 ((CircularSliderStyle)bindable).thickness = (float?)newValue;
38 defaultValueCreator: (bindable) =>
40 return ((CircularSliderStyle)bindable).thickness;
43 /// <summary>Bindable property of MaxValue</summary>
44 [EditorBrowsable(EditorBrowsableState.Never)]
45 public static readonly BindableProperty MaxValueProperty = BindableProperty.Create(nameof(MaxValue), typeof(float), typeof(CircularSliderStyle), default(float), propertyChanged: (bindable, oldValue, newValue) =>
47 ((CircularSliderStyle)bindable).maxValue = (float)newValue;
49 defaultValueCreator: (bindable) =>
51 return ((CircularSliderStyle)bindable).maxValue;
54 /// <summary>Bindable property of MinValue</summary>
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public static readonly BindableProperty MinValueProperty = BindableProperty.Create(nameof(MinValue), typeof(float), typeof(CircularSliderStyle), default(float), propertyChanged: (bindable, oldValue, newValue) =>
58 ((CircularSliderStyle)bindable).minValue = (float)newValue;
60 defaultValueCreator: (bindable) =>
62 return ((CircularSliderStyle)bindable).minValue;
65 /// <summary>Bindable property of CurrentValue</summary>
66 [EditorBrowsable(EditorBrowsableState.Never)]
67 public static readonly BindableProperty CurrentValueProperty = BindableProperty.Create(nameof(CurrentValue), typeof(float), typeof(CircularSliderStyle), default(float), propertyChanged: (bindable, oldValue, newValue) =>
69 ((CircularSliderStyle)bindable).currentValue = (float)newValue;
71 defaultValueCreator: (bindable) =>
73 return ((CircularSliderStyle)bindable).currentValue;
76 /// <summary>Bindable property of TrackColor</summary>
77 [EditorBrowsable(EditorBrowsableState.Never)]
78 public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(CircularSliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
80 ((CircularSliderStyle)bindable).trackColor = newValue == null ? null : new Color((Color)newValue);
82 defaultValueCreator: (bindable) =>
84 return ((CircularSliderStyle)bindable).trackColor;
87 /// <summary>Bindable property of ProgressColor</summary>
88 [EditorBrowsable(EditorBrowsableState.Never)]
89 public static readonly BindableProperty ProgressColorProperty = BindableProperty.Create(nameof(ProgressColor), typeof(Color), typeof(CircularSliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
91 ((CircularSliderStyle)bindable).progressColor = newValue == null ? null : new Color((Color)newValue);
93 defaultValueCreator: (bindable) =>
95 return ((CircularSliderStyle)bindable).progressColor;
98 /// <summary>Bindable property of ThumbSize</summary>
99 [EditorBrowsable(EditorBrowsableState.Never)]
100 public static readonly BindableProperty ThumbSizeProperty = BindableProperty.Create(nameof(ThumbSize), typeof(Size), typeof(CircularSliderStyle), new Size(0, 0), propertyChanged: (bindable, oldValue, newValue) =>
102 ((CircularSliderStyle)bindable).thumbSize = (Size)newValue;
104 defaultValueCreator: (bindable) =>
106 return ((CircularSliderStyle)bindable).thumbSize;
109 /// <summary>Bindable property of ThumbColor</summary>
110 [EditorBrowsable(EditorBrowsableState.Never)]
111 public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(CircularSliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
113 ((CircularSliderStyle)bindable).thumbColor = newValue == null ? null : new Color((Color)newValue);
115 defaultValueCreator: (bindable) =>
117 return ((CircularSliderStyle)bindable).thumbColor;
120 /// <summary>Bindable property of IsEnabled</summary>
121 [EditorBrowsable(EditorBrowsableState.Never)]
122 public new static readonly BindableProperty IsEnabledProperty = BindableProperty.Create(nameof(IsEnabled), typeof(bool?), typeof(CircularSliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
124 ((CircularSliderStyle)bindable).isEnabled = (bool?)newValue;
126 defaultValueCreator: (bindable) =>
128 return ((CircularSliderStyle)bindable).isEnabled;
131 private float? thickness;
132 private float maxValue;
133 private float minValue;
134 private float currentValue;
135 private Color trackColor;
136 private Color progressColor;
137 private Color thumbColor;
138 private Size thumbSize;
139 private bool? isEnabled;
141 static CircularSliderStyle() { }
144 /// Creates a new instance of a CircularSliderStyle.
146 [Obsolete("This has been deprecated in API12")]
147 [EditorBrowsable(EditorBrowsableState.Never)]
148 public CircularSliderStyle() : base()
154 /// Creates a new instance of a CircularSliderStyle with style.
156 /// <param name="style">Create CircularSliderStyle by style customized by user.</param>
157 [Obsolete("This has been deprecated in API12")]
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 public CircularSliderStyle(CircularSliderStyle style) : base(style)
164 /// The thickness of the track and progress.
166 [Obsolete("This has been deprecated in API12")]
167 [EditorBrowsable(EditorBrowsableState.Never)]
168 public float? Thickness
172 return (float?)GetValue(ThicknessProperty);
176 SetValue(ThicknessProperty, value);
181 /// The property to get/set the maximum value of the CircularSlider.
183 [Obsolete("This has been deprecated in API12")]
184 [EditorBrowsable(EditorBrowsableState.Never)]
185 public float MaxValue
189 return (float)GetValue(MaxValueProperty);
193 SetValue(MaxValueProperty, value);
198 /// The property to get/set the minim value of the CircularSlider.
200 [Obsolete("This has been deprecated in API12")]
201 [EditorBrowsable(EditorBrowsableState.Never)]
202 public float MinValue
206 return (float)GetValue(MinValueProperty);
210 SetValue(MinValueProperty, value);
215 /// The property to get/set the current value of the CircularSlider.
217 [Obsolete("This has been deprecated in API12")]
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public float CurrentValue
223 return (float)GetValue(CurrentValueProperty);
227 SetValue(CurrentValueProperty, value);
232 /// The property to get/set Track object color of the CircularSlider.
234 [Obsolete("This has been deprecated in API12")]
235 [EditorBrowsable(EditorBrowsableState.Never)]
236 public Color TrackColor
240 return (Color)GetValue(TrackColorProperty);
244 SetValue(TrackColorProperty, value);
249 /// The property to get/set Progress object color of the CircularSlider.
251 [Obsolete("This has been deprecated in API12")]
252 [EditorBrowsable(EditorBrowsableState.Never)]
253 public Color ProgressColor
257 return (Color)GetValue(ProgressColorProperty);
261 SetValue(ProgressColorProperty, value);
266 /// Gets or sets the size of the thumb of Slider.
268 [Obsolete("This has been deprecated in API12")]
269 [EditorBrowsable(EditorBrowsableState.Never)]
270 public Size ThumbSize
274 return (Size)GetValue(ThumbSizeProperty);
278 SetValue(ThumbSizeProperty, value);
283 /// The property to get/set Thumb object color of the CircularSlider.
285 [Obsolete("This has been deprecated in API12")]
286 [EditorBrowsable(EditorBrowsableState.Never)]
287 public Color ThumbColor
291 return (Color)GetValue(ThumbColorProperty);
295 SetValue(ThumbColorProperty, value);
300 /// Flag to be enabled or disabled in CircularSlider.
302 /// <since_tizen> 8 </since_tizen>
303 [Obsolete("This has been deprecated in API12")]
304 public new bool? IsEnabled
308 return (bool?)GetValue(IsEnabledProperty);
312 SetValue(IsEnabledProperty, value);
316 private void Initialize()
323 trackColor = new Color(0.0f, 0.16f, 0.30f, 1.0f); // #002A4D
324 progressColor = new Color(0.0f, 0.55f, 1.0f, 1.0f); // #008CFF
325 thumbSize = new Size(19, 19);
326 thumbColor = new Color(0.0f, 0.55f, 1.0f, 1.0f); // #008CFF