[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_canvas_surface.eo.cs
1 #define EFL_BETA
2 #pragma warning disable CS1591
3 using System;
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
6 using System.Linq;
7 using System.Threading;
8 using System.ComponentModel;
9 namespace Efl {
10
11 namespace Canvas {
12
13 /// <summary>Native surfaces usually bound to an externally-managed buffer.
14 /// The attached <see cref="Efl.Canvas.Surface.NativeBuffer"/> is entirely platform-dependent, which means some of this mixin&apos;s subclasses will not work (constructor returns <c>null</c>) on some platforms. This class is meant to be used from native code only (C or C++), with direct access to the display system or a buffer allocation system.</summary>
15 /// <remarks>This is a <b>BETA</b> class. It can be modified or removed in the future. Do not use it for product development.</remarks>
16 [Efl.Canvas.Surface.NativeMethods]
17 [Efl.Eo.BindingEntity]
18 public abstract class Surface : Efl.Canvas.ImageInternal
19 {
20     /// <summary>Pointer to the native class description.</summary>
21     public override System.IntPtr NativeClass
22     {
23         get
24         {
25             if (((object)this).GetType() == typeof(Surface))
26             {
27                 return GetEflClassStatic();
28             }
29             else
30             {
31                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
32             }
33         }
34     }
35
36     [System.Runtime.InteropServices.DllImport(efl.Libs.Evas)] internal static extern System.IntPtr
37         efl_canvas_surface_class_get();
38     /// <summary>Initializes a new instance of the <see cref="Surface"/> class.</summary>
39     /// <param name="parent">Parent instance.</param>
40     public Surface(Efl.Object parent= null
41             ) : base(efl_canvas_surface_class_get(), parent)
42     {
43         FinishInstantiation();
44     }
45
46     /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
47     /// Do not call this constructor directly.</summary>
48     /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
49     protected Surface(ConstructingHandle ch) : base(ch)
50     {
51     }
52
53     /// <summary>Initializes a new instance of the <see cref="Surface"/> class.
54     /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
55     /// <param name="wh">The native pointer to be wrapped.</param>
56     protected Surface(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
57     {
58     }
59
60     [Efl.Eo.PrivateNativeClass]
61     private class SurfaceRealized : Surface
62     {
63         private SurfaceRealized(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
64         {
65         }
66     }
67     /// <summary>Initializes a new instance of the <see cref="Surface"/> class.
68     /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
69     /// <param name="baseKlass">The pointer to the base native Eo class.</param>
70     /// <param name="parent">The Efl.Object parent of this instance.</param>
71     protected Surface(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
72     {
73     }
74
75     /// <summary>External buffer attached to this native surface.
76     /// Set to <c>null</c> to detach this surface from the external buffer.</summary>
77     /// <returns>The external buffer, depends on its type.</returns>
78     virtual public System.IntPtr GetNativeBuffer() {
79          var _ret_var = Efl.Canvas.Surface.NativeMethods.efl_canvas_surface_native_buffer_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
80         Eina.Error.RaiseIfUnhandledException();
81         return _ret_var;
82  }
83     /// <summary>Set the buffer. If this fails, this function returns <c>false</c>, and the surface is left without any attached buffer.</summary>
84     /// <param name="buffer">The external buffer, depends on its type.</param>
85     /// <returns><c>true</c> on success, <c>false</c> otherwise</returns>
86     virtual public bool SetNativeBuffer(System.IntPtr buffer) {
87                                  var _ret_var = Efl.Canvas.Surface.NativeMethods.efl_canvas_surface_native_buffer_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),buffer);
88         Eina.Error.RaiseIfUnhandledException();
89                         return _ret_var;
90  }
91     /// <summary>External buffer attached to this native surface.
92     /// Set to <c>null</c> to detach this surface from the external buffer.</summary>
93     /// <value>The external buffer, depends on its type.</value>
94     public System.IntPtr NativeBuffer {
95         get { return GetNativeBuffer(); }
96         set { SetNativeBuffer(value); }
97     }
98     private static IntPtr GetEflClassStatic()
99     {
100         return Efl.Canvas.Surface.efl_canvas_surface_class_get();
101     }
102     /// <summary>Wrapper for native methods and virtual method delegates.
103     /// For internal use by generated code only.</summary>
104     public new class NativeMethods : Efl.Canvas.ImageInternal.NativeMethods
105     {
106         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Evas);
107         /// <summary>Gets the list of Eo operations to override.</summary>
108         /// <returns>The list of Eo operations to be overload.</returns>
109         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
110         {
111             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
112             var methods = Efl.Eo.Globals.GetUserMethods(type);
113
114             if (efl_canvas_surface_native_buffer_get_static_delegate == null)
115             {
116                 efl_canvas_surface_native_buffer_get_static_delegate = new efl_canvas_surface_native_buffer_get_delegate(native_buffer_get);
117             }
118
119             if (methods.FirstOrDefault(m => m.Name == "GetNativeBuffer") != null)
120             {
121                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_canvas_surface_native_buffer_get"), func = Marshal.GetFunctionPointerForDelegate(efl_canvas_surface_native_buffer_get_static_delegate) });
122             }
123
124             if (efl_canvas_surface_native_buffer_set_static_delegate == null)
125             {
126                 efl_canvas_surface_native_buffer_set_static_delegate = new efl_canvas_surface_native_buffer_set_delegate(native_buffer_set);
127             }
128
129             if (methods.FirstOrDefault(m => m.Name == "SetNativeBuffer") != null)
130             {
131                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_canvas_surface_native_buffer_set"), func = Marshal.GetFunctionPointerForDelegate(efl_canvas_surface_native_buffer_set_static_delegate) });
132             }
133
134             descs.AddRange(base.GetEoOps(type));
135             return descs;
136         }
137         /// <summary>Returns the Eo class for the native methods of this class.</summary>
138         /// <returns>The native class pointer.</returns>
139         public override IntPtr GetEflClass()
140         {
141             return Efl.Canvas.Surface.efl_canvas_surface_class_get();
142         }
143
144         #pragma warning disable CA1707, CS1591, SA1300, SA1600
145
146         
147         private delegate System.IntPtr efl_canvas_surface_native_buffer_get_delegate(System.IntPtr obj, System.IntPtr pd);
148
149         
150         public delegate System.IntPtr efl_canvas_surface_native_buffer_get_api_delegate(System.IntPtr obj);
151
152         public static Efl.Eo.FunctionWrapper<efl_canvas_surface_native_buffer_get_api_delegate> efl_canvas_surface_native_buffer_get_ptr = new Efl.Eo.FunctionWrapper<efl_canvas_surface_native_buffer_get_api_delegate>(Module, "efl_canvas_surface_native_buffer_get");
153
154         private static System.IntPtr native_buffer_get(System.IntPtr obj, System.IntPtr pd)
155         {
156             Eina.Log.Debug("function efl_canvas_surface_native_buffer_get was called");
157             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
158             if (ws != null)
159             {
160             System.IntPtr _ret_var = default(System.IntPtr);
161                 try
162                 {
163                     _ret_var = ((Surface)ws.Target).GetNativeBuffer();
164                 }
165                 catch (Exception e)
166                 {
167                     Eina.Log.Warning($"Callback error: {e.ToString()}");
168                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
169                 }
170
171         return _ret_var;
172
173             }
174             else
175             {
176                 return efl_canvas_surface_native_buffer_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
177             }
178         }
179
180         private static efl_canvas_surface_native_buffer_get_delegate efl_canvas_surface_native_buffer_get_static_delegate;
181
182         [return: MarshalAs(UnmanagedType.U1)]
183         private delegate bool efl_canvas_surface_native_buffer_set_delegate(System.IntPtr obj, System.IntPtr pd,  System.IntPtr buffer);
184
185         [return: MarshalAs(UnmanagedType.U1)]
186         public delegate bool efl_canvas_surface_native_buffer_set_api_delegate(System.IntPtr obj,  System.IntPtr buffer);
187
188         public static Efl.Eo.FunctionWrapper<efl_canvas_surface_native_buffer_set_api_delegate> efl_canvas_surface_native_buffer_set_ptr = new Efl.Eo.FunctionWrapper<efl_canvas_surface_native_buffer_set_api_delegate>(Module, "efl_canvas_surface_native_buffer_set");
189
190         private static bool native_buffer_set(System.IntPtr obj, System.IntPtr pd, System.IntPtr buffer)
191         {
192             Eina.Log.Debug("function efl_canvas_surface_native_buffer_set was called");
193             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
194             if (ws != null)
195             {
196                                     bool _ret_var = default(bool);
197                 try
198                 {
199                     _ret_var = ((Surface)ws.Target).SetNativeBuffer(buffer);
200                 }
201                 catch (Exception e)
202                 {
203                     Eina.Log.Warning($"Callback error: {e.ToString()}");
204                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
205                 }
206
207                         return _ret_var;
208
209             }
210             else
211             {
212                 return efl_canvas_surface_native_buffer_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), buffer);
213             }
214         }
215
216         private static efl_canvas_surface_native_buffer_set_delegate efl_canvas_surface_native_buffer_set_static_delegate;
217
218         #pragma warning restore CA1707, CS1591, SA1300, SA1600
219
220 }
221 }
222 }
223
224 }
225
226 #if EFL_BETA
227 #pragma warning disable CS1591
228 public static class Efl_CanvasSurface_ExtensionMethods {
229     public static Efl.BindableProperty<System.IntPtr> NativeBuffer<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<Efl.Canvas.Surface, T>magic = null) where T : Efl.Canvas.Surface {
230         return new Efl.BindableProperty<System.IntPtr>("native_buffer", fac);
231     }
232
233 }
234 #pragma warning restore CS1591
235 #endif