beec6258b06fe4510b660bcc00f08b9d1db85866
[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
124 IFormat
125     
126 {
127     ///<summary>Pointer to the native class description.</summary>
128     public 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     private  System.IntPtr handle;
144     ///<summary>Pointer to the native instance.</summary>
145     public System.IntPtr NativeHandle
146     {
147         get { return handle; }
148     }
149
150     [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
151         efl_ui_format_mixin_get();
152     /// <summary>Initializes a new instance of the <see cref="IFormat"/> class.
153     /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
154     private IFormatConcrete(System.IntPtr raw)
155     {
156         handle = raw;
157     }
158     ///<summary>Destructor.</summary>
159     ~IFormatConcrete()
160     {
161         Dispose(false);
162     }
163
164     ///<summary>Releases the underlying native instance.</summary>
165     private void Dispose(bool disposing)
166     {
167         if (handle != System.IntPtr.Zero)
168         {
169             IntPtr h = handle;
170             handle = IntPtr.Zero;
171
172             IntPtr gcHandlePtr = IntPtr.Zero;
173             if (disposing)
174             {
175                 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
176             }
177             else
178             {
179                 Monitor.Enter(Efl.All.InitLock);
180                 if (Efl.All.MainLoopInitialized)
181                 {
182                     Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
183                 }
184
185                 Monitor.Exit(Efl.All.InitLock);
186             }
187         }
188
189     }
190
191     ///<summary>Releases the underlying native instance.</summary>
192     public void Dispose()
193     {
194         Dispose(true);
195         GC.SuppressFinalize(this);
196     }
197
198     /// <summary>Verifies if the given object is equal to this one.</summary>
199     /// <param name="instance">The object to compare to.</param>
200     /// <returns>True if both objects point to the same native object.</returns>
201     public override bool Equals(object instance)
202     {
203         var other = instance as Efl.Object;
204         if (other == null)
205         {
206             return false;
207         }
208         return this.NativeHandle == other.NativeHandle;
209     }
210
211     /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
212     /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
213     public override int GetHashCode()
214     {
215         return this.NativeHandle.ToInt32();
216     }
217
218     /// <summary>Turns the native pointer into a string representation.</summary>
219     /// <returns>A string with the type and the native pointer for this object.</returns>
220     public override String ToString()
221     {
222         return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
223     }
224
225     /// <summary>Set the format function pointer to format the string.</summary>
226     /// <param name="func">The format function callback</param>
227     public void SetFormatCb(Efl.Ui.FormatFuncCb func) {
228                          GCHandle func_handle = GCHandle.Alloc(func);
229         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);
230         Eina.Error.RaiseIfUnhandledException();
231                          }
232     /// <summary>Control the format string for a given units label
233     /// 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.
234     /// 
235     /// Note: The default format string is an integer percentage, as in $&quot;%.0f %%&quot;.</summary>
236     /// <returns>The format string for <c>obj</c>&apos;s units label.</returns>
237     public System.String GetFormatString() {
238          var _ret_var = Efl.Ui.IFormatConcrete.NativeMethods.efl_ui_format_string_get_ptr.Value.Delegate(this.NativeHandle);
239         Eina.Error.RaiseIfUnhandledException();
240         return _ret_var;
241  }
242     /// <summary>Control the format string for a given units label
243     /// 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.
244     /// 
245     /// Note: The default format string is an integer percentage, as in $&quot;%.0f %%&quot;.</summary>
246     /// <param name="units">The format string for <c>obj</c>&apos;s units label.</param>
247     public void SetFormatString(System.String units) {
248                                  Efl.Ui.IFormatConcrete.NativeMethods.efl_ui_format_string_set_ptr.Value.Delegate(this.NativeHandle,units);
249         Eina.Error.RaiseIfUnhandledException();
250                          }
251     /// <summary>Set the format function pointer to format the string.</summary>
252 /// <value>The format function callback</value>
253     public Efl.Ui.FormatFuncCb FormatCb {
254         set { SetFormatCb(value); }
255     }
256     /// <summary>Control the format string for a given units label
257 /// 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.
258 /// 
259 /// Note: The default format string is an integer percentage, as in $&quot;%.0f %%&quot;.</summary>
260 /// <value>The format string for <c>obj</c>&apos;s units label.</value>
261     public System.String FormatString {
262         get { return GetFormatString(); }
263         set { SetFormatString(value); }
264     }
265     private static IntPtr GetEflClassStatic()
266     {
267         return Efl.Ui.IFormatConcrete.efl_ui_format_mixin_get();
268     }
269     /// <summary>Wrapper for native methods and virtual method delegates.
270     /// For internal use by generated code only.</summary>
271     public class NativeMethods  : Efl.Eo.NativeClass
272     {
273         private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule(    efl.Libs.Efl);
274         /// <summary>Gets the list of Eo operations to override.</summary>
275         /// <returns>The list of Eo operations to be overload.</returns>
276         public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
277         {
278             var descs = new System.Collections.Generic.List<Efl_Op_Description>();
279             var methods = Efl.Eo.Globals.GetUserMethods(type);
280
281             if (efl_ui_format_cb_set_static_delegate == null)
282             {
283                 efl_ui_format_cb_set_static_delegate = new efl_ui_format_cb_set_delegate(format_cb_set);
284             }
285
286             if (methods.FirstOrDefault(m => m.Name == "SetFormatCb") != null)
287             {
288                 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) });
289             }
290
291             if (efl_ui_format_string_get_static_delegate == null)
292             {
293                 efl_ui_format_string_get_static_delegate = new efl_ui_format_string_get_delegate(format_string_get);
294             }
295
296             if (methods.FirstOrDefault(m => m.Name == "GetFormatString") != null)
297             {
298                 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) });
299             }
300
301             if (efl_ui_format_string_set_static_delegate == null)
302             {
303                 efl_ui_format_string_set_static_delegate = new efl_ui_format_string_set_delegate(format_string_set);
304             }
305
306             if (methods.FirstOrDefault(m => m.Name == "SetFormatString") != null)
307             {
308                 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) });
309             }
310
311             return descs;
312         }
313         /// <summary>Returns the Eo class for the native methods of this class.</summary>
314         /// <returns>The native class pointer.</returns>
315         public override IntPtr GetEflClass()
316         {
317             return Efl.Ui.IFormatConcrete.efl_ui_format_mixin_get();
318         }
319
320         #pragma warning disable CA1707, SA1300, SA1600
321
322         
323         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);
324
325         
326         public delegate void efl_ui_format_cb_set_api_delegate(System.IntPtr obj,  IntPtr func_data, Efl.Ui.FormatFuncCbInternal func, EinaFreeCb func_free_cb);
327
328         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");
329
330         private static void format_cb_set(System.IntPtr obj, System.IntPtr pd, IntPtr func_data, Efl.Ui.FormatFuncCbInternal func, EinaFreeCb func_free_cb)
331         {
332             Eina.Log.Debug("function efl_ui_format_cb_set was called");
333             Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
334             if (wrapper != null)
335             {
336                             Efl.Ui.FormatFuncCbWrapper func_wrapper = new Efl.Ui.FormatFuncCbWrapper(func, func_data, func_free_cb);
337             
338                 try
339                 {
340                     ((IFormatConcrete)wrapper).SetFormatCb(func_wrapper.ManagedCb);
341                 }
342                 catch (Exception e)
343                 {
344                     Eina.Log.Warning($"Callback error: {e.ToString()}");
345                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
346                 }
347
348                         
349             }
350             else
351             {
352                 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);
353             }
354         }
355
356         private static efl_ui_format_cb_set_delegate efl_ui_format_cb_set_static_delegate;
357
358         [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]
359         private delegate System.String efl_ui_format_string_get_delegate(System.IntPtr obj, System.IntPtr pd);
360
361         [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]
362         public delegate System.String efl_ui_format_string_get_api_delegate(System.IntPtr obj);
363
364         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");
365
366         private static System.String format_string_get(System.IntPtr obj, System.IntPtr pd)
367         {
368             Eina.Log.Debug("function efl_ui_format_string_get was called");
369             Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
370             if (wrapper != null)
371             {
372             System.String _ret_var = default(System.String);
373                 try
374                 {
375                     _ret_var = ((IFormatConcrete)wrapper).GetFormatString();
376                 }
377                 catch (Exception e)
378                 {
379                     Eina.Log.Warning($"Callback error: {e.ToString()}");
380                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
381                 }
382
383         return _ret_var;
384
385             }
386             else
387             {
388                 return efl_ui_format_string_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
389             }
390         }
391
392         private static efl_ui_format_string_get_delegate efl_ui_format_string_get_static_delegate;
393
394         
395         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);
396
397         
398         public delegate void efl_ui_format_string_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String units);
399
400         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");
401
402         private static void format_string_set(System.IntPtr obj, System.IntPtr pd, System.String units)
403         {
404             Eina.Log.Debug("function efl_ui_format_string_set was called");
405             Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
406             if (wrapper != null)
407             {
408                                     
409                 try
410                 {
411                     ((IFormatConcrete)wrapper).SetFormatString(units);
412                 }
413                 catch (Exception e)
414                 {
415                     Eina.Log.Warning($"Callback error: {e.ToString()}");
416                     Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
417                 }
418
419                         
420             }
421             else
422             {
423                 efl_ui_format_string_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), units);
424             }
425         }
426
427         private static efl_ui_format_string_set_delegate efl_ui_format_string_set_static_delegate;
428
429         #pragma warning restore CA1707, SA1300, SA1600
430
431 }
432 }
433 }
434
435 }
436