1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.Threading;
7 using System.ComponentModel;
10 ///<summary>Event argument wrapper for event <see cref="Efl.LoopMessageFutureHandler.MessageFutureEvt"/>.</summary>
11 public class LoopMessageFutureHandlerMessageFutureEvt_Args : EventArgs {
12 ///<summary>Actual event payload.</summary>
13 public Efl.LoopMessageFuture arg { get; set; }
15 /// <summary>Internal use for future on an efl loop - replacing legacy ecore events</summary>
16 [Efl.LoopMessageFutureHandler.NativeMethods]
17 public class LoopMessageFutureHandler : Efl.LoopMessageHandler, Efl.Eo.IWrapper
19 ///<summary>Pointer to the native class description.</summary>
20 public override System.IntPtr NativeClass
24 if (((object)this).GetType() == typeof(LoopMessageFutureHandler))
26 return GetEflClassStatic();
30 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
35 [System.Runtime.InteropServices.DllImport(efl.Libs.Ecore)] internal static extern System.IntPtr
36 efl_loop_message_future_handler_class_get();
37 /// <summary>Initializes a new instance of the <see cref="LoopMessageFutureHandler"/> class.</summary>
38 /// <param name="parent">Parent instance.</param>
39 public LoopMessageFutureHandler(Efl.Object parent= null
40 ) : base(efl_loop_message_future_handler_class_get(), typeof(LoopMessageFutureHandler), parent)
42 FinishInstantiation();
45 /// <summary>Initializes a new instance of the <see cref="LoopMessageFutureHandler"/> class.
46 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
47 /// <param name="raw">The native pointer to be wrapped.</param>
48 protected LoopMessageFutureHandler(System.IntPtr raw) : base(raw)
52 /// <summary>Initializes a new instance of the <see cref="LoopMessageFutureHandler"/> class.
53 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
54 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
55 /// <param name="managedType">The managed type of the public constructor that originated this call.</param>
56 /// <param name="parent">The Efl.Object parent of this instance.</param>
57 protected LoopMessageFutureHandler(IntPtr baseKlass, System.Type managedType, Efl.Object parent) : base(baseKlass, managedType, parent)
61 /// <summary>Verifies if the given object is equal to this one.</summary>
62 /// <param name="instance">The object to compare to.</param>
63 /// <returns>True if both objects point to the same native object.</returns>
64 public override bool Equals(object instance)
66 var other = instance as Efl.Object;
71 return this.NativeHandle == other.NativeHandle;
74 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
75 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
76 public override int GetHashCode()
78 return this.NativeHandle.ToInt32();
81 /// <summary>Turns the native pointer into a string representation.</summary>
82 /// <returns>A string with the type and the native pointer for this object.</returns>
83 public override String ToString()
85 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
88 /// <summary>No description supplied.</summary>
89 public event EventHandler<Efl.LoopMessageFutureHandlerMessageFutureEvt_Args> MessageFutureEvt
95 var wRef = new WeakReference(this);
96 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
98 var obj = wRef.Target as Efl.Eo.IWrapper;
101 Efl.LoopMessageFutureHandlerMessageFutureEvt_Args args = new Efl.LoopMessageFutureHandlerMessageFutureEvt_Args();
102 args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.LoopMessageFuture);
105 value?.Invoke(obj, args);
109 Eina.Log.Error(e.ToString());
110 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
115 string key = "_EFL_LOOP_MESSAGE_FUTURE_HANDLER_EVENT_MESSAGE_FUTURE";
116 AddNativeEventHandler(efl.Libs.Ecore, key, callerCb, value);
124 string key = "_EFL_LOOP_MESSAGE_FUTURE_HANDLER_EVENT_MESSAGE_FUTURE";
125 RemoveNativeEventHandler(efl.Libs.Ecore, key, value);
129 ///<summary>Method to raise event MessageFutureEvt.</summary>
130 public void OnMessageFutureEvt(Efl.LoopMessageFutureHandlerMessageFutureEvt_Args e)
132 var key = "_EFL_LOOP_MESSAGE_FUTURE_HANDLER_EVENT_MESSAGE_FUTURE";
133 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Ecore, key);
134 if (desc == IntPtr.Zero)
136 Eina.Log.Error($"Failed to get native event {key}");
140 IntPtr info = e.arg.NativeHandle;
141 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
143 /// <summary>No description supplied.</summary>
144 /// <returns>No description supplied.</returns>
145 virtual public Efl.LoopMessageFuture AddMessageType() {
146 var _ret_var = Efl.LoopMessageFutureHandler.NativeMethods.efl_loop_message_future_handler_message_type_add_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle));
147 Eina.Error.RaiseIfUnhandledException();
150 private static IntPtr GetEflClassStatic()
152 return Efl.LoopMessageFutureHandler.efl_loop_message_future_handler_class_get();
154 /// <summary>Wrapper for native methods and virtual method delegates.
155 /// For internal use by generated code only.</summary>
156 public new class NativeMethods : Efl.LoopMessageHandler.NativeMethods
158 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Ecore);
159 /// <summary>Gets the list of Eo operations to override.</summary>
160 /// <returns>The list of Eo operations to be overload.</returns>
161 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
163 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
164 var methods = Efl.Eo.Globals.GetUserMethods(type);
166 if (efl_loop_message_future_handler_message_type_add_static_delegate == null)
168 efl_loop_message_future_handler_message_type_add_static_delegate = new efl_loop_message_future_handler_message_type_add_delegate(message_type_add);
171 if (methods.FirstOrDefault(m => m.Name == "AddMessageType") != null)
173 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_loop_message_future_handler_message_type_add"), func = Marshal.GetFunctionPointerForDelegate(efl_loop_message_future_handler_message_type_add_static_delegate) });
176 descs.AddRange(base.GetEoOps(type));
179 /// <summary>Returns the Eo class for the native methods of this class.</summary>
180 /// <returns>The native class pointer.</returns>
181 public override IntPtr GetEflClass()
183 return Efl.LoopMessageFutureHandler.efl_loop_message_future_handler_class_get();
186 #pragma warning disable CA1707, SA1300, SA1600
188 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
189 private delegate Efl.LoopMessageFuture efl_loop_message_future_handler_message_type_add_delegate(System.IntPtr obj, System.IntPtr pd);
191 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
192 public delegate Efl.LoopMessageFuture efl_loop_message_future_handler_message_type_add_api_delegate(System.IntPtr obj);
194 public static Efl.Eo.FunctionWrapper<efl_loop_message_future_handler_message_type_add_api_delegate> efl_loop_message_future_handler_message_type_add_ptr = new Efl.Eo.FunctionWrapper<efl_loop_message_future_handler_message_type_add_api_delegate>(Module, "efl_loop_message_future_handler_message_type_add");
196 private static Efl.LoopMessageFuture message_type_add(System.IntPtr obj, System.IntPtr pd)
198 Eina.Log.Debug("function efl_loop_message_future_handler_message_type_add was called");
199 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
202 Efl.LoopMessageFuture _ret_var = default(Efl.LoopMessageFuture);
205 _ret_var = ((LoopMessageFutureHandler)wrapper).AddMessageType();
209 Eina.Log.Warning($"Callback error: {e.ToString()}");
210 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
218 return efl_loop_message_future_handler_message_type_add_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
222 private static efl_loop_message_future_handler_message_type_add_delegate efl_loop_message_future_handler_message_type_add_static_delegate;
224 #pragma warning restore CA1707, SA1300, SA1600