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;
21 namespace Tizen.NUI.Components
24 /// ScrollBarStyle is a class which saves Scrollbar's ux data.
26 /// <since_tizen> 8 </since_tizen>
27 public class ScrollBarStyle : ControlStyle
29 static ScrollBarStyle() { }
32 /// Creates a new instance of a ScrollBarStyle.
34 /// <since_tizen> 8 </since_tizen>
35 public ScrollBarStyle() : base()
38 Direction = ScrollBar.DirectionType.Horizontal;
42 /// Creates a new instance of a ScrollBarStyle with style.
44 /// <param name="style">Create ScrollBarStyle by style customized by user.</param>
45 /// <since_tizen> 8 </since_tizen>
46 public ScrollBarStyle(ScrollBarStyle style) : base(style)
48 if (null == style) return;
56 /// Get or set track image style.
58 /// <since_tizen> 8 </since_tizen>
59 public ImageViewStyle Track { get; set; }
62 /// Get or set thumb image style.
64 /// <since_tizen> 8 </since_tizen>
65 public ImageViewStyle Thumb { get; set; }
68 /// Get or set direction type.
70 /// <since_tizen> 8 </since_tizen>
71 public ScrollBar.DirectionType? Direction { get; set; }
74 /// Get or set duration.
76 /// <since_tizen> 8 </since_tizen>
77 public uint Duration { get; set; }
80 /// Style's clone function.
82 /// <param name="bindableObject">The style that need to copy.</param>
83 /// <since_tizen> 8 </since_tizen>
84 public override void CopyFrom(BindableObject bindableObject)
86 base.CopyFrom(bindableObject);
88 ScrollBarStyle scrollBarStyle = bindableObject as ScrollBarStyle;
90 if (null != scrollBarStyle)
92 if (null != scrollBarStyle.Track)
94 Track?.CopyFrom(scrollBarStyle.Track);
97 if (null != scrollBarStyle.Thumb)
99 Thumb?.CopyFrom(scrollBarStyle.Thumb);
102 Direction = scrollBarStyle.Direction;
103 Duration = scrollBarStyle.Duration;
107 private void InitSubStyle()
109 Track = new ImageViewStyle()
111 PositionUsesPivotPoint = true,
112 ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft,
113 PivotPoint = Tizen.NUI.PivotPoint.CenterLeft,
114 WidthResizePolicy = ResizePolicyType.FillToParent,
115 HeightResizePolicy = ResizePolicyType.FillToParent
118 Thumb = new ImageViewStyle()
120 PositionUsesPivotPoint = true,
121 ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft,
122 PivotPoint = Tizen.NUI.PivotPoint.CenterLeft,
123 WidthResizePolicy = ResizePolicyType.Fixed,
124 HeightResizePolicy = ResizePolicyType.Fixed