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