2 #pragma warning disable CS1591
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
7 using System.Threading;
8 using System.ComponentModel;
11 /// <summary>Common interface for objects (containers) with multiple contents (sub-objects) which can be added and removed at runtime.</summary>
12 [Efl.IPackConcrete.NativeMethods]
13 [Efl.Eo.BindingEntity]
14 public interface IPack :
16 Efl.Eo.IWrapper, IDisposable
18 /// <summary>Removes all packed sub-objects and unreferences them.</summary>
19 /// <returns><c>true</c> on success, <c>false</c> otherwise.</returns>
21 /// <summary>Removes all packed sub-objects without unreferencing them.
22 /// Use with caution.</summary>
23 /// <returns><c>true</c> on success, <c>false</c> otherwise.</returns>
25 /// <summary>Removes an existing sub-object from the container without deleting it.</summary>
26 /// <param name="subobj">The sub-object to unpack.</param>
27 /// <returns><c>false</c> if <c>subobj</c> wasn't in the container or couldn't be removed.</returns>
28 bool Unpack(Efl.Gfx.IEntity subobj);
29 /// <summary>Adds a sub-object to this container.
30 /// Depending on the container this will either fill in the default spot, replacing any already existing element or append to the end of the container if there is no default part.
32 /// When this container is deleted, it will request deletion of the given <c>subobj</c>. Use <see cref="Efl.IPack.Unpack"/> to remove <c>subobj</c> from this container without deleting it.</summary>
33 /// <param name="subobj">The object to pack.</param>
34 /// <returns><c>false</c> if <c>subobj</c> could not be packed.</returns>
35 bool Pack(Efl.Gfx.IEntity subobj);
37 /// <summary>Common interface for objects (containers) with multiple contents (sub-objects) which can be added and removed at runtime.</summary>
38 sealed public class IPackConcrete :
43 /// <summary>Pointer to the native class description.</summary>
44 public override System.IntPtr NativeClass
48 if (((object)this).GetType() == typeof(IPackConcrete))
50 return GetEflClassStatic();
54 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
59 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
60 /// Do not call this constructor directly.</summary>
61 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
62 private IPackConcrete(ConstructingHandle ch) : base(ch)
66 [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
67 efl_pack_interface_get();
68 /// <summary>Initializes a new instance of the <see cref="IPack"/> class.
69 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
70 /// <param name="wh">The native pointer to be wrapped.</param>
71 private IPackConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
75 /// <summary>Sent after a new sub-object was added.
76 /// (Since EFL 1.22)</summary>
77 /// <value><see cref="Efl.IContainerContentAddedEvt_Args"/></value>
78 public event EventHandler<Efl.IContainerContentAddedEvt_Args> ContentAddedEvt
82 lock (eflBindingEventLock)
84 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
86 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
89 Efl.IContainerContentAddedEvt_Args args = new Efl.IContainerContentAddedEvt_Args();
90 args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
93 value?.Invoke(obj, args);
97 Eina.Log.Error(e.ToString());
98 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
103 string key = "_EFL_CONTAINER_EVENT_CONTENT_ADDED";
104 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
110 lock (eflBindingEventLock)
112 string key = "_EFL_CONTAINER_EVENT_CONTENT_ADDED";
113 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
117 /// <summary>Method to raise event ContentAddedEvt.</summary>
118 public void OnContentAddedEvt(Efl.IContainerContentAddedEvt_Args e)
120 var key = "_EFL_CONTAINER_EVENT_CONTENT_ADDED";
121 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
122 if (desc == IntPtr.Zero)
124 Eina.Log.Error($"Failed to get native event {key}");
128 IntPtr info = e.arg.NativeHandle;
129 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
131 /// <summary>Sent after a sub-object was removed, before unref.
132 /// (Since EFL 1.22)</summary>
133 /// <value><see cref="Efl.IContainerContentRemovedEvt_Args"/></value>
134 public event EventHandler<Efl.IContainerContentRemovedEvt_Args> ContentRemovedEvt
138 lock (eflBindingEventLock)
140 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
142 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
145 Efl.IContainerContentRemovedEvt_Args args = new Efl.IContainerContentRemovedEvt_Args();
146 args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
149 value?.Invoke(obj, args);
153 Eina.Log.Error(e.ToString());
154 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
159 string key = "_EFL_CONTAINER_EVENT_CONTENT_REMOVED";
160 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
166 lock (eflBindingEventLock)
168 string key = "_EFL_CONTAINER_EVENT_CONTENT_REMOVED";
169 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
173 /// <summary>Method to raise event ContentRemovedEvt.</summary>
174 public void OnContentRemovedEvt(Efl.IContainerContentRemovedEvt_Args e)
176 var key = "_EFL_CONTAINER_EVENT_CONTENT_REMOVED";
177 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
178 if (desc == IntPtr.Zero)
180 Eina.Log.Error($"Failed to get native event {key}");
184 IntPtr info = e.arg.NativeHandle;
185 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
187 /// <summary>Removes all packed sub-objects and unreferences them.</summary>
188 /// <returns><c>true</c> on success, <c>false</c> otherwise.</returns>
189 public bool ClearPack() {
190 var _ret_var = Efl.IPackConcrete.NativeMethods.efl_pack_clear_ptr.Value.Delegate(this.NativeHandle);
191 Eina.Error.RaiseIfUnhandledException();
194 /// <summary>Removes all packed sub-objects without unreferencing them.
195 /// Use with caution.</summary>
196 /// <returns><c>true</c> on success, <c>false</c> otherwise.</returns>
197 public bool UnpackAll() {
198 var _ret_var = Efl.IPackConcrete.NativeMethods.efl_pack_unpack_all_ptr.Value.Delegate(this.NativeHandle);
199 Eina.Error.RaiseIfUnhandledException();
202 /// <summary>Removes an existing sub-object from the container without deleting it.</summary>
203 /// <param name="subobj">The sub-object to unpack.</param>
204 /// <returns><c>false</c> if <c>subobj</c> wasn't in the container or couldn't be removed.</returns>
205 public bool Unpack(Efl.Gfx.IEntity subobj) {
206 var _ret_var = Efl.IPackConcrete.NativeMethods.efl_pack_unpack_ptr.Value.Delegate(this.NativeHandle,subobj);
207 Eina.Error.RaiseIfUnhandledException();
210 /// <summary>Adds a sub-object to this container.
211 /// Depending on the container this will either fill in the default spot, replacing any already existing element or append to the end of the container if there is no default part.
213 /// When this container is deleted, it will request deletion of the given <c>subobj</c>. Use <see cref="Efl.IPack.Unpack"/> to remove <c>subobj</c> from this container without deleting it.</summary>
214 /// <param name="subobj">The object to pack.</param>
215 /// <returns><c>false</c> if <c>subobj</c> could not be packed.</returns>
216 public bool Pack(Efl.Gfx.IEntity subobj) {
217 var _ret_var = Efl.IPackConcrete.NativeMethods.efl_pack_ptr.Value.Delegate(this.NativeHandle,subobj);
218 Eina.Error.RaiseIfUnhandledException();
221 /// <summary>Begin iterating over this object's contents.
222 /// (Since EFL 1.22)</summary>
223 /// <returns>Iterator on object's content.</returns>
224 public Eina.Iterator<Efl.Gfx.IEntity> ContentIterate() {
225 var _ret_var = Efl.IContainerConcrete.NativeMethods.efl_content_iterate_ptr.Value.Delegate(this.NativeHandle);
226 Eina.Error.RaiseIfUnhandledException();
227 return new Eina.Iterator<Efl.Gfx.IEntity>(_ret_var, true);
229 /// <summary>Returns the number of contained sub-objects.
230 /// (Since EFL 1.22)</summary>
231 /// <returns>Number of sub-objects.</returns>
232 public int ContentCount() {
233 var _ret_var = Efl.IContainerConcrete.NativeMethods.efl_content_count_ptr.Value.Delegate(this.NativeHandle);
234 Eina.Error.RaiseIfUnhandledException();
237 private static IntPtr GetEflClassStatic()
239 return Efl.IPackConcrete.efl_pack_interface_get();
241 /// <summary>Wrapper for native methods and virtual method delegates.
242 /// For internal use by generated code only.</summary>
243 public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods
245 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
246 /// <summary>Gets the list of Eo operations to override.</summary>
247 /// <returns>The list of Eo operations to be overload.</returns>
248 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
250 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
251 var methods = Efl.Eo.Globals.GetUserMethods(type);
253 if (efl_pack_clear_static_delegate == null)
255 efl_pack_clear_static_delegate = new efl_pack_clear_delegate(pack_clear);
258 if (methods.FirstOrDefault(m => m.Name == "ClearPack") != null)
260 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_pack_clear"), func = Marshal.GetFunctionPointerForDelegate(efl_pack_clear_static_delegate) });
263 if (efl_pack_unpack_all_static_delegate == null)
265 efl_pack_unpack_all_static_delegate = new efl_pack_unpack_all_delegate(unpack_all);
268 if (methods.FirstOrDefault(m => m.Name == "UnpackAll") != null)
270 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_pack_unpack_all"), func = Marshal.GetFunctionPointerForDelegate(efl_pack_unpack_all_static_delegate) });
273 if (efl_pack_unpack_static_delegate == null)
275 efl_pack_unpack_static_delegate = new efl_pack_unpack_delegate(unpack);
278 if (methods.FirstOrDefault(m => m.Name == "Unpack") != null)
280 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_pack_unpack"), func = Marshal.GetFunctionPointerForDelegate(efl_pack_unpack_static_delegate) });
283 if (efl_pack_static_delegate == null)
285 efl_pack_static_delegate = new efl_pack_delegate(pack);
288 if (methods.FirstOrDefault(m => m.Name == "Pack") != null)
290 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_pack"), func = Marshal.GetFunctionPointerForDelegate(efl_pack_static_delegate) });
293 if (efl_content_iterate_static_delegate == null)
295 efl_content_iterate_static_delegate = new efl_content_iterate_delegate(content_iterate);
298 if (methods.FirstOrDefault(m => m.Name == "ContentIterate") != null)
300 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) });
303 if (efl_content_count_static_delegate == null)
305 efl_content_count_static_delegate = new efl_content_count_delegate(content_count);
308 if (methods.FirstOrDefault(m => m.Name == "ContentCount") != null)
310 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) });
315 /// <summary>Returns the Eo class for the native methods of this class.</summary>
316 /// <returns>The native class pointer.</returns>
317 public override IntPtr GetEflClass()
319 return Efl.IPackConcrete.efl_pack_interface_get();
322 #pragma warning disable CA1707, CS1591, SA1300, SA1600
324 [return: MarshalAs(UnmanagedType.U1)]
325 private delegate bool efl_pack_clear_delegate(System.IntPtr obj, System.IntPtr pd);
327 [return: MarshalAs(UnmanagedType.U1)]
328 public delegate bool efl_pack_clear_api_delegate(System.IntPtr obj);
330 public static Efl.Eo.FunctionWrapper<efl_pack_clear_api_delegate> efl_pack_clear_ptr = new Efl.Eo.FunctionWrapper<efl_pack_clear_api_delegate>(Module, "efl_pack_clear");
332 private static bool pack_clear(System.IntPtr obj, System.IntPtr pd)
334 Eina.Log.Debug("function efl_pack_clear was called");
335 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
338 bool _ret_var = default(bool);
341 _ret_var = ((IPack)ws.Target).ClearPack();
345 Eina.Log.Warning($"Callback error: {e.ToString()}");
346 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
354 return efl_pack_clear_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
358 private static efl_pack_clear_delegate efl_pack_clear_static_delegate;
360 [return: MarshalAs(UnmanagedType.U1)]
361 private delegate bool efl_pack_unpack_all_delegate(System.IntPtr obj, System.IntPtr pd);
363 [return: MarshalAs(UnmanagedType.U1)]
364 public delegate bool efl_pack_unpack_all_api_delegate(System.IntPtr obj);
366 public static Efl.Eo.FunctionWrapper<efl_pack_unpack_all_api_delegate> efl_pack_unpack_all_ptr = new Efl.Eo.FunctionWrapper<efl_pack_unpack_all_api_delegate>(Module, "efl_pack_unpack_all");
368 private static bool unpack_all(System.IntPtr obj, System.IntPtr pd)
370 Eina.Log.Debug("function efl_pack_unpack_all was called");
371 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
374 bool _ret_var = default(bool);
377 _ret_var = ((IPack)ws.Target).UnpackAll();
381 Eina.Log.Warning($"Callback error: {e.ToString()}");
382 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
390 return efl_pack_unpack_all_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
394 private static efl_pack_unpack_all_delegate efl_pack_unpack_all_static_delegate;
396 [return: MarshalAs(UnmanagedType.U1)]
397 private delegate bool efl_pack_unpack_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Gfx.IEntity subobj);
399 [return: MarshalAs(UnmanagedType.U1)]
400 public delegate bool efl_pack_unpack_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Gfx.IEntity subobj);
402 public static Efl.Eo.FunctionWrapper<efl_pack_unpack_api_delegate> efl_pack_unpack_ptr = new Efl.Eo.FunctionWrapper<efl_pack_unpack_api_delegate>(Module, "efl_pack_unpack");
404 private static bool unpack(System.IntPtr obj, System.IntPtr pd, Efl.Gfx.IEntity subobj)
406 Eina.Log.Debug("function efl_pack_unpack was called");
407 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
410 bool _ret_var = default(bool);
413 _ret_var = ((IPack)ws.Target).Unpack(subobj);
417 Eina.Log.Warning($"Callback error: {e.ToString()}");
418 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
426 return efl_pack_unpack_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), subobj);
430 private static efl_pack_unpack_delegate efl_pack_unpack_static_delegate;
432 [return: MarshalAs(UnmanagedType.U1)]
433 private delegate bool efl_pack_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Gfx.IEntity subobj);
435 [return: MarshalAs(UnmanagedType.U1)]
436 public delegate bool efl_pack_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Gfx.IEntity subobj);
438 public static Efl.Eo.FunctionWrapper<efl_pack_api_delegate> efl_pack_ptr = new Efl.Eo.FunctionWrapper<efl_pack_api_delegate>(Module, "efl_pack");
440 private static bool pack(System.IntPtr obj, System.IntPtr pd, Efl.Gfx.IEntity subobj)
442 Eina.Log.Debug("function efl_pack was called");
443 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
446 bool _ret_var = default(bool);
449 _ret_var = ((IPack)ws.Target).Pack(subobj);
453 Eina.Log.Warning($"Callback error: {e.ToString()}");
454 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
462 return efl_pack_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), subobj);
466 private static efl_pack_delegate efl_pack_static_delegate;
469 private delegate System.IntPtr efl_content_iterate_delegate(System.IntPtr obj, System.IntPtr pd);
472 public delegate System.IntPtr efl_content_iterate_api_delegate(System.IntPtr obj);
474 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");
476 private static System.IntPtr content_iterate(System.IntPtr obj, System.IntPtr pd)
478 Eina.Log.Debug("function efl_content_iterate was called");
479 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
482 Eina.Iterator<Efl.Gfx.IEntity> _ret_var = default(Eina.Iterator<Efl.Gfx.IEntity>);
485 _ret_var = ((IPack)ws.Target).ContentIterate();
489 Eina.Log.Warning($"Callback error: {e.ToString()}");
490 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
493 _ret_var.Own = false; return _ret_var.Handle;
498 return efl_content_iterate_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
502 private static efl_content_iterate_delegate efl_content_iterate_static_delegate;
505 private delegate int efl_content_count_delegate(System.IntPtr obj, System.IntPtr pd);
508 public delegate int efl_content_count_api_delegate(System.IntPtr obj);
510 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");
512 private static int content_count(System.IntPtr obj, System.IntPtr pd)
514 Eina.Log.Debug("function efl_content_count was called");
515 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
518 int _ret_var = default(int);
521 _ret_var = ((IPack)ws.Target).ContentCount();
525 Eina.Log.Warning($"Callback error: {e.ToString()}");
526 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
534 return efl_content_count_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
538 private static efl_content_count_delegate efl_content_count_static_delegate;
540 #pragma warning restore CA1707, CS1591, SA1300, SA1600
547 #pragma warning disable CS1591
548 public static class EflIPackConcrete_ExtensionMethods {
550 #pragma warning restore CS1591