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) 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
19 /// <summary>Begin iterating over this object's contents.
20 /// (Since EFL 1.22)</summary>
21 /// <returns>Iterator on object'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>
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;
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; }
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; }
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 :
58 /// <summary>Pointer to the native class description.</summary>
59 public override System.IntPtr NativeClass
63 if (((object)this).GetType() == typeof(IContainerConcrete))
65 return GetEflClassStatic();
69 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
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)
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)
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
97 lock (eflBindingEventLock)
99 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
101 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
104 Efl.IContainerContentAddedEvt_Args args = new Efl.IContainerContentAddedEvt_Args();
105 args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
108 value?.Invoke(obj, args);
112 Eina.Log.Error(e.ToString());
113 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
118 string key = "_EFL_CONTAINER_EVENT_CONTENT_ADDED";
119 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
125 lock (eflBindingEventLock)
127 string key = "_EFL_CONTAINER_EVENT_CONTENT_ADDED";
128 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
132 /// <summary>Method to raise event ContentAddedEvt.</summary>
133 public void OnContentAddedEvt(Efl.IContainerContentAddedEvt_Args e)
135 var key = "_EFL_CONTAINER_EVENT_CONTENT_ADDED";
136 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
137 if (desc == IntPtr.Zero)
139 Eina.Log.Error($"Failed to get native event {key}");
143 IntPtr info = e.arg.NativeHandle;
144 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
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
153 lock (eflBindingEventLock)
155 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
157 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
160 Efl.IContainerContentRemovedEvt_Args args = new Efl.IContainerContentRemovedEvt_Args();
161 args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
164 value?.Invoke(obj, args);
168 Eina.Log.Error(e.ToString());
169 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
174 string key = "_EFL_CONTAINER_EVENT_CONTENT_REMOVED";
175 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
181 lock (eflBindingEventLock)
183 string key = "_EFL_CONTAINER_EVENT_CONTENT_REMOVED";
184 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
188 /// <summary>Method to raise event ContentRemovedEvt.</summary>
189 public void OnContentRemovedEvt(Efl.IContainerContentRemovedEvt_Args e)
191 var key = "_EFL_CONTAINER_EVENT_CONTENT_REMOVED";
192 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
193 if (desc == IntPtr.Zero)
195 Eina.Log.Error($"Failed to get native event {key}");
199 IntPtr info = e.arg.NativeHandle;
200 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
202 /// <summary>Begin iterating over this object's contents.
203 /// (Since EFL 1.22)</summary>
204 /// <returns>Iterator on object'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);
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();
218 private static IntPtr GetEflClassStatic()
220 return Efl.IContainerConcrete.efl_container_interface_get();
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
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)
231 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
232 var methods = Efl.Eo.Globals.GetUserMethods(type);
234 if (efl_content_iterate_static_delegate == null)
236 efl_content_iterate_static_delegate = new efl_content_iterate_delegate(content_iterate);
239 if (methods.FirstOrDefault(m => m.Name == "ContentIterate") != null)
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) });
244 if (efl_content_count_static_delegate == null)
246 efl_content_count_static_delegate = new efl_content_count_delegate(content_count);
249 if (methods.FirstOrDefault(m => m.Name == "ContentCount") != null)
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) });
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()
260 return Efl.IContainerConcrete.efl_container_interface_get();
263 #pragma warning disable CA1707, CS1591, SA1300, SA1600
266 private delegate System.IntPtr efl_content_iterate_delegate(System.IntPtr obj, System.IntPtr pd);
269 public delegate System.IntPtr efl_content_iterate_api_delegate(System.IntPtr obj);
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");
273 private static System.IntPtr content_iterate(System.IntPtr obj, System.IntPtr pd)
275 Eina.Log.Debug("function efl_content_iterate was called");
276 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
279 Eina.Iterator<Efl.Gfx.IEntity> _ret_var = default(Eina.Iterator<Efl.Gfx.IEntity>);
282 _ret_var = ((IContainer)ws.Target).ContentIterate();
286 Eina.Log.Warning($"Callback error: {e.ToString()}");
287 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
290 _ret_var.Own = false; return _ret_var.Handle;
295 return efl_content_iterate_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
299 private static efl_content_iterate_delegate efl_content_iterate_static_delegate;
302 private delegate int efl_content_count_delegate(System.IntPtr obj, System.IntPtr pd);
305 public delegate int efl_content_count_api_delegate(System.IntPtr obj);
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");
309 private static int content_count(System.IntPtr obj, System.IntPtr pd)
311 Eina.Log.Debug("function efl_content_count was called");
312 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
315 int _ret_var = default(int);
318 _ret_var = ((IContainer)ws.Target).ContentCount();
322 Eina.Log.Warning($"Callback error: {e.ToString()}");
323 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
331 return efl_content_count_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
335 private static efl_content_count_delegate efl_content_count_static_delegate;
337 #pragma warning restore CA1707, CS1591, SA1300, SA1600
344 #pragma warning disable CS1591
345 public static class EflIContainerConcrete_ExtensionMethods {
347 #pragma warning restore CS1591