[NUI]Merge master#1199 to API6 (#1202)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Attributes / ProgressAttributes.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     /// ProgressStyle is a class which saves Progress's ux data.
25     /// </summary>
26     /// <since_tizen> 6 </since_tizen>
27     /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
28     [EditorBrowsable(EditorBrowsableState.Never)]
29     public class ProgressStyle : ControlStyle
30     {
31         /// <summary>
32         /// Creates a new instance of a ProgressStyle.
33         /// </summary>
34         /// <since_tizen> 6 </since_tizen>
35         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36         [EditorBrowsable(EditorBrowsableState.Never)]
37         public ProgressStyle() : base()
38         {
39             InitSubStyle();
40         }
41
42         /// <summary>
43         /// Creates a new instance of a ProgressStyle with style.
44         /// </summary>
45         /// <param name="style">Create ProgressStyle by style customized by user.</param>
46         /// <since_tizen> 6 </since_tizen>
47         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
48         [EditorBrowsable(EditorBrowsableState.Never)]
49         public ProgressStyle(ProgressStyle 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.
60         /// </summary>
61         /// <since_tizen> 6 </since_tizen>
62         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
63         [EditorBrowsable(EditorBrowsableState.Never)]
64         public ImageViewStyle Track
65         {
66             get;
67             set;
68         }
69
70         /// <summary>
71         /// Get or set progress image.
72         /// </summary>
73         /// <since_tizen> 6 </since_tizen>
74         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
75         [EditorBrowsable(EditorBrowsableState.Never)]
76         public ImageViewStyle Progress
77         {
78             get;
79             set;
80         }
81
82         /// <summary>
83         /// Get or set buffer image.
84         /// </summary>
85         /// <since_tizen> 6 </since_tizen>
86         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
87         [EditorBrowsable(EditorBrowsableState.Never)]
88         public ImageViewStyle Buffer
89         {
90             get;
91             set;
92         }
93
94         /// <summary>
95         /// Clone function.
96         /// </summary>
97         /// <since_tizen> 6 </since_tizen>
98         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
99         [EditorBrowsable(EditorBrowsableState.Never)]
100         public override void CopyFrom(BindableObject bindableObject)
101         {
102             base.CopyFrom(bindableObject);
103
104             ProgressStyle progressStyle = bindableObject as ProgressStyle;
105
106             if (null != progressStyle)
107             {
108                 if (null != progressStyle.Track)
109                 {
110                     Track.CopyFrom(progressStyle.Track);
111                 }
112
113                 if (null != progressStyle.Progress)
114                 {
115                     Progress.CopyFrom(progressStyle.Progress);
116                 }
117
118                 if (null != progressStyle.Buffer)
119                 {
120                     Buffer.CopyFrom(progressStyle.Buffer);
121                 }
122             }
123         }
124
125         private void InitSubStyle()
126         {
127             Track = new ImageViewStyle()
128             {
129                 WidthResizePolicy = ResizePolicyType.FillToParent,
130                 HeightResizePolicy = ResizePolicyType.FillToParent,
131                 PositionUsesPivotPoint = true,
132                 ParentOrigin = NUI.ParentOrigin.TopLeft,
133                 PivotPoint = NUI.PivotPoint.TopLeft
134             };
135
136             Progress = new ImageViewStyle()
137             {
138                 WidthResizePolicy = ResizePolicyType.FillToParent,
139                 HeightResizePolicy = ResizePolicyType.FillToParent,
140                 PositionUsesPivotPoint = true,
141                 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
142                 PivotPoint = Tizen.NUI.PivotPoint.TopLeft
143             };
144
145             Buffer = new ImageViewStyle()
146             {
147                 WidthResizePolicy = ResizePolicyType.FillToParent,
148                 HeightResizePolicy = ResizePolicyType.FillToParent,
149                 PositionUsesPivotPoint = true,
150                 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
151                 PivotPoint = Tizen.NUI.PivotPoint.TopLeft
152             };
153         }
154     }
155 }