[EflSharp] Update Circle and efl cs files (#916)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_container.eo.cs
1 #pragma warning disable CS1591
2 using System;
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Threading;
7 using System.ComponentModel;
8 namespace Efl {
9
10 /// <summary>Common interface for objects (containers) that can have multiple contents (sub-objects).
11 /// APIs in this interface deal with containers of multiple sub-objects, not with individual parts.
12 /// (Since EFL 1.22)</summary>
13 [Efl.IContainerConcrete.NativeMethods]
14 public interface IContainer : 
15     Efl.Eo.IWrapper, IDisposable
16 {
17     /// <summary>Begin iterating over this object&apos;s contents.
18 /// (Since EFL 1.22)</summary>
19 /// <returns>Iterator on object&apos;s content.</returns>
20 Eina.Iterator<Efl.Gfx.IEntity> ContentIterate();
21     /// <summary>Returns the number of contained sub-objects.
22 /// (Since EFL 1.22)</summary>
23 /// <returns>Number of sub-objects.</returns>
24 int ContentCount();
25             /// <summary>Sent after a new sub-object was added.
26     /// (Since EFL 1.22)</summary>
27     event EventHandler<Efl.IContainerContentAddedEvt_Args> ContentAddedEvt;
28     /// <summary>Sent after a sub-object was removed, before unref.
29     /// (Since EFL 1.22)</summary>
30     event EventHandler<Efl.IContainerContentRemovedEvt_Args> ContentRemovedEvt;
31 }
32 ///<summary>Event argument wrapper for event <see cref="Efl.IContainer.ContentAddedEvt"/>.</summary>
33 public class IContainerContentAddedEvt_Args : EventArgs {
34     ///<summary>Actual event payload.</summary>
35     public Efl.Gfx.IEntity arg { get; set; }
36 }
37 ///<summary>Event argument wrapper for event <see cref="Efl.IContainer.ContentRemovedEvt"/>.</summary>
38 public class IContainerContentRemovedEvt_Args : EventArgs {
39     ///<summary>Actual event payload.</summary>
40     public Efl.Gfx.IEntity arg { get; set; }
41 }
42 /// <summary>Common interface for objects (containers) that can have multiple contents (sub-objects).
43 /// APIs in this interface deal with containers of multiple sub-objects, not with individual parts.
44 /// (Since EFL 1.22)</summary>
45 sealed public class IContainerConcrete :
46     Efl.Eo.EoWrapper
47     , IContainer
48     
49 {
50     ///<summary>Pointer to the native class description.</summary>
51     public override System.IntPtr NativeClass
52     {
53         get
54         {
55             if (((object)this).GetType() == typeof(IContainerConcrete))
56             {
57                 return GetEflClassStatic();
58             }
59             else
60             {
61                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
62             }
63         }
64     }
65
66     [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
67         efl_container_interface_get();
68     /// <summary>Initializes a new instance of the <see cref="IContainer"/> class.
69     /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
70     private IContainerConcrete(System.IntPtr raw) : base(raw)
71     {
72     }
73
74     /// <summary>Sent after a new sub-object was added.
75     /// (Since EFL 1.22)</summary>
76     public event EventHandler<Efl.IContainerContentAddedEvt_Args> ContentAddedEvt
77     {
78         add
79         {
80             lock (eventLock)
81             {
82                 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
83                 {
84                     var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
85                     if (obj != null)
86                     {
87                         Efl.IContainerContentAddedEvt_Args args = new Efl.IContainerContentAddedEvt_Args();
88                         args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
89                         try
90                         {
91                             value?.Invoke(obj, args);
92                         }
93                         catch (Exception e)
94                         {
95                             Eina.Log.Error(e.ToString());
96                             Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
97                         }
98                     }
99                 };
100
101                 string key = "_EFL_CONTAINER_EVENT_CONTENT_ADDED";
102                 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
103             }
104         }
105
106         remove
107         {
108             lock (eventLock)
109             {
110                 string key = "_EFL_CONTAINER_EVENT_CONTENT_ADDED";
111                 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
112             }
113         }
114     }
115     ///<summary>Method to raise event ContentAddedEvt.</summary>
116     public void OnContentAddedEvt(Efl.IContainerContentAddedEvt_Args e)
117     {
118         var key = "_EFL_CONTAINER_EVENT_CONTENT_ADDED";
119         IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
120         if (desc == IntPtr.Zero)
121         {
122             Eina.Log.Error($"Failed to get native event {key}");
123             return;
124         }
125
126         IntPtr info = e.arg.NativeHandle;
127         Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
128     }
129     /// <summary>Sent after a sub-object was removed, before unref.
130     /// (Since EFL 1.22)</summary>
131     public event EventHandler<Efl.IContainerContentRemovedEvt_Args> ContentRemovedEvt
132     {
133         add
134         {
135             lock (eventLock)
136             {
137                 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
138                 {
139                     var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
140                     if (obj != null)
141                     {
142                         Efl.IContainerContentRemovedEvt_Args args = new Efl.IContainerContentRemovedEvt_Args();
143                         args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
144                         try
145                         {
146                             value?.Invoke(obj, args);
147                         }
148                         catch (Exception e)
149                         {
150                             Eina.Log.Error(e.ToString());
151                             Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
152                         }
153                     }
154                 };
155
156                 string key = "_EFL_CONTAINER_EVENT_CONTENT_REMOVED";
157                 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
158             }
159         }
160
161         remove
162         {
163             lock (eventLock)
164             {
165                 string key = "_EFL_CONTAINER_EVENT_CONTENT_REMOVED";
166                 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
167             }
168         }
169     }
170     ///<summary>Method to raise event ContentRemovedEvt.</summary>
171     public void OnContentRemovedEvt(Efl.IContainerContentRemovedEvt_Args e)
172     {
173         var key = "_EFL_CONTAINER_EVENT_CONTENT_REMOVED";
174         IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
175         if (desc == IntPtr.Zero)
176         {
177             Eina.Log.Error($"Failed to get native event {key}");
178             return;
179         }
180
181         IntPtr info = e.arg.NativeHandle;
182         Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
183     }
184     /// <summary>Begin iterating over this object&apos;s contents.
185     /// (Since EFL 1.22)</summary>
186     /// <returns>Iterator on object&apos;s content.</returns>
187     public Eina.Iterator<Efl.Gfx.IEntity> ContentIterate() {
188          var _ret_var = Efl.IContainerConcrete.NativeMethods.efl_content_iterate_ptr.Value.Delegate(this.NativeHandle);
189         Eina.Error.RaiseIfUnhandledException();
190         return new Eina.Iterator<Efl.Gfx.IEntity>(_ret_var, true, false);
191  }
192     /// <summary>Returns the number of contained sub-objects.
193     /// (Since EFL 1.22)</summary>
194     /// <returns>Number of sub-objects.</returns>
195     public int ContentCount() {
196          var _ret_var = Efl.IContainerConcrete.NativeMethods.efl_content_count_ptr.Value.Delegate(this.NativeHandle);
197         Eina.Error.RaiseIfUnhandledException();
198         return _ret_var;
199  }
200     private static IntPtr GetEflClassStatic()
201     {
202         return Efl.IContainerConcrete.efl_container_interface_get();
203     }
204     /// <summary>Wrapper for native methods and virtual method delegates.
205     /// For internal use by generated code only.</summary>
206     public class NativeMethods  : Efl.Eo.NativeClass
207     {
208         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Efl);
209         /// <summary>Gets the list of Eo operations to override.</summary>
210         /// <returns>The list of Eo operations to be overload.</returns>
211         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
212         {
213             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
214             var methods = Efl.Eo.Globals.GetUserMethods(type);
215
216             if (efl_content_iterate_static_delegate == null)
217             {
218                 efl_content_iterate_static_delegate = new efl_content_iterate_delegate(content_iterate);
219             }
220
221             if (methods.FirstOrDefault(m => m.Name == "ContentIterate") != null)
222             {
223                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_content_iterate"), func = Marshal.GetFunctionPointerForDelegate(efl_content_iterate_static_delegate) });
224             }
225
226             if (efl_content_count_static_delegate == null)
227             {
228                 efl_content_count_static_delegate = new efl_content_count_delegate(content_count);
229             }
230
231             if (methods.FirstOrDefault(m => m.Name == "ContentCount") != null)
232             {
233                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_content_count"), func = Marshal.GetFunctionPointerForDelegate(efl_content_count_static_delegate) });
234             }
235
236             return descs;
237         }
238         /// <summary>Returns the Eo class for the native methods of this class.</summary>
239         /// <returns>The native class pointer.</returns>
240         public override IntPtr GetEflClass()
241         {
242             return Efl.IContainerConcrete.efl_container_interface_get();
243         }
244
245         #pragma warning disable CA1707, CS1591, SA1300, SA1600
246
247         
248         private delegate System.IntPtr efl_content_iterate_delegate(System.IntPtr obj, System.IntPtr pd);
249
250         
251         public delegate System.IntPtr efl_content_iterate_api_delegate(System.IntPtr obj);
252
253         public static Efl.Eo.FunctionWrapper<efl_content_iterate_api_delegate> efl_content_iterate_ptr = new Efl.Eo.FunctionWrapper<efl_content_iterate_api_delegate>(Module, "efl_content_iterate");
254
255         private static System.IntPtr content_iterate(System.IntPtr obj, System.IntPtr pd)
256         {
257             Eina.Log.Debug("function efl_content_iterate was called");
258             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
259             if (ws != null)
260             {
261             Eina.Iterator<Efl.Gfx.IEntity> _ret_var = default(Eina.Iterator<Efl.Gfx.IEntity>);
262                 try
263                 {
264                     _ret_var = ((IContainer)ws.Target).ContentIterate();
265                 }
266                 catch (Exception e)
267                 {
268                     Eina.Log.Warning($"Callback error: {e.ToString()}");
269                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
270                 }
271
272         _ret_var.Own = false; return _ret_var.Handle;
273
274             }
275             else
276             {
277                 return efl_content_iterate_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
278             }
279         }
280
281         private static efl_content_iterate_delegate efl_content_iterate_static_delegate;
282
283         
284         private delegate int efl_content_count_delegate(System.IntPtr obj, System.IntPtr pd);
285
286         
287         public delegate int efl_content_count_api_delegate(System.IntPtr obj);
288
289         public static Efl.Eo.FunctionWrapper<efl_content_count_api_delegate> efl_content_count_ptr = new Efl.Eo.FunctionWrapper<efl_content_count_api_delegate>(Module, "efl_content_count");
290
291         private static int content_count(System.IntPtr obj, System.IntPtr pd)
292         {
293             Eina.Log.Debug("function efl_content_count was called");
294             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
295             if (ws != null)
296             {
297             int _ret_var = default(int);
298                 try
299                 {
300                     _ret_var = ((IContainer)ws.Target).ContentCount();
301                 }
302                 catch (Exception e)
303                 {
304                     Eina.Log.Warning($"Callback error: {e.ToString()}");
305                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
306                 }
307
308         return _ret_var;
309
310             }
311             else
312             {
313                 return efl_content_count_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
314             }
315         }
316
317         private static efl_content_count_delegate efl_content_count_static_delegate;
318
319         #pragma warning restore CA1707, CS1591, SA1300, SA1600
320
321 }
322 }
323 }
324