[EflSharp] Update Circle and efl cs files (#995)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_filter_model.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 /// <param name="parent">This object can be used to know when to cancel the future.</param>
10 /// <param name="child">You must reference this object for the duration of your use of it as the caller will not do that for you.</param>
11 [Efl.Eo.BindingEntity]
12 public delegate  Eina.Future EflFilterModel(Efl.FilterModel parent, Efl.IModel child);
13 [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]public delegate  Eina.Future EflFilterModelInternal(IntPtr data, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.FilterModel parent, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.IModel child);
14 internal class EflFilterModelWrapper : IDisposable
15 {
16
17     private EflFilterModelInternal _cb;
18     private IntPtr _cb_data;
19     private EinaFreeCb _cb_free_cb;
20
21     internal EflFilterModelWrapper (EflFilterModelInternal _cb, IntPtr _cb_data, EinaFreeCb _cb_free_cb)
22     {
23         this._cb = _cb;
24         this._cb_data = _cb_data;
25         this._cb_free_cb = _cb_free_cb;
26     }
27
28     ~EflFilterModelWrapper()
29     {
30         Dispose(false);
31     }
32
33     protected virtual void Dispose(bool disposing)
34     {
35         if (this._cb_free_cb != null)
36         {
37             if (disposing)
38             {
39                 this._cb_free_cb(this._cb_data);
40             }
41             else
42             {
43                 Efl.Eo.Globals.ThreadSafeFreeCbExec(this._cb_free_cb, this._cb_data);
44             }
45             this._cb_free_cb = null;
46             this._cb_data = IntPtr.Zero;
47             this._cb = null;
48         }
49     }
50
51     public void Dispose()
52     {
53         Dispose(true);
54         GC.SuppressFinalize(this);
55     }
56
57     internal  Eina.Future ManagedCb(Efl.FilterModel parent,Efl.IModel child)
58     {
59                                                         var _ret_var = _cb(_cb_data, parent, child);
60         Eina.Error.RaiseIfUnhandledException();
61                                         return _ret_var;
62     }
63
64     [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.FutureMarshaler))]    internal static  Eina.Future Cb(IntPtr cb_data, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.FilterModel parent, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.IModel child)
65     {
66         GCHandle handle = GCHandle.FromIntPtr(cb_data);
67         EflFilterModel cb = (EflFilterModel)handle.Target;
68                                                              Eina.Future _ret_var = default( Eina.Future);
69         try {
70             _ret_var = cb(parent, child);
71         } catch (Exception e) {
72             Eina.Log.Warning($"Callback error: {e.ToString()}");
73             Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
74         }
75                                         return _ret_var;
76     }
77 }
78
79
80 namespace Efl {
81
82 /// <summary>Efl model designed to filter its children.</summary>
83 /// <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>
84 [Efl.FilterModel.NativeMethods]
85 [Efl.Eo.BindingEntity]
86 public class FilterModel : Efl.CompositeModel
87 {
88     /// <summary>Pointer to the native class description.</summary>
89     public override System.IntPtr NativeClass
90     {
91         get
92         {
93             if (((object)this).GetType() == typeof(FilterModel))
94             {
95                 return GetEflClassStatic();
96             }
97             else
98             {
99                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
100             }
101         }
102     }
103
104     [System.Runtime.InteropServices.DllImport(efl.Libs.Ecore)] internal static extern System.IntPtr
105         efl_filter_model_class_get();
106     /// <summary>Initializes a new instance of the <see cref="FilterModel"/> class.</summary>
107     /// <param name="parent">Parent instance.</param>
108     /// <param name="filterSet">Set a filter function that will catch children from the composited model. See <see cref="Efl.FilterModel.SetFilter" /></param>
109     /// <param name="model">Model that is/will be See <see cref="Efl.Ui.IView.SetModel" /></param>
110     /// <param name="index">Position of this object in the parent model. See <see cref="Efl.CompositeModel.SetIndex" /></param>
111     public FilterModel(Efl.Object parent
112             , EflFilterModel filterSet, Efl.IModel model, uint? index = null) : base(efl_filter_model_class_get(), parent)
113     {
114         if (Efl.Eo.Globals.ParamHelperCheck(filterSet))
115         {
116             SetFilter(Efl.Eo.Globals.GetParamHelper(filterSet));
117         }
118
119         if (Efl.Eo.Globals.ParamHelperCheck(model))
120         {
121             SetModel(Efl.Eo.Globals.GetParamHelper(model));
122         }
123
124         if (Efl.Eo.Globals.ParamHelperCheck(index))
125         {
126             SetIndex(Efl.Eo.Globals.GetParamHelper(index));
127         }
128
129         FinishInstantiation();
130     }
131
132     /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
133     /// Do not call this constructor directly.</summary>
134     /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
135     protected FilterModel(ConstructingHandle ch) : base(ch)
136     {
137     }
138
139     /// <summary>Initializes a new instance of the <see cref="FilterModel"/> class.
140     /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
141     /// <param name="wh">The native pointer to be wrapped.</param>
142     protected FilterModel(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
143     {
144     }
145
146     /// <summary>Initializes a new instance of the <see cref="FilterModel"/> class.
147     /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
148     /// <param name="baseKlass">The pointer to the base native Eo class.</param>
149     /// <param name="parent">The Efl.Object parent of this instance.</param>
150     protected FilterModel(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
151     {
152     }
153
154     /// <summary>Set a filter function that will catch children from the composited model.</summary>
155     /// <param name="filter">Filter callback</param>
156     virtual public void SetFilter(EflFilterModel filter) {
157                          GCHandle filter_handle = GCHandle.Alloc(filter);
158         Efl.FilterModel.NativeMethods.efl_filter_model_filter_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),GCHandle.ToIntPtr(filter_handle), EflFilterModelWrapper.Cb, Efl.Eo.Globals.free_gchandle);
159         Eina.Error.RaiseIfUnhandledException();
160                          }
161     private static IntPtr GetEflClassStatic()
162     {
163         return Efl.FilterModel.efl_filter_model_class_get();
164     }
165     /// <summary>Wrapper for native methods and virtual method delegates.
166     /// For internal use by generated code only.</summary>
167     public new class NativeMethods : Efl.CompositeModel.NativeMethods
168     {
169         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Ecore);
170         /// <summary>Gets the list of Eo operations to override.</summary>
171         /// <returns>The list of Eo operations to be overload.</returns>
172         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
173         {
174             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
175             var methods = Efl.Eo.Globals.GetUserMethods(type);
176
177             if (efl_filter_model_filter_set_static_delegate == null)
178             {
179                 efl_filter_model_filter_set_static_delegate = new efl_filter_model_filter_set_delegate(filter_set);
180             }
181
182             if (methods.FirstOrDefault(m => m.Name == "SetFilter") != null)
183             {
184                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_filter_model_filter_set"), func = Marshal.GetFunctionPointerForDelegate(efl_filter_model_filter_set_static_delegate) });
185             }
186
187             descs.AddRange(base.GetEoOps(type));
188             return descs;
189         }
190         /// <summary>Returns the Eo class for the native methods of this class.</summary>
191         /// <returns>The native class pointer.</returns>
192         public override IntPtr GetEflClass()
193         {
194             return Efl.FilterModel.efl_filter_model_class_get();
195         }
196
197         #pragma warning disable CA1707, CS1591, SA1300, SA1600
198
199         
200         private delegate void efl_filter_model_filter_set_delegate(System.IntPtr obj, System.IntPtr pd,  IntPtr filter_data, EflFilterModelInternal filter, EinaFreeCb filter_free_cb);
201
202         
203         public delegate void efl_filter_model_filter_set_api_delegate(System.IntPtr obj,  IntPtr filter_data, EflFilterModelInternal filter, EinaFreeCb filter_free_cb);
204
205         public static Efl.Eo.FunctionWrapper<efl_filter_model_filter_set_api_delegate> efl_filter_model_filter_set_ptr = new Efl.Eo.FunctionWrapper<efl_filter_model_filter_set_api_delegate>(Module, "efl_filter_model_filter_set");
206
207         private static void filter_set(System.IntPtr obj, System.IntPtr pd, IntPtr filter_data, EflFilterModelInternal filter, EinaFreeCb filter_free_cb)
208         {
209             Eina.Log.Debug("function efl_filter_model_filter_set was called");
210             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
211             if (ws != null)
212             {
213                             EflFilterModelWrapper filter_wrapper = new EflFilterModelWrapper(filter, filter_data, filter_free_cb);
214             
215                 try
216                 {
217                     ((FilterModel)ws.Target).SetFilter(filter_wrapper.ManagedCb);
218                 }
219                 catch (Exception e)
220                 {
221                     Eina.Log.Warning($"Callback error: {e.ToString()}");
222                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
223                 }
224
225                         
226             }
227             else
228             {
229                 efl_filter_model_filter_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), filter_data, filter, filter_free_cb);
230             }
231         }
232
233         private static efl_filter_model_filter_set_delegate efl_filter_model_filter_set_static_delegate;
234
235         #pragma warning restore CA1707, CS1591, SA1300, SA1600
236
237 }
238 }
239 }
240
241 #if EFL_BETA
242 #pragma warning disable CS1591
243 public static class EflFilterModel_ExtensionMethods {
244 }
245 #pragma warning restore CS1591
246 #endif