#define EFL_BETA #pragma warning disable CS1591 using System; using System.Runtime.InteropServices; using System.Collections.Generic; using System.Linq; using System.Threading; using System.ComponentModel; namespace Efl { namespace Ui { /// Interface that contains properties regarding the displaying of a value within a range. /// 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. /// This is a BETA class. It can be modified or removed in the future. Do not use it for product development. [Efl.Ui.IRangeDisplayConcrete.NativeMethods] [Efl.Eo.BindingEntity] public interface IRangeDisplay : Efl.Eo.IWrapper, IDisposable { /// Control the value (position) of the widget within its valid range. /// Values outside the limits defined in are ignored and an error is printed. /// The range value (must be within the bounds of ). double GetRangeValue(); /// Control the value (position) of the widget within its valid range. /// Values outside the limits defined in are ignored and an error is printed. /// The range value (must be within the bounds of ). void SetRangeValue(double val); /// Set the minimum and maximum values for given range widget. /// If the current value is less than min, it will be updated to min. If it is bigger then max, will be updated to max. The resulting value can be obtained with . /// /// The default minimum and maximum values may be different for each class. /// /// Note: maximum must be greater than minimum, otherwise behavior is undefined. /// The minimum value. /// The maximum value. void GetRangeLimits(out double min, out double max); /// Set the minimum and maximum values for given range widget. /// If the current value is less than min, it will be updated to min. If it is bigger then max, will be updated to max. The resulting value can be obtained with . /// /// The default minimum and maximum values may be different for each class. /// /// Note: maximum must be greater than minimum, otherwise behavior is undefined. /// The minimum value. /// The maximum value. void SetRangeLimits(double min, double max); /// Emitted when the is getting changed. event EventHandler ChangedEvt; /// Emitted when the has reached the minimum of . event EventHandler MinReachedEvt; /// Emitted when the range_value has reached the maximum of . event EventHandler MaxReachedEvt; /// Control the value (position) of the widget within its valid range. /// Values outside the limits defined in are ignored and an error is printed. /// The range value (must be within the bounds of ). double RangeValue { get; set; } /// Set the minimum and maximum values for given range widget. /// If the current value is less than min, it will be updated to min. If it is bigger then max, will be updated to max. The resulting value can be obtained with . /// /// The default minimum and maximum values may be different for each class. /// /// Note: maximum must be greater than minimum, otherwise behavior is undefined. /// The minimum value. (double, double) RangeLimits { get; set; } } /// Interface that contains properties regarding the displaying of a value within a range. /// 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. /// This is a BETA class. It can be modified or removed in the future. Do not use it for product development. sealed public class IRangeDisplayConcrete : Efl.Eo.EoWrapper , IRangeDisplay { /// Pointer to the native class description. public override System.IntPtr NativeClass { get { if (((object)this).GetType() == typeof(IRangeDisplayConcrete)) { return GetEflClassStatic(); } else { return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()]; } } } /// Subclasses should override this constructor if they are expected to be instantiated from native code. /// Do not call this constructor directly. /// Tag struct storing the native handle of the object being constructed. private IRangeDisplayConcrete(ConstructingHandle ch) : base(ch) { } [System.Runtime.InteropServices.DllImport("libefl.so.1")] internal static extern System.IntPtr efl_ui_range_display_interface_get(); /// Initializes a new instance of the class. /// Internal usage: This is used when interacting with C code and should not be used directly. /// The native pointer to be wrapped. private IRangeDisplayConcrete(Efl.Eo.Globals.WrappingHandle wh) : base(wh) { } /// Emitted when the is getting changed. public event EventHandler ChangedEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { EventArgs args = EventArgs.Empty; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_UI_RANGE_EVENT_CHANGED"; AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_UI_RANGE_EVENT_CHANGED"; RemoveNativeEventHandler(efl.Libs.Efl, key, value); } } } /// Method to raise event ChangedEvt. public void OnChangedEvt(EventArgs e) { var key = "_EFL_UI_RANGE_EVENT_CHANGED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero); } /// Emitted when the has reached the minimum of . public event EventHandler MinReachedEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { EventArgs args = EventArgs.Empty; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_UI_RANGE_EVENT_MIN_REACHED"; AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_UI_RANGE_EVENT_MIN_REACHED"; RemoveNativeEventHandler(efl.Libs.Efl, key, value); } } } /// Method to raise event MinReachedEvt. public void OnMinReachedEvt(EventArgs e) { var key = "_EFL_UI_RANGE_EVENT_MIN_REACHED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero); } /// Emitted when the range_value has reached the maximum of . public event EventHandler MaxReachedEvt { add { lock (eflBindingEventLock) { Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) => { var obj = Efl.Eo.Globals.WrapperSupervisorPtrToManaged(data).Target; if (obj != null) { EventArgs args = EventArgs.Empty; try { value?.Invoke(obj, args); } catch (Exception e) { Eina.Log.Error(e.ToString()); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } }; string key = "_EFL_UI_RANGE_EVENT_MAX_REACHED"; AddNativeEventHandler(efl.Libs.Efl, key, callerCb, value); } } remove { lock (eflBindingEventLock) { string key = "_EFL_UI_RANGE_EVENT_MAX_REACHED"; RemoveNativeEventHandler(efl.Libs.Efl, key, value); } } } /// Method to raise event MaxReachedEvt. public void OnMaxReachedEvt(EventArgs e) { var key = "_EFL_UI_RANGE_EVENT_MAX_REACHED"; IntPtr desc = Efl.EventDescription.GetNative(efl.Libs.Efl, key); if (desc == IntPtr.Zero) { Eina.Log.Error($"Failed to get native event {key}"); return; } Efl.Eo.Globals.efl_event_callback_call(this.NativeHandle, desc, IntPtr.Zero); } /// Control the value (position) of the widget within its valid range. /// Values outside the limits defined in are ignored and an error is printed. /// The range value (must be within the bounds of ). public double GetRangeValue() { var _ret_var = Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_value_get_ptr.Value.Delegate(this.NativeHandle); Eina.Error.RaiseIfUnhandledException(); return _ret_var; } /// Control the value (position) of the widget within its valid range. /// Values outside the limits defined in are ignored and an error is printed. /// The range value (must be within the bounds of ). public void SetRangeValue(double val) { Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_value_set_ptr.Value.Delegate(this.NativeHandle,val); Eina.Error.RaiseIfUnhandledException(); } /// Set the minimum and maximum values for given range widget. /// If the current value is less than min, it will be updated to min. If it is bigger then max, will be updated to max. The resulting value can be obtained with . /// /// The default minimum and maximum values may be different for each class. /// /// Note: maximum must be greater than minimum, otherwise behavior is undefined. /// The minimum value. /// The maximum value. public void GetRangeLimits(out double min, out double max) { Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_limits_get_ptr.Value.Delegate(this.NativeHandle,out min, out max); Eina.Error.RaiseIfUnhandledException(); } /// Set the minimum and maximum values for given range widget. /// If the current value is less than min, it will be updated to min. If it is bigger then max, will be updated to max. The resulting value can be obtained with . /// /// The default minimum and maximum values may be different for each class. /// /// Note: maximum must be greater than minimum, otherwise behavior is undefined. /// The minimum value. /// The maximum value. public void SetRangeLimits(double min, double max) { Efl.Ui.IRangeDisplayConcrete.NativeMethods.efl_ui_range_limits_set_ptr.Value.Delegate(this.NativeHandle,min, max); Eina.Error.RaiseIfUnhandledException(); } /// Control the value (position) of the widget within its valid range. /// Values outside the limits defined in are ignored and an error is printed. /// The range value (must be within the bounds of ). public double RangeValue { get { return GetRangeValue(); } set { SetRangeValue(value); } } /// Set the minimum and maximum values for given range widget. /// If the current value is less than min, it will be updated to min. If it is bigger then max, will be updated to max. The resulting value can be obtained with . /// /// The default minimum and maximum values may be different for each class. /// /// Note: maximum must be greater than minimum, otherwise behavior is undefined. /// The minimum value. public (double, double) RangeLimits { get { double _out_min = default(double); double _out_max = default(double); GetRangeLimits(out _out_min,out _out_max); return (_out_min,_out_max); } set { SetRangeLimits( value.Item1, value.Item2); } } private static IntPtr GetEflClassStatic() { return Efl.Ui.IRangeDisplayConcrete.efl_ui_range_display_interface_get(); } /// Wrapper for native methods and virtual method delegates. /// For internal use by generated code only. public new class NativeMethods : Efl.Eo.EoWrapper.NativeMethods { private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule( efl.Libs.Efl); /// Gets the list of Eo operations to override. /// The list of Eo operations to be overload. public override System.Collections.Generic.List GetEoOps(System.Type type) { var descs = new System.Collections.Generic.List(); var methods = Efl.Eo.Globals.GetUserMethods(type); if (efl_ui_range_value_get_static_delegate == null) { efl_ui_range_value_get_static_delegate = new efl_ui_range_value_get_delegate(range_value_get); } if (methods.FirstOrDefault(m => m.Name == "GetRangeValue") != null) { 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) }); } if (efl_ui_range_value_set_static_delegate == null) { efl_ui_range_value_set_static_delegate = new efl_ui_range_value_set_delegate(range_value_set); } if (methods.FirstOrDefault(m => m.Name == "SetRangeValue") != null) { 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) }); } if (efl_ui_range_limits_get_static_delegate == null) { efl_ui_range_limits_get_static_delegate = new efl_ui_range_limits_get_delegate(range_limits_get); } if (methods.FirstOrDefault(m => m.Name == "GetRangeLimits") != null) { 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) }); } if (efl_ui_range_limits_set_static_delegate == null) { efl_ui_range_limits_set_static_delegate = new efl_ui_range_limits_set_delegate(range_limits_set); } if (methods.FirstOrDefault(m => m.Name == "SetRangeLimits") != null) { 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) }); } return descs; } /// Returns the Eo class for the native methods of this class. /// The native class pointer. public override IntPtr GetEflClass() { return Efl.Ui.IRangeDisplayConcrete.efl_ui_range_display_interface_get(); } #pragma warning disable CA1707, CS1591, SA1300, SA1600 private delegate double efl_ui_range_value_get_delegate(System.IntPtr obj, System.IntPtr pd); public delegate double efl_ui_range_value_get_api_delegate(System.IntPtr obj); public static Efl.Eo.FunctionWrapper efl_ui_range_value_get_ptr = new Efl.Eo.FunctionWrapper(Module, "efl_ui_range_value_get"); private static double range_value_get(System.IntPtr obj, System.IntPtr pd) { Eina.Log.Debug("function efl_ui_range_value_get was called"); var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj); if (ws != null) { double _ret_var = default(double); try { _ret_var = ((IRangeDisplay)ws.Target).GetRangeValue(); } catch (Exception e) { Eina.Log.Warning($"Callback error: {e.ToString()}"); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } return _ret_var; } else { return efl_ui_range_value_get_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj))); } } private static efl_ui_range_value_get_delegate efl_ui_range_value_get_static_delegate; private delegate void efl_ui_range_value_set_delegate(System.IntPtr obj, System.IntPtr pd, double val); public delegate void efl_ui_range_value_set_api_delegate(System.IntPtr obj, double val); public static Efl.Eo.FunctionWrapper efl_ui_range_value_set_ptr = new Efl.Eo.FunctionWrapper(Module, "efl_ui_range_value_set"); private static void range_value_set(System.IntPtr obj, System.IntPtr pd, double val) { Eina.Log.Debug("function efl_ui_range_value_set was called"); var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj); if (ws != null) { try { ((IRangeDisplay)ws.Target).SetRangeValue(val); } catch (Exception e) { Eina.Log.Warning($"Callback error: {e.ToString()}"); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } else { efl_ui_range_value_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), val); } } private static efl_ui_range_value_set_delegate efl_ui_range_value_set_static_delegate; private delegate void efl_ui_range_limits_get_delegate(System.IntPtr obj, System.IntPtr pd, out double min, out double max); public delegate void efl_ui_range_limits_get_api_delegate(System.IntPtr obj, out double min, out double max); public static Efl.Eo.FunctionWrapper efl_ui_range_limits_get_ptr = new Efl.Eo.FunctionWrapper(Module, "efl_ui_range_limits_get"); private static void range_limits_get(System.IntPtr obj, System.IntPtr pd, out double min, out double max) { Eina.Log.Debug("function efl_ui_range_limits_get was called"); var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj); if (ws != null) { min = default(double); max = default(double); try { ((IRangeDisplay)ws.Target).GetRangeLimits(out min, out max); } catch (Exception e) { Eina.Log.Warning($"Callback error: {e.ToString()}"); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } else { 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); } } private static efl_ui_range_limits_get_delegate efl_ui_range_limits_get_static_delegate; private delegate void efl_ui_range_limits_set_delegate(System.IntPtr obj, System.IntPtr pd, double min, double max); public delegate void efl_ui_range_limits_set_api_delegate(System.IntPtr obj, double min, double max); public static Efl.Eo.FunctionWrapper efl_ui_range_limits_set_ptr = new Efl.Eo.FunctionWrapper(Module, "efl_ui_range_limits_set"); private static void range_limits_set(System.IntPtr obj, System.IntPtr pd, double min, double max) { Eina.Log.Debug("function efl_ui_range_limits_set was called"); var ws = Efl.Eo.Globals.GetWrapperSupervisor(obj); if (ws != null) { try { ((IRangeDisplay)ws.Target).SetRangeLimits(min, max); } catch (Exception e) { Eina.Log.Warning($"Callback error: {e.ToString()}"); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } } else { efl_ui_range_limits_set_ptr.Value.Delegate(Efl.Eo.Globals.efl_super(obj, Efl.Eo.Globals.efl_class_get(obj)), min, max); } } private static efl_ui_range_limits_set_delegate efl_ui_range_limits_set_static_delegate; #pragma warning restore CA1707, CS1591, SA1300, SA1600 } } } } #if EFL_BETA #pragma warning disable CS1591 public static class Efl_UiIRangeDisplayConcrete_ExtensionMethods { public static Efl.BindableProperty RangeValue(this Efl.Ui.ItemFactory fac, Efl.Csharp.ExtensionTagmagic = null) where T : Efl.Ui.IRangeDisplay { return new Efl.BindableProperty("range_value", fac); } } #pragma warning restore CS1591 #endif