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>Common interface for objects that have a single sub-object as content.
11 /// This is used for the default content part of widgets, as well as for individual parts through <see cref="Efl.IPart"/>.
12 /// (Since EFL 1.22)</summary>
13 [Efl.IContentConcrete.NativeMethods]
14 public interface IContent :
15 Efl.Eo.IWrapper, IDisposable
17 /// <summary>Sub-object currently set as this object's single content.
18 /// 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).
19 /// (Since EFL 1.22)</summary>
20 /// <returns>The sub-object.</returns>
21 Efl.Gfx.IEntity GetContent();
22 /// <summary>Sub-object currently set as this object's single content.
23 /// 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).
24 /// (Since EFL 1.22)</summary>
25 /// <param name="content">The sub-object.</param>
26 /// <returns><c>true</c> if <c>content</c> was successfully swallowed.</returns>
27 bool SetContent(Efl.Gfx.IEntity content);
28 /// <summary>Remove the sub-object currently set as content of this object and return it. This object becomes empty.
29 /// (Since EFL 1.22)</summary>
30 /// <returns>Unswallowed object</returns>
31 Efl.Gfx.IEntity UnsetContent();
32 /// <summary>Sent after the content is set or unset using the current content object.
33 /// (Since EFL 1.22)</summary>
34 event EventHandler<Efl.IContentContentChangedEvt_Args> ContentChangedEvt;
35 /// <summary>Sub-object currently set as this object's single content.
36 /// 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).
37 /// (Since EFL 1.22)</summary>
38 /// <value>The sub-object.</value>
39 Efl.Gfx.IEntity Content {
44 ///<summary>Event argument wrapper for event <see cref="Efl.IContent.ContentChangedEvt"/>.</summary>
45 public class IContentContentChangedEvt_Args : EventArgs {
46 ///<summary>Actual event payload.</summary>
47 public Efl.Gfx.IEntity arg { get; set; }
49 /// <summary>Common interface for objects that have a single sub-object as content.
50 /// This is used for the default content part of widgets, as well as for individual parts through <see cref="Efl.IPart"/>.
51 /// (Since EFL 1.22)</summary>
52 sealed public class IContentConcrete :
57 ///<summary>Pointer to the native class description.</summary>
58 public override System.IntPtr NativeClass
62 if (((object)this).GetType() == typeof(IContentConcrete))
64 return GetEflClassStatic();
68 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
73 [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
74 efl_content_interface_get();
75 /// <summary>Initializes a new instance of the <see cref="IContent"/> class.
76 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
77 private IContentConcrete(System.IntPtr raw) : base(raw)
81 /// <summary>Sent after the content is set or unset using the current content object.
82 /// (Since EFL 1.22)</summary>
83 public event EventHandler<Efl.IContentContentChangedEvt_Args> ContentChangedEvt
89 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
91 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
94 Efl.IContentContentChangedEvt_Args args = new Efl.IContentContentChangedEvt_Args();
95 args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
98 value?.Invoke(obj, args);
102 Eina.Log.Error(e.ToString());
103 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
108 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
109 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
117 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
118 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
122 ///<summary>Method to raise event ContentChangedEvt.</summary>
123 public void OnContentChangedEvt(Efl.IContentContentChangedEvt_Args e)
125 var key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
126 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
127 if (desc == IntPtr.Zero)
129 Eina.Log.Error($"Failed to get native event {key}");
133 IntPtr info = e.arg.NativeHandle;
134 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
136 /// <summary>Sub-object currently set as this object's single content.
137 /// 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).
138 /// (Since EFL 1.22)</summary>
139 /// <returns>The sub-object.</returns>
140 public Efl.Gfx.IEntity GetContent() {
141 var _ret_var = Efl.IContentConcrete.NativeMethods.efl_content_get_ptr.Value.Delegate(this.NativeHandle);
142 Eina.Error.RaiseIfUnhandledException();
145 /// <summary>Sub-object currently set as this object's single content.
146 /// 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).
147 /// (Since EFL 1.22)</summary>
148 /// <param name="content">The sub-object.</param>
149 /// <returns><c>true</c> if <c>content</c> was successfully swallowed.</returns>
150 public bool SetContent(Efl.Gfx.IEntity content) {
151 var _ret_var = Efl.IContentConcrete.NativeMethods.efl_content_set_ptr.Value.Delegate(this.NativeHandle,content);
152 Eina.Error.RaiseIfUnhandledException();
155 /// <summary>Remove the sub-object currently set as content of this object and return it. This object becomes empty.
156 /// (Since EFL 1.22)</summary>
157 /// <returns>Unswallowed object</returns>
158 public Efl.Gfx.IEntity UnsetContent() {
159 var _ret_var = Efl.IContentConcrete.NativeMethods.efl_content_unset_ptr.Value.Delegate(this.NativeHandle);
160 Eina.Error.RaiseIfUnhandledException();
163 /// <summary>Sub-object currently set as this object's single content.
164 /// 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).
165 /// (Since EFL 1.22)</summary>
166 /// <value>The sub-object.</value>
167 public Efl.Gfx.IEntity Content {
168 get { return GetContent(); }
169 set { SetContent(value); }
171 private static IntPtr GetEflClassStatic()
173 return Efl.IContentConcrete.efl_content_interface_get();
175 /// <summary>Wrapper for native methods and virtual method delegates.
176 /// For internal use by generated code only.</summary>
177 public class NativeMethods : Efl.Eo.NativeClass
179 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
180 /// <summary>Gets the list of Eo operations to override.</summary>
181 /// <returns>The list of Eo operations to be overload.</returns>
182 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
184 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
185 var methods = Efl.Eo.Globals.GetUserMethods(type);
187 if (efl_content_get_static_delegate == null)
189 efl_content_get_static_delegate = new efl_content_get_delegate(content_get);
192 if (methods.FirstOrDefault(m => m.Name == "GetContent") != null)
194 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) });
197 if (efl_content_set_static_delegate == null)
199 efl_content_set_static_delegate = new efl_content_set_delegate(content_set);
202 if (methods.FirstOrDefault(m => m.Name == "SetContent") != null)
204 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) });
207 if (efl_content_unset_static_delegate == null)
209 efl_content_unset_static_delegate = new efl_content_unset_delegate(content_unset);
212 if (methods.FirstOrDefault(m => m.Name == "UnsetContent") != null)
214 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) });
219 /// <summary>Returns the Eo class for the native methods of this class.</summary>
220 /// <returns>The native class pointer.</returns>
221 public override IntPtr GetEflClass()
223 return Efl.IContentConcrete.efl_content_interface_get();
226 #pragma warning disable CA1707, CS1591, SA1300, SA1600
228 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
229 private delegate Efl.Gfx.IEntity efl_content_get_delegate(System.IntPtr obj, System.IntPtr pd);
231 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
232 public delegate Efl.Gfx.IEntity efl_content_get_api_delegate(System.IntPtr obj);
234 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");
236 private static Efl.Gfx.IEntity content_get(System.IntPtr obj, System.IntPtr pd)
238 Eina.Log.Debug("function efl_content_get was called");
239 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
242 Efl.Gfx.IEntity _ret_var = default(Efl.Gfx.IEntity);
245 _ret_var = ((IContent)ws.Target).GetContent();
249 Eina.Log.Warning($"Callback error: {e.ToString()}");
250 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
258 return efl_content_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
262 private static efl_content_get_delegate efl_content_get_static_delegate;
264 [return: MarshalAs(UnmanagedType.U1)]
265 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);
267 [return: MarshalAs(UnmanagedType.U1)]
268 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);
270 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");
272 private static bool content_set(System.IntPtr obj, System.IntPtr pd, Efl.Gfx.IEntity content)
274 Eina.Log.Debug("function efl_content_set was called");
275 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
278 bool _ret_var = default(bool);
281 _ret_var = ((IContent)ws.Target).SetContent(content);
285 Eina.Log.Warning($"Callback error: {e.ToString()}");
286 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
294 return efl_content_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), content);
298 private static efl_content_set_delegate efl_content_set_static_delegate;
300 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
301 private delegate Efl.Gfx.IEntity efl_content_unset_delegate(System.IntPtr obj, System.IntPtr pd);
303 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
304 public delegate Efl.Gfx.IEntity efl_content_unset_api_delegate(System.IntPtr obj);
306 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");
308 private static Efl.Gfx.IEntity content_unset(System.IntPtr obj, System.IntPtr pd)
310 Eina.Log.Debug("function efl_content_unset was called");
311 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
314 Efl.Gfx.IEntity _ret_var = default(Efl.Gfx.IEntity);
317 _ret_var = ((IContent)ws.Target).UnsetContent();
321 Eina.Log.Warning($"Callback error: {e.ToString()}");
322 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
330 return efl_content_unset_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
334 private static efl_content_unset_delegate efl_content_unset_static_delegate;
336 #pragma warning restore CA1707, CS1591, SA1300, SA1600