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;
20 using static Tizen.NUI.Components.Slider;
22 namespace Tizen.NUI.Components
25 /// SliderStyle is a class which saves Slider's ux data.
27 /// <since_tizen> 6 </since_tizen>
28 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class SliderStyle : ControlStyle
32 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
33 [EditorBrowsable(EditorBrowsableState.Never)]
34 public static readonly BindableProperty IndicatorTypeProperty = BindableProperty.Create("IndicatorType", typeof(IndicatorType?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
36 var instance = (Tizen.NUI.Components.SliderStyle)bindable;
39 instance.privateIndicatorType = (IndicatorType)newValue;
42 defaultValueCreator: (bindable) =>
44 var instance = (SliderStyle)bindable;
45 return instance.privateIndicatorType;
47 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
48 [EditorBrowsable(EditorBrowsableState.Never)]
49 public static readonly BindableProperty SpaceBetweenTrackAndIndicatorProperty = BindableProperty.Create("SpaceBetweenTrackAndIndicator", typeof(uint?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
51 var instance = (SliderStyle)bindable;
54 instance.privateSpaceBetweenTrackAndIndicator = (uint?)newValue;
57 defaultValueCreator: (bindable) =>
59 var instance = (SliderStyle)bindable;
60 return instance.privateSpaceBetweenTrackAndIndicator;
62 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
63 [EditorBrowsable(EditorBrowsableState.Never)]
64 public static readonly BindableProperty TrackThicknessProperty = BindableProperty.Create("TrackThickness", typeof(uint?), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
66 var instance = (SliderStyle)bindable;
69 instance.privateTrackThickness = (uint?)newValue;
72 defaultValueCreator: (bindable) =>
74 var instance = (SliderStyle)bindable;
75 return instance.privateTrackThickness;
77 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
78 [EditorBrowsable(EditorBrowsableState.Never)]
79 public static readonly BindableProperty TrackPaddingProperty = BindableProperty.Create("TrackPadding", typeof(Extents), typeof(SliderStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
81 var instance = (SliderStyle)bindable;
84 instance.trackPadding.CopyFrom((Extents)newValue);
87 defaultValueCreator: (bindable) =>
89 var instance = (SliderStyle)bindable;
90 return instance.trackPadding;
93 /// Creates a new instance of a SliderStyle.
95 /// <since_tizen> 6 </since_tizen>
96 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
97 [EditorBrowsable(EditorBrowsableState.Never)]
98 public SliderStyle() : base()
100 IndicatorType = Slider.IndicatorType.None;
105 /// Creates a new instance of a SliderStyle with style.
107 /// <param name="style">Create SliderStyle by style customized by user.</param>
108 /// <since_tizen> 6 </since_tizen>
109 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
110 [EditorBrowsable(EditorBrowsableState.Never)]
111 public SliderStyle(SliderStyle style) : base(style)
120 this.CopyFrom(style);
122 IndicatorType = style.IndicatorType;
126 /// Get or set background track.
128 /// <since_tizen> 6 </since_tizen>
129 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
130 [EditorBrowsable(EditorBrowsableState.Never)]
131 public ImageViewStyle Track
138 /// Get or set slided track.
140 /// <since_tizen> 6 </since_tizen>
141 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
142 [EditorBrowsable(EditorBrowsableState.Never)]
143 public ImageViewStyle Progress
150 /// Get or set thumb.
152 /// <since_tizen> 6 </since_tizen>
153 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
154 [EditorBrowsable(EditorBrowsableState.Never)]
155 public ImageViewStyle Thumb
162 /// Get or set thumb background.
164 /// <since_tizen> 6 </since_tizen>
165 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
166 [EditorBrowsable(EditorBrowsableState.Never)]
167 public ImageViewStyle ThumbBackground
174 /// Get or set low indicator image.
176 /// <since_tizen> 6 </since_tizen>
177 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 public ImageViewStyle LowIndicatorImage
186 /// Get or set high indicator image.
188 /// <since_tizen> 6 </since_tizen>
189 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
190 [EditorBrowsable(EditorBrowsableState.Never)]
191 public ImageViewStyle HighIndicatorImage
198 /// Get or set low indicator text.
200 /// <since_tizen> 6 </since_tizen>
201 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
202 [EditorBrowsable(EditorBrowsableState.Never)]
203 public TextLabelStyle LowIndicator
210 /// Get or set high indicator text.
212 /// <since_tizen> 6 </since_tizen>
213 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
214 [EditorBrowsable(EditorBrowsableState.Never)]
215 public TextLabelStyle HighIndicator
222 /// Get or set Indicator type
224 /// <since_tizen> 6 </since_tizen>
225 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
226 [EditorBrowsable(EditorBrowsableState.Never)]
227 public IndicatorType? IndicatorType
231 return (IndicatorType?)GetValue(IndicatorTypeProperty);
235 SetValue(IndicatorTypeProperty, value);
238 private IndicatorType? privateIndicatorType
245 /// Get or set track thickness
247 /// <since_tizen> 6 </since_tizen>
248 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
249 [EditorBrowsable(EditorBrowsableState.Never)]
250 public uint? TrackThickness
254 return (uint?)GetValue(TrackThicknessProperty);
258 SetValue(TrackThicknessProperty, value);
261 private uint? privateTrackThickness
268 /// Get or set space between track and indicator
270 /// <since_tizen> 6 </since_tizen>
271 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
272 [EditorBrowsable(EditorBrowsableState.Never)]
273 public uint? SpaceBetweenTrackAndIndicator
277 return (uint?)GetValue(SpaceBetweenTrackAndIndicatorProperty);
281 SetValue(SpaceBetweenTrackAndIndicatorProperty, value);
284 private uint? privateSpaceBetweenTrackAndIndicator
291 /// Get or set space between track and indicator
293 /// <since_tizen> 6 </since_tizen>
294 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
295 [EditorBrowsable(EditorBrowsableState.Never)]
296 public Extents TrackPadding
300 return (Extents)GetValue(TrackPaddingProperty);
304 SetValue(TrackPaddingProperty, value);
307 private Extents _trackPadding;
308 private Extents trackPadding
312 if (null == _trackPadding)
314 _trackPadding = new Extents((ushort start, ushort end, ushort top, ushort bottom)=>
316 Extents extents = new Extents(start, end, top, bottom);
317 _trackPadding.CopyFrom(extents);
320 return _trackPadding;
325 /// Attributes's clone function.
327 /// <since_tizen> 6 </since_tizen>
328 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
329 [EditorBrowsable(EditorBrowsableState.Never)]
330 public override void CopyFrom(BindableObject bindableObject)
332 base.CopyFrom(bindableObject);
334 SliderStyle sliderAttributes = bindableObject as SliderStyle;
336 if (null != sliderAttributes)
338 if (sliderAttributes.Track != null)
342 Track = new ImageViewStyle();
344 Track.CopyFrom(sliderAttributes.Track);
347 if (sliderAttributes.Progress != null)
349 if (null == Progress)
351 Progress = new ImageViewStyle();
353 Progress.CopyFrom(sliderAttributes.Progress);
356 if (sliderAttributes.Thumb != null)
360 Thumb = new ImageViewStyle();
362 Thumb.CopyFrom(sliderAttributes.Thumb);
365 if (sliderAttributes.ThumbBackground != null)
367 if (null == ThumbBackground)
369 ThumbBackground = new ImageViewStyle();
371 ThumbBackground.CopyFrom(sliderAttributes.ThumbBackground);
374 if (sliderAttributes.LowIndicatorImage != null)
376 if (null == LowIndicatorImage)
378 LowIndicatorImage = new ImageViewStyle();
380 LowIndicatorImage.CopyFrom(sliderAttributes.LowIndicatorImage);
383 if (sliderAttributes.HighIndicatorImage != null)
385 if (null == HighIndicatorImage)
387 HighIndicatorImage = new ImageViewStyle();
389 HighIndicatorImage.CopyFrom(sliderAttributes.HighIndicatorImage);
392 if (sliderAttributes.LowIndicator != null)
394 if (null == LowIndicator)
396 LowIndicator = new TextLabelStyle();
398 LowIndicator.CopyFrom(sliderAttributes.LowIndicator);
401 if (sliderAttributes.HighIndicator != null)
403 if (null == HighIndicator)
405 HighIndicator = new TextLabelStyle();
407 HighIndicator.CopyFrom(sliderAttributes.HighIndicator);
410 if (sliderAttributes.TrackThickness != null)
412 TrackThickness = sliderAttributes.TrackThickness;
415 if (sliderAttributes.TrackPadding != null)
417 TrackPadding = sliderAttributes.TrackPadding;
422 private void InitSubStyle()
424 Track = new ImageViewStyle();
425 Progress = new ImageViewStyle();
426 Thumb = new ImageViewStyle();
427 ThumbBackground = new ImageViewStyle();
428 LowIndicatorImage = new ImageViewStyle();
429 HighIndicatorImage = new ImageViewStyle();
430 LowIndicator = new TextLabelStyle();
431 HighIndicator = new TextLabelStyle();