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>Interface that contains properties regarding the displaying of a range.</summary>
13 [Efl.Ui.IRangeDisplayConcrete.NativeMethods]
14 public interface IRangeDisplay :
15 Efl.Eo.IWrapper, IDisposable
17 /// <summary>Control the range value (in percentage) on a given range widget
18 /// Use this call to set range levels.
20 /// Note: If you pass a value out of the specified interval for <c>val</c>, it will be interpreted as the closest of the boundary values in the interval.</summary>
21 /// <returns>The range value (must be between $0.0 and 1.0)</returns>
22 double GetRangeValue();
23 /// <summary>Control the range value (in percentage) on a given range widget
24 /// Use this call to set range levels.
26 /// Note: If you pass a value out of the specified interval for <c>val</c>, it will be interpreted as the closest of the boundary values in the interval.</summary>
27 /// <param name="val">The range value (must be between $0.0 and 1.0)</param>
28 void SetRangeValue(double val);
29 /// <summary>Get the minimum and maximum values of the given range widget.
30 /// Note: If only one value is needed, the other pointer can be passed as <c>null</c>.</summary>
31 /// <param name="min">The minimum value.</param>
32 /// <param name="max">The maximum value.</param>
33 void GetRangeMinMax(out double min, out double max);
34 /// <summary>Set the minimum and maximum values for given range widget.
35 /// Define the allowed range of values to be selected by the user.
37 /// If actual value is less than <c>min</c>, it will be updated to <c>min</c>. If it is bigger then <c>max</c>, will be updated to <c>max</c>. The actual value can be obtained with <see cref="Efl.Ui.IRangeDisplay.GetRangeValue"/>
39 /// The minimum and maximum values may be different for each class.
41 /// Warning: maximum must be greater than minimum, otherwise behavior is undefined.</summary>
42 /// <param name="min">The minimum value.</param>
43 /// <param name="max">The maximum value.</param>
44 void SetRangeMinMax(double min, double max);
45 /// <summary>Control the range value (in percentage) on a given range widget
46 /// Use this call to set range levels.
48 /// Note: If you pass a value out of the specified interval for <c>val</c>, it will be interpreted as the closest of the boundary values in the interval.</summary>
49 /// <value>The range value (must be between $0.0 and 1.0)</value>
55 /// <summary>Interface that contains properties regarding the displaying of a range.</summary>
56 sealed public class IRangeDisplayConcrete :
61 ///<summary>Pointer to the native class description.</summary>
62 public System.IntPtr NativeClass
66 if (((object)this).GetType() == typeof(IRangeDisplayConcrete))
68 return GetEflClassStatic();
72 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
77 private System.IntPtr handle;
78 ///<summary>Pointer to the native instance.</summary>
79 public System.IntPtr NativeHandle
81 get { return handle; }
84 [System.Runtime.InteropServices.DllImport(efl.Libs.Efl)] internal static extern System.IntPtr
85 efl_ui_range_display_interface_get();
86 /// <summary>Initializes a new instance of the <see cref="IRangeDisplay"/> class.
87 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
88 private IRangeDisplayConcrete(System.IntPtr raw)
92 ///<summary>Destructor.</summary>
93 ~IRangeDisplayConcrete()
98 ///<summary>Releases the underlying native instance.</summary>
99 private void Dispose(bool disposing)
101 if (handle != System.IntPtr.Zero)
104 handle = IntPtr.Zero;
106 IntPtr gcHandlePtr = IntPtr.Zero;
109 Efl.Eo.Globals.efl_mono_native_dispose(h, gcHandlePtr);
113 Monitor.Enter(Efl.All.InitLock);
114 if (Efl.All.MainLoopInitialized)
116 Efl.Eo.Globals.efl_mono_thread_safe_native_dispose(h, gcHandlePtr);
119 Monitor.Exit(Efl.All.InitLock);
125 ///<summary>Releases the underlying native instance.</summary>
126 public void Dispose()
129 GC.SuppressFinalize(this);
132 /// <summary>Verifies if the given object is equal to this one.</summary>
133 /// <param name="instance">The object to compare to.</param>
134 /// <returns>True if both objects point to the same native object.</returns>
135 public override bool Equals(object instance)
137 var other = instance as Efl.Object;
142 return this.NativeHandle == other.NativeHandle;
145 /// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>
146 /// <returns>The value of the pointer, to be used as the hash code of this object.</returns>
147 public override int GetHashCode()
149 return this.NativeHandle.ToInt32();
152 /// <summary>Turns the native pointer into a string representation.</summary>
153 /// <returns>A string with the type and the native pointer for this object.</returns>
154 public override String ToString()
156 return $"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]";
159 /// <summary>Control the range value (in percentage) on a given range widget
160 /// Use this call to set range levels.
162 /// Note: If you pass a value out of the specified interval for <c>val</c>, it will be interpreted as the closest of the boundary values in the interval.</summary>
163 /// <returns>The range value (must be between $0.0 and 1.0)</returns>
164 public double GetRangeValue() {
165 var _ret_var = Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_value_get_ptr.Value.Delegate(this.NativeHandle);
166 Eina.Error.RaiseIfUnhandledException();
169 /// <summary>Control the range value (in percentage) on a given range widget
170 /// Use this call to set range levels.
172 /// Note: If you pass a value out of the specified interval for <c>val</c>, it will be interpreted as the closest of the boundary values in the interval.</summary>
173 /// <param name="val">The range value (must be between $0.0 and 1.0)</param>
174 public void SetRangeValue(double val) {
175 Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_value_set_ptr.Value.Delegate(this.NativeHandle,val);
176 Eina.Error.RaiseIfUnhandledException();
178 /// <summary>Get the minimum and maximum values of the given range widget.
179 /// Note: If only one value is needed, the other pointer can be passed as <c>null</c>.</summary>
180 /// <param name="min">The minimum value.</param>
181 /// <param name="max">The maximum value.</param>
182 public void GetRangeMinMax(out double min, out double max) {
183 Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_min_max_get_ptr.Value.Delegate(this.NativeHandle,out min, out max);
184 Eina.Error.RaiseIfUnhandledException();
186 /// <summary>Set the minimum and maximum values for given range widget.
187 /// Define the allowed range of values to be selected by the user.
189 /// If actual value is less than <c>min</c>, it will be updated to <c>min</c>. If it is bigger then <c>max</c>, will be updated to <c>max</c>. The actual value can be obtained with <see cref="Efl.Ui.IRangeDisplay.GetRangeValue"/>
191 /// The minimum and maximum values may be different for each class.
193 /// Warning: maximum must be greater than minimum, otherwise behavior is undefined.</summary>
194 /// <param name="min">The minimum value.</param>
195 /// <param name="max">The maximum value.</param>
196 public void SetRangeMinMax(double min, double max) {
197 Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_min_max_set_ptr.Value.Delegate(this.NativeHandle,min, max);
198 Eina.Error.RaiseIfUnhandledException();
200 /// <summary>Control the range value (in percentage) on a given range widget
201 /// Use this call to set range levels.
203 /// Note: If you pass a value out of the specified interval for <c>val</c>, it will be interpreted as the closest of the boundary values in the interval.</summary>
204 /// <value>The range value (must be between $0.0 and 1.0)</value>
205 public double RangeValue {
206 get { return GetRangeValue(); }
207 set { SetRangeValue(value); }
209 private static IntPtr GetEflClassStatic()
211 return Efl.Ui.IRangeDisplayConcrete.efl_ui_range_display_interface_get();
213 /// <summary>Wrapper for native methods and virtual method delegates.
214 /// For internal use by generated code only.</summary>
215 public class NativeMethods : Efl.Eo.NativeClass
217 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
218 /// <summary>Gets the list of Eo operations to override.</summary>
219 /// <returns>The list of Eo operations to be overload.</returns>
220 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
222 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
223 var methods = Efl.Eo.Globals.GetUserMethods(type);
225 if (efl_ui_range_value_get_static_delegate == null)
227 efl_ui_range_value_get_static_delegate = new efl_ui_range_value_get_delegate(range_value_get);
230 if (methods.FirstOrDefault(m => m.Name == "GetRangeValue") != null)
232 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_range_value_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_range_value_get_static_delegate) });
235 if (efl_ui_range_value_set_static_delegate == null)
237 efl_ui_range_value_set_static_delegate = new efl_ui_range_value_set_delegate(range_value_set);
240 if (methods.FirstOrDefault(m => m.Name == "SetRangeValue") != null)
242 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_range_value_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_range_value_set_static_delegate) });
245 if (efl_ui_range_min_max_get_static_delegate == null)
247 efl_ui_range_min_max_get_static_delegate = new efl_ui_range_min_max_get_delegate(range_min_max_get);
250 if (methods.FirstOrDefault(m => m.Name == "GetRangeMinMax") != null)
252 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_range_min_max_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_range_min_max_get_static_delegate) });
255 if (efl_ui_range_min_max_set_static_delegate == null)
257 efl_ui_range_min_max_set_static_delegate = new efl_ui_range_min_max_set_delegate(range_min_max_set);
260 if (methods.FirstOrDefault(m => m.Name == "SetRangeMinMax") != null)
262 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_range_min_max_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_range_min_max_set_static_delegate) });
267 /// <summary>Returns the Eo class for the native methods of this class.</summary>
268 /// <returns>The native class pointer.</returns>
269 public override IntPtr GetEflClass()
271 return Efl.Ui.IRangeDisplayConcrete.efl_ui_range_display_interface_get();
274 #pragma warning disable CA1707, SA1300, SA1600
277 private delegate double efl_ui_range_value_get_delegate(System.IntPtr obj, System.IntPtr pd);
280 public delegate double efl_ui_range_value_get_api_delegate(System.IntPtr obj);
282 public static Efl.Eo.FunctionWrapper<efl_ui_range_value_get_api_delegate> efl_ui_range_value_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_range_value_get_api_delegate>(Module, "efl_ui_range_value_get");
284 private static double range_value_get(System.IntPtr obj, System.IntPtr pd)
286 Eina.Log.Debug("function efl_ui_range_value_get was called");
287 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
290 double _ret_var = default(double);
293 _ret_var = ((IRangeDisplay)wrapper).GetRangeValue();
297 Eina.Log.Warning($"Callback error: {e.ToString()}");
298 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
306 return efl_ui_range_value_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
310 private static efl_ui_range_value_get_delegate efl_ui_range_value_get_static_delegate;
313 private delegate void efl_ui_range_value_set_delegate(System.IntPtr obj, System.IntPtr pd, double val);
316 public delegate void efl_ui_range_value_set_api_delegate(System.IntPtr obj, double val);
318 public static Efl.Eo.FunctionWrapper<efl_ui_range_value_set_api_delegate> efl_ui_range_value_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_range_value_set_api_delegate>(Module, "efl_ui_range_value_set");
320 private static void range_value_set(System.IntPtr obj, System.IntPtr pd, double val)
322 Eina.Log.Debug("function efl_ui_range_value_set was called");
323 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
329 ((IRangeDisplay)wrapper).SetRangeValue(val);
333 Eina.Log.Warning($"Callback error: {e.ToString()}");
334 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
341 efl_ui_range_value_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), val);
345 private static efl_ui_range_value_set_delegate efl_ui_range_value_set_static_delegate;
348 private delegate void efl_ui_range_min_max_get_delegate(System.IntPtr obj, System.IntPtr pd, out double min, out double max);
351 public delegate void efl_ui_range_min_max_get_api_delegate(System.IntPtr obj, out double min, out double max);
353 public static Efl.Eo.FunctionWrapper<efl_ui_range_min_max_get_api_delegate> efl_ui_range_min_max_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_range_min_max_get_api_delegate>(Module, "efl_ui_range_min_max_get");
355 private static void range_min_max_get(System.IntPtr obj, System.IntPtr pd, out double min, out double max)
357 Eina.Log.Debug("function efl_ui_range_min_max_get was called");
358 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
361 min = default(double); max = default(double);
364 ((IRangeDisplay)wrapper).GetRangeMinMax(out min, out max);
368 Eina.Log.Warning($"Callback error: {e.ToString()}");
369 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
376 efl_ui_range_min_max_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), out min, out max);
380 private static efl_ui_range_min_max_get_delegate efl_ui_range_min_max_get_static_delegate;
383 private delegate void efl_ui_range_min_max_set_delegate(System.IntPtr obj, System.IntPtr pd, double min, double max);
386 public delegate void efl_ui_range_min_max_set_api_delegate(System.IntPtr obj, double min, double max);
388 public static Efl.Eo.FunctionWrapper<efl_ui_range_min_max_set_api_delegate> efl_ui_range_min_max_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_range_min_max_set_api_delegate>(Module, "efl_ui_range_min_max_set");
390 private static void range_min_max_set(System.IntPtr obj, System.IntPtr pd, double min, double max)
392 Eina.Log.Debug("function efl_ui_range_min_max_set was called");
393 Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);
399 ((IRangeDisplay)wrapper).SetRangeMinMax(min, max);
403 Eina.Log.Warning($"Callback error: {e.ToString()}");
404 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
411 efl_ui_range_min_max_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), min, max);
415 private static efl_ui_range_min_max_set_delegate efl_ui_range_min_max_set_static_delegate;
417 #pragma warning restore CA1707, SA1300, SA1600