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