2 #pragma warning disable CS1591
4 using System.Runtime.InteropServices;
5 using System.Collections.Generic;
7 using System.Threading;
8 using System.ComponentModel;
13 /// <summary>Interface that contains properties regarding the displaying of a value within a range.
14 /// A value range contains a value restricted between specified minimum and maximum limits at all times. This can be used for progressbars, sliders or spinners, for example.</summary>
15 /// <remarks>This is a <b>BETA</b> class. It can be modified or removed in the future. Do not use it for product development.</remarks>
16 [Efl.Ui.IRangeDisplayConcrete.NativeMethods]
17 [Efl.Eo.BindingEntity]
18 public interface IRangeDisplay :
19 Efl.Eo.IWrapper, IDisposable
21 /// <summary>Control the value (position) of the widget within its valid range.
22 /// Values outside the limits defined in <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/> are ignored and an error is printed.</summary>
23 /// <returns>The range value (must be within the bounds of <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/>).</returns>
24 double GetRangeValue();
25 /// <summary>Control the value (position) of the widget within its valid range.
26 /// Values outside the limits defined in <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/> are ignored and an error is printed.</summary>
27 /// <param name="val">The range value (must be within the bounds of <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/>).</param>
28 void SetRangeValue(double val);
29 /// <summary>Set the minimum and maximum values for given range widget.
30 /// If the current 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 resulting value can be obtained with <see cref="Efl.Ui.IRangeDisplay.GetRangeValue"/>.
32 /// The default minimum and maximum values may be different for each class.
34 /// Note: maximum must be greater than minimum, otherwise behavior is undefined.</summary>
35 /// <param name="min">The minimum value.</param>
36 /// <param name="max">The maximum value.</param>
37 void GetRangeLimits(out double min, out double max);
38 /// <summary>Set the minimum and maximum values for given range widget.
39 /// If the current 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 resulting value can be obtained with <see cref="Efl.Ui.IRangeDisplay.GetRangeValue"/>.
41 /// The default minimum and maximum values may be different for each class.
43 /// Note: maximum must be greater than minimum, otherwise behavior is undefined.</summary>
44 /// <param name="min">The minimum value.</param>
45 /// <param name="max">The maximum value.</param>
46 void SetRangeLimits(double min, double max);
47 /// <summary>Emitted when the <see cref="Efl.Ui.IRangeDisplay.RangeValue"/> is getting changed.</summary>
48 event EventHandler ChangedEvt;
49 /// <summary>Emitted when the <see cref="Efl.Ui.IRangeDisplay.RangeValue"/> has reached the minimum of <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/>.</summary>
50 event EventHandler MinReachedEvt;
51 /// <summary>Emitted when the <c>range_value</c> has reached the maximum of <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/>.</summary>
52 event EventHandler MaxReachedEvt;
53 /// <summary>Control the value (position) of the widget within its valid range.
54 /// Values outside the limits defined in <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/> are ignored and an error is printed.</summary>
55 /// <value>The range value (must be within the bounds of <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/>).</value>
60 /// <summary>Set the minimum and maximum values for given range widget.
61 /// If the current 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 resulting value can be obtained with <see cref="Efl.Ui.IRangeDisplay.GetRangeValue"/>.
63 /// The default minimum and maximum values may be different for each class.
65 /// Note: maximum must be greater than minimum, otherwise behavior is undefined.</summary>
66 /// <value>The minimum value.</value>
67 (double, double) RangeLimits {
72 /// <summary>Interface that contains properties regarding the displaying of a value within a range.
73 /// A value range contains a value restricted between specified minimum and maximum limits at all times. This can be used for progressbars, sliders or spinners, for example.</summary>
74 /// <remarks>This is a <b>BETA</b> class. It can be modified or removed in the future. Do not use it for product development.</remarks>
75 sealed public class IRangeDisplayConcrete :
80 /// <summary>Pointer to the native class description.</summary>
81 public override System.IntPtr NativeClass
85 if (((object)this).GetType() == typeof(IRangeDisplayConcrete))
87 return GetEflClassStatic();
91 return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];
96 /// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.
97 /// Do not call this constructor directly.</summary>
98 /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
99 private IRangeDisplayConcrete(ConstructingHandle ch) : base(ch)
103 [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr
104 efl_ui_range_display_interface_get();
105 /// <summary>Initializes a new instance of the <see cref="IRangeDisplay"/> class.
106 /// Internal usage: This is used when interacting with C code and should not be used directly.</summary>
107 /// <param name="wh">The native pointer to be wrapped.</param>
108 private IRangeDisplayConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh)
112 /// <summary>Emitted when the <see cref="Efl.Ui.IRangeDisplay.RangeValue"/> is getting changed.</summary>
113 public event EventHandler ChangedEvt
117 lock (eflBindingEventLock)
119 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
121 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
124 EventArgs args = EventArgs.Empty;
127 value?.Invoke(obj, args);
131 Eina.Log.Error(e.ToString());
132 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
137 string key = "_EFL_UI_RANGE_EVENT_CHANGED";
138 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
144 lock (eflBindingEventLock)
146 string key = "_EFL_UI_RANGE_EVENT_CHANGED";
147 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
151 /// <summary>Method to raise event ChangedEvt.</summary>
152 public void OnChangedEvt(EventArgs e)
154 var key = "_EFL_UI_RANGE_EVENT_CHANGED";
155 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
156 if (desc == IntPtr.Zero)
158 Eina.Log.Error($"Failed to get native event {key}");
162 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero);
164 /// <summary>Emitted when the <see cref="Efl.Ui.IRangeDisplay.RangeValue"/> has reached the minimum of <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/>.</summary>
165 public event EventHandler MinReachedEvt
169 lock (eflBindingEventLock)
171 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
173 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
176 EventArgs args = EventArgs.Empty;
179 value?.Invoke(obj, args);
183 Eina.Log.Error(e.ToString());
184 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
189 string key = "_EFL_UI_RANGE_EVENT_MIN_REACHED";
190 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
196 lock (eflBindingEventLock)
198 string key = "_EFL_UI_RANGE_EVENT_MIN_REACHED";
199 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
203 /// <summary>Method to raise event MinReachedEvt.</summary>
204 public void OnMinReachedEvt(EventArgs e)
206 var key = "_EFL_UI_RANGE_EVENT_MIN_REACHED";
207 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
208 if (desc == IntPtr.Zero)
210 Eina.Log.Error($"Failed to get native event {key}");
214 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero);
216 /// <summary>Emitted when the <c>range_value</c> has reached the maximum of <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/>.</summary>
217 public event EventHandler MaxReachedEvt
221 lock (eflBindingEventLock)
223 Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>
225 var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target;
228 EventArgs args = EventArgs.Empty;
231 value?.Invoke(obj, args);
235 Eina.Log.Error(e.ToString());
236 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
241 string key = "_EFL_UI_RANGE_EVENT_MAX_REACHED";
242 AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value);
248 lock (eflBindingEventLock)
250 string key = "_EFL_UI_RANGE_EVENT_MAX_REACHED";
251 RemoveNativeEventHandler(efl.Libs.Efl, key, value);
255 /// <summary>Method to raise event MaxReachedEvt.</summary>
256 public void OnMaxReachedEvt(EventArgs e)
258 var key = "_EFL_UI_RANGE_EVENT_MAX_REACHED";
259 IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key);
260 if (desc == IntPtr.Zero)
262 Eina.Log.Error($"Failed to get native event {key}");
266 Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero);
268 /// <summary>Control the value (position) of the widget within its valid range.
269 /// Values outside the limits defined in <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/> are ignored and an error is printed.</summary>
270 /// <returns>The range value (must be within the bounds of <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/>).</returns>
271 public double GetRangeValue() {
272 var _ret_var = Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_value_get_ptr.Value.Delegate(this.NativeHandle);
273 Eina.Error.RaiseIfUnhandledException();
276 /// <summary>Control the value (position) of the widget within its valid range.
277 /// Values outside the limits defined in <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/> are ignored and an error is printed.</summary>
278 /// <param name="val">The range value (must be within the bounds of <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/>).</param>
279 public void SetRangeValue(double val) {
280 Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_value_set_ptr.Value.Delegate(this.NativeHandle,val);
281 Eina.Error.RaiseIfUnhandledException();
283 /// <summary>Set the minimum and maximum values for given range widget.
284 /// If the current 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 resulting value can be obtained with <see cref="Efl.Ui.IRangeDisplay.GetRangeValue"/>.
286 /// The default minimum and maximum values may be different for each class.
288 /// Note: maximum must be greater than minimum, otherwise behavior is undefined.</summary>
289 /// <param name="min">The minimum value.</param>
290 /// <param name="max">The maximum value.</param>
291 public void GetRangeLimits(out double min, out double max) {
292 Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_limits_get_ptr.Value.Delegate(this.NativeHandle,out min, out max);
293 Eina.Error.RaiseIfUnhandledException();
295 /// <summary>Set the minimum and maximum values for given range widget.
296 /// If the current 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 resulting value can be obtained with <see cref="Efl.Ui.IRangeDisplay.GetRangeValue"/>.
298 /// The default minimum and maximum values may be different for each class.
300 /// Note: maximum must be greater than minimum, otherwise behavior is undefined.</summary>
301 /// <param name="min">The minimum value.</param>
302 /// <param name="max">The maximum value.</param>
303 public void SetRangeLimits(double min, double max) {
304 Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_limits_set_ptr.Value.Delegate(this.NativeHandle,min, max);
305 Eina.Error.RaiseIfUnhandledException();
307 /// <summary>Control the value (position) of the widget within its valid range.
308 /// Values outside the limits defined in <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/> are ignored and an error is printed.</summary>
309 /// <value>The range value (must be within the bounds of <see cref="Efl.Ui.IRangeDisplay.GetRangeLimits"/>).</value>
310 public double RangeValue {
311 get { return GetRangeValue(); }
312 set { SetRangeValue(value); }
314 /// <summary>Set the minimum and maximum values for given range widget.
315 /// If the current 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 resulting value can be obtained with <see cref="Efl.Ui.IRangeDisplay.GetRangeValue"/>.
317 /// The default minimum and maximum values may be different for each class.
319 /// Note: maximum must be greater than minimum, otherwise behavior is undefined.</summary>
320 /// <value>The minimum value.</value>
321 public (double, double) RangeLimits {
323 double _out_min = default(double);
324 double _out_max = default(double);
325 GetRangeLimits(out _out_min,out _out_max);
326 return (_out_min,_out_max);
328 set { SetRangeLimits( value.Item1, value.Item2); }
330 private static IntPtr GetEflClassStatic()
332 return Efl.Ui.IRangeDisplayConcrete.efl_ui_range_display_interface_get();
334 /// <summary>Wrapper for native methods and virtual method delegates.
335 /// For internal use by generated code only.</summary>
336 public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods
338 private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl);
339 /// <summary>Gets the list of Eo operations to override.</summary>
340 /// <returns>The list of Eo operations to be overload.</returns>
341 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)
343 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
344 var methods = Efl.Eo.Globals.GetUserMethods(type);
346 if (efl_ui_range_value_get_static_delegate == null)
348 efl_ui_range_value_get_static_delegate = new efl_ui_range_value_get_delegate(range_value_get);
351 if (methods.FirstOrDefault(m => m.Name == "GetRangeValue") != null)
353 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) });
356 if (efl_ui_range_value_set_static_delegate == null)
358 efl_ui_range_value_set_static_delegate = new efl_ui_range_value_set_delegate(range_value_set);
361 if (methods.FirstOrDefault(m => m.Name == "SetRangeValue") != null)
363 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) });
366 if (efl_ui_range_limits_get_static_delegate == null)
368 efl_ui_range_limits_get_static_delegate = new efl_ui_range_limits_get_delegate(range_limits_get);
371 if (methods.FirstOrDefault(m => m.Name == "GetRangeLimits") != null)
373 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_range_limits_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_range_limits_get_static_delegate) });
376 if (efl_ui_range_limits_set_static_delegate == null)
378 efl_ui_range_limits_set_static_delegate = new efl_ui_range_limits_set_delegate(range_limits_set);
381 if (methods.FirstOrDefault(m => m.Name == "SetRangeLimits") != null)
383 descs.Add(new Efl_Op_Description() {api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_range_limits_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_range_limits_set_static_delegate) });
388 /// <summary>Returns the Eo class for the native methods of this class.</summary>
389 /// <returns>The native class pointer.</returns>
390 public override IntPtr GetEflClass()
392 return Efl.Ui.IRangeDisplayConcrete.efl_ui_range_display_interface_get();
395 #pragma warning disable CA1707, CS1591, SA1300, SA1600
398 private delegate double efl_ui_range_value_get_delegate(System.IntPtr obj, System.IntPtr pd);
401 public delegate double efl_ui_range_value_get_api_delegate(System.IntPtr obj);
403 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");
405 private static double range_value_get(System.IntPtr obj, System.IntPtr pd)
407 Eina.Log.Debug("function efl_ui_range_value_get was called");
408 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
411 double _ret_var = default(double);
414 _ret_var = ((IRangeDisplay)ws.Target).GetRangeValue();
418 Eina.Log.Warning($"Callback error: {e.ToString()}");
419 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
427 return efl_ui_range_value_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)));
431 private static efl_ui_range_value_get_delegate efl_ui_range_value_get_static_delegate;
434 private delegate void efl_ui_range_value_set_delegate(System.IntPtr obj, System.IntPtr pd, double val);
437 public delegate void efl_ui_range_value_set_api_delegate(System.IntPtr obj, double val);
439 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");
441 private static void range_value_set(System.IntPtr obj, System.IntPtr pd, double val)
443 Eina.Log.Debug("function efl_ui_range_value_set was called");
444 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
450 ((IRangeDisplay)ws.Target).SetRangeValue(val);
454 Eina.Log.Warning($"Callback error: {e.ToString()}");
455 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
462 efl_ui_range_value_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), val);
466 private static efl_ui_range_value_set_delegate efl_ui_range_value_set_static_delegate;
469 private delegate void efl_ui_range_limits_get_delegate(System.IntPtr obj, System.IntPtr pd, out double min, out double max);
472 public delegate void efl_ui_range_limits_get_api_delegate(System.IntPtr obj, out double min, out double max);
474 public static Efl.Eo.FunctionWrapper<efl_ui_range_limits_get_api_delegate> efl_ui_range_limits_get_ptr = new Efl.Eo.FunctionWrapper<efl_ui_range_limits_get_api_delegate>(Module, "efl_ui_range_limits_get");
476 private static void range_limits_get(System.IntPtr obj, System.IntPtr pd, out double min, out double max)
478 Eina.Log.Debug("function efl_ui_range_limits_get was called");
479 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
482 min = default(double); max = default(double);
485 ((IRangeDisplay)ws.Target).GetRangeLimits(out min, out max);
489 Eina.Log.Warning($"Callback error: {e.ToString()}");
490 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
497 efl_ui_range_limits_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), out min, out max);
501 private static efl_ui_range_limits_get_delegate efl_ui_range_limits_get_static_delegate;
504 private delegate void efl_ui_range_limits_set_delegate(System.IntPtr obj, System.IntPtr pd, double min, double max);
507 public delegate void efl_ui_range_limits_set_api_delegate(System.IntPtr obj, double min, double max);
509 public static Efl.Eo.FunctionWrapper<efl_ui_range_limits_set_api_delegate> efl_ui_range_limits_set_ptr = new Efl.Eo.FunctionWrapper<efl_ui_range_limits_set_api_delegate>(Module, "efl_ui_range_limits_set");
511 private static void range_limits_set(System.IntPtr obj, System.IntPtr pd, double min, double max)
513 Eina.Log.Debug("function efl_ui_range_limits_set was called");
514 var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj);
520 ((IRangeDisplay)ws.Target).SetRangeLimits(min, max);
524 Eina.Log.Warning($"Callback error: {e.ToString()}");
525 Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
532 efl_ui_range_limits_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), min, max);
536 private static efl_ui_range_limits_set_delegate efl_ui_range_limits_set_static_delegate;
538 #pragma warning restore CA1707, CS1591, SA1300, SA1600
547 #pragma warning disable CS1591
548 public static class Efl_UiIRangeDisplayConcrete_ExtensionMethods {
549 public static Efl.BindableProperty<double> RangeValue<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<Efl.Ui.IRangeDisplay, T>magic = null) where T : Efl.Ui.IRangeDisplay {
550 return new Efl.BindableProperty<double>("range_value", fac);
555 #pragma warning restore CS1591