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>Elementary layout internal part class</summary>
14 /// <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>
15 [Efl.Ui.LayoutPartContent.NativeMethods]
16 [Efl.Eo.BindingEntity]
17 public class LayoutPartContent : Efl.Ui.LayoutPart, Efl.IContent
19 /// <summary>Pointer to the native class description.</summary>
20 public override System.IntPtr NativeClass
24 if (((object)this).GetType() == typeof(LayoutPartContent))
26 return GetEflClassStatic();
30 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
35 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
36 efl_ui_layout_part_content_class_get();
37 /// <summary>Initializes a new instance of the <see cref="LayoutPartContent"/> class.</summary>
38 /// <param name="parent">Parent instance.</param>
39 public LayoutPartContent(Efl.Object parent= null
40 ) : base(efl_ui_layout_part_content_class_get(), parent)
42 FinishInstantiation();
45 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
46 /// Do not call this constructor directly.</summary>
47 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
48 protected LayoutPartContent(ConstructingHandle ch) : base(ch)
52 /// <summary>Initializes a new instance of the <see cref="LayoutPartContent"/> class.
53 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
54 /// <param name="wh">The native pointer to be wrapped.</param>
55 protected LayoutPartContent(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
59 /// <summary>Initializes a new instance of the <see cref="LayoutPartContent"/> class.
60 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
61 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
62 /// <param name="parent">The Efl.Object parent of this instance.</param>
63 protected LayoutPartContent(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)
67 /// <summary>Sent after the content is set or unset using the current content object.
68 /// (Since EFL 1.22)</summary>
69 /// <value><see cref="Efl.IContentContentChangedEvt_Args"/></value>
70 public event EventHandler<Efl.IContentContentChangedEvt_Args> ContentChangedEvt
74 lock (eflBindingEventLock)
76 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
78 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
81 Efl.IContentContentChangedEvt_Args args = new Efl.IContentContentChangedEvt_Args();
82 args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
85 value?.Invoke(obj, args);
89 Eina.Log.Error(e.ToString());
90 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
95 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
96 AddNativeEventHandler(efl.Libs.Elementary, key, callerCb, value);
102 lock (eflBindingEventLock)
104 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
105 RemoveNativeEventHandler(efl.Libs.Elementary, key, value);
109 /// <summary>Method to raise event ContentChangedEvt.</summary>
110 public void OnContentChangedEvt(Efl.IContentContentChangedEvt_Args e)
112 var key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
113 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Elementary, key);
114 if (desc == IntPtr.Zero)
116 Eina.Log.Error($"Failed to get native event {key}");
120 IntPtr info = e.arg.NativeHandle;
121 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
123 /// <summary>Sub-object currently set as this object's single content.
124 /// 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).
125 /// (Since EFL 1.22)</summary>
126 /// <returns>The sub-object.</returns>
127 virtual public Efl.Gfx.IEntity GetContent() {
128 var _ret_var = Efl.IContentConcrete.NativeMethods.efl_content_get_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
129 Eina.Error.RaiseIfUnhandledException();
132 /// <summary>Sub-object currently set as this object's single content.
133 /// 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).
134 /// (Since EFL 1.22)</summary>
135 /// <param name="content">The sub-object.</param>
136 /// <returns><c>true</c> if <c>content</c> was successfully swallowed.</returns>
137 virtual public bool SetContent(Efl.Gfx.IEntity content) {
138 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);
139 Eina.Error.RaiseIfUnhandledException();
142 /// <summary>Remove the sub-object currently set as content of this object and return it. This object becomes empty.
143 /// (Since EFL 1.22)</summary>
144 /// <returns>Unswallowed object</returns>
145 virtual public Efl.Gfx.IEntity UnsetContent() {
146 var _ret_var = Efl.IContentConcrete.NativeMethods.efl_content_unset_ptr.Value.Delegate((IsGeneratedBindingClass ? this.NativeHandle : Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass)));
147 Eina.Error.RaiseIfUnhandledException();
150 /// <summary>Sub-object currently set as this object's single content.
151 /// 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).
152 /// (Since EFL 1.22)</summary>
153 /// <value>The sub-object.</value>
154 public Efl.Gfx.IEntity Content {
155 get { return GetContent(); }
156 set { SetContent(value); }
158 private static IntPtr GetEflClassStatic()
160 return Efl.Ui.LayoutPartContent.efl_ui_layout_part_content_class_get();
162 /// <summary>Wrapper for native methods and virtual method delegates.
163 /// For internal use by generated code only.</summary>
164 public new class NativeMethods : Efl.Ui.LayoutPart.NativeMethods
166 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Elementary);
167 /// <summary>Gets the list of Eo operations to override.</summary>
168 /// <returns>The list of Eo operations to be overload.</returns>
169 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
171 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
172 var methods = Efl.Eo.Globals.GetUserMethods(type);
174 if (efl_content_get_static_delegate == null)
176 efl_content_get_static_delegate = new efl_content_get_delegate(content_get);
179 if (methods.FirstOrDefault(m => m.Name == "GetContent") != null)
181 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) });
184 if (efl_content_set_static_delegate == null)
186 efl_content_set_static_delegate = new efl_content_set_delegate(content_set);
189 if (methods.FirstOrDefault(m => m.Name == "SetContent") != null)
191 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) });
194 if (efl_content_unset_static_delegate == null)
196 efl_content_unset_static_delegate = new efl_content_unset_delegate(content_unset);
199 if (methods.FirstOrDefault(m => m.Name == "UnsetContent") != null)
201 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) });
204 descs.AddRange(base.GetEoOps(type));
207 /// <summary>Returns the Eo class for the native methods of this class.</summary>
208 /// <returns>The native class pointer.</returns>
209 public override IntPtr GetEflClass()
211 return Efl.Ui.LayoutPartContent.efl_ui_layout_part_content_class_get();
214 #pragma warning disable CA1707, CS1591, SA1300, SA1600
216 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
217 private delegate Efl.Gfx.IEntity efl_content_get_delegate(System.IntPtr obj, System.IntPtr pd);
219 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
220 public delegate Efl.Gfx.IEntity efl_content_get_api_delegate(System.IntPtr obj);
222 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");
224 private static Efl.Gfx.IEntity content_get(System.IntPtr obj, System.IntPtr pd)
226 Eina.Log.Debug("function efl_content_get was called");
227 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
230 Efl.Gfx.IEntity _ret_var = default(Efl.Gfx.IEntity);
233 _ret_var = ((LayoutPartContent)ws.Target).GetContent();
237 Eina.Log.Warning($"Callback error: {e.ToString()}");
238 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
246 return efl_content_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
250 private static efl_content_get_delegate efl_content_get_static_delegate;
252 [return: MarshalAs(UnmanagedType.U1)]
253 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);
255 [return: MarshalAs(UnmanagedType.U1)]
256 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);
258 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");
260 private static bool content_set(System.IntPtr obj, System.IntPtr pd, Efl.Gfx.IEntity content)
262 Eina.Log.Debug("function efl_content_set was called");
263 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
266 bool _ret_var = default(bool);
269 _ret_var = ((LayoutPartContent)ws.Target).SetContent(content);
273 Eina.Log.Warning($"Callback error: {e.ToString()}");
274 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
282 return efl_content_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), content);
286 private static efl_content_set_delegate efl_content_set_static_delegate;
288 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
289 private delegate Efl.Gfx.IEntity efl_content_unset_delegate(System.IntPtr obj, System.IntPtr pd);
291 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
292 public delegate Efl.Gfx.IEntity efl_content_unset_api_delegate(System.IntPtr obj);
294 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");
296 private static Efl.Gfx.IEntity content_unset(System.IntPtr obj, System.IntPtr pd)
298 Eina.Log.Debug("function efl_content_unset was called");
299 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
302 Efl.Gfx.IEntity _ret_var = default(Efl.Gfx.IEntity);
305 _ret_var = ((LayoutPartContent)ws.Target).UnsetContent();
309 Eina.Log.Warning($"Callback error: {e.ToString()}");
310 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
318 return efl_content_unset_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
322 private static efl_content_unset_delegate efl_content_unset_static_delegate;
324 #pragma warning restore CA1707, CS1591, SA1300, SA1600
333 #pragma warning disable CS1591
334 public static class Efl_UiLayoutPartContent_ExtensionMethods {
335 public static Efl.BindableProperty<Efl.Gfx.IEntity> Content<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<Efl.Ui.LayoutPartContent, T>magic = null) where T : Efl.Ui.LayoutPartContent {
336 return new Efl.BindableProperty<Efl.Gfx.IEntity>("content", fac);
340 #pragma warning restore CS1591