599e1c8d886c0f2e07dcbdce1a4ae886a907ac52
[platform/core/csapi/tizenfx.git] / internals / src / EflSharp / EflSharp / efl / efl_ui_format.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 namespace Ui {
11
12 /// <param name="str">the formated string to be appended by user.</param>
13 /// <param name="value">The <see cref="Eina.Value"/> passed by <c>obj</c>.</param>
14 public delegate void FormatFuncCb(Eina.Strbuf str, Eina.Value value);
15 public delegate void FormatFuncCbInternal(IntPtr data, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufKeepOwnershipMarshaler))] Eina.Strbuf str,  Eina.ValueNative value);
16 internal class FormatFuncCbWrapper : IDisposable
17 {
18
19     private FormatFuncCbInternal _cb;
20     private IntPtr _cb_data;
21     private EinaFreeCb _cb_free_cb;
22
23     internal FormatFuncCbWrapper (FormatFuncCbInternal _cb, IntPtr _cb_data, EinaFreeCb _cb_free_cb)
24     {
25         this._cb = _cb;
26         this._cb_data = _cb_data;
27         this._cb_free_cb = _cb_free_cb;
28     }
29
30     ~FormatFuncCbWrapper()
31     {
32         Dispose(false);
33     }
34
35     protected virtual void Dispose(bool disposing)
36     {
37         if (this._cb_free_cb != null)
38         {
39             if (disposing)
40             {
41                 this._cb_free_cb(this._cb_data);
42             }
43             else
44             {
45                 Efl.Eo.Globals.ThreadSafeFreeCbExec(this._cb_free_cb, this._cb_data);
46             }
47             this._cb_free_cb = null;
48             this._cb_data = IntPtr.Zero;
49             this._cb = null;
50         }
51     }
52
53     public void Dispose()
54     {
55         Dispose(true);
56         GC.SuppressFinalize(this);
57     }
58
59     internal void ManagedCb(Eina.Strbuf str,Eina.Value value)
60     {
61                                                         _cb(_cb_data, str, value);
62         Eina.Error.RaiseIfUnhandledException();
63                                             }
64
65         internal static void Cb(IntPtr cb_data, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufKeepOwnershipMarshaler))] Eina.Strbuf str,  Eina.ValueNative value)
66     {
67         GCHandle handle = GCHandle.FromIntPtr(cb_data);
68         FormatFuncCb cb = (FormatFuncCb)handle.Target;
69                                                             
70         try {
71             cb(str, value);
72         } catch (Exception e) {
73             Eina.Log.Warning($"Callback error: {e.ToString()}");
74             Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
75         }
76                                             }
77 }
78 }
79
80 }
81
82 namespace Efl {
83
84 namespace Ui {
85
86 /// <summary>interface class for format_func</summary>
87 [Efl.Ui.IFormatConcrete.NativeMethods]
88 public interface IFormat : 
89     Efl.Eo.IWrapper, IDisposable
90 {
91     /// <summary>Set the format function pointer to format the string.</summary>
92 /// <param name="func">The format function callback</param>
93 void SetFormatCb(Efl.Ui.FormatFuncCb func);
94     /// <summary>Control the format string for a given units label
95 /// If <c>NULL</c> is passed to <c>format</c>, it will hide <c>obj</c>&apos;s units area completely. If not, it&apos;ll set the &lt;b&gt;format string&lt;/b&gt; for the units label text. The units label is provided as a floating point value, so the units text can display at most one floating point value. Note that the units label is optional. Use a format string such as &quot;%1.2f meters&quot; for example.
96 /// 
97 /// Note: The default format string is an integer percentage, as in $&quot;%.0f %%&quot;.</summary>
98 /// <returns>The format string for <c>obj</c>&apos;s units label.</returns>
99 System.String GetFormatString();
100     /// <summary>Control the format string for a given units label
101 /// If <c>NULL</c> is passed to <c>format</c>, it will hide <c>obj</c>&apos;s units area completely. If not, it&apos;ll set the &lt;b&gt;format string&lt;/b&gt; for the units label text. The units label is provided as a floating point value, so the units text can display at most one floating point value. Note that the units label is optional. Use a format string such as &quot;%1.2f meters&quot; for example.
102 /// 
103 /// Note: The default format string is an integer percentage, as in $&quot;%.0f %%&quot;.</summary>
104 /// <param name="units">The format string for <c>obj</c>&apos;s units label.</param>
105 void SetFormatString(System.String units);
106                 /// <summary>Set the format function pointer to format the string.</summary>
107     /// <value>The format function callback</value>
108     Efl.Ui.FormatFuncCb FormatCb {
109         set ;
110     }
111     /// <summary>Control the format string for a given units label
112     /// If <c>NULL</c> is passed to <c>format</c>, it will hide <c>obj</c>&apos;s units area completely. If not, it&apos;ll set the &lt;b&gt;format string&lt;/b&gt; for the units label text. The units label is provided as a floating point value, so the units text can display at most one floating point value. Note that the units label is optional. Use a format string such as &quot;%1.2f meters&quot; for example.
113     /// 
114     /// Note: The default format string is an integer percentage, as in $&quot;%.0f %%&quot;.</summary>
115     /// <value>The format string for <c>obj</c>&apos;s units label.</value>
116     System.String FormatString {
117         get ;
118         set ;
119     }
120 }
121 /// <summary>interface class for format_func</summary>
122 sealed public class IFormatConcrete :
123     Efl.Eo.EoWrapper
124     , IFormat
125     
126 {
127     ///<summary>Pointer to the native class description.</summary>
128     public override System.IntPtr NativeClass
129     {
130         get
131         {
132             if (((object)this).GetType() == typeof(IFormatConcrete))
133             {
134                 return GetEflClassStatic();
135             }
136             else
137             {
138                 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
139             }
140         }
141     }
142
143     [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
144         efl_ui_format_mixin_get();
145     /// <summary>Initializes a new instance of the <see cref="IFormat"/> class.
146     /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
147     private IFormatConcrete(System.IntPtr raw) : base(raw)
148     {
149     }
150
151     /// <summary>Set the format function pointer to format the string.</summary>
152     /// <param name="func">The format function callback</param>
153     public void SetFormatCb(Efl.Ui.FormatFuncCb func) {
154                          GCHandle func_handle = GCHandle.Alloc(func);
155         Efl.Ui.IFormatConcrete.NativeMethods.efl_ui_format_cb_set_ptr.Value.Delegate(this.NativeHandle,GCHandle.ToIntPtr(func_handle), Efl.Ui.FormatFuncCbWrapper.Cb, Efl.Eo.Globals.free_gchandle);
156         Eina.Error.RaiseIfUnhandledException();
157                          }
158     /// <summary>Control the format string for a given units label
159     /// If <c>NULL</c> is passed to <c>format</c>, it will hide <c>obj</c>&apos;s units area completely. If not, it&apos;ll set the &lt;b&gt;format string&lt;/b&gt; for the units label text. The units label is provided as a floating point value, so the units text can display at most one floating point value. Note that the units label is optional. Use a format string such as &quot;%1.2f meters&quot; for example.
160     /// 
161     /// Note: The default format string is an integer percentage, as in $&quot;%.0f %%&quot;.</summary>
162     /// <returns>The format string for <c>obj</c>&apos;s units label.</returns>
163     public System.String GetFormatString() {
164          var _ret_var = Efl.Ui.IFormatConcrete.NativeMethods.efl_ui_format_string_get_ptr.Value.Delegate(this.NativeHandle);
165         Eina.Error.RaiseIfUnhandledException();
166         return _ret_var;
167  }
168     /// <summary>Control the format string for a given units label
169     /// If <c>NULL</c> is passed to <c>format</c>, it will hide <c>obj</c>&apos;s units area completely. If not, it&apos;ll set the &lt;b&gt;format string&lt;/b&gt; for the units label text. The units label is provided as a floating point value, so the units text can display at most one floating point value. Note that the units label is optional. Use a format string such as &quot;%1.2f meters&quot; for example.
170     /// 
171     /// Note: The default format string is an integer percentage, as in $&quot;%.0f %%&quot;.</summary>
172     /// <param name="units">The format string for <c>obj</c>&apos;s units label.</param>
173     public void SetFormatString(System.String units) {
174                                  Efl.Ui.IFormatConcrete.NativeMethods.efl_ui_format_string_set_ptr.Value.Delegate(this.NativeHandle,units);
175         Eina.Error.RaiseIfUnhandledException();
176                          }
177     /// <summary>Set the format function pointer to format the string.</summary>
178     /// <value>The format function callback</value>
179     public Efl.Ui.FormatFuncCb FormatCb {
180         set { SetFormatCb(value); }
181     }
182     /// <summary>Control the format string for a given units label
183     /// If <c>NULL</c> is passed to <c>format</c>, it will hide <c>obj</c>&apos;s units area completely. If not, it&apos;ll set the &lt;b&gt;format string&lt;/b&gt; for the units label text. The units label is provided as a floating point value, so the units text can display at most one floating point value. Note that the units label is optional. Use a format string such as &quot;%1.2f meters&quot; for example.
184     /// 
185     /// Note: The default format string is an integer percentage, as in $&quot;%.0f %%&quot;.</summary>
186     /// <value>The format string for <c>obj</c>&apos;s units label.</value>
187     public System.String FormatString {
188         get { return GetFormatString(); }
189         set { SetFormatString(value); }
190     }
191     private static IntPtr GetEflClassStatic()
192     {
193         return Efl.Ui.IFormatConcrete.efl_ui_format_mixin_get();
194     }
195     /// <summary>Wrapper for native methods and virtual method delegates.
196     /// For internal use by generated code only.</summary>
197     public class NativeMethods  : Efl.Eo.NativeClass
198     {
199         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Efl);
200         /// <summary>Gets the list of Eo operations to override.</summary>
201         /// <returns>The list of Eo operations to be overload.</returns>
202         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
203         {
204             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
205             var methods = Efl.Eo.Globals.GetUserMethods(type);
206
207             if (efl_ui_format_cb_set_static_delegate == null)
208             {
209                 efl_ui_format_cb_set_static_delegate = new efl_ui_format_cb_set_delegate(format_cb_set);
210             }
211
212             if (methods.FirstOrDefault(m => m.Name == "SetFormatCb") != null)
213             {
214                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_format_cb_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_format_cb_set_static_delegate) });
215             }
216
217             if (efl_ui_format_string_get_static_delegate == null)
218             {
219                 efl_ui_format_string_get_static_delegate = new efl_ui_format_string_get_delegate(format_string_get);
220             }
221
222             if (methods.FirstOrDefault(m => m.Name == "GetFormatString") != null)
223             {
224                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_format_string_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_format_string_get_static_delegate) });
225             }
226
227             if (efl_ui_format_string_set_static_delegate == null)
228             {
229                 efl_ui_format_string_set_static_delegate = new efl_ui_format_string_set_delegate(format_string_set);
230             }
231
232             if (methods.FirstOrDefault(m => m.Name == "SetFormatString") != null)
233             {
234                 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_format_string_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_format_string_set_static_delegate) });
235             }
236
237             return descs;
238         }
239         /// <summary>Returns the Eo class for the native methods of this class.</summary>
240         /// <returns>The native class pointer.</returns>
241         public override IntPtr GetEflClass()
242         {
243             return Efl.Ui.IFormatConcrete.efl_ui_format_mixin_get();
244         }
245
246         #pragma warning disable CA1707, CS1591, SA1300, SA1600
247
248         
249         private delegate void efl_ui_format_cb_set_delegate(System.IntPtr obj, System.IntPtr pd,  IntPtr func_data, Efl.Ui.FormatFuncCbInternal func, EinaFreeCb func_free_cb);
250
251         
252         public delegate void efl_ui_format_cb_set_api_delegate(System.IntPtr obj,  IntPtr func_data, Efl.Ui.FormatFuncCbInternal func, EinaFreeCb func_free_cb);
253
254         public static Efl.Eo.FunctionWrapper<efl_ui_format_cb_set_api_delegate> efl_ui_format_cb_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_format_cb_set_api_delegate>(Module, "efl_ui_format_cb_set");
255
256         private static void format_cb_set(System.IntPtr obj, System.IntPtr pd, IntPtr func_data, Efl.Ui.FormatFuncCbInternal func, EinaFreeCb func_free_cb)
257         {
258             Eina.Log.Debug("function efl_ui_format_cb_set was called");
259             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
260             if (ws != null)
261             {
262                             Efl.Ui.FormatFuncCbWrapper func_wrapper = new Efl.Ui.FormatFuncCbWrapper(func, func_data, func_free_cb);
263             
264                 try
265                 {
266                     ((IFormat)ws.Target).SetFormatCb(func_wrapper.ManagedCb);
267                 }
268                 catch (Exception e)
269                 {
270                     Eina.Log.Warning($"Callback error: {e.ToString()}");
271                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
272                 }
273
274                         
275             }
276             else
277             {
278                 efl_ui_format_cb_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), func_data, func, func_free_cb);
279             }
280         }
281
282         private static efl_ui_format_cb_set_delegate efl_ui_format_cb_set_static_delegate;
283
284         [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]
285         private delegate System.String efl_ui_format_string_get_delegate(System.IntPtr obj, System.IntPtr pd);
286
287         [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]
288         public delegate System.String efl_ui_format_string_get_api_delegate(System.IntPtr obj);
289
290         public static Efl.Eo.FunctionWrapper<efl_ui_format_string_get_api_delegate> efl_ui_format_string_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_format_string_get_api_delegate>(Module, "efl_ui_format_string_get");
291
292         private static System.String format_string_get(System.IntPtr obj, System.IntPtr pd)
293         {
294             Eina.Log.Debug("function efl_ui_format_string_get was called");
295             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
296             if (ws != null)
297             {
298             System.String _ret_var = default(System.String);
299                 try
300                 {
301                     _ret_var = ((IFormat)ws.Target).GetFormatString();
302                 }
303                 catch (Exception e)
304                 {
305                     Eina.Log.Warning($"Callback error: {e.ToString()}");
306                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
307                 }
308
309         return _ret_var;
310
311             }
312             else
313             {
314                 return efl_ui_format_string_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
315             }
316         }
317
318         private static efl_ui_format_string_get_delegate efl_ui_format_string_get_static_delegate;
319
320         
321         private delegate void efl_ui_format_string_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String units);
322
323         
324         public delegate void efl_ui_format_string_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String units);
325
326         public static Efl.Eo.FunctionWrapper<efl_ui_format_string_set_api_delegate> efl_ui_format_string_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_format_string_set_api_delegate>(Module, "efl_ui_format_string_set");
327
328         private static void format_string_set(System.IntPtr obj, System.IntPtr pd, System.String units)
329         {
330             Eina.Log.Debug("function efl_ui_format_string_set was called");
331             var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
332             if (ws != null)
333             {
334                                     
335                 try
336                 {
337                     ((IFormat)ws.Target).SetFormatString(units);
338                 }
339                 catch (Exception e)
340                 {
341                     Eina.Log.Warning($"Callback error: {e.ToString()}");
342                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
343                 }
344
345                         
346             }
347             else
348             {
349                 efl_ui_format_string_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), units);
350             }
351         }
352
353         private static efl_ui_format_string_set_delegate efl_ui_format_string_set_static_delegate;
354
355         #pragma warning restore CA1707, CS1591, SA1300, SA1600
356
357 }
358 }
359 }
360
361 }
362