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>Class representing an external part in Edje layouts.
14 /// An object of this type is an Efl.Part object, which means its lifecycle is limited to only one function call.
16 /// An external part contains one object, which can be retrieved with <see cref="Efl.IContent.GetContent"/>. Do not delete this object. Just like for other parts Edje is in charge of the visibility, geometry, clip, etc.
18 /// Common usage in pseudo-C would be as follows: Eo *widget = efl_content_get(efl_part(layout, "extpartname")); efl_text_set(widget, "hello");
20 /// Note that as a shortcut the widget's functions can be called directly on this part object. In C++: efl::eo::downcast<efl::Text>(layout.part("title")).text_set("hello"); Or in pseudo-C: efl_text_set(efl_part(layout, "title"), "hello"); Or in pseudo-script: layout["title"].text = "hello";</summary>
21 /// <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>
22 [Efl.Canvas.LayoutPartExternal.NativeMethods]
23 [Efl.Eo.BindingEntity]
24 public class LayoutPartExternal : Efl.Canvas.LayoutPart, Efl.IContent
26 /// <summary>Pointer to the native class description.</summary>
27 public override System.IntPtr NativeClass
31 if (((object)this).GetType() == typeof(LayoutPartExternal))
33 return GetEflClassStatic();
37 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
42 [System.Runtime.InteropServices.DllImport(efl.Libs.Edje)] internal static extern System.IntPtr
43 efl_canvas_layout_part_external_class_get();
44 /// <summary>Initializes a new instance of the <see cref="LayoutPartExternal"/> class.</summary>
45 /// <param name="parent">Parent instance.</param>
46 public LayoutPartExternal(Efl.Object parent= null
47 ) : base(efl_canvas_layout_part_external_class_get(), parent)
49 FinishInstantiation();
52 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
53 /// Do not call this constructor directly.</summary>
54 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
55 protected LayoutPartExternal(ConstructingHandle ch) : base(ch)
59 /// <summary>Initializes a new instance of the <see cref="LayoutPartExternal"/> class.
60 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
61 /// <param name="wh">The native pointer to be wrapped.</param>
62 protected LayoutPartExternal(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
66 /// <summary>Initializes a new instance of the <see cref="LayoutPartExternal"/> class.
67 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
68 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
69 /// <param name="parent">The Efl.Object parent of this instance.</param>
70 protected LayoutPartExternal(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
74 /// <summary>Sent after the content is set or unset using the current content object.
75 /// (Since EFL 1.22)</summary>
76 /// <value><see cref="Efl.IContentContentChangedEvt_Args"/></value>
77 public event EventHandler<Efl.IContentContentChangedEvt_Args> ContentChangedEvt
81 lock (eflBindingEventLock)
83 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
85 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
88 Efl.IContentContentChangedEvt_Args args = new Efl.IContentContentChangedEvt_Args();
89 args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
92 value?.Invoke(obj, args);
96 Eina.Log.Error(e.ToString());
97 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
102 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
103 AddNativeEventHandler(efl.Libs.Edje, key, callerCb, value);
109 lock (eflBindingEventLock)
111 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
112 RemoveNativeEventHandler(efl.Libs.Edje, key, value);
116 /// <summary>Method to raise event ContentChangedEvt.</summary>
117 public void OnContentChangedEvt(Efl.IContentContentChangedEvt_Args e)
119 var key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
120 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Edje, key);
121 if (desc == IntPtr.Zero)
123 Eina.Log.Error($"Failed to get native event {key}");
127 IntPtr info = e.arg.NativeHandle;
128 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
130 /// <summary>Sub-object currently set as this object's single content.
131 /// 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).
132 /// (Since EFL 1.22)</summary>
133 /// <returns>The sub-object.</returns>
134 virtual public Efl.Gfx.IEntity GetContent() {
135 var _ret_var = Efl.IContentConcrete.NativeMethods.efl_content_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
136 Eina.Error.RaiseIfUnhandledException();
139 /// <summary>Sub-object currently set as this object's single content.
140 /// 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).
141 /// (Since EFL 1.22)</summary>
142 /// <param name="content">The sub-object.</param>
143 /// <returns><c>true</c> if <c>content</c> was successfully swallowed.</returns>
144 virtual public bool SetContent(Efl.Gfx.IEntity content) {
145 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);
146 Eina.Error.RaiseIfUnhandledException();
149 /// <summary>Remove the sub-object currently set as content of this object and return it. This object becomes empty.
150 /// (Since EFL 1.22)</summary>
151 /// <returns>Unswallowed object</returns>
152 virtual public Efl.Gfx.IEntity UnsetContent() {
153 var _ret_var = Efl.IContentConcrete.NativeMethods.efl_content_unset_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
154 Eina.Error.RaiseIfUnhandledException();
157 /// <summary>Sub-object currently set as this object's single content.
158 /// 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).
159 /// (Since EFL 1.22)</summary>
160 /// <value>The sub-object.</value>
161 public Efl.Gfx.IEntity Content {
162 get { return GetContent(); }
163 set { SetContent(value); }
165 private static IntPtr GetEflClassStatic()
167 return Efl.Canvas.LayoutPartExternal.efl_canvas_layout_part_external_class_get();
169 /// <summary>Wrapper for native methods and virtual method delegates.
170 /// For internal use by generated code only.</summary>
171 public new class NativeMethods : Efl.Canvas.LayoutPart.NativeMethods
173 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Edje);
174 /// <summary>Gets the list of Eo operations to override.</summary>
175 /// <returns>The list of Eo operations to be overload.</returns>
176 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
178 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
179 var methods = Efl.Eo.Globals.GetUserMethods(type);
181 if (efl_content_get_static_delegate == null)
183 efl_content_get_static_delegate = new efl_content_get_delegate(content_get);
186 if (methods.FirstOrDefault(m => m.Name == "GetContent") != null)
188 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) });
191 if (efl_content_set_static_delegate == null)
193 efl_content_set_static_delegate = new efl_content_set_delegate(content_set);
196 if (methods.FirstOrDefault(m => m.Name == "SetContent") != null)
198 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) });
201 if (efl_content_unset_static_delegate == null)
203 efl_content_unset_static_delegate = new efl_content_unset_delegate(content_unset);
206 if (methods.FirstOrDefault(m => m.Name == "UnsetContent") != null)
208 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) });
211 descs.AddRange(base.GetEoOps(type));
214 /// <summary>Returns the Eo class for the native methods of this class.</summary>
215 /// <returns>The native class pointer.</returns>
216 public override IntPtr GetEflClass()
218 return Efl.Canvas.LayoutPartExternal.efl_canvas_layout_part_external_class_get();
221 #pragma warning disable CA1707, CS1591, SA1300, SA1600
223 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
224 private delegate Efl.Gfx.IEntity efl_content_get_delegate(System.IntPtr obj, System.IntPtr pd);
226 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
227 public delegate Efl.Gfx.IEntity efl_content_get_api_delegate(System.IntPtr obj);
229 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");
231 private static Efl.Gfx.IEntity content_get(System.IntPtr obj, System.IntPtr pd)
233 Eina.Log.Debug("function efl_content_get was called");
234 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
237 Efl.Gfx.IEntity _ret_var = default(Efl.Gfx.IEntity);
240 _ret_var = ((LayoutPartExternal)ws.Target).GetContent();
244 Eina.Log.Warning($"Callback error: {e.ToString()}");
245 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
253 return efl_content_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
257 private static efl_content_get_delegate efl_content_get_static_delegate;
259 [return: MarshalAs(UnmanagedType.U1)]
260 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);
262 [return: MarshalAs(UnmanagedType.U1)]
263 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);
265 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");
267 private static bool content_set(System.IntPtr obj, System.IntPtr pd, Efl.Gfx.IEntity content)
269 Eina.Log.Debug("function efl_content_set was called");
270 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
273 bool _ret_var = default(bool);
276 _ret_var = ((LayoutPartExternal)ws.Target).SetContent(content);
280 Eina.Log.Warning($"Callback error: {e.ToString()}");
281 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
289 return efl_content_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), content);
293 private static efl_content_set_delegate efl_content_set_static_delegate;
295 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
296 private delegate Efl.Gfx.IEntity efl_content_unset_delegate(System.IntPtr obj, System.IntPtr pd);
298 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
299 public delegate Efl.Gfx.IEntity efl_content_unset_api_delegate(System.IntPtr obj);
301 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");
303 private static Efl.Gfx.IEntity content_unset(System.IntPtr obj, System.IntPtr pd)
305 Eina.Log.Debug("function efl_content_unset was called");
306 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
309 Efl.Gfx.IEntity _ret_var = default(Efl.Gfx.IEntity);
312 _ret_var = ((LayoutPartExternal)ws.Target).UnsetContent();
316 Eina.Log.Warning($"Callback error: {e.ToString()}");
317 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
325 return efl_content_unset_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
329 private static efl_content_unset_delegate efl_content_unset_static_delegate;
331 #pragma warning restore CA1707, CS1591, SA1300, SA1600
340 #pragma warning disable CS1591
341 public static class Efl_CanvasLayoutPartExternal_ExtensionMethods {
342 public static Efl.BindableProperty<Efl.Gfx.IEntity> Content<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<Efl.Canvas.LayoutPartExternal, T>magic = null) where T : Efl.Canvas.LayoutPartExternal {
343 return new Efl.BindableProperty<Efl.Gfx.IEntity>("content", fac);
347 #pragma warning restore CS1591