Note that some Text propeties in devel api can't be changed
[platform/core/uifw/dali-toolkit.git] / plugins / dali-sharp / sharp / public / Image.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.10
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10
11 namespace Dali {
12
13 using System;
14 using System.Runtime.InteropServices;
15
16
17 public class Image : BaseHandle {
18   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
19
20   internal Image(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Image_SWIGUpcast(cPtr), cMemoryOwn) {
21     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
22   }
23
24   internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Image obj) {
25     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
26   }
27
28   ~Image() {
29     DisposeQueue.Instance.Add(this);
30   }
31
32   public override void Dispose() {
33     if (!Window.IsInstalled()) {
34       DisposeQueue.Instance.Add(this);
35       return;
36     }
37
38     lock(this) {
39       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
40         if (swigCMemOwn) {
41           swigCMemOwn = false;
42           NDalicPINVOKE.delete_Image(swigCPtr);
43         }
44         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
45       }
46       global::System.GC.SuppressFinalize(this);
47       base.Dispose();
48     }
49   }
50
51
52
53
54 /**
55   * @brief Event arguments that passed via Uploaded signal
56   *
57   */
58 public class UploadedEventArgs : EventArgs
59 {
60    private Image _image;
61    /**
62      * @brief Image - is the image data that gets uploaded to GL.
63      *
64      */
65    public Image Image
66    {
67       get
68       {
69          return _image;
70       }
71       set
72       {
73          _image = value;
74       }
75    }
76 }
77
78   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
79   private delegate void UploadedEventCallbackDelegate(IntPtr image);
80   private DaliEventHandler<object,UploadedEventArgs> _imageUploadedEventHandler;
81   private UploadedEventCallbackDelegate _imageUploadedEventCallbackDelegate;
82
83   /**
84     * @brief Event for Uploaded signal which can be used to subscribe/unsubscribe the event handler
85     * (in the type of UploadedEventHandler-DaliEventHandler<object,UploadedEventArgs>) 
86     * provided by the user. Uploaded signal is emitted when the image data gets uploaded to GL.
87     */
88   public event DaliEventHandler<object,UploadedEventArgs> Uploaded
89   {
90      add
91      {
92         lock(this)
93         {
94            // Restricted to only one listener
95            if (_imageUploadedEventHandler == null)
96            {
97               _imageUploadedEventHandler += value;
98
99               _imageUploadedEventCallbackDelegate = new UploadedEventCallbackDelegate(OnUploaded);
100               this.UploadedSignal().Connect(_imageUploadedEventCallbackDelegate);
101            }
102         }
103      }
104
105      remove
106      {
107         lock(this)
108         {
109            if (_imageUploadedEventHandler != null)
110            {
111               this.UploadedSignal().Disconnect(_imageUploadedEventCallbackDelegate);
112            }
113
114            _imageUploadedEventHandler -= value;
115         }
116      }
117   }
118
119   // Callback for Image UploadedSignal
120   private void OnUploaded(IntPtr data)
121   {
122      UploadedEventArgs e = new UploadedEventArgs();
123
124      // Populate all members of "e" (UploadedEventArgs) with real data
125      e.Image = Image.GetImageFromPtr(data);
126
127      if (_imageUploadedEventHandler != null)
128      {
129         //here we send all data to user event handlers
130         _imageUploadedEventHandler(this, e);
131      }
132   }
133
134
135 public static Image GetImageFromPtr(global::System.IntPtr cPtr) {
136     Image ret = new Image(cPtr, false);
137    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138     return ret;
139   }
140
141
142   public Image() : this(NDalicPINVOKE.new_Image__SWIG_0(), true) {
143     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144   }
145
146   public Image(Image handle) : this(NDalicPINVOKE.new_Image__SWIG_1(Image.getCPtr(handle)), true) {
147     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148   }
149
150   public Image Assign(Image rhs) {
151     Image ret = new Image(NDalicPINVOKE.Image_Assign(swigCPtr, Image.getCPtr(rhs)), false);
152     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153     return ret;
154   }
155
156   public static Image DownCast(BaseHandle handle) {
157     Image ret = new Image(NDalicPINVOKE.Image_DownCast(BaseHandle.getCPtr(handle)), true);
158     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159     return ret;
160   }
161
162   public uint GetWidth() {
163     uint ret = NDalicPINVOKE.Image_GetWidth(swigCPtr);
164     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165     return ret;
166   }
167
168   public uint GetHeight() {
169     uint ret = NDalicPINVOKE.Image_GetHeight(swigCPtr);
170     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171     return ret;
172   }
173
174   internal ImageSignal UploadedSignal() {
175     ImageSignal ret = new ImageSignal(NDalicPINVOKE.Image_UploadedSignal(swigCPtr), false);
176     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177     return ret;
178   }
179
180 }
181
182 }