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>Efl observer interface</summary>
12 /// <remarks>This is a <b>BETA</b> class. It can be modified or removed in the future. Do not use it for product development.</remarks>
13 [Efl.IObserverConcrete.NativeMethods]
14 [Efl.Eo.BindingEntity]
15 public interface IObserver :
16 Efl.Eo.IWrapper, IDisposable
18 /// <summary>Update observer according to the changes of observable object.</summary>
19 /// <param name="obs">An observable object</param>
20 /// <param name="key">A key to classify observer groups</param>
21 /// <param name="data">Required data to update the observer, usually passed by observable object</param>
22 void Update(Efl.Object obs, System.String key, System.IntPtr data);
24 /// <summary>Efl observer interface</summary>
25 /// <remarks>This is a <b>BETA</b> class. It can be modified or removed in the future. Do not use it for product development.</remarks>
26 sealed public class IObserverConcrete :
31 /// <summary>Pointer to the native class description.</summary>
32 public override System.IntPtr NativeClass
36 if (((object)this).GetType() == typeof(IObserverConcrete))
38 return GetEflClassStatic();
42 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
47 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
48 /// Do not call this constructor directly.</summary>
49 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
50 private IObserverConcrete(ConstructingHandle ch) : base(ch)
54 [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
55 efl_observer_interface_get();
56 /// <summary>Initializes a new instance of the <see cref="IObserver"/> class.
57 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
58 /// <param name="wh">The native pointer to be wrapped.</param>
59 private IObserverConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
63 /// <summary>Update observer according to the changes of observable object.</summary>
64 /// <param name="obs">An observable object</param>
65 /// <param name="key">A key to classify observer groups</param>
66 /// <param name="data">Required data to update the observer, usually passed by observable object</param>
67 public void Update(Efl.Object obs, System.String key, System.IntPtr data) {
68 Efl.IObserverConcrete.NativeMethods.efl_observer_update_ptr.Value.Delegate(this.NativeHandle,obs, key, data);
69 Eina.Error.RaiseIfUnhandledException();
71 private static IntPtr GetEflClassStatic()
73 return Efl.IObserverConcrete.efl_observer_interface_get();
75 /// <summary>Wrapper for native methods and virtual method delegates.
76 /// For internal use by generated code only.</summary>
77 public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods
79 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
80 /// <summary>Gets the list of Eo operations to override.</summary>
81 /// <returns>The list of Eo operations to be overload.</returns>
82 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
84 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
85 var methods = Efl.Eo.Globals.GetUserMethods(type);
87 if (efl_observer_update_static_delegate == null)
89 efl_observer_update_static_delegate = new efl_observer_update_delegate(update);
92 if (methods.FirstOrDefault(m => m.Name == "Update") != null)
94 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) });
99 /// <summary>Returns the Eo class for the native methods of this class.</summary>
100 /// <returns>The native class pointer.</returns>
101 public override IntPtr GetEflClass()
103 return Efl.IObserverConcrete.efl_observer_interface_get();
106 #pragma warning disable CA1707, CS1591, SA1300, SA1600
109 private delegate void efl_observer_update_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Object obs, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String key, System.IntPtr data);
112 public delegate void efl_observer_update_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Object obs, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String key, System.IntPtr data);
114 public static Efl.Eo.FunctionWrapper<efl_observer_update_api_delegate> efl_observer_update_ptr = new Efl.Eo.FunctionWrapper<efl_observer_update_api_delegate>(Module, "efl_observer_update");
116 private static void update(System.IntPtr obj, System.IntPtr pd, Efl.Object obs, System.String key, System.IntPtr data)
118 Eina.Log.Debug("function efl_observer_update was called");
119 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
125 ((IObserver)ws.Target).Update(obs, key, data);
129 Eina.Log.Warning($"Callback error: {e.ToString()}");
130 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
137 efl_observer_update_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), obs, key, data);
141 private static efl_observer_update_delegate efl_observer_update_static_delegate;
143 #pragma warning restore CA1707, CS1591, SA1300, SA1600
150 #pragma warning disable CS1591
151 public static class EflIObserverConcrete_ExtensionMethods {
153 #pragma warning restore CS1591