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>The bg (background) widget is used for setting (solid) background decorations
13 /// in a window (unless it has transparency enabled) or on any container object. It works just like an image but has some properties useful for backgrounds, such as setting it to tiled, centered, scaled or stretched.</summary>
14 [Efl.Ui.ILegacyConcrete.NativeMethods]
15 public interface ILegacy :
16 Efl.Eo.IWrapper, IDisposable
19 /// <summary>The bg (background) widget is used for setting (solid) background decorations
20 /// in a window (unless it has transparency enabled) or on any container object. It works just like an image but has some properties useful for backgrounds, such as setting it to tiled, centered, scaled or stretched.</summary>
21 sealed public class ILegacyConcrete :
26 ///<summary>Pointer to the native class description.</summary>
27 public System.IntPtr NativeClass
31 if (((object)this).GetType() == typeof(ILegacyConcrete))
33 return GetEflClassStatic();
37 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
42 private System.IntPtr handle;
43 ///<summary>Pointer to the native instance.</summary>
44 public System.IntPtr NativeHandle
46 get { return handle; }
49 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
50 efl_ui_legacy_interface_get();
51 /// <summary>Initializes a new instance of the <see cref="ILegacy"/> class.
52 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
53 private ILegacyConcrete(System.IntPtr raw)
57 ///<summary>Destructor.</summary>
63 ///<summary>Releases the underlying native instance.</summary>
64 private void Dispose(bool disposing)
66 if (handle != System.IntPtr.Zero)
71 IntPtr gcHandlePtr = IntPtr.Zero;
74 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
78 Monitor.Enter(Efl.All.InitLock);
79 if (Efl.All.MainLoopInitialized)
81 Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
84 Monitor.Exit(Efl.All.InitLock);
90 ///<summary>Releases the underlying native instance.</summary>
94 GC.SuppressFinalize(this);
97 /// <summary>Verifies if the given object is equal to this one.</summary>
98 /// <param name="instance">The object to compare to.</param>
99 /// <returns>True if both objects point to the same native object.</returns>
100 public override bool Equals(object instance)
102 var other = instance as Efl.Object;
107 return this.NativeHandle == other.NativeHandle;
110 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
111 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
112 public override int GetHashCode()
114 return this.NativeHandle.ToInt32();
117 /// <summary>Turns the native pointer into a string representation.</summary>
118 /// <returns>A string with the type and the native pointer for this object.</returns>
119 public override String ToString()
121 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
124 private static IntPtr GetEflClassStatic()
126 return Efl.Ui.ILegacyConcrete.efl_ui_legacy_interface_get();
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
132 /// <summary>Gets the list of Eo operations to override.</summary>
133 /// <returns>The list of Eo operations to be overload.</returns>
134 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
136 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
139 /// <summary>Returns the Eo class for the native methods of this class.</summary>
140 /// <returns>The native class pointer.</returns>
141 public override IntPtr GetEflClass()
143 return Efl.Ui.ILegacyConcrete.efl_ui_legacy_interface_get();
146 #pragma warning disable CA1707, SA1300, SA1600
148 #pragma warning restore CA1707, SA1300, SA1600