Fix components issue 1216 (#1194) (#1201)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / Style / ImageViewStyle.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;
18 using System.ComponentModel;
19 using Tizen.NUI.Binding;
20
21 namespace Tizen.NUI.BaseComponents
22 {
23     /// <summary>
24     /// The base class for Children attributes in Components.
25     /// </summary>
26     /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
27     [EditorBrowsable(EditorBrowsableState.Never)]
28     public class ImageViewStyle : ViewStyle
29     {
30         private bool? preMultipliedAlpha;
31         private RelativeVector4 pixelArea;
32         private bool? borderOnly;
33         private bool? synchronosLoading;
34         private bool? orientationCorrection;
35
36         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
37         [EditorBrowsable(EditorBrowsableState.Never)]
38         public static readonly BindableProperty ResourceUrlSelectorProperty = BindableProperty.Create("ResourceUrlSelector", typeof(Selector<string>), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
39         {
40             var imageViewStyle = (ImageViewStyle)bindable;
41             imageViewStyle.resourceUrlSelector.Clone((Selector<string>)newValue);
42         },
43         defaultValueCreator: (bindable) =>
44         {
45             var imageViewStyle = (ImageViewStyle)bindable;
46             return imageViewStyle.resourceUrlSelector;
47         });
48         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
49         [EditorBrowsable(EditorBrowsableState.Never)]
50         public static readonly BindableProperty PreMultipliedAlphaProperty = BindableProperty.Create("PreMultipliedAlpha", typeof(bool?), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
51         {
52             var imageViewStyle = (ImageViewStyle)bindable;
53             imageViewStyle.preMultipliedAlpha = (bool?)newValue;
54         },
55         defaultValueCreator: (bindable) =>
56         {
57             var imageViewStyle = (ImageViewStyle)bindable;
58             return imageViewStyle.preMultipliedAlpha;
59         });
60         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
61         [EditorBrowsable(EditorBrowsableState.Never)]
62         public static readonly BindableProperty PixelAreaProperty = BindableProperty.Create("PixelArea", typeof(RelativeVector4), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
63         {
64             var imageViewStyle = (ImageViewStyle)bindable;
65             imageViewStyle.pixelArea = (RelativeVector4)newValue;
66         },
67         defaultValueCreator: (bindable) =>
68         {
69             var imageViewStyle = (ImageViewStyle)bindable;
70             return imageViewStyle.pixelArea;
71         });
72         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
73         [EditorBrowsable(EditorBrowsableState.Never)]
74         public static readonly BindableProperty BorderSelectorProperty = BindableProperty.Create("BorderSelector", typeof(Selector<Rectangle>), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
75         {
76             var imageViewStyle = (ImageViewStyle)bindable;
77             imageViewStyle.borderSelector.Clone((Selector<Rectangle>)newValue);
78         },
79         defaultValueCreator: (bindable) =>
80         {
81             var imageViewStyle = (ImageViewStyle)bindable;
82             return imageViewStyle.borderSelector;
83         });
84         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
85         [EditorBrowsable(EditorBrowsableState.Never)]
86         public static readonly BindableProperty BorderOnlyProperty = BindableProperty.Create("BorderOnly", typeof(bool?), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
87         {
88             var imageViewStyle = (ImageViewStyle)bindable;
89             imageViewStyle.borderOnly = (bool?)newValue;
90         },
91         defaultValueCreator: (bindable) =>
92         {
93             var imageViewStyle = (ImageViewStyle)bindable;
94             return imageViewStyle.borderOnly;
95         });
96         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
97         [EditorBrowsable(EditorBrowsableState.Never)]
98         public static readonly BindableProperty SynchronosLoadingProperty = BindableProperty.Create("SynchronosLoading", typeof(bool?), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
99         {
100             var imageViewStyle = (ImageViewStyle)bindable;
101             imageViewStyle.synchronosLoading = (bool?)newValue;
102         },
103         defaultValueCreator: (bindable) =>
104         {
105             var imageViewStyle = (ImageViewStyle)bindable;
106             return imageViewStyle.synchronosLoading;
107         });
108         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
109         [EditorBrowsable(EditorBrowsableState.Never)]
110         public static readonly BindableProperty OrientationCorrectionProperty = BindableProperty.Create("OrientationCorrection", typeof(bool?), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
111         {
112             var imageViewStyle = (ImageViewStyle)bindable;
113             imageViewStyle.orientationCorrection = (bool?)newValue;
114         },
115         defaultValueCreator: (bindable) =>
116         {
117             var imageViewStyle = (ImageViewStyle)bindable;
118             return imageViewStyle.orientationCorrection;
119         });
120
121         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
122         [EditorBrowsable(EditorBrowsableState.Never)]
123         public bool? PreMultipliedAlpha
124         {
125             get
126             {
127                 bool? temp = (bool?)GetValue(PreMultipliedAlphaProperty);
128                 return temp;
129             }
130             set
131             {
132                 SetValue(PreMultipliedAlphaProperty, value);
133             }
134         }
135
136         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
137         [EditorBrowsable(EditorBrowsableState.Never)]
138         public RelativeVector4 PixelArea
139         {
140             get
141             {
142                 RelativeVector4 temp = (RelativeVector4)GetValue(PixelAreaProperty);
143                 return temp;
144             }
145             set
146             {
147                 SetValue(PixelAreaProperty, value);
148             }
149         }
150
151         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
152         [EditorBrowsable(EditorBrowsableState.Never)]
153         public bool? BorderOnly
154         {
155             get
156             {
157                 bool? temp = (bool?)GetValue(BorderOnlyProperty);
158                 return temp;
159             }
160             set
161             {
162                 SetValue(BorderOnlyProperty, value);
163             }
164         }
165
166         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
167         [EditorBrowsable(EditorBrowsableState.Never)]
168         public bool? SynchronosLoading
169         {
170             get
171             {
172                 bool? temp = (bool?)GetValue(SynchronosLoadingProperty);
173                 return temp;
174             }
175             set
176             {
177                 SetValue(SynchronosLoadingProperty, value);
178             }
179         }
180
181         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
182         [EditorBrowsable(EditorBrowsableState.Never)]
183         public bool? OrientationCorrection
184         {
185             get
186             {
187                 bool? temp = (bool?)GetValue(OrientationCorrectionProperty);
188                 return temp;
189             }
190             set
191             {
192                 SetValue(OrientationCorrectionProperty, value);
193             }
194         }
195
196         private Selector<string> resourceUrlSelector = new Selector<string>();
197         /// <summary>
198         /// Image URL.
199         /// </summary>
200         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
201         [EditorBrowsable(EditorBrowsableState.Never)]
202         public Selector<string> ResourceUrl
203         {
204             get
205             {
206                 return (Selector<string>)GetValue(ResourceUrlSelectorProperty);
207             }
208             set
209             {
210                 SetValue(ResourceUrlSelectorProperty, value);
211             }
212         }
213
214         private Selector<Rectangle> borderSelector = new Selector<Rectangle>();
215         /// <summary>
216         /// Image border.
217         /// </summary>
218         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
219         [EditorBrowsable(EditorBrowsableState.Never)]
220         public Selector<Rectangle> Border
221         {
222             get
223             {
224                 return (Selector<Rectangle>)GetValue(BorderSelectorProperty);
225             }
226             set
227             {
228                 SetValue(BorderSelectorProperty, value);
229             }
230         }
231     }
232 }