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.
18 using System.ComponentModel;
19 using Tizen.NUI.Binding;
21 namespace Tizen.NUI.BaseComponents
24 /// The base class for Children attributes in Components.
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
30 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
31 [EditorBrowsable(EditorBrowsableState.Never)]
32 public static readonly BindableProperty ResourceUrlSelectorProperty = BindableProperty.Create("ResourceUrlSelector", typeof(Selector<string>), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
34 var imageViewStyle = (ImageViewStyle)bindable;
35 imageViewStyle.resourceUrlSelector = ((Selector<string>)newValue)?.Clone();
37 defaultValueCreator: (bindable) =>
39 var imageViewStyle = (ImageViewStyle)bindable;
40 return imageViewStyle.resourceUrlSelector;
42 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
43 [EditorBrowsable(EditorBrowsableState.Never)]
44 public static readonly BindableProperty PreMultipliedAlphaProperty = BindableProperty.Create(nameof(PreMultipliedAlpha), typeof(bool?), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
46 var imageViewStyle = (ImageViewStyle)bindable;
47 imageViewStyle.preMultipliedAlpha = (bool?)newValue;
49 defaultValueCreator: (bindable) =>
51 var imageViewStyle = (ImageViewStyle)bindable;
52 return imageViewStyle.preMultipliedAlpha;
54 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public static readonly BindableProperty PixelAreaProperty = BindableProperty.Create(nameof(PixelArea), typeof(RelativeVector4), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
58 var imageViewStyle = (ImageViewStyle)bindable;
59 imageViewStyle.pixelArea = (RelativeVector4)newValue;
61 defaultValueCreator: (bindable) =>
63 var imageViewStyle = (ImageViewStyle)bindable;
64 return imageViewStyle.pixelArea;
66 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
67 [EditorBrowsable(EditorBrowsableState.Never)]
68 public static readonly BindableProperty BorderSelectorProperty = BindableProperty.Create("BorderSelector", typeof(Selector<Rectangle>), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
70 var imageViewStyle = (ImageViewStyle)bindable;
71 imageViewStyle.borderSelector = ((Selector<Rectangle>)newValue)?.Clone();
73 defaultValueCreator: (bindable) =>
75 var imageViewStyle = (ImageViewStyle)bindable;
76 return imageViewStyle.borderSelector;
78 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
79 [EditorBrowsable(EditorBrowsableState.Never)]
80 public static readonly BindableProperty BorderOnlyProperty = BindableProperty.Create(nameof(BorderOnly), typeof(bool?), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
82 var imageViewStyle = (ImageViewStyle)bindable;
83 imageViewStyle.borderOnly = (bool?)newValue;
85 defaultValueCreator: (bindable) =>
87 var imageViewStyle = (ImageViewStyle)bindable;
88 return imageViewStyle.borderOnly;
90 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
91 [EditorBrowsable(EditorBrowsableState.Never)]
92 public static readonly BindableProperty SynchronosLoadingProperty = BindableProperty.Create(nameof(SynchronosLoading), typeof(bool?), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
94 var imageViewStyle = (ImageViewStyle)bindable;
95 imageViewStyle.synchronosLoading = (bool?)newValue;
97 defaultValueCreator: (bindable) =>
99 var imageViewStyle = (ImageViewStyle)bindable;
100 return imageViewStyle.synchronosLoading;
102 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
103 [EditorBrowsable(EditorBrowsableState.Never)]
104 public static readonly BindableProperty OrientationCorrectionProperty = BindableProperty.Create(nameof(OrientationCorrection), typeof(bool?), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
106 var imageViewStyle = (ImageViewStyle)bindable;
107 imageViewStyle.orientationCorrection = (bool?)newValue;
109 defaultValueCreator: (bindable) =>
111 var imageViewStyle = (ImageViewStyle)bindable;
112 return imageViewStyle.orientationCorrection;
115 private bool? preMultipliedAlpha;
116 private RelativeVector4 pixelArea;
117 private bool? borderOnly;
118 private bool? synchronosLoading;
119 private bool? orientationCorrection;
120 private Selector<string> resourceUrlSelector;
121 private Selector<Rectangle> borderSelector;
123 static ImageViewStyle() { }
126 /// Create an empty instance.
128 [EditorBrowsable(EditorBrowsableState.Never)]
129 public ImageViewStyle() : base()
134 /// Create an instance and set properties from the given ImageView.
136 /// <param name="imageView">The ImageView instance that includes property data.</param>
137 [EditorBrowsable(EditorBrowsableState.Never)]
138 public ImageViewStyle(ImageView imageView) : base(imageView)
142 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
143 [EditorBrowsable(EditorBrowsableState.Never)]
144 public bool? PreMultipliedAlpha
146 get => (bool?)GetValue(PreMultipliedAlphaProperty);
147 set => SetValue(PreMultipliedAlphaProperty, value);
150 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 public RelativeVector4 PixelArea
154 get => (RelativeVector4)GetValue(PixelAreaProperty);
155 set => SetValue(PixelAreaProperty, value);
158 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
159 [EditorBrowsable(EditorBrowsableState.Never)]
160 public bool? BorderOnly
162 get => (bool?)GetValue(BorderOnlyProperty);
163 set => SetValue(BorderOnlyProperty, value);
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
170 get => (bool?)GetValue(SynchronosLoadingProperty);
171 set => SetValue(SynchronosLoadingProperty, value);
174 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
175 [EditorBrowsable(EditorBrowsableState.Never)]
176 public bool? OrientationCorrection
178 get => (bool?)GetValue(OrientationCorrectionProperty);
179 set => SetValue(OrientationCorrectionProperty, value);
185 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
186 [EditorBrowsable(EditorBrowsableState.Never)]
187 public Selector<string> ResourceUrl
191 Selector<string> tmp = (Selector<string>)GetValue(ResourceUrlSelectorProperty);
192 return (null != tmp) ? tmp : resourceUrlSelector = new Selector<string>();
194 set => SetValue(ResourceUrlSelectorProperty, value);
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<Rectangle> Border
206 Selector<Rectangle> tmp = (Selector<Rectangle>)GetValue(BorderSelectorProperty);
207 return (null != tmp) ? tmp : borderSelector = new Selector<Rectangle>();
209 set => SetValue(BorderSelectorProperty, value);