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 Ui Theme class</summary>
13 [Efl.Ui.Theme.NativeMethods]
14 public class Theme : Efl.Object, Efl.Eo.IWrapper
16 ///<summary>Pointer to the native class description.</summary>
17 public override System.IntPtr NativeClass
21 if (((object)this).GetType() == typeof(Theme))
23 return GetEflClassStatic();
27 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
32 [System.Runtime.InteropServices.DllImport(efl.Libs.Elementary)] internal static extern System.IntPtr
33 efl_ui_theme_class_get();
34 /// <summary>Initializes a new instance of the <see cref="Theme"/> class.</summary>
35 /// <param name="parent">Parent instance.</param>
36 public Theme(Efl.Object parent= null
37 ) : base(efl_ui_theme_class_get(), typeof(Theme), parent)
39 FinishInstantiation();
42 /// <summary>Initializes a new instance of the <see cref="Theme"/> class.
43 /// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
44 /// <param name="raw">The native pointer to be wrapped.</param>
45 protected Theme(System.IntPtr raw) : base(raw)
49 /// <summary>Initializes a new instance of the <see cref="Theme"/> class.
50 /// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>
51 /// <param name="baseKlass">The pointer to the base native Eo class.</param>
52 /// <param name="managedType">The managed type of the public constructor that originated this call.</param>
53 /// <param name="parent">The Efl.Object parent of this instance.</param>
54 protected Theme(IntPtr baseKlass, System.Type managedType, Efl.Object parent) : base(baseKlass, managedType, parent)
58 /// <summary>Verifies if the given object is equal to this one.</summary>
59 /// <param name="instance">The object to compare to.</param>
60 /// <returns>True if both objects point to the same native object.</returns>
61 public override bool Equals(object instance)
63 var other = instance as Efl.Object;
68 return this.NativeHandle == other.NativeHandle;
71 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
72 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
73 public override int GetHashCode()
75 return this.NativeHandle.ToInt32();
78 /// <summary>Turns the native pointer into a string representation.</summary>
79 /// <returns>A string with the type and the native pointer for this object.</returns>
80 public override String ToString()
82 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
85 /// <summary>Gets the default theme handle.</summary>
86 /// <returns>The default theme handle</returns>
87 public static Efl.Ui.Theme GetDefault() {
88 var _ret_var = Efl.Ui.Theme.NativeMethods.efl_ui_theme_default_get_ptr.Value.Delegate();
89 Eina.Error.RaiseIfUnhandledException();
92 /// <summary>Appends a theme extension to the list of extensions. This is intended when an application needs more styles of widgets or new widget themes that the default does not provide (or may not provide). The application has "extended" usage by coming up with new custom style names for widgets for specific uses, but as these are not "standard", they are not guaranteed to be provided by a default theme. This means the application is required to provide these extra elements itself in specific Edje files. This call adds one of those Edje files to the theme search path to be searched after the default theme. The use of this call is encouraged when default styles do not meet the needs of the application. Use this call instead of <see cref="Efl.Ui.Theme.AddOverlay"/> for almost all cases.</summary>
93 /// <param name="item">The Edje file path to be used</param>
94 virtual public void AddExtension(System.String item) {
95 Efl.Ui.Theme.NativeMethods.efl_ui_theme_extension_add_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle),item);
96 Eina.Error.RaiseIfUnhandledException();
98 /// <summary>Deletes a theme extension from the list of extensions.</summary>
99 /// <param name="item">The Edje file path not to be used</param>
100 virtual public void DelExtension(System.String item) {
101 Efl.Ui.Theme.NativeMethods.efl_ui_theme_extension_del_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle),item);
102 Eina.Error.RaiseIfUnhandledException();
104 /// <summary>Prepends a theme overlay to the list of overlays. Use this if your application needs to provide some custom overlay theme (An Edje file that replaces some default styles of widgets) where adding new styles, or changing system theme configuration is not possible. Do NOT use this instead of a proper system theme configuration. Use proper configuration files, profiles, environment variables etc. to set a theme so that the theme can be altered by simple configuration by a user. Using this call to achieve that effect is abusing the API and will create lots of trouble.</summary>
105 /// <param name="item">The Edje file path to be used</param>
106 virtual public void AddOverlay(System.String item) {
107 Efl.Ui.Theme.NativeMethods.efl_ui_theme_overlay_add_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle),item);
108 Eina.Error.RaiseIfUnhandledException();
110 /// <summary>Delete a theme overlay from the list of overlays.</summary>
111 /// <param name="item">The Edje file path not to be used</param>
112 virtual public void DelOverlay(System.String item) {
113 Efl.Ui.Theme.NativeMethods.efl_ui_theme_overlay_del_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle),item);
114 Eina.Error.RaiseIfUnhandledException();
116 /// <summary>This is the default theme.
117 /// All widgets use the default theme implicitly unless a specific theme is set.</summary>
118 /// <value>The default theme handle</value>
119 public static Efl.Ui.Theme Default {
120 get { return GetDefault(); }
122 private static IntPtr GetEflClassStatic()
124 return Efl.Ui.Theme.efl_ui_theme_class_get();
126 /// <summary>Wrapper for native methods and virtual method delegates.
127 /// For internal use by generated code only.</summary>
128 public new class NativeMethods : Efl.Object.NativeMethods
130 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Elementary);
131 /// <summary>Gets the list of Eo operations to override.</summary>
132 /// <returns>The list of Eo operations to be overload.</returns>
133 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
135 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
136 var methods = Efl.Eo.Globals.GetUserMethods(type);
138 if (efl_ui_theme_extension_add_static_delegate == null)
140 efl_ui_theme_extension_add_static_delegate = new efl_ui_theme_extension_add_delegate(extension_add);
143 if (methods.FirstOrDefault(m => m.Name == "AddExtension") != null)
145 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_theme_extension_add"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_theme_extension_add_static_delegate) });
148 if (efl_ui_theme_extension_del_static_delegate == null)
150 efl_ui_theme_extension_del_static_delegate = new efl_ui_theme_extension_del_delegate(extension_del);
153 if (methods.FirstOrDefault(m => m.Name == "DelExtension") != null)
155 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_theme_extension_del"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_theme_extension_del_static_delegate) });
158 if (efl_ui_theme_overlay_add_static_delegate == null)
160 efl_ui_theme_overlay_add_static_delegate = new efl_ui_theme_overlay_add_delegate(overlay_add);
163 if (methods.FirstOrDefault(m => m.Name == "AddOverlay") != null)
165 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_theme_overlay_add"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_theme_overlay_add_static_delegate) });
168 if (efl_ui_theme_overlay_del_static_delegate == null)
170 efl_ui_theme_overlay_del_static_delegate = new efl_ui_theme_overlay_del_delegate(overlay_del);
173 if (methods.FirstOrDefault(m => m.Name == "DelOverlay") != null)
175 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_theme_overlay_del"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_theme_overlay_del_static_delegate) });
178 descs.AddRange(base.GetEoOps(type));
181 /// <summary>Returns the Eo class for the native methods of this class.</summary>
182 /// <returns>The native class pointer.</returns>
183 public override IntPtr GetEflClass()
185 return Efl.Ui.Theme.efl_ui_theme_class_get();
188 #pragma warning disable CA1707, SA1300, SA1600
190 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
191 private delegate Efl.Ui.Theme efl_ui_theme_default_get_delegate();
193 [return:MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.MarshalEo<Efl.Eo.NonOwnTag>))]
194 public delegate Efl.Ui.Theme efl_ui_theme_default_get_api_delegate();
196 public static Efl.Eo.FunctionWrapper<efl_ui_theme_default_get_api_delegate> efl_ui_theme_default_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_theme_default_get_api_delegate>(Module, "efl_ui_theme_default_get");
198 private static Efl.Ui.Theme default_get(System.IntPtr obj, System.IntPtr pd)
200 Eina.Log.Debug("function efl_ui_theme_default_get was called");
201 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
204 Efl.Ui.Theme _ret_var = default(Efl.Ui.Theme);
207 _ret_var = Theme.GetDefault();
211 Eina.Log.Warning($"Callback error: {e.ToString()}");
212 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
220 return efl_ui_theme_default_get_ptr.Value.Delegate();
225 private delegate void efl_ui_theme_extension_add_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String item);
228 public delegate void efl_ui_theme_extension_add_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String item);
230 public static Efl.Eo.FunctionWrapper<efl_ui_theme_extension_add_api_delegate> efl_ui_theme_extension_add_ptr = new Efl.Eo.FunctionWrapper<efl_ui_theme_extension_add_api_delegate>(Module, "efl_ui_theme_extension_add");
232 private static void extension_add(System.IntPtr obj, System.IntPtr pd, System.String item)
234 Eina.Log.Debug("function efl_ui_theme_extension_add was called");
235 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
241 ((Theme)wrapper).AddExtension(item);
245 Eina.Log.Warning($"Callback error: {e.ToString()}");
246 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
253 efl_ui_theme_extension_add_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), item);
257 private static efl_ui_theme_extension_add_delegate efl_ui_theme_extension_add_static_delegate;
260 private delegate void efl_ui_theme_extension_del_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String item);
263 public delegate void efl_ui_theme_extension_del_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String item);
265 public static Efl.Eo.FunctionWrapper<efl_ui_theme_extension_del_api_delegate> efl_ui_theme_extension_del_ptr = new Efl.Eo.FunctionWrapper<efl_ui_theme_extension_del_api_delegate>(Module, "efl_ui_theme_extension_del");
267 private static void extension_del(System.IntPtr obj, System.IntPtr pd, System.String item)
269 Eina.Log.Debug("function efl_ui_theme_extension_del was called");
270 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
276 ((Theme)wrapper).DelExtension(item);
280 Eina.Log.Warning($"Callback error: {e.ToString()}");
281 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
288 efl_ui_theme_extension_del_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), item);
292 private static efl_ui_theme_extension_del_delegate efl_ui_theme_extension_del_static_delegate;
295 private delegate void efl_ui_theme_overlay_add_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String item);
298 public delegate void efl_ui_theme_overlay_add_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String item);
300 public static Efl.Eo.FunctionWrapper<efl_ui_theme_overlay_add_api_delegate> efl_ui_theme_overlay_add_ptr = new Efl.Eo.FunctionWrapper<efl_ui_theme_overlay_add_api_delegate>(Module, "efl_ui_theme_overlay_add");
302 private static void overlay_add(System.IntPtr obj, System.IntPtr pd, System.String item)
304 Eina.Log.Debug("function efl_ui_theme_overlay_add was called");
305 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
311 ((Theme)wrapper).AddOverlay(item);
315 Eina.Log.Warning($"Callback error: {e.ToString()}");
316 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
323 efl_ui_theme_overlay_add_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), item);
327 private static efl_ui_theme_overlay_add_delegate efl_ui_theme_overlay_add_static_delegate;
330 private delegate void efl_ui_theme_overlay_del_delegate(System.IntPtr obj, System.IntPtr pd, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String item);
333 public delegate void efl_ui_theme_overlay_del_api_delegate(System.IntPtr obj, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))] System.String item);
335 public static Efl.Eo.FunctionWrapper<efl_ui_theme_overlay_del_api_delegate> efl_ui_theme_overlay_del_ptr = new Efl.Eo.FunctionWrapper<efl_ui_theme_overlay_del_api_delegate>(Module, "efl_ui_theme_overlay_del");
337 private static void overlay_del(System.IntPtr obj, System.IntPtr pd, System.String item)
339 Eina.Log.Debug("function efl_ui_theme_overlay_del was called");
340 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
346 ((Theme)wrapper).DelOverlay(item);
350 Eina.Log.Warning($"Callback error: {e.ToString()}");
351 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
358 efl_ui_theme_overlay_del_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), item);
362 private static efl_ui_theme_overlay_del_delegate efl_ui_theme_overlay_del_static_delegate;
364 #pragma warning restore CA1707, SA1300, SA1600