Merge "Fix some bugs: (1)Change the return type of Window.IsVisible() form void to...
[platform/core/csapi/nui.git] / Tizen.NUI / src / public / ImageView.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Tizen.NUI
28 {
29
30     /// <summary>
31     /// ImageView is a class for displaying an image resource.<br>
32     /// An instance of ImageView can be created using a URL or an Image instance.<br>
33     /// </summary>
34     public class ImageView : View
35     {
36         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
37
38         internal ImageView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ImageView_SWIGUpcast(cPtr), cMemoryOwn)
39         {
40             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
41         }
42
43         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageView obj)
44         {
45             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
46         }
47
48         ~ImageView()
49         {
50             DisposeQueue.Instance.Add(this);
51         }
52
53         public override void Dispose()
54         {
55             if (!Stage.IsInstalled())
56             {
57                 DisposeQueue.Instance.Add(this);
58                 return;
59             }
60
61             lock (this)
62             {
63                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
64                 {
65                     if (swigCMemOwn)
66                     {
67                         swigCMemOwn = false;
68                         NDalicPINVOKE.delete_ImageView(swigCPtr);
69                     }
70                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
71                 }
72                 global::System.GC.SuppressFinalize(this);
73                 base.Dispose();
74             }
75         }
76
77
78         internal class Property : global::System.IDisposable
79         {
80             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
81             protected bool swigCMemOwn;
82
83             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
84             {
85                 swigCMemOwn = cMemoryOwn;
86                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
87             }
88
89             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
90             {
91                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
92             }
93
94             ~Property()
95             {
96                 Dispose();
97             }
98
99             public virtual void Dispose()
100             {
101                 lock (this)
102                 {
103                     if (swigCPtr.Handle != global::System.IntPtr.Zero)
104                     {
105                         if (swigCMemOwn)
106                         {
107                             swigCMemOwn = false;
108                             NDalicPINVOKE.delete_ImageView_Property(swigCPtr);
109                         }
110                         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
111                     }
112                     global::System.GC.SuppressFinalize(this);
113                 }
114             }
115
116             internal Property() : this(NDalicPINVOKE.new_ImageView_Property(), true)
117             {
118                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119             }
120
121             internal static readonly int RESOURCE_URL = NDalicPINVOKE.ImageView_Property_RESOURCE_URL_get();
122             internal static readonly int IMAGE = NDalicPINVOKE.ImageView_Property_IMAGE_get();
123             internal static readonly int PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.ImageView_Property_PRE_MULTIPLIED_ALPHA_get();
124             internal static readonly int PIXEL_AREA = NDalicPINVOKE.ImageView_Property_PIXEL_AREA_get();
125
126         }
127
128         /// <summary>
129         /// Creates an initialized ImageView.
130         /// </summary>
131         public ImageView() : this(NDalicPINVOKE.ImageView_New__SWIG_0(), true)
132         {
133             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134
135         }
136         /// <summary>
137         /// Creates an initialized ImageView from an URL to an image resource.<br>
138         /// If the string is empty, ImageView will not display anything.<br>
139         /// </summary>
140         /// <param name="url">The url of the image resource to display</param>
141         public ImageView(string url) : this(NDalicPINVOKE.ImageView_New__SWIG_2(url), true)
142         {
143             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144
145         }
146         internal ImageView(string url, Uint16Pair size) : this(NDalicPINVOKE.ImageView_New__SWIG_3(url, Uint16Pair.getCPtr(size)), true)
147         {
148             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
149
150         }
151         internal ImageView(ImageView imageView) : this(NDalicPINVOKE.new_ImageView__SWIG_1(ImageView.getCPtr(imageView)), true)
152         {
153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154         }
155         internal ImageView Assign(ImageView imageView)
156         {
157             ImageView ret = new ImageView(NDalicPINVOKE.ImageView_Assign(swigCPtr, ImageView.getCPtr(imageView)), false);
158             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159             return ret;
160         }
161         /// <summary>
162         /// Downcasts a handle to ImageView handle.<br>
163         /// If handle points to a ImageView, the downcast produces valid handle.<br>
164         /// If not, the returned handle is left uninitialized.<br>
165         /// </summary>
166         /// <param name="handle">Handle to an object</param>
167         /// <returns>Handle to a ImageView or an uninitialized handle</returns>
168         public new static ImageView DownCast(BaseHandle handle)
169         {
170             ImageView ret = new ImageView(NDalicPINVOKE.ImageView_DownCast(BaseHandle.getCPtr(handle)), true);
171             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172             return ret;
173         }
174         /// <summary>
175         /// Sets this ImageView from the given URL.<br>
176         /// If the URL is empty, ImageView will not display anything.<br>
177         /// </summary>
178         /// <param name="url">The URL to the image resource to display</param>
179         public void SetImage(string url)
180         {
181             NDalicPINVOKE.ImageView_SetImage__SWIG_1(swigCPtr, url);
182             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183         }
184         internal void SetImage(string url, Uint16Pair size)
185         {
186             NDalicPINVOKE.ImageView_SetImage__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(size));
187             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
188         }
189         internal enum PropertyRange
190         {
191             PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
192             PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000,
193             ANIMATABLE_PROPERTY_START_INDEX = PropertyRanges.ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,
194             ANIMATABLE_PROPERTY_END_INDEX = PropertyRanges.ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000
195         }
196
197         /// <summary>
198         /// ImageView ResourceUrl, type string
199         /// </summary>
200         public string ResourceUrl
201         {
202             get
203             {
204                 string temp;
205                 GetProperty(ImageView.Property.RESOURCE_URL).Get(out temp);
206                 return temp;
207             }
208             set
209             {
210                 SetProperty(ImageView.Property.RESOURCE_URL, new Tizen.NUI.PropertyValue(value));
211             }
212         }
213         /// <summary>
214         /// ImageView ImageMap, type PropertyMap : string if it is a url, map otherwise
215         /// </summary>
216         public PropertyMap ImageMap
217         {
218             get
219             {
220                 PropertyMap temp = new PropertyMap();
221                 GetProperty(ImageView.Property.IMAGE).Get(temp);
222                 return temp;
223             }
224             set
225             {
226                 SetProperty(ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(value));
227             }
228         }
229         /// <summary>
230         /// ImageView PreMultipliedAlpha, type Boolean.<br>
231         /// Image must be initialized.<br>
232         /// </summary>
233         public bool PreMultipliedAlpha
234         {
235             get
236             {
237                 bool temp = false;
238                 GetProperty(ImageView.Property.PRE_MULTIPLIED_ALPHA).Get(ref temp);
239                 return temp;
240             }
241             set
242             {
243                 SetProperty(ImageView.Property.PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue(value));
244             }
245         }
246         /// <summary>
247         /// ImageView PixelArea, type Vector4 (Animatable property).<br>
248         /// Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].<br>
249         /// </summary>
250         public RelativeVector4 PixelArea
251         {
252             get
253             {
254                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
255                 GetProperty(ImageView.Property.PIXEL_AREA).Get(temp);
256                 return temp;
257             }
258             set
259             {
260                 SetProperty(ImageView.Property.PIXEL_AREA, new Tizen.NUI.PropertyValue(value));
261             }
262         }
263
264     }
265
266 }