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.
27 /// Please note that this class will be replaced with ScrollbarStyle class in the near future.
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class ScrollBarStyle : ControlStyle
32 static ScrollBarStyle() { }
35 /// Creates a new instance of a ScrollBarStyle.
37 [EditorBrowsable(EditorBrowsableState.Never)]
38 public ScrollBarStyle() : base()
41 Direction = ScrollBar.DirectionType.Horizontal;
45 /// Creates a new instance of a ScrollBarStyle with style.
47 /// <param name="style">Create ScrollBarStyle by style customized by user.</param>
48 [EditorBrowsable(EditorBrowsableState.Never)]
49 public ScrollBarStyle(ScrollBarStyle style) : base(style)
51 if (null == style) return;
59 /// Get or set track image style.
61 [EditorBrowsable(EditorBrowsableState.Never)]
62 public ImageViewStyle Track { get; set; }
65 /// Get or set thumb image style.
67 [EditorBrowsable(EditorBrowsableState.Never)]
68 public ImageViewStyle Thumb { get; set; }
71 /// Get or set direction type.
73 [EditorBrowsable(EditorBrowsableState.Never)]
74 public ScrollBar.DirectionType? Direction { get; set; }
77 /// Get or set duration.
79 [EditorBrowsable(EditorBrowsableState.Never)]
80 public uint Duration { get; set; }
83 [EditorBrowsable(EditorBrowsableState.Never)]
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