b8afe5eb448fb5805d2428205d10eb6955384fb6
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_content.eo.cs
1 #pragma warning disable CS1591
2 using System;
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
5 using System.Linq;
6 using System.Threading;
7 using System.ComponentModel;
8 namespace Efl {
9
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
16 {
17     /// <summary>Sub-object currently set as this object&apos;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&apos;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&apos;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 {
40         get ;
41         set ;
42     }
43 }
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; }
48 }
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 :
53     Efl.Eo.EoWrapper
54     , IContent
55     
56 {
57     ///<summary>Pointer to the native class description.</summary>
58     public override System.IntPtr NativeClass
59     {
60         get
61         {
62             if (((object)this).GetType() == typeof(IContentConcrete))
63             {
64                 return GetEflClassStatic();
65             }
66             else
67             {
68                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
69             }
70         }
71     }
72
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)
78     {
79     }
80
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
84     {
85         add
86         {
87             lock (eventLock)
88             {
89                 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
90                 {
91                     var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
92                     if (obj != null)
93                     {
94                         Efl.IContentContentChangedEvt_Args args = new Efl.IContentContentChangedEvt_Args();
95                         args.arg = (Efl.Eo.Globals.CreateWrapperFor(evt.Info) as Efl.Gfx.IEntityConcrete);
96                         try
97                         {
98                             value?.Invoke(obj, args);
99                         }
100                         catch (Exception e)
101                         {
102                             Eina.Log.Error(e.ToString());
103                             Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
104                         }
105                     }
106                 };
107
108                 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
109                 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
110             }
111         }
112
113         remove
114         {
115             lock (eventLock)
116             {
117                 string key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
118                 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
119             }
120         }
121     }
122     ///<summary>Method to raise event ContentChangedEvt.</summary>
123     public void OnContentChangedEvt(Efl.IContentContentChangedEvt_Args e)
124     {
125         var key = "_EFL_CONTENT_EVENT_CONTENT_CHANGED";
126         IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
127         if (desc == IntPtr.Zero)
128         {
129             Eina.Log.Error($"Failed to get native event {key}");
130             return;
131         }
132
133         IntPtr info = e.arg.NativeHandle;
134         Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, info);
135     }
136     /// <summary>Sub-object currently set as this object&apos;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();
143         return _ret_var;
144  }
145     /// <summary>Sub-object currently set as this object&apos;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();
153                         return _ret_var;
154  }
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();
161         return _ret_var;
162  }
163     /// <summary>Sub-object currently set as this object&apos;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); }
170     }
171     private static IntPtr GetEflClassStatic()
172     {
173         return Efl.IContentConcrete.efl_content_interface_get();
174     }
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
178     {
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)
183         {
184             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
185             var methods = Efl.Eo.Globals.GetUserMethods(type);
186
187             if (efl_content_get_static_delegate == null)
188             {
189                 efl_content_get_static_delegate = new efl_content_get_delegate(content_get);
190             }
191
192             if (methods.FirstOrDefault(m => m.Name == "GetContent") != null)
193             {
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) });
195             }
196
197             if (efl_content_set_static_delegate == null)
198             {
199                 efl_content_set_static_delegate = new efl_content_set_delegate(content_set);
200             }
201
202             if (methods.FirstOrDefault(m => m.Name == "SetContent") != null)
203             {
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) });
205             }
206
207             if (efl_content_unset_static_delegate == null)
208             {
209                 efl_content_unset_static_delegate = new efl_content_unset_delegate(content_unset);
210             }
211
212             if (methods.FirstOrDefault(m => m.Name == "UnsetContent") != null)
213             {
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) });
215             }
216
217             return descs;
218         }
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()
222         {
223             return Efl.IContentConcrete.efl_content_interface_get();
224         }
225
226         #pragma warning disable CA1707, CS1591, SA1300, SA1600
227
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);
230
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);
233
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");
235
236         private static Efl.Gfx.IEntity content_get(System.IntPtr obj, System.IntPtr pd)
237         {
238             Eina.Log.Debug("function efl_content_get was called");
239             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
240             if (ws != null)
241             {
242             Efl.Gfx.IEntity _ret_var = default(Efl.Gfx.IEntity);
243                 try
244                 {
245                     _ret_var = ((IContent)ws.Target).GetContent();
246                 }
247                 catch (Exception e)
248                 {
249                     Eina.Log.Warning($"Callback error: {e.ToString()}");
250                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
251                 }
252
253         return _ret_var;
254
255             }
256             else
257             {
258                 return efl_content_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
259             }
260         }
261
262         private static efl_content_get_delegate efl_content_get_static_delegate;
263
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);
266
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);
269
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");
271
272         private static bool content_set(System.IntPtr obj, System.IntPtr pd, Efl.Gfx.IEntity content)
273         {
274             Eina.Log.Debug("function efl_content_set was called");
275             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
276             if (ws != null)
277             {
278                                     bool _ret_var = default(bool);
279                 try
280                 {
281                     _ret_var = ((IContent)ws.Target).SetContent(content);
282                 }
283                 catch (Exception e)
284                 {
285                     Eina.Log.Warning($"Callback error: {e.ToString()}");
286                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
287                 }
288
289                         return _ret_var;
290
291             }
292             else
293             {
294                 return efl_content_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), content);
295             }
296         }
297
298         private static efl_content_set_delegate efl_content_set_static_delegate;
299
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);
302
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);
305
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");
307
308         private static Efl.Gfx.IEntity content_unset(System.IntPtr obj, System.IntPtr pd)
309         {
310             Eina.Log.Debug("function efl_content_unset was called");
311             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
312             if (ws != null)
313             {
314             Efl.Gfx.IEntity _ret_var = default(Efl.Gfx.IEntity);
315                 try
316                 {
317                     _ret_var = ((IContent)ws.Target).UnsetContent();
318                 }
319                 catch (Exception e)
320                 {
321                     Eina.Log.Warning($"Callback error: {e.ToString()}");
322                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
323                 }
324
325         return _ret_var;
326
327             }
328             else
329             {
330                 return efl_content_unset_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
331             }
332         }
333
334         private static efl_content_unset_delegate efl_content_unset_static_delegate;
335
336         #pragma warning restore CA1707, CS1591, SA1300, SA1600
337
338 }
339 }
340 }
341