Replace duplicate documentation of CopyFrom with inheritdoc
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Style / ImageScrollBarStyle.cs
1 /*
2  * Copyright(c) 2019 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.Binding;
20
21 namespace Tizen.NUI.Components
22 {
23     /// <summary>
24     /// ScrollBarStyle is a class which saves Scrollbar's ux data.
25     /// </summary>
26     /// <remarks>
27     /// Please note that this class will be replaced with ScrollbarStyle class in the near future.
28     /// </remarks>
29     [EditorBrowsable(EditorBrowsableState.Never)]
30     public class ScrollBarStyle : ControlStyle
31     {
32         static ScrollBarStyle() { }
33
34         /// <summary>
35         /// Creates a new instance of a ScrollBarStyle.
36         /// </summary>
37         [EditorBrowsable(EditorBrowsableState.Never)]
38         public ScrollBarStyle() : base()
39         {
40             InitSubStyle();
41             Direction = ScrollBar.DirectionType.Horizontal;
42         }
43
44         /// <summary>
45         /// Creates a new instance of a ScrollBarStyle with style.
46         /// </summary>
47         /// <param name="style">Create ScrollBarStyle by style customized by user.</param>
48         [EditorBrowsable(EditorBrowsableState.Never)]
49         public ScrollBarStyle(ScrollBarStyle style) : base(style)
50         {
51             if (null == style) return;
52
53             InitSubStyle();
54
55             this.CopyFrom(style);
56         }
57
58         /// <summary>
59         /// Get or set track image style.
60         /// </summary>
61         [EditorBrowsable(EditorBrowsableState.Never)]
62         public ImageViewStyle Track { get; set; }
63
64         /// <summary>
65         /// Get or set thumb image style.
66         /// </summary>
67         [EditorBrowsable(EditorBrowsableState.Never)]
68         public ImageViewStyle Thumb { get; set; }
69
70         /// <summary>
71         /// Get or set direction type.
72         /// </summary>
73         [EditorBrowsable(EditorBrowsableState.Never)]
74         public ScrollBar.DirectionType? Direction { get; set; }
75
76         /// <summary>
77         /// Get or set duration.
78         /// </summary>
79         [EditorBrowsable(EditorBrowsableState.Never)]
80         public uint Duration { get; set; }
81
82         /// <inheritdoc/>
83         [EditorBrowsable(EditorBrowsableState.Never)]
84         public override void CopyFrom(BindableObject bindableObject)
85         {
86             base.CopyFrom(bindableObject);
87
88             ScrollBarStyle scrollBarStyle = bindableObject as ScrollBarStyle;
89
90             if (null != scrollBarStyle)
91             {
92                 if (null != scrollBarStyle.Track)
93                 {
94                     Track?.CopyFrom(scrollBarStyle.Track);
95                 }
96
97                 if (null != scrollBarStyle.Thumb)
98                 {
99                     Thumb?.CopyFrom(scrollBarStyle.Thumb);
100                 }
101
102                 Direction = scrollBarStyle.Direction;
103                 Duration = scrollBarStyle.Duration;
104             }
105         }
106
107         private void InitSubStyle()
108         {
109             Track = new ImageViewStyle()
110             {
111                 PositionUsesPivotPoint = true,
112                 ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft,
113                 PivotPoint = Tizen.NUI.PivotPoint.CenterLeft,
114                 WidthResizePolicy = ResizePolicyType.FillToParent,
115                 HeightResizePolicy = ResizePolicyType.FillToParent
116             };
117
118             Thumb = new ImageViewStyle()
119             {
120                 PositionUsesPivotPoint = true,
121                 ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft,
122                 PivotPoint = Tizen.NUI.PivotPoint.CenterLeft,
123                 WidthResizePolicy = ResizePolicyType.Fixed,
124                 HeightResizePolicy = ResizePolicyType.Fixed
125             };
126         }
127     }
128 }