#define EFL_BETA #pragma warning disable CS1591 using System; using System.Runtime.InteropServices; using System.Collections.Generic; using System.Linq; using System.Threading; using System.ComponentModel; namespace Efl { /// Efl observer interface /// This is a BETA class. It can be modified or removed in the future. Do not use it for product development. [Efl.IObserverConcrete.NativeMethods] [Efl.Eo.BindingEntity] public interface IObserver : Efl.Eo.IWrapper, IDisposable { /// Update observer according to the changes of observable object. /// An observable object /// A key to classify observer groups /// Required data to update the observer, usually passed by observable object void Update(Efl.Object obs, System.String key, System.IntPtr data); } /// Efl observer interface /// This is a BETA class. It can be modified or removed in the future. Do not use it for product development. sealed public class IObserverConcrete : Efl.Eo.EoWrapper , IObserver { /// Pointer to the native class description. public override System.IntPtr NativeClass { get { if (((object)this).GetType() == typeof(IObserverConcrete)) { return GetEflClassStatic(); } else { return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()]; } } } /// Subclasses should override this constructor if they are expected to be instantiated from native code. /// Do not call this constructor directly. /// Tag struct storing the native handle of the object being constructed. private IObserverConcrete(ConstructingHandle ch) : base(ch) { } [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr efl_observer_interface_get(); /// Initializes a new instance of the class. /// Internal usage: This is used when interacting with C code and should not be used directly. /// The native pointer to be wrapped. private IObserverConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh) { } /// Update observer according to the changes of observable object. /// An observable object /// A key to classify observer groups /// Required data to update the observer, usually passed by observable object public void Update(Efl.Object obs, System.String key, System.IntPtr data) { Efl.IObserverConcrete.NativeMethods.efl_observer_update_ptr.Value.Delegate(this.NativeHandle,obs, key, data); Eina.Error.RaiseIfUnhandledException(); } private static IntPtr GetEflClassStatic() { return Efl.IObserverConcrete.efl_observer_interface_get(); } /// Wrapper for native methods and virtual method delegates. /// For internal use by generated code only. public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods { private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl); /// Gets the list of Eo operations to override. /// The list of Eo operations to be overload. public override System.Collections.Generic.List GetEoOps(System.Type type) { var descs = new System.Collections.Generic.List(); var methods = Efl.Eo.Globals.GetUserMethods(type); if (efl_observer_update_static_delegate == null) { efl_observer_update_static_delegate = new efl_observer_update_delegate(update); } if (methods.FirstOrDefault(m => m.Name == "Update") != null) { descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_observer_update"), func = Marshal.GetFunctionPointerForDelegate(efl_observer_update_static_delegate) }); } return descs; } /// Returns the Eo class for the native methods of this class. /// The native class pointer. public override IntPtr GetEflClass() { return Efl.IObserverConcrete.efl_observer_interface_get(); } #pragma warning disable CA1707, CS1591, SA1300, SA1600 private delegate void efl_observer_update_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo))] Efl.Object obs, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String key, System.IntPtr data); public delegate void efl_observer_update_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo))] Efl.Object obs, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String key, System.IntPtr data); public static Efl.Eo.FunctionWrapper efl_observer_update_ptr = new Efl.Eo.FunctionWrapper(Module, "efl_observer_update"); private static void update(System.IntPtr obj, System.IntPtr pd, Efl.Object obs, System.String key, System.IntPtr data) { Eina.Log.Debug("function efl_observer_update was called"); var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj); if (ws != null) { try { ((IObserver)ws.Target).Update(obs, key, data); } catch (Exception e) { Eina.Log.Warning($"Callback error: {e.ToString()}"); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } else { efl_observer_update_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), obs, key, data); } } private static efl_observer_update_delegate efl_observer_update_static_delegate; #pragma warning restore CA1707, CS1591, SA1300, SA1600 } } } #if EFL_BETA #pragma warning disable CS1591 public static class EflIObserverConcrete_ExtensionMethods { } #pragma warning restore CS1591 #endif