[EflSharp] Update Circle and efl cs files (#916)
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_pack_layout.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>Low-level APIs for object that can lay their children out.
11 /// Used for containers (box, grid).</summary>
12 [Efl.IPackLayoutConcrete.NativeMethods]
13 public interface IPackLayout : 
14     Efl.Eo.IWrapper, IDisposable
15 {
16     /// <summary>Requests EFL to call the <see cref="Efl.IPackLayout.UpdateLayout"/> method on this object.
17 /// This <see cref="Efl.IPackLayout.UpdateLayout"/> may be called asynchronously.</summary>
18 void LayoutRequest();
19     /// <summary>Implementation of this container&apos;s layout algorithm.
20 /// EFL will call this function whenever the contents of this container need to be re-laid out on the canvas.
21 /// 
22 /// This can be overriden to implement custom layout behaviors.</summary>
23 void UpdateLayout();
24             /// <summary>Sent after the layout was updated.</summary>
25     event EventHandler LayoutUpdatedEvt;
26 }
27 /// <summary>Low-level APIs for object that can lay their children out.
28 /// Used for containers (box, grid).</summary>
29 sealed public class IPackLayoutConcrete :
30     Efl.Eo.EoWrapper
31     , IPackLayout
32     
33 {
34     ///<summary>Pointer to the native class description.</summary>
35     public override System.IntPtr NativeClass
36     {
37         get
38         {
39             if (((object)this).GetType() == typeof(IPackLayoutConcrete))
40             {
41                 return GetEflClassStatic();
42             }
43             else
44             {
45                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
46             }
47         }
48     }
49
50     [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
51         efl_pack_layout_interface_get();
52     /// <summary>Initializes a new instance of the <see cref="IPackLayout"/> class.
53     /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
54     private IPackLayoutConcrete(System.IntPtr raw) : base(raw)
55     {
56     }
57
58     /// <summary>Sent after the layout was updated.</summary>
59     public event EventHandler LayoutUpdatedEvt
60     {
61         add
62         {
63             lock (eventLock)
64             {
65                 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
66                 {
67                     var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
68                     if (obj != null)
69                     {
70                         EventArgs args = EventArgs.Empty;
71                         try
72                         {
73                             value?.Invoke(obj, args);
74                         }
75                         catch (Exception e)
76                         {
77                             Eina.Log.Error(e.ToString());
78                             Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
79                         }
80                     }
81                 };
82
83                 string key = "_EFL_PACK_EVENT_LAYOUT_UPDATED";
84                 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
85             }
86         }
87
88         remove
89         {
90             lock (eventLock)
91             {
92                 string key = "_EFL_PACK_EVENT_LAYOUT_UPDATED";
93                 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
94             }
95         }
96     }
97     ///<summary>Method to raise event LayoutUpdatedEvt.</summary>
98     public void OnLayoutUpdatedEvt(EventArgs e)
99     {
100         var key = "_EFL_PACK_EVENT_LAYOUT_UPDATED";
101         IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
102         if (desc == IntPtr.Zero)
103         {
104             Eina.Log.Error($"Failed to get native event {key}");
105             return;
106         }
107
108         Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero);
109     }
110     /// <summary>Requests EFL to call the <see cref="Efl.IPackLayout.UpdateLayout"/> method on this object.
111     /// This <see cref="Efl.IPackLayout.UpdateLayout"/> may be called asynchronously.</summary>
112     public void LayoutRequest() {
113          Efl.IPackLayoutConcrete.NativeMethods.efl_pack_layout_request_ptr.Value.Delegate(this.NativeHandle);
114         Eina.Error.RaiseIfUnhandledException();
115          }
116     /// <summary>Implementation of this container&apos;s layout algorithm.
117     /// EFL will call this function whenever the contents of this container need to be re-laid out on the canvas.
118     /// 
119     /// This can be overriden to implement custom layout behaviors.</summary>
120     public void UpdateLayout() {
121          Efl.IPackLayoutConcrete.NativeMethods.efl_pack_layout_update_ptr.Value.Delegate(this.NativeHandle);
122         Eina.Error.RaiseIfUnhandledException();
123          }
124     private static IntPtr GetEflClassStatic()
125     {
126         return Efl.IPackLayoutConcrete.efl_pack_layout_interface_get();
127     }
128     /// <summary>Wrapper for native methods and virtual method delegates.
129     /// For internal use by generated code only.</summary>
130     public class NativeMethods  : Efl.Eo.NativeClass
131     {
132         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Efl);
133         /// <summary>Gets the list of Eo operations to override.</summary>
134         /// <returns>The list of Eo operations to be overload.</returns>
135         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
136         {
137             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
138             var methods = Efl.Eo.Globals.GetUserMethods(type);
139
140             if (efl_pack_layout_request_static_delegate == null)
141             {
142                 efl_pack_layout_request_static_delegate = new efl_pack_layout_request_delegate(layout_request);
143             }
144
145             if (methods.FirstOrDefault(m => m.Name == "LayoutRequest") != null)
146             {
147                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_pack_layout_request"), func = Marshal.GetFunctionPointerForDelegate(efl_pack_layout_request_static_delegate) });
148             }
149
150             if (efl_pack_layout_update_static_delegate == null)
151             {
152                 efl_pack_layout_update_static_delegate = new efl_pack_layout_update_delegate(layout_update);
153             }
154
155             if (methods.FirstOrDefault(m => m.Name == "UpdateLayout") != null)
156             {
157                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_pack_layout_update"), func = Marshal.GetFunctionPointerForDelegate(efl_pack_layout_update_static_delegate) });
158             }
159
160             return descs;
161         }
162         /// <summary>Returns the Eo class for the native methods of this class.</summary>
163         /// <returns>The native class pointer.</returns>
164         public override IntPtr GetEflClass()
165         {
166             return Efl.IPackLayoutConcrete.efl_pack_layout_interface_get();
167         }
168
169         #pragma warning disable CA1707, CS1591, SA1300, SA1600
170
171         
172         private delegate void efl_pack_layout_request_delegate(System.IntPtr obj, System.IntPtr pd);
173
174         
175         public delegate void efl_pack_layout_request_api_delegate(System.IntPtr obj);
176
177         public static Efl.Eo.FunctionWrapper<efl_pack_layout_request_api_delegate> efl_pack_layout_request_ptr = new Efl.Eo.FunctionWrapper<efl_pack_layout_request_api_delegate>(Module, "efl_pack_layout_request");
178
179         private static void layout_request(System.IntPtr obj, System.IntPtr pd)
180         {
181             Eina.Log.Debug("function efl_pack_layout_request was called");
182             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
183             if (ws != null)
184             {
185             
186                 try
187                 {
188                     ((IPackLayout)ws.Target).LayoutRequest();
189                 }
190                 catch (Exception e)
191                 {
192                     Eina.Log.Warning($"Callback error: {e.ToString()}");
193                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
194                 }
195
196         
197             }
198             else
199             {
200                 efl_pack_layout_request_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
201             }
202         }
203
204         private static efl_pack_layout_request_delegate efl_pack_layout_request_static_delegate;
205
206         
207         private delegate void efl_pack_layout_update_delegate(System.IntPtr obj, System.IntPtr pd);
208
209         
210         public delegate void efl_pack_layout_update_api_delegate(System.IntPtr obj);
211
212         public static Efl.Eo.FunctionWrapper<efl_pack_layout_update_api_delegate> efl_pack_layout_update_ptr = new Efl.Eo.FunctionWrapper<efl_pack_layout_update_api_delegate>(Module, "efl_pack_layout_update");
213
214         private static void layout_update(System.IntPtr obj, System.IntPtr pd)
215         {
216             Eina.Log.Debug("function efl_pack_layout_update was called");
217             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
218             if (ws != null)
219             {
220             
221                 try
222                 {
223                     ((IPackLayout)ws.Target).UpdateLayout();
224                 }
225                 catch (Exception e)
226                 {
227                     Eina.Log.Warning($"Callback error: {e.ToString()}");
228                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
229                 }
230
231         
232             }
233             else
234             {
235                 efl_pack_layout_update_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
236             }
237         }
238
239         private static efl_pack_layout_update_delegate efl_pack_layout_update_static_delegate;
240
241         #pragma warning restore CA1707, CS1591, SA1300, SA1600
242
243 }
244 }
245 }
246