2 #pragma warning disable CS1591
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
7 using System.Threading;
8 using System.ComponentModel;
13 /// <summary>Represents a SWALLOW part of an Edje object.
14 /// Its lifetime is limited to one function call only, unless an extra reference is explicitely held.</summary>
15 /// <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>
16 [Efl.Canvas.LayoutPartSwallow.NativeMethods]
17 [Efl.Eo.BindingEntity]
18 public class LayoutPartSwallow : Efl.Canvas.LayoutPart, Efl.IContent
20 /// <summary>Pointer to the native class description.</summary>
21 public override System.IntPtr NativeClass
25 if (((object)this).GetType() == typeof(LayoutPartSwallow))
27 return GetEflClassStatic();
31 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
36 [System.Runtime.InteropServices.DllImport(efl.Libs.Edje)] internal static extern System.IntPtr
37 efl_canvas_layout_part_swallow_class_get();
38 /// <summary>Initializes a new instance of the <see cref="LayoutPartSwallow"/> class.</summary>
39 /// <param name="parent">Parent instance.</param>
40 public LayoutPartSwallow(Efl.Object parent= null
41 ) : base(efl_canvas_layout_part_swallow_class_get(), parent)
43 FinishInstantiation();
46 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
47 /// Do not call this constructor directly.</summary>
48 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
49 protected LayoutPartSwallow(ConstructingHandle ch) : base(ch)
53 /// <summary>Initializes a new instance of the <see cref="LayoutPartSwallow"/> class.
54 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
55 /// <param name="wh">The native pointer to be wrapped.</param>
56 protected LayoutPartSwallow(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
60 /// <summary>Initializes a new instance of the <see cref="LayoutPartSwallow"/> class.
61 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
62 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
63 /// <param name="parent">The Efl.Object parent of this instance.</param>
64 protected LayoutPartSwallow(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
68 /// <summary>Sent after the content is set or unset using the current content object.
69 /// (Since EFL 1.22)</summary>
70 /// <value><see cref="Efl.IContentContentChangedEvt_Args"/></value>
71 public event EventHandler<Efl.IContentContentChangedEvt_Args> ContentChangedEvt
75 lock (eflBindingEventLock)
77 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
79 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
82 Efl.IContentContentChangedEvt_Args args = new Efl.IContentContentChangedEvt_Args();
83 args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
86 value?.Invoke(obj, args);
90 Eina.Log.Error(e.ToString());
91 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
96 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
97 AddNativeEventHandler(efl.Libs.Edje, key, callerCb, value);
103 lock (eflBindingEventLock)
105 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
106 RemoveNativeEventHandler(efl.Libs.Edje, key, value);
110 /// <summary>Method to raise event ContentChangedEvt.</summary>
111 public void OnContentChangedEvt(Efl.IContentContentChangedEvt_Args e)
113 var key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
114 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Edje, key);
115 if (desc == IntPtr.Zero)
117 Eina.Log.Error($"Failed to get native event {key}");
121 IntPtr info = e.arg.NativeHandle;
122 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
124 /// <summary>Sub-object currently set as this object's single content.
125 /// If it is set multiple times, previous sub-objects are removed first. Therefore, if an invalid <c>content</c> is set the object will become empty (it will have no sub-object).
126 /// (Since EFL 1.22)</summary>
127 /// <returns>The sub-object.</returns>
128 virtual public Efl.Gfx.IEntity GetContent() {
129 var _ret_var = Efl.IContentConcrete.NativeMethods.efl_content_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
130 Eina.Error.RaiseIfUnhandledException();
133 /// <summary>Sub-object currently set as this object's single content.
134 /// If it is set multiple times, previous sub-objects are removed first. Therefore, if an invalid <c>content</c> is set the object will become empty (it will have no sub-object).
135 /// (Since EFL 1.22)</summary>
136 /// <param name="content">The sub-object.</param>
137 /// <returns><c>true</c> if <c>content</c> was successfully swallowed.</returns>
138 virtual public bool SetContent(Efl.Gfx.IEntity content) {
139 var _ret_var = Efl.IContentConcrete.NativeMethods.efl_content_set_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)),content);
140 Eina.Error.RaiseIfUnhandledException();
143 /// <summary>Remove the sub-object currently set as content of this object and return it. This object becomes empty.
144 /// (Since EFL 1.22)</summary>
145 /// <returns>Unswallowed object</returns>
146 virtual public Efl.Gfx.IEntity UnsetContent() {
147 var _ret_var = Efl.IContentConcrete.NativeMethods.efl_content_unset_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
148 Eina.Error.RaiseIfUnhandledException();
151 /// <summary>Sub-object currently set as this object's single content.
152 /// If it is set multiple times, previous sub-objects are removed first. Therefore, if an invalid <c>content</c> is set the object will become empty (it will have no sub-object).
153 /// (Since EFL 1.22)</summary>
154 /// <value>The sub-object.</value>
155 public Efl.Gfx.IEntity Content {
156 get { return GetContent(); }
157 set { SetContent(value); }
159 private static IntPtr GetEflClassStatic()
161 return Efl.Canvas.LayoutPartSwallow.efl_canvas_layout_part_swallow_class_get();
163 /// <summary>Wrapper for native methods and virtual method delegates.
164 /// For internal use by generated code only.</summary>
165 public new class NativeMethods : Efl.Canvas.LayoutPart.NativeMethods
167 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Edje);
168 /// <summary>Gets the list of Eo operations to override.</summary>
169 /// <returns>The list of Eo operations to be overload.</returns>
170 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
172 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
173 var methods = Efl.Eo.Globals.GetUserMethods(type);
175 if (efl_content_get_static_delegate == null)
177 efl_content_get_static_delegate = new efl_content_get_delegate(content_get);
180 if (methods.FirstOrDefault(m => m.Name == "GetContent") != null)
182 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_content_get"), func = Marshal.GetFunctionPointerForDelegate(efl_content_get_static_delegate) });
185 if (efl_content_set_static_delegate == null)
187 efl_content_set_static_delegate = new efl_content_set_delegate(content_set);
190 if (methods.FirstOrDefault(m => m.Name == "SetContent") != null)
192 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_content_set"), func = Marshal.GetFunctionPointerForDelegate(efl_content_set_static_delegate) });
195 if (efl_content_unset_static_delegate == null)
197 efl_content_unset_static_delegate = new efl_content_unset_delegate(content_unset);
200 if (methods.FirstOrDefault(m => m.Name == "UnsetContent") != null)
202 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_content_unset"), func = Marshal.GetFunctionPointerForDelegate(efl_content_unset_static_delegate) });
205 descs.AddRange(base.GetEoOps(type));
208 /// <summary>Returns the Eo class for the native methods of this class.</summary>
209 /// <returns>The native class pointer.</returns>
210 public override IntPtr GetEflClass()
212 return Efl.Canvas.LayoutPartSwallow.efl_canvas_layout_part_swallow_class_get();
215 #pragma warning disable CA1707, CS1591, SA1300, SA1600
217 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
218 private delegate Efl.Gfx.IEntity efl_content_get_delegate(System.IntPtr obj, System.IntPtr pd);
220 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
221 public delegate Efl.Gfx.IEntity efl_content_get_api_delegate(System.IntPtr obj);
223 public static Efl.Eo.FunctionWrapper<efl_content_get_api_delegate> efl_content_get_ptr = new Efl.Eo.FunctionWrapper<efl_content_get_api_delegate>(Module, "efl_content_get");
225 private static Efl.Gfx.IEntity content_get(System.IntPtr obj, System.IntPtr pd)
227 Eina.Log.Debug("function efl_content_get was called");
228 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
231 Efl.Gfx.IEntity _ret_var = default(Efl.Gfx.IEntity);
234 _ret_var = ((LayoutPartSwallow)ws.Target).GetContent();
238 Eina.Log.Warning($"Callback error: {e.ToString()}");
239 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
247 return efl_content_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
251 private static efl_content_get_delegate efl_content_get_static_delegate;
253 [return: MarshalAs(UnmanagedType.U1)]
254 private delegate bool efl_content_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Gfx.IEntity content);
256 [return: MarshalAs(UnmanagedType.U1)]
257 public delegate bool efl_content_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))] Efl.Gfx.IEntity content);
259 public static Efl.Eo.FunctionWrapper<efl_content_set_api_delegate> efl_content_set_ptr = new Efl.Eo.FunctionWrapper<efl_content_set_api_delegate>(Module, "efl_content_set");
261 private static bool content_set(System.IntPtr obj, System.IntPtr pd, Efl.Gfx.IEntity content)
263 Eina.Log.Debug("function efl_content_set was called");
264 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
267 bool _ret_var = default(bool);
270 _ret_var = ((LayoutPartSwallow)ws.Target).SetContent(content);
274 Eina.Log.Warning($"Callback error: {e.ToString()}");
275 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
283 return efl_content_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), content);
287 private static efl_content_set_delegate efl_content_set_static_delegate;
289 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
290 private delegate Efl.Gfx.IEntity efl_content_unset_delegate(System.IntPtr obj, System.IntPtr pd);
292 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
293 public delegate Efl.Gfx.IEntity efl_content_unset_api_delegate(System.IntPtr obj);
295 public static Efl.Eo.FunctionWrapper<efl_content_unset_api_delegate> efl_content_unset_ptr = new Efl.Eo.FunctionWrapper<efl_content_unset_api_delegate>(Module, "efl_content_unset");
297 private static Efl.Gfx.IEntity content_unset(System.IntPtr obj, System.IntPtr pd)
299 Eina.Log.Debug("function efl_content_unset was called");
300 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
303 Efl.Gfx.IEntity _ret_var = default(Efl.Gfx.IEntity);
306 _ret_var = ((LayoutPartSwallow)ws.Target).UnsetContent();
310 Eina.Log.Warning($"Callback error: {e.ToString()}");
311 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
319 return efl_content_unset_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
323 private static efl_content_unset_delegate efl_content_unset_static_delegate;
325 #pragma warning restore CA1707, CS1591, SA1300, SA1600
334 #pragma warning disable CS1591
335 public static class Efl_CanvasLayoutPartSwallow_ExtensionMethods {
336 public static Efl.BindableProperty<Efl.Gfx.IEntity> Content<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<Efl.Canvas.LayoutPartSwallow, T>magic = null) where T : Efl.Canvas.LayoutPartSwallow {
337 return new Efl.BindableProperty<Efl.Gfx.IEntity>("content", fac);
341 #pragma warning restore CS1591