1 #pragma warning disable CS1591
3 using System.Runtime.InteropServices;
4 using System.Collections.Generic;
6 using System.Threading;
7 using System.ComponentModel;
12 /// <summary>Efl Gfx Text Class interface</summary>
13 [Efl.Gfx.ITextClassConcrete.NativeMethods]
14 public interface ITextClass :
15 Efl.Eo.IWrapper, IDisposable
17 /// <summary>Get font and font size from edje text class.
18 /// This function gets the font and the font size from text class. The font string will only be valid until the text class is changed or the edje object is deleted.</summary>
19 /// <param name="text_class">The text class name</param>
20 /// <param name="font">Font name</param>
21 /// <param name="size">Font Size</param>
22 /// <returns><c>true</c>, on success or <c>false</c>, on error</returns>
23 bool GetTextClass(System.String text_class, out System.String font, out Efl.Font.Size size);
24 /// <summary>Set Edje text class.
25 /// This function sets the text class for the Edje.</summary>
26 /// <param name="text_class">The text class name</param>
27 /// <param name="font">Font name</param>
28 /// <param name="size">Font Size</param>
29 /// <returns><c>true</c>, on success or <c>false</c>, on error</returns>
30 bool SetTextClass(System.String text_class, System.String font, Efl.Font.Size size);
31 /// <summary>Delete the text class.
32 /// This function deletes any values for the specified text class.
34 /// Deleting the text class will revert it to the values defined by <see cref="Efl.Gfx.ITextClass.GetTextClass"/> or the text class defined in the theme file.</summary>
35 /// <param name="text_class">The text class to be deleted.</param>
36 void DelTextClass(System.String text_class);
38 /// <summary>Efl Gfx Text Class interface</summary>
39 sealed public class ITextClassConcrete :
44 ///<summary>Pointer to the native class description.</summary>
45 public System.IntPtr NativeClass
49 if (((object)this).GetType() == typeof(ITextClassConcrete))
51 return GetEflClassStatic();
55 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
60 private System.IntPtr handle;
61 ///<summary>Pointer to the native instance.</summary>
62 public System.IntPtr NativeHandle
64 get { return handle; }
67 [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
68 efl_gfx_text_class_interface_get();
69 /// <summary>Initializes a new instance of the <see cref="ITextClass"/> class.
70 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
71 private ITextClassConcrete(System.IntPtr raw)
75 ///<summary>Destructor.</summary>
81 ///<summary>Releases the underlying native instance.</summary>
82 private void Dispose(bool disposing)
84 if (handle != System.IntPtr.Zero)
89 IntPtr gcHandlePtr = IntPtr.Zero;
92 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
96 Monitor.Enter(Efl.All.InitLock);
97 if (Efl.All.MainLoopInitialized)
99 Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
102 Monitor.Exit(Efl.All.InitLock);
108 ///<summary>Releases the underlying native instance.</summary>
109 public void Dispose()
112 GC.SuppressFinalize(this);
115 /// <summary>Verifies if the given object is equal to this one.</summary>
116 /// <param name="instance">The object to compare to.</param>
117 /// <returns>True if both objects point to the same native object.</returns>
118 public override bool Equals(object instance)
120 var other = instance as Efl.Object;
125 return this.NativeHandle == other.NativeHandle;
128 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
129 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
130 public override int GetHashCode()
132 return this.NativeHandle.ToInt32();
135 /// <summary>Turns the native pointer into a string representation.</summary>
136 /// <returns>A string with the type and the native pointer for this object.</returns>
137 public override String ToString()
139 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
142 /// <summary>Get font and font size from edje text class.
143 /// This function gets the font and the font size from text class. The font string will only be valid until the text class is changed or the edje object is deleted.</summary>
144 /// <param name="text_class">The text class name</param>
145 /// <param name="font">Font name</param>
146 /// <param name="size">Font Size</param>
147 /// <returns><c>true</c>, on success or <c>false</c>, on error</returns>
148 public bool GetTextClass(System.String text_class, out System.String font, out Efl.Font.Size size) {
149 var _ret_var = Efl.Gfx.ITextClassConcrete.NativeMethods.efl_gfx_text_class_get_ptr.Value.Delegate(this.NativeHandle,text_class, out font, out size);
150 Eina.Error.RaiseIfUnhandledException();
153 /// <summary>Set Edje text class.
154 /// This function sets the text class for the Edje.</summary>
155 /// <param name="text_class">The text class name</param>
156 /// <param name="font">Font name</param>
157 /// <param name="size">Font Size</param>
158 /// <returns><c>true</c>, on success or <c>false</c>, on error</returns>
159 public bool SetTextClass(System.String text_class, System.String font, Efl.Font.Size size) {
160 var _ret_var = Efl.Gfx.ITextClassConcrete.NativeMethods.efl_gfx_text_class_set_ptr.Value.Delegate(this.NativeHandle,text_class, font, size);
161 Eina.Error.RaiseIfUnhandledException();
164 /// <summary>Delete the text class.
165 /// This function deletes any values for the specified text class.
167 /// Deleting the text class will revert it to the values defined by <see cref="Efl.Gfx.ITextClass.GetTextClass"/> or the text class defined in the theme file.</summary>
168 /// <param name="text_class">The text class to be deleted.</param>
169 public void DelTextClass(System.String text_class) {
170 Efl.Gfx.ITextClassConcrete.NativeMethods.efl_gfx_text_class_del_ptr.Value.Delegate(this.NativeHandle,text_class);
171 Eina.Error.RaiseIfUnhandledException();
173 private static IntPtr GetEflClassStatic()
175 return Efl.Gfx.ITextClassConcrete.efl_gfx_text_class_interface_get();
177 /// <summary>Wrapper for native methods and virtual method delegates.
178 /// For internal use by generated code only.</summary>
179 public class NativeMethods : Efl.Eo.NativeClass
181 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
182 /// <summary>Gets the list of Eo operations to override.</summary>
183 /// <returns>The list of Eo operations to be overload.</returns>
184 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
186 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
187 var methods = Efl.Eo.Globals.GetUserMethods(type);
189 if (efl_gfx_text_class_get_static_delegate == null)
191 efl_gfx_text_class_get_static_delegate = new efl_gfx_text_class_get_delegate(text_class_get);
194 if (methods.FirstOrDefault(m => m.Name == "GetTextClass") != null)
196 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_text_class_get"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_text_class_get_static_delegate) });
199 if (efl_gfx_text_class_set_static_delegate == null)
201 efl_gfx_text_class_set_static_delegate = new efl_gfx_text_class_set_delegate(text_class_set);
204 if (methods.FirstOrDefault(m => m.Name == "SetTextClass") != null)
206 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_text_class_set"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_text_class_set_static_delegate) });
209 if (efl_gfx_text_class_del_static_delegate == null)
211 efl_gfx_text_class_del_static_delegate = new efl_gfx_text_class_del_delegate(text_class_del);
214 if (methods.FirstOrDefault(m => m.Name == "DelTextClass") != null)
216 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gfx_text_class_del"), func = Marshal.GetFunctionPointerForDelegate(efl_gfx_text_class_del_static_delegate) });
221 /// <summary>Returns the Eo class for the native methods of this class.</summary>
222 /// <returns>The native class pointer.</returns>
223 public override IntPtr GetEflClass()
225 return Efl.Gfx.ITextClassConcrete.efl_gfx_text_class_interface_get();
228 #pragma warning disable CA1707, SA1300, SA1600
230 [return: MarshalAs(UnmanagedType.U1)]
231 private delegate bool efl_gfx_text_class_get_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String text_class, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] out System.String font, out Efl.Font.Size size);
233 [return: MarshalAs(UnmanagedType.U1)]
234 public delegate bool efl_gfx_text_class_get_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String text_class, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] out System.String font, out Efl.Font.Size size);
236 public static Efl.Eo.FunctionWrapper<efl_gfx_text_class_get_api_delegate> efl_gfx_text_class_get_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_text_class_get_api_delegate>(Module, "efl_gfx_text_class_get");
238 private static bool text_class_get(System.IntPtr obj, System.IntPtr pd, System.String text_class, out System.String font, out Efl.Font.Size size)
240 Eina.Log.Debug("function efl_gfx_text_class_get was called");
241 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
244 System.String _out_font = default(System.String);
245 size = default(Efl.Font.Size); bool _ret_var = default(bool);
248 _ret_var = ((ITextClass)wrapper).GetTextClass(text_class, out _out_font, out size);
252 Eina.Log.Warning($"Callback error: {e.ToString()}");
253 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
262 return efl_gfx_text_class_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), text_class, out font, out size);
266 private static efl_gfx_text_class_get_delegate efl_gfx_text_class_get_static_delegate;
268 [return: MarshalAs(UnmanagedType.U1)]
269 private delegate bool efl_gfx_text_class_set_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String text_class, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String font, Efl.Font.Size size);
271 [return: MarshalAs(UnmanagedType.U1)]
272 public delegate bool efl_gfx_text_class_set_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String text_class, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String font, Efl.Font.Size size);
274 public static Efl.Eo.FunctionWrapper<efl_gfx_text_class_set_api_delegate> efl_gfx_text_class_set_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_text_class_set_api_delegate>(Module, "efl_gfx_text_class_set");
276 private static bool text_class_set(System.IntPtr obj, System.IntPtr pd, System.String text_class, System.String font, Efl.Font.Size size)
278 Eina.Log.Debug("function efl_gfx_text_class_set was called");
279 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
282 bool _ret_var = default(bool);
285 _ret_var = ((ITextClass)wrapper).SetTextClass(text_class, font, size);
289 Eina.Log.Warning($"Callback error: {e.ToString()}");
290 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
298 return efl_gfx_text_class_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), text_class, font, size);
302 private static efl_gfx_text_class_set_delegate efl_gfx_text_class_set_static_delegate;
305 private delegate void efl_gfx_text_class_del_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String text_class);
308 public delegate void efl_gfx_text_class_del_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String text_class);
310 public static Efl.Eo.FunctionWrapper<efl_gfx_text_class_del_api_delegate> efl_gfx_text_class_del_ptr = new Efl.Eo.FunctionWrapper<efl_gfx_text_class_del_api_delegate>(Module, "efl_gfx_text_class_del");
312 private static void text_class_del(System.IntPtr obj, System.IntPtr pd, System.String text_class)
314 Eina.Log.Debug("function efl_gfx_text_class_del was called");
315 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
321 ((ITextClass)wrapper).DelTextClass(text_class);
325 Eina.Log.Warning($"Callback error: {e.ToString()}");
326 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
333 efl_gfx_text_class_del_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), text_class);
337 private static efl_gfx_text_class_del_delegate efl_gfx_text_class_del_static_delegate;
339 #pragma warning restore CA1707, SA1300, SA1600